/* Spectrum Terminal
   A self-contained learning-artifact theme. It is intentionally loaded only by
   pages under /engineering/ and scoped by their data-theme marker. */
html[data-theme="spectrum-terminal"] {
  --canvas: #0c0a0c;
  --panel: #11110f;
  --panel-deep: #080908;
  --line: #2c2928;
  --ink: #f2efec;
  --muted: #a29c98;
  --faint: #625e5b;
  --orange: #d89a45;
  --green: #3dbc8b;
  --cyan: #45b6d2;
  --violet: #7466bd;
  --magenta: #ca58d2;
  --coral: #e45163;
  --terminal: #e66a47;
  --display: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --frame: 1180px;
  --radius: 13px;
  --stat-card-height: 118px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}

button, input { font: inherit; }

button {
  color: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.site-shell {
  width: min(calc(100% - 48px), var(--frame));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.terminal-head,
.terminal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.terminal-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.terminal-foot {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.spectrum-title {
  max-width: 12ch;
  margin: 38px 0 12px;
  font-family: var(--display);
  font-size: clamp(42px, 8vw, 94px);
  font-weight: 800;
  letter-spacing: -.06em;
  line-height: .84;
  text-transform: uppercase;
}

.spectrum-rule {
  width: 100%;
  height: 4px;
  margin: 22px 0 34px;
  border: 0;
  background: linear-gradient(90deg, var(--orange), var(--green), var(--cyan), var(--violet), var(--magenta), var(--coral));
}

.comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.lesson-thesis {
  align-items: center;
}

.lesson-eyebrow {
  color: var(--terminal, var(--green));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
}

.definition-ledger {
  display: grid;
  gap: 8px;
  margin: 0;
}

.definition-ledger > div {
  display: grid;
  grid-template-columns: minmax(92px, 0.34fr) minmax(0, 1fr);
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}

.definition-ledger dt,
.definition-ledger dd {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.definition-ledger dt {
  color: var(--muted);
  font-weight: 700;
}

.learning-source-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-source-list a {
  overflow-wrap: anywhere;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.stat-card {
  height: var(--stat-card-height);
  min-height: 116px;
  padding: 17px;
}

.stat-card > strong {
  display: block;
  margin-top: 12px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 32px;
  letter-spacing: -.04em;
  line-height: 1;
}

.section-intro {
  max-width: 650px;
  margin: 42px 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.section-intro > :first-child { margin-top: 0; }
.section-intro > :last-child { margin-bottom: 0; }

.panel { padding: 20px; }

.diagram-control {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-deep);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.diagram-control:hover,
.diagram-control[aria-pressed='true'] {
  border-color: currentColor;
  background: color-mix(in srgb, currentColor 12%, var(--panel-deep));
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.progress-track {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.progress-fill {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.faint { color: var(--faint); }

.accent-orange { color: var(--orange); }
.accent-green { color: var(--green); }
.accent-cyan { color: var(--cyan); }
.accent-violet { color: var(--violet); }
.accent-magenta { color: var(--magenta); }
.accent-coral { color: var(--coral); }

@media (max-width: 900px) {
  .site-shell { width: min(calc(100% - 36px), var(--frame)); padding-top: 28px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 621px) and (max-width: 900px) {
  main.site-shell .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .site-shell { width: min(calc(100% - 28px), var(--frame)); padding-bottom: 40px; }
  .terminal-head, .terminal-foot { align-items: flex-start; flex-direction: column; }
  .spectrum-title { margin-top: 30px; font-size: clamp(39px, 15vw, 66px); }
  .comparison, .stat-grid { grid-template-columns: 1fr; }
  .definition-ledger > div { grid-template-columns: 1fr; }
  .stat-card { height: auto; min-height: var(--stat-card-height); }
  .panel { padding: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
