/* Reuse the same local font files and fallback stacks as the LLaDA article. */
@font-face {
  font-family: GeistReference;
  src: url("/llada-kernels/fonts/Geist_Variable.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
}

@font-face {
  font-family: GeistMonoReference;
  src: url("/llada-kernels/fonts/GeistMono_Variable.woff2") format("woff2");
  font-display: swap;
  font-weight: 100 900;
}

:root {
  --paper: #fdfdfb;
  --surface: #ffffff;
  --ink: #2c2a4e;
  --muted: #716d84;
  --rule: #dedbea;
  --violet: #8c78ee;
  --mint: #3ed6ac;
  --amber: #efa12c;
  --wash: #f4f2fb;
  --serif: "Iowan Old Style", "Iowan Old Style BT", Georgia, "Times New Roman", serif;
  --sans: GeistReference, ui-sans-serif, system-ui, sans-serif;
  --mono: GeistMonoReference, ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.site-header {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding-top: 56px;
}

.back-link {
  font-size: 13px;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
}

article {
  padding-bottom: 72px;
}

.hero {
  width: min(700px, calc(100% - 40px));
  margin: 0 auto 38px;
  text-align: center;
}

h1,
h2,
.result-copy,
blockquote p {
  font-family: var(--serif);
  font-weight: 400;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 61px);
  line-height: 1.04;
  letter-spacing: -0.028em;
}

.dek {
  max-width: 620px;
  margin: 18px auto 18px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(19px, 2vw, 24px);
  font-style: italic;
  line-height: 1.42;
}

.byline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px 13px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.byline span:first-child {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hero-streams {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 64px;
}

.hero-streams iframe {
  display: block;
  width: 100%;
  aspect-ratio: 1640 / 720;
  border: 0;
  background: transparent;
}

.hero-streams figcaption {
  max-width: 620px;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.01em;
}

.trajectory-figure {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto 58px;
}

.explorer-introduction {
  width: min(680px, calc(100% - 40px));
  margin: 82px auto 24px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.65;
}

.trajectory-explorer {
  padding: 22px 24px 19px;
  border: 1px solid var(--rule);
  background: var(--surface);
}

.explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 25px;
}

.mode-switch {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
}

.mode-switch button {
  appearance: none;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 8px 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: 12px var(--sans);
}

.mode-switch button[aria-pressed="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.mode-switch button:focus-visible,
#trajectory-play:focus-visible,
#trajectory-pass:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.pass-control {
  display: flex;
  min-width: 300px;
  align-items: center;
  gap: 10px;
}

#trajectory-play {
  font-family: var(--sans);
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
}

#trajectory-pass {
  min-width: 0;
  flex: 1;
  accent-color: var(--amber);
}

.pass-control span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.pass-control strong {
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.batch-formula {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28em;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 53px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.batch-formula .batch-op {
  min-width: 0.6em;
  color: var(--muted);
  font-weight: 400;
  text-align: center;
}

.batch-formula .batch-cut {
  color: var(--mint);
}

.explorer-subtitle {
  margin: 8px 0 27px;
  color: var(--muted);
  font-size: 11px;
}

.batch-lanes,
.batch-brackets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.batch-lane {
  min-width: 0;
}

.batch-lane-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.batch-lane-heading strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
}

.batch-lane-heading small,
.batch-regime {
  color: var(--muted);
  font-size: 10px;
}

.batch-regime {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.batch-regime i {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--regime-color, currentColor);
}

.batch-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
}

.batch-stats {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 10px 0 0;
  font-size: 10px;
}

.batch-stats dt {
  color: var(--muted);
  white-space: nowrap;
}

.batch-stats dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.batch-brackets {
  margin-top: 17px;
}

.batch-bracket {
  display: grid;
  gap: 6px;
}

.batch-bracket-rail {
  height: 8px;
  border: 1px solid var(--bracket-color, currentColor);
  border-top: 0;
}

.batch-bracket-label {
  font-size: 10px;
  text-align: center;
}

