:root {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #0e172c;
  --raised: #121e38;
  --line: #283959;
  --text: #f0f4ff;
  --muted: #b4c4de;
  --accent: #8fe4ed;
  --link-hover: #bed3ff;
  --blue: #879eff;
  --cyan: #8fe4ed;
  --radius: 1.15rem;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.6; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--link-hover); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
[hidden] { display: none !important; }
#main, section[id] { scroll-margin-top: 1.75rem; }
.wrap { width: min(calc(100% - 4rem), 71rem); margin-inline: auto; }
.skip-link { position: absolute; z-index: 3; top: 0.5rem; left: 0.5rem; padding: 0.6rem 0.9rem; background: var(--surface); transform: translateY(-200%); }
.skip-link:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); background: #0b1427; }
.header-inner { min-height: 4.45rem; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.65rem; line-height: 1.2; font-weight: 760; color: var(--text); text-decoration: none; }
.brand-mark { display: block; flex: 0 0 2.25rem; width: 2.25rem; height: 2.25rem; border-radius: 0.4rem; }
.institution { text-align: center; font-size: 0.875rem; color: var(--muted); }
.header-link { color: var(--text); border: 1px solid var(--line); border-radius: 0.55rem; padding: 0.35rem 0.75rem; font-size: 0.875rem; font-weight: 650; text-decoration: none; white-space: nowrap; }
.header-link:hover { color: var(--accent); border-color: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(3rem, 6.6vw, 6rem) clamp(3rem, 6vw, 5rem); }
.eyebrow { display: flex; align-items: center; gap: 0.58rem; color: var(--accent); font-size: 0.875rem; line-height: 1.45; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.hero .eyebrow { color: var(--cyan); }
.signal { flex: 0 0 0.46rem; height: 0.46rem; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px #75ebee2d; }
h1, h2 { font-weight: 720; }
h1 { font-size: clamp(3rem, 7.5vw, 6.5rem); letter-spacing: -0.075em; line-height: 1; margin-block: 0.65rem 0.95rem; }
.version { color: var(--blue); }
.hero-subtitle { font-size: clamp(1.6rem, 3.55vw, 3.1rem); letter-spacing: -0.047em; line-height: 1.15; font-weight: 630; }
.hero-subtitle strong { color: var(--cyan); font-weight: 720; }
.hero-description { max-width: 32rem; margin-top: 1.25rem; color: var(--muted); font-size: clamp(1rem, 1.55vw, 1.125rem); }
.actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1.6rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: 0.48rem 1rem; border: 1px solid transparent; border-radius: 0.65rem; font-size: 0.9rem; font-weight: 730; text-decoration: none; cursor: pointer; }
.primary { background: var(--cyan); color: #081328; }
.primary:hover { background: #b5f3fb; color: #081328; }
.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.secondary:hover { background: var(--raised); color: var(--cyan); border-color: var(--cyan); }
.hero-art { position: relative; isolation: isolate; justify-self: end; width: min(100%, 24.5rem); padding: 0.65rem; border: 1px solid #2a456d; border-radius: calc(var(--radius) + 0.6rem); background: linear-gradient(145deg, #233b64, #11192d 49%, #183546); }
.hero-art::before { position: absolute; z-index: -1; inset: -1.75rem; content: ""; border-radius: 50%; background: radial-gradient(ellipse, #408ce934, transparent 68%); filter: blur(1.3rem); }
.hero-art img { display: block; width: 100%; height: auto; border: 1px solid #304567; border-radius: var(--radius); }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.25rem; border-block: 1px solid var(--line); }
.metrics div { display: grid; grid-template-rows: auto 1fr; min-width: 0; padding: 1rem clamp(0.8rem, 3vw, 1.45rem); }
.metrics div + div { border-left: 1px solid var(--line); }
.metrics dt, .scale-stats dt { grid-row: 2; color: var(--muted); margin-top: 0.23rem; font-size: 0.875rem; line-height: 1.4; }
.metrics dd, .scale-stats dd { grid-row: 1; color: var(--text); font-size: clamp(1.75rem, 4vw, 2.55rem); line-height: 1.12; font-weight: 740; letter-spacing: -0.055em; }
.metrics dd small, .scale-stats dd small { color: var(--cyan); font-size: 0.62em; letter-spacing: 0; }

.guide-body { display: grid; grid-template-columns: 11.35rem minmax(0, 1fr); gap: clamp(1.8rem, 4vw, 4rem); margin-top: clamp(2.25rem, 5vw, 4rem); }
.chapter-nav { position: sticky; top: 1.4rem; align-self: start; }
.chapter-toggle { display: none; }
.chapter-inner { display: grid; gap: 0.22rem; padding-left: 0.8rem; border-left: 1px solid var(--line); }
.chapter-inner p { margin: 0 0 0.5rem 0.55rem; color: var(--text); font-size: 0.875rem; font-weight: 760; }
.chapter-inner a { display: block; padding: 0.32rem 0.55rem; border-radius: 0.35rem; color: var(--muted); font-size: 0.875rem; line-height: 1.4; text-decoration: none; }
.chapter-inner a:hover, .chapter-inner a[aria-current] { background: #192d4d; color: var(--accent); }
.guide-content > .wrap { width: 100%; }
.section { margin-block: 0 clamp(3rem, 6.8vw, 5.5rem); }
.section + .section { border-top: 1px solid var(--line); padding-top: clamp(1.7rem, 4.3vw, 3.25rem); }
.section-heading { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: end; gap: 1.5rem; margin-bottom: 1.4rem; }
.section-heading > p { color: var(--muted); max-width: 26rem; }
h2 { font-size: clamp(1.9rem, 3.5vw, 2.95rem); letter-spacing: -0.042em; line-height: 1.07; }
.eyebrow + h2 { margin-top: 0.5rem; }
h3 { font-size: 1.16rem; line-height: 1.3; letter-spacing: -0.022em; }

.benchmark-panel, .scale-panel { background: linear-gradient(145deg, var(--raised), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); }
.benchmark-panel { padding: clamp(1.1rem, 3vw, 1.8rem); }
.chart-top { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
.chart-top h3 { font-size: 1.3rem; }
.chart-top p { color: var(--muted); margin-top: 0.23rem; }
.chart-controls { display: inline-flex; padding: 0.19rem; gap: 0.18rem; background: var(--bg); border: 1px solid var(--line); border-radius: 0.5rem; }
.chart-controls button { cursor: pointer; border: 1px solid transparent; border-radius: 0.3rem; padding: 0.32rem 0.55rem; min-height: 2.15rem; background: transparent; color: var(--muted); font-size: 0.875rem; font-weight: 650; }
.chart-controls button:hover { color: var(--accent); }
.chart-controls button[aria-pressed="true"] { border-color: #365d79; background: #1c334f; color: var(--accent); }
.bars { padding: 0; margin: 1.45rem 0 1.1rem; list-style: none; display: grid; gap: 0.82rem; }
.bars li { display: grid; grid-template-columns: minmax(9rem, 0.35fr) minmax(1rem, 1fr) minmax(4rem, auto); align-items: center; gap: clamp(0.45rem, 1.8vw, 1.1rem); }
.model { font-size: 0.9rem; font-weight: 620; }
.value { text-align: right; font-weight: 700; }
.track { position: relative; display: block; height: 0.6rem; background: #243653; border-radius: 0.5rem; }
.track > span { display: block; width: var(--bar); height: 100%; background: #7794e4; border-radius: inherit; }
.lmaana .track > span { background: var(--cyan); box-shadow: 0 0 0.65rem #8fe4ed60; }
.lmaana .model, .lmaana .value, .lmaana th { color: var(--accent); }
.chart-note { border-top: 1px solid var(--line); padding-top: 0.85rem; color: var(--muted); }
.chart-note strong { color: var(--text); }

.details { border-block-end: 1px solid var(--line); }
.results-details { margin-top: 0.7rem; }
.details summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; list-style: none; cursor: pointer; min-height: 3.25rem; padding-block: 0.8rem; font-weight: 670; }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: ""; flex: 0 0 0.55rem; height: 0.55rem; margin-right: 0.3rem; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.details[open] summary::after { transform: rotate(225deg); }
.details summary:hover { color: var(--accent); }
.detail-body { color: var(--muted); padding-bottom: 1rem; }
.detail-body p { max-width: 74ch; }
.detail-body p + p { margin-top: 0.6rem; }
.detail-body h3 { margin-top: 0.85rem; }
.table-scroll { overflow: auto; }
.table-context, .table-hint { margin-bottom: 0.5rem; }
.table-hint { color: var(--accent); font-size: 0.875rem; }
.table-takeaway { margin-top: 0.6rem; }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
caption { text-align: left; color: var(--muted); margin-bottom: 0.6rem; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 0.58rem 0.6rem; white-space: nowrap; }
th:first-child { padding-left: 0; }
#benchmark-table th:first-child { position: sticky; left: 0; z-index: 1; padding-right: 0.75rem; border-right: 1px solid var(--line); background: var(--bg); }
th, td strong { color: var(--text); }
td small { display: block; color: var(--muted); font-size: 0.82rem; }
.findings { display: grid; grid-template-columns: 1fr 1fr; gap: 1.35rem; margin-top: 1.45rem; }
.findings article { border-left: 2px solid #7699d9; padding-left: 0.9rem; }
.findings p, .pipeline p, .architecture-note p, .scale-copy > p:last-child, .technical-deep-dive > p, .training-results p, .credits-grid p { color: var(--muted); margin-top: 0.42rem; }
.scale-highlight { margin-top: 1.2rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 0.55rem; background: var(--surface); }
.scale-highlight a { font-weight: 700; }
.scale-highlight span { display: block; color: var(--muted); font-size: 0.875rem; }

.technical-figure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: clamp(0.45rem, 1.5vw, 0.95rem); }
.technical-figure img { display: block; width: 100%; height: auto; border-radius: 0.45rem; background: #fff; }
.technical-figure figcaption { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; border-top: 1px solid var(--line); margin-top: 0.6rem; padding: 0.65rem 0.2rem 0.05rem; color: var(--muted); font-size: 0.875rem; }
.technical-figure figcaption > span { min-width: 0; }
.figure-toggle { flex: none; padding: 0.36rem 0.55rem; border: 1px solid var(--line); border-radius: 0.35rem; background: var(--raised); color: var(--accent); font-size: 0.875rem; font-weight: 670; cursor: pointer; }
.figure-toggle:hover { background: #1c334f; }
#figure-dialog { width: min(calc(100% - 2rem), 108rem); max-width: unset; max-height: calc(100dvh - 2rem); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem; color: var(--text); background: var(--surface); overflow: auto; }
#figure-dialog[open] { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.65rem; }
#figure-dialog::backdrop { background: #0a153ac2; }
#figure-dialog h2 { align-self: center; font-size: 1.2rem; letter-spacing: -0.02em; }
#figure-dialog form { display: flex; flex-wrap: wrap; justify-content: end; gap: 0.55rem; }
#figure-dialog figure, #figure-pan-help { grid-column: 1 / -1; }
#figure-pan-help { color: var(--muted); font-size: 0.875rem; }
.figure-viewport { overflow: auto; max-height: 68dvh; background: #fff; }
.figure-viewport img { display: block; width: 100%; max-height: 68dvh; object-fit: contain; }
.figure-viewport.is-zoomed img { max-width: none; max-height: none; width: max(150%, 58rem); }
#figure-dialog figcaption { color: var(--muted); margin: 0.55rem 0.25rem 0.2rem; }
@media (min-width: 901px) { .technical-figure figcaption { padding-inline: 0.35rem; } }

.pipeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; padding: 0; margin: 1.15rem 0 0; list-style: none; }
.pipeline li { padding: 0.95rem; background: var(--surface); border-top: 2px solid #7699d9; }
.architecture-note { margin-top: 1rem; max-width: 78ch; }
.architecture-note p + p { margin-top: 0.65rem; }
.text-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; margin-top: 0.72rem; }
.text-links a { color: var(--accent); font-weight: 650; }
.text-links a:hover { color: var(--link-hover); }
.technical-deep-dive { margin-top: 1.7rem; }
.technical-deep-dive > p { max-width: 74ch; }
.technical-deep-dive .technical-figure { margin-top: 0.9rem; }
.formula-list { display: grid; gap: 0; border-block: 1px solid var(--line); margin-block: 0.9rem; background: var(--surface); }
.formula-list > div { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr); gap: 0.5rem; padding: 0.65rem 0.85rem; }
.formula-list > div + div { border-top: 1px solid var(--line); }
.formula-list dt { color: var(--muted); }
.decoder-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem; margin-block: 0.9rem; }
.decoder-panel label { display: block; font-weight: 700; }
#ctc-help { color: var(--muted); font-size: 0.9rem; margin: 0.22rem 0 0.55rem; }
#ctc-path { width: min(100%, 32rem); min-height: 2.9rem; margin: 0 0.55rem 0.55rem 0; padding: 0.5rem 0.65rem; border: 1px solid var(--line); border-radius: 0.55rem; background: var(--bg); color: var(--text); font: 1rem ui-monospace, "Cascadia Code", monospace; }
.decoder-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
.decoder-results dt { color: var(--muted); font-size: 0.875rem; }
.decoder-results dd { margin-top: 0.15rem; overflow-wrap: anywhere; }
#ctc-transcript { color: var(--cyan); font-size: 1.1rem; font-weight: 700; }
.training-results { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr); gap: 1rem; margin-top: 1rem; }
.training-table { min-width: 0; }
.scale-panel { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 2rem); align-items: center; padding: clamp(1.2rem, 3vw, 1.8rem); background: var(--raised); }
.scale-copy p:last-child { margin-top: 0.7rem; }
.scale-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
.scale-stats div { display: grid; grid-template-rows: auto 1fr; padding-left: 0.6rem; border-left: 1px solid var(--line); }
.scale-stats dd { font-size: clamp(1.35rem, 2.7vw, 1.9rem); }
.methodology .section-heading { border-bottom: 1px solid var(--line); padding-bottom: 1rem; margin-bottom: 0; }
code { color: #c6d8ff; overflow-wrap: anywhere; }
.credits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.credits-grid > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.reading-list { padding: 0; margin: 0.4rem 0 0; list-style: none; }
.reading-list li + li { margin-top: 0.25rem; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding-block: 1.15rem; color: var(--muted); font-size: 0.875rem; }

@media (max-width: 1000px) {
  .section-heading { grid-template-columns: 1fr; gap: 0.55rem; }
  .scale-panel { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
  .header-inner { gap: 0.7rem 1rem; }
  .institution { font-size: 0.83rem; }
  .guide-body { display: block; }
  .chapter-nav { position: static; margin-bottom: 1.8rem; }
  .chapter-nav[data-collapsible] { position: sticky; z-index: 2; top: 0; background: var(--bg); }
  .chapter-toggle { display: flex; align-items: center; gap: 0.7rem; width: 100%; min-height: 2.9rem; padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: 0.55rem; background: var(--surface); color: var(--text); font-weight: 700; text-align: left; cursor: pointer; }
  .chapter-toggle::after { content: ""; flex: 0 0 0.5rem; height: 0.5rem; margin-left: auto; margin-right: 0.2rem; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
  .chapter-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
  #chapter-position { min-width: 0; overflow: hidden; color: var(--accent); font-size: 0.875rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
  #chapter-position:empty { display: none; }
  .chapter-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; padding: 0 0 0.65rem; border-left: 0; border-bottom: 1px solid var(--line); }
  .chapter-inner p { flex-basis: 100%; margin: 0 0 0.3rem; }
  .chapter-inner a { background: var(--raised); }
  .chapter-nav[data-collapsible] .chapter-inner { max-height: 50dvh; overflow: auto; padding: 0.55rem 0.35rem; }
  .chapter-nav[data-collapsible] .chapter-inner p, .chapter-nav[data-collapsible] .chapter-toggle[aria-expanded="false"] + .chapter-inner { display: none; }
  .guide-content section[id] { scroll-margin-top: 5rem; }
}
@media (max-width: 600px) {
  .wrap { width: calc(100% - 2rem); }
  .header-inner { grid-template-columns: 1fr auto; padding-block: 0.7rem; }
  .institution { grid-row: 2; grid-column: 1 / -1; text-align: left; }
  .hero { grid-template-columns: 1fr; gap: 1.75rem; padding-block: 2.3rem 2rem; }
  .hero-art { justify-self: start; width: min(48%, 11rem); }
  .hero-art::before { inset: -0.35rem; }
  .metrics div { padding: 0.75rem 0.45rem; }
  .metrics dt { font-size: 0.8rem; }
  .metrics dd { font-size: clamp(1.35rem, 6vw, 1.75rem); white-space: nowrap; }
  .chart-top { flex-direction: column; }
  .bars li { grid-template-columns: minmax(7.1rem, 0.7fr) minmax(0.5rem, 1fr) minmax(3.4rem, auto); }
  .model, .value { font-size: 0.875rem; }
  .findings, .pipeline, .training-results, .credits-grid { grid-template-columns: 1fr; }
  .formula-list > div, .decoder-results { grid-template-columns: minmax(0, 1fr); }
  .formula-list > div { gap: 0.15rem; }
  .technical-figure figcaption { align-items: flex-start; flex-direction: column; }
  #figure-dialog[open] { grid-template-columns: minmax(0, 1fr); }
  #figure-dialog form { justify-content: start; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

