:root {
  color-scheme: light;
  --paper: #f9f7f5;
  --panel: #fffefd;
  --tint: #f2edf4;
  --ink: #241b2c;
  --muted: #62576a;
  --line: #ded5df;
  --accent: #932658;
  --accent-dark: #742048;
  --rose: #f1dce8;
  --purple: #574080;
  --night: #271936;
  --tall: 4.5rem;
  --sans: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Georgia", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--tall) + 1rem); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.65 var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; }
button, select, input { font: inherit; }
button, select, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button { color: inherit; }
:focus-visible { outline: 3px solid #aa3576; outline-offset: 4px; }
p, h1, h2, h3, h4, figure { margin: 0; }
code, .mono { font-family: var(--mono); }
code { overflow-wrap: anywhere; }
.frame { width: min(75rem, calc(100% - 5rem)); margin-inline: auto; }
.skip { position: fixed; left: 1rem; top: 1rem; transform: translateY(-180%); z-index: 30; padding: .65rem 1rem; background: white; }
.skip:focus { transform: none; }
.site-header { position: sticky; top: 0; z-index: 10; background: #f9f7f5f7; border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.header-inner { display: flex; min-height: var(--tall); align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .68rem; font-weight: 750; text-decoration: none; white-space: nowrap; }
.brand-mark { display: block; flex: none; width: 2rem; height: 2rem; border-radius: 7px; object-fit: cover; }
.brand-sub { color: var(--muted); font-size: .875rem; font-weight: 500; }
.top-nav { display: flex; gap: clamp(1rem, 2.7vw, 2.6rem); }
.top-nav a { font-size: .875rem; font-weight: 650; color: var(--muted); text-decoration: none; white-space: nowrap; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.slides-link { white-space: nowrap; }
progress { appearance: none; border: 0; display: block; width: 100%; height: 2px; position: absolute; bottom: -1px; background: transparent; color: var(--accent); }
progress::-webkit-progress-bar { background: transparent; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.button { display: inline-flex; min-height: 2.75rem; justify-content: center; align-items: center; gap: .55rem; padding: .55rem 1rem; font-size: .875rem; font-weight: 720; line-height: 1.3; border: 1px solid transparent; border-radius: 8px; text-decoration: none; text-align: center; transition: background-color .18s, border-color .18s, color .18s; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.quiet { background: transparent; border-color: var(--line); }
.button.quiet:hover { background: #eee6ef; border-color: #c9b7ca; }
.button:disabled { opacity: .46; cursor: default; }
.screen-icon { width: .875rem; height: .65rem; border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.screen-icon::after { content: ""; width: 6px; height: 1.5px; background: currentColor; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); }
.hero { padding: clamp(3.6rem, 7vw, 6.8rem) 0 2.75rem; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.kicker { color: var(--accent); display: flex; align-items: center; gap: .65rem; font-size: .875rem; font-weight: 760; letter-spacing: .055em; }
.kicker > span { width: 1.8rem; height: 2px; background: currentColor; display: inline-block; flex: 0 0 auto; }
h1 { font: 500 clamp(3.6rem, 6.8vw, 7.2rem)/.99 var(--serif); letter-spacing: -.074em; margin: 1.23rem 0 1.48rem; }
h1 em { color: var(--accent); font-weight: inherit; margin-inline-start: .035em; }
.hero-subtitle { font-size: clamp(1.16rem, 2vw, 1.55rem); font-weight: 740; letter-spacing: -.01em; }
.hero-lead { color: var(--muted); max-width: 25rem; margin-top: .65rem; }
.actions { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.hero .actions { margin: 1.55rem 0 1.45rem; }
.hero .button { min-height: 3rem; padding-inline: 1.2rem; }
.byline { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; color: var(--muted); font-size: .875rem; }
.byline span { width: 4px; height: 4px; border-radius: 50%; background: #a7869e; }
.hero-viz { background: radial-gradient(ellipse at 52% 40%, #422650 0%, transparent 66%), var(--night); border: 1px solid #382446; color: #f9eefa; border-radius: 25px; padding: clamp(1.1rem, 2.5vw, 2rem); box-shadow: 0 20px 52px #3b234727; min-width: 0; }
.viz-header { display: flex; justify-content: space-between; align-items: start; gap: .5rem; margin-bottom: 1rem; }
.viz-overline { color: #ddabd0; font-size: .81rem; letter-spacing: .1em; }
.viz-header h2 { font-size: clamp(1.12rem, 1.8vw, 1.5rem); line-height: 1.35; margin-top: .22rem; }
.demo-tag { color: #e8cce5; border: 1px solid #80638a; padding: .18rem .52rem; border-radius: 50px; font-size: .8125rem; white-space: nowrap; }
.segmented { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .25rem; padding: .25rem; background: #f1eaf2; border: 1px solid #e7dbe8; border-radius: 9px; width: fit-content; }
.segmented button { min-height: 2.1rem; font-size: .875rem; font-weight: 680; border: 0; border-radius: 6px; background: transparent; padding: .22rem .72rem; color: var(--muted); }
.segmented button:hover { color: var(--accent); }
.segmented button[aria-pressed="true"] { background: white; color: var(--accent-dark); box-shadow: 0 1px 4px #37233e18; }
.segmented.on-dark { background: #281b35; border-color: #765a82; }
.on-dark button { color: #e6d1e6; }
.on-dark button:hover { color: white; }
.on-dark button[aria-pressed="true"] { color: #281332; background: #efc8e5; }
.hero-network { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 12.5rem; margin-top: 1.05rem; border-radius: 11px; padding: .55rem 0 .1rem; isolation: isolate; background-image: radial-gradient(#edcaff38 .9px, transparent .9px); background-size: 14px 14px; }
.hero-network canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.query-chip { width: fit-content; align-self: center; min-height: 2.45rem; padding: .32rem .8rem; background: #654173; border: 1px solid #b68cb5; border-radius: 7px; font: .875rem/1.65 var(--mono), var(--sans); }
.hero-tokens { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; padding-inline: .35rem; }
.hero-tokens button { min-height: 3.65rem; padding: .28rem .15rem; display: grid; place-content: center; gap: .02rem; border-radius: 8px; border: 1px solid #886695; background: #362342; color: white; line-height: 1.35; }
.hero-tokens button:hover { background: #51315c; }
.hero-tokens button[aria-pressed="true"] { border-color: #ffd1eb; background: #5f365e; }
.hero-tokens button small { font: .8rem/1.45 var(--mono), var(--sans); color: #ead2ea; }
.hero-viz :focus-visible { outline-color: #ffd1eb; }
.viz-caption { min-height: 3.75rem; border-top: 1px solid #745681; padding-top: .85rem; margin-top: 1rem; font-size: .875rem; color: #e5d2e8; }
.chapter-nav { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .62rem; margin-top: clamp(2.7rem, 5vw, 5rem); }
.chapter-nav a { display: flex; align-items: center; gap: .62rem; min-height: 3rem; padding: .48rem .65rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fcfaf9; text-decoration: none; font-size: .875rem; font-weight: 670; }
.chapter-nav a:hover { background: var(--rose); border-color: #c9a1bc; }
.chapter-nav span { color: var(--accent); font: .81rem var(--mono); }
.section-inner { padding-block: clamp(3.8rem, 7vw, 7rem); }
.chapter:not(.hero) { border-top: 1px solid var(--line); }
.section-tint { background: var(--tint); }
.section-heading { max-width: 54rem; margin-bottom: clamp(1.5rem, 3vw, 2.45rem); }
.section-heading h2 { font: 720 clamp(1.95rem, 4.4vw, 3.65rem)/1.22 var(--sans); letter-spacing: -.055em; margin: .52rem 0 .78rem; text-wrap: balance; }
.section-heading > p:last-child { color: var(--muted); max-width: 49rem; font-size: 1.066rem; text-wrap: pretty; }
.split { display: grid; gap: 1rem; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.panel { border: 1px solid var(--line); background: var(--panel); min-width: 0; border-radius: 16px; padding: clamp(1rem, 3vw, 2rem); }
.context { background: #f3ecf3; }
.panel h3 { font-size: clamp(1.2rem, 2.5vw, 1.55rem); line-height: 1.35; letter-spacing: -.035em; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.1rem; }
.panel-kicker { font-size: .8125rem; color: var(--accent); font-weight: 700; margin-bottom: .2rem; }
.timeline { list-style: none; padding: 0 0 0 1.05rem; margin: 1.2rem 0 0 .22rem; border-left: 1px solid #c8a9c1; }
.timeline li { position: relative; margin-bottom: 1.05rem; }
.timeline li:last-child { margin-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -1.32rem; top: .57rem; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
.timeline p { color: var(--muted); font-size: .9375rem; margin-top: .15rem; }
.timeline code { color: var(--purple); font-size: .875rem; }
.vector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-block: .85rem; }
.vector-item { min-width: 0; padding: .4rem .6rem; font-size: .875rem; border: 1px solid #e8dce7; border-radius: 7px; display: flex; gap: .5rem; flex-wrap: wrap; align-items: baseline; }
.vector-item code { color: var(--muted); }
.formula-box { background: #f4eef6; border: 1px solid #e6d9e8; border-radius: 9px; padding: .75rem .9rem; min-width: 0; }
.formula { font-family: var(--mono), var(--sans); overflow-wrap: anywhere; color: var(--ink); }
.formula + .formula { margin-top: .35rem; }
.annotation { color: var(--muted); margin-top: .6rem; font-size: .94rem; }
.fine-print { color: var(--muted); font-size: .8125rem; line-height: 1.5; margin-top: .65rem; }
.rnn-track { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.3rem, 1vw, .85rem); margin-bottom: 1rem; }
.rnn-step { border: 1px solid var(--line); padding: .7rem .2rem; text-align: center; border-radius: 8px; background: #f9f6f9; position: relative; color: var(--muted); transition: background-color .2s, border-color .2s; }
.rnn-step.done { background: #f5e6f1; color: var(--ink); }
.rnn-step.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.rnn-step span, .rnn-step strong { display: block; }
.rnn-step .rnn-time { font-size: .82rem; color: var(--muted); }
.rnn-step strong { margin-block: .1rem; font-size: 1.15rem; }
.rnn-step .rnn-values { font-size: .875rem; }
.status-line { color: var(--accent-dark); background: #f6e9f1; border: 1px solid #ead4e3; padding: .7rem .9rem; border-radius: 8px; font-weight: 670; overflow-wrap: anywhere; }
.two-formulas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin-top: .8rem; }
.two-formulas > div { border: 1px solid var(--line); padding: .6rem .75rem; border-radius: 8px; }
.two-formulas strong { display: block; color: var(--muted); font-size: .875rem; }
.translation { display: inline-block; color: var(--muted); margin-left: .6rem; font: italic 1.1rem var(--serif); }
.alignment-layout, .arch-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.step-buttons, .head-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.step-buttons button, .head-buttons button, .arch-column button { background: #fbf8fb; border: 1px solid var(--line); border-radius: 7px; min-height: 2.55rem; padding: .3rem .67rem; font-size: .875rem; font-weight: 670; }
.step-buttons button:hover, .head-buttons button:hover, .arch-column button:hover { border-color: #ab6694; }
.step-buttons button[aria-pressed="true"], .head-buttons button[aria-pressed="true"], .arch-column button[aria-pressed="true"] { color: var(--accent-dark); background: var(--rose); border-color: #b4719b; }
.head-buttons button { min-width: 3.4rem; }
.weight-list { min-width: 0; display: grid; gap: .5rem; align-content: start; }
.weight-row { display: grid; grid-template-columns: minmax(4.1rem, auto) 1fr 4.1rem; align-items: center; gap: .5rem; font-size: .875rem; }
.weight-row strong { font-weight: 680; }
.weight-row output { text-align: right; font: .875rem var(--mono); }
.weight-track { display: block; height: .72rem; border-radius: 6px; background: #f2e8f0; overflow: hidden; }
.weight-fill { display: block; width: 0; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #ae4880, #744ca0); transition: width .33s cubic-bezier(.25,.65,.35,1); }
.alignment-detail { padding: clamp(.85rem, 2vw, 1.3rem); align-content: center; }
.architecture-metrics { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: end; }
.architecture-metrics span { border: 1px solid #e6d7e7; background: #f7f1f8; border-radius: 8px; padding: .25rem .58rem; font-size: .875rem; white-space: nowrap; color: var(--muted); }
.architecture-metrics b { color: var(--accent); }
.arch-diagram { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.arch-column { padding: .65rem; background: #f6f0fa; border: 1px solid #e4d7e9; border-radius: 10px; display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.arch-column.decoder { background: #faf0f3; border-color: #ead7e3; }
.arch-column h4 { color: var(--purple); font-size: .94rem; }
.arch-column.decoder h4 { color: var(--accent); }
.arch-column button { width: 100%; min-height: 2.25rem; line-height: 1.35; padding: .36rem .2rem; }
.arch-stack { display: grid; gap: .27rem; border: 1px dashed #bfa5c4; border-radius: 7px; padding: .31rem; }
.arch-stack > span, .arch-end { font: .8125rem/1.45 var(--mono), var(--sans); color: var(--muted); text-align: center; }
.cross-node small { display: block; font-size: .75rem; color: var(--muted); }
.arch-detail { min-height: 14rem; align-self: stretch; padding: clamp(.9rem, 2vw, 1.3rem); }
.arch-detail h4 { font-size: 1.22rem; }
.arch-detail .formula { margin-block: .7rem; }
.arch-detail .annotation { margin-top: .3rem; }
.mini-sequence { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .7rem; }
.mini-sequence span { border: 1px solid #c6a6c4; background: #fff9fd; color: var(--ink); padding: .32rem .48rem; font-size: .875rem; border-radius: 6px; }
.mini-sequence span.masked { background: #e8dfe9; color: #594c61; border-style: dashed; }
.mini-sequence span.query { border: 2px solid var(--accent); }
.paper-figure { margin-top: .95rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.paper-figure summary { color: var(--purple); cursor: pointer; font-weight: 700; width: fit-content; }
.paper-figure figure { margin-top: .75rem; }
.paper-figure img { display: block; width: min(100%, 29rem); height: auto; border: 1px solid var(--line); border-radius: 8px; background: white; }
figcaption { font-size: .875rem; color: var(--muted); margin-top: .35rem; }
.qkv-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: .75rem; }
.qkv-roles > div { display: flex; align-items: center; gap: .55rem; min-width: 0; padding: .62rem .75rem; background: #f4eaf3; border: 1px solid #e7d9e6; border-radius: 9px; }
.qkv-roles b { flex: 0 0 auto; text-align: center; font: italic 1.85rem var(--serif); color: var(--accent); }
.qkv-roles span { color: var(--muted); font-size: .875rem; line-height: 1.4; }
.qkv-roles strong { display: block; font-size: .94rem; color: var(--ink); }
.switch-label, .select-label { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .36rem; font-size: .875rem; font-weight: 680; color: var(--muted); }
.switch-label input { accent-color: var(--accent); width: 1.08rem; height: 1.08rem; }
.select-label select { min-width: 4.1rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
#qkv-queries { margin-top: .75rem; }
.calculation-steps { margin-top: .75rem; }
.viz-table { max-width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .875rem; }
th, td { border-bottom: 1px solid #eadfea; padding: .5rem .55rem; }
thead th { color: var(--muted); background: #f5eff6; white-space: nowrap; }
td { font-family: var(--mono), var(--sans); }
.viz-table + .status-line { margin-top: .7rem; }
.table-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: clamp(.75rem, 2vw, 1.25rem); margin-top: .9rem; }
.table-panel table { min-width: 27rem; }
.table-panel caption { text-align: left; font-weight: 720; margin-bottom: .65rem; font-size: 1rem; }
.table-panel caption span { color: var(--muted); font-size: .8125rem; font-weight: 500; margin-left: .38rem; white-space: nowrap; }
.range-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; margin-bottom: .75rem; }
.range-wrap input { width: 100%; min-width: 0; accent-color: var(--accent); }
.range-wrap label { font-size: .875rem; font-weight: 690; }
.range-wrap output { color: var(--accent); min-width: 3.4rem; text-align: right; font-family: var(--mono); font-weight: 740; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .875rem; color: var(--muted); }
.chart-legend span::before { width: 1.05rem; height: 2px; margin-right: .35rem; display: inline-block; content: ""; vertical-align: middle; }
.chart-legend .legend-attention::before { background: var(--accent); }
.chart-legend .legend-rnn::before { border-top: 2px dashed var(--purple); }
.chart-legend span:last-child::before { display: none; }
#complexity-chart { width: 100%; height: clamp(12rem, 27vw, 19rem); display: block; margin-bottom: .55rem; }
.takeaway { border-left: 3px solid var(--accent); padding: .1rem 0 .1rem .9rem; margin-top: 1.65rem; }
.takeaway strong { color: var(--accent-dark); }
.takeaway p { color: var(--muted); margin-top: .18rem; }
.references { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .75rem 1.2rem; margin-top: 1.4rem; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .875rem; }
.references > div { display: grid; gap: .22rem; color: var(--muted); }
.references a { text-decoration-color: #b183a4; text-underline-offset: 3px; }
.references a:hover { color: var(--accent); }
.present-controls { position: fixed; display: flex; justify-content: center; align-items: center; gap: .7rem; bottom: .85rem; left: 50%; transform: translateX(-50%); max-width: calc(100% - 1rem); z-index: 12; background: #fffdfa; padding: .45rem; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 35px #38254133; }
.present-controls span { min-width: 7.5rem; text-align: center; color: var(--muted); font-size: .875rem; }
.present-controls button { white-space: nowrap; }
.presenting .chapter { min-height: calc(100vh - var(--tall)); min-height: calc(100dvh - var(--tall)); padding-bottom: 5.5rem; border-top: 0; }
.presenting .section-inner { padding-block: clamp(1.5rem, 3.6vw, 3rem) 0; }
.presenting .hero { padding-top: clamp(2rem, 6vw, 6rem); }
.presenting .section-heading { margin-bottom: 1.15rem; }
.presenting .section-heading h2 { font-size: clamp(1.9rem, 3.8vw, 3.4rem); }
.presenting .hero .chapter-nav { margin-top: 1.7rem; }

@media (max-width: 930px) {
  .frame { width: calc(100% - 3rem); }
  .top-nav { gap: 1rem; }
  .chapter-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chapter-nav a { min-height: 2.65rem; }
}
@media (max-width: 820px) {
  .top-nav { display: none; }
}
@media (max-width: 730px) {
  .hero-grid, .split { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-top: 2.6rem; }
  .hero-grid { gap: 1.7rem; }
  h1 { font-size: clamp(3.25rem, 11.5vw, 5.55rem); }
  .hero .actions { margin-block: 1.05rem; }
  .chapter-nav { margin-top: 1.6rem; }
  .section-heading h2 { letter-spacing: -.04em; }
}
@media (max-width: 520px) {
  :root { --tall: 3.75rem; }
  .frame { width: calc(100% - 1.7rem); }
  .header-inner { gap: .4rem; }
  .brand { gap: .43rem; font-size: .94rem; }
  .brand-sub { display: none; }
  .header-actions { gap: .32rem; }
  .slides-link, .present-button { padding-inline: .5rem; min-height: 2.5rem; white-space: nowrap; }
  .chapter-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chapter-nav a { padding-block: .33rem; }
  .alignment-layout, .arch-layout { grid-template-columns: minmax(0, 1fr); }
  .panel-header { flex-wrap: wrap; gap: .6rem; }
  .architecture-metrics { justify-content: start; }
  .vector-grid { gap: .35rem; }
  .vector-item { padding-inline: .39rem; gap: .22rem; }
  .vector-item code { font-size: .81rem; }
  .two-formulas > div { padding-inline: .48rem; }
  .two-formulas code { font-size: .875rem; }
  .qkv-roles { gap: .3rem; }
  .qkv-roles > div { flex-direction: column; align-items: start; gap: .12rem; padding: .36rem .45rem; }
  .qkv-roles b { font-size: 1.4rem; }
  .references { grid-template-columns: 1fr; gap: .35rem; }
  .present-controls { gap: .35rem; bottom: .4rem; }
  .present-controls .button { padding-inline: .53rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; }
}