.explorer-footer {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 22px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  align-items: start;
}

.explorer-footer figcaption {
  margin: 0;
  text-align: left;
}

.explorer-footer figcaption span,
.explorer-footer figcaption small {
  display: block;
}

.explorer-footer figcaption span {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.explorer-footer figcaption small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.trajectory-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 13px;
  color: var(--muted);
  font-size: 10px;
}

.trajectory-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trajectory-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
}

.legend-noise {
  background: var(--rule);
}

.legend-token {
  background: var(--ink);
  opacity: 0.45;
}

.legend-difference {
  background: var(--mint);
}

figcaption {
  max-width: 700px;
  margin: 13px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.article-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 900px);
  gap: 54px;
  width: min(1134px, calc(100% - 40px));
  margin: 0 auto;
  align-items: start;
}

.article-body {
  min-width: 0;
}

.contents {
  display: flex;
  position: sticky;
  top: 32px;
  width: auto;
  margin: 0;
  padding: 2px 0;
  flex-direction: column;
  font-size: 13px;
  line-height: 1.35;
}

.contents a {
  display: block;
  padding: 7px 0 7px 13px;
  border-left: 1px solid var(--rule);
  color: var(--muted);
  text-decoration: none;
}

.contents a:hover,
.contents a:focus-visible,
.contents a[aria-current="location"] {
  border-left-color: var(--violet);
  color: var(--ink);
}

.contents a:hover,
.contents a:focus-visible {
  text-decoration: underline;
}

.prose,
blockquote {
  width: min(680px, calc(100% - 40px));
  margin-right: auto;
  margin-left: auto;
}

.prose {
  margin-bottom: 56px;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.72;
}

.prose p {
  margin: 0 0 1.15em;
}

.prose h2 {
  margin: 0 0 22px;
  font-size: clamp(29px, 3.4vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.article-body [id] {
  scroll-margin-top: 32px;
}

code {
  font-family: var(--mono);
  padding: 0.08em 0.28em;
  background: var(--wash);
  font-size: 0.8em;
}

.original-question {
  margin: 1.45em 0 !important;
  padding-left: 24px;
  border-left: 2px solid var(--ink);
  font-size: 1.25em;
  line-height: 1.48;
}

.result-statement {
  width: min(780px, calc(100% - 40px));
  margin: 62px auto;
  padding: 34px 0 37px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  text-align: center;
}

.result-kicker {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 12px;
}

.result-copy {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(27px, 3.5vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.018em;
}

.result-copy strong {
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: var(--mint);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.12em;
}

.evidence {
  width: min(680px, calc(100% - 40px));
  margin: 64px auto;
}

.evidence h2 {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(29px, 3.4vw, 38px);
  font-weight: 400;
  letter-spacing: -0.025em;
}

.evidence table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.evidence th,
.evidence td {
  padding: 13px 12px;
  border-top: 1px solid var(--rule);
  text-align: left;
}

.evidence th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.evidence td:last-child,
.evidence th:last-child {
  width: 128px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.evidence tbody tr:last-child td {
  border-bottom: 1px solid var(--rule);
}

.research-figure {
  width: min(900px, calc(100% - 40px));
  margin: 72px auto;
  padding: 30px 0 24px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}

.research-figure-heading {
  max-width: 680px;
  margin: 0 auto 34px;
}

.research-figure-heading > p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.research-figure-heading h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(27px, 3.4vw, 38px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.022em;
}

.research-figure > figcaption {
  margin-top: 24px;
}

.propagation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: center;
  gap: 0;
}

.prop-stage {
  min-width: 0;
}

.prop-stage canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  margin: 12px 0 18px;
}

.prop-where {
  min-height: 34px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.prop-stage strong {
  display: block;
  margin-bottom: 7px;
  color: var(--amber);
  font-family: var(--serif);
  font-size: clamp(29px, 4vw, 43px);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.prop-stage > p:last-child {
  max-width: 20ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.prop-arrow {
  color: var(--muted);
  font-family: var(--serif);
  font-size: 25px;
  text-align: center;
}

.hardware-comparison {
  width: 100%;
  margin-top: 34px;
  border-collapse: collapse;
  font-size: 13px;
}

.hardware-comparison th,
.hardware-comparison td {
  padding: 11px 12px;
  border-top: 1px solid var(--rule);
  text-align: left;
}

.hardware-comparison th {
  color: var(--muted);
  font-weight: 400;
}

.hardware-comparison tbody tr:last-child > * {
  border-bottom: 1px solid var(--rule);
}

.loop-diagram {
  overflow-x: auto;
}

.loop-diagram svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.loop-edge {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.5;
}

.loop-edge.loop-feedback {
  stroke: var(--amber);
  stroke-dasharray: 5 4;
}

#arrow path {
  fill: var(--muted);
}

#arrow-accent path {
  fill: var(--amber);
}

.loop-label {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}

.loop-feedback-label {
  fill: var(--amber);
}

.loop-node rect {
  fill: var(--wash);
  stroke: var(--rule);
  stroke-width: 1.5;
}

.loop-node.loop-fault rect {
  stroke: var(--amber);
  stroke-width: 2;
}

.loop-node > text {
  fill: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
}

.loop-node .loop-sub {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
}

.fault-marker circle {
  fill: var(--amber);
}

.fault-marker text {
  fill: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.repair-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
  max-width: 760px;
  margin: 10px auto 0;
}

.repair-notes > div {
  display: grid;
  grid-template-columns: 25px 1fr;
  gap: 12px;
  align-items: start;
}

.repair-notes span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--amber);
  color: var(--paper);
  font-size: 12px;
  font-weight: 600;
}

.repair-notes p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.repair-notes strong {
  color: var(--ink);
  font-weight: 500;
}

.repair-close {
  margin-top: -20px;
}

.repair-close h2 {
  margin-bottom: 20px;
}

blockquote {
  margin-top: 74px;
  margin-bottom: 74px;
  padding-left: 28px;
  border-left: 3px solid var(--violet);
}

blockquote p {
  margin: 0 0 14px;
  font-size: clamp(27px, 4vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

blockquote footer {
  color: var(--muted);
  font-size: 12px;
}

.boundary {
  padding: 18px 20px;
  border: 1px solid var(--rule);
  background: var(--wash);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
}

.article-footer {
  font-family: var(--mono);
  display: flex;
  width: min(980px, calc(100% - 40px));
  margin: 86px auto 0;
  padding-top: 18px;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
}

.article-footer p {
  margin: 0;
}

@media (max-width: 1050px) {
  .article-layout {
    display: block;
    width: 100%;
  }

  .contents {
    position: static;
    width: min(680px, calc(100% - 40px));
    margin: 0 auto 58px;
    padding: 15px 0;
    flex-direction: row;
    gap: 22px;
    overflow-x: auto;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
  }

  .contents a {
    padding: 0;
    border-left: 0;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding-top: 28px;
  }

  .hero {
    margin-top: 34px;
    margin-bottom: 28px;
  }

  .hero-streams {
    width: calc(100% - 20px);
    margin-bottom: 48px;
  }

  h1 {
    font-size: clamp(42px, 12vw, 54px);
  }

  .trajectory-explorer {
    padding: 16px;
  }

  .explorer-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .pass-control {
    min-width: 0;
  }

  .batch-lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 14px;
  }

  .batch-brackets {
    display: none;
  }

  .explorer-footer {
    grid-template-columns: 1fr;
  }

  .trajectory-legend {
    justify-content: flex-start;
  }

  .contents {
    gap: 18px;
    overflow-x: auto;
    white-space: nowrap;
  }

  .propagation {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .prop-stage canvas {
    max-width: 240px;
  }

  .prop-arrow {
    transform: rotate(90deg);
  }

  .hardware-comparison th,
  .hardware-comparison td {
    padding-right: 7px;
    padding-left: 7px;
    font-size: 11px;
  }

  .repair-notes {
    grid-template-columns: 1fr;
  }

  .article-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
