/* The post wears the NextTransformer observatory's look (website/app/editorial.css and dream-theme.css upstream): warm
   paper, white cards with a warm hairline, blue, lavender and rose as accents, a strong sans title followed by a serif
   accent line, and the hand-written Kalam wordmark. The dark values follow the documentation's dark theme.
   Layout rules are in STYLE.md. */
@font-face { font-family: Kalam; font-style: normal; font-weight: 700; font-display: swap; src: url('assets/fonts/kalam-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: Kalam; font-style: normal; font-weight: 400; font-display: swap; src: url('assets/fonts/kalam-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: Kalam; font-style: normal; font-weight: 300; font-display: swap; src: url('assets/fonts/kalam-latin-300-normal.woff2') format('woff2'); }

:root {
  color-scheme: light;
  /* Interface: the observatory's paper, inks and three accents. */
  --paper: #FBF9F7; --surface: #FFFEFD; --line: #E6E2E3; --line-cool: #E2E7EB; --hair: #E8EDF3;
  --ink-strong: #353D43; --ink: #494E52; --ink-soft: #4E5860; --muted: #616B78; --faint: #8A939D;
  --blue: #526B85; --purple: #74638C; --rose: #965C66; --rose-strong: #A45F6B; --accent: #7F9DBA;
  --blue-soft: #F0F4F8; --purple-soft: #F4F1F8; --rose-soft: #FBF2F3;
  --blue-line: #D6E1EB; --purple-line: #DED4EC; --rose-line: #E7C9D1;
  --topbar: #FBF9F7E8; --mark-bg: #FFFCFC; --mark-line: #C89CA3; --mark-arrow: #AD7987; --amp: #C96A7A;
  --repo-bg: #EEF3F8; --repo-line: #B7C6D6; --repo-ink: #3D5670; --repo-bg-hover: #DCE6F0;
  --frost: linear-gradient(135deg, #F4F1F8 0%, #FBF2F3 55%, #F0F4F8 100%); --frost-line: #EFEAF4;
  --card-bg: linear-gradient(160deg, #F7F5FC, #FFFFFF 70%); --card-line: #DFE6EE;
  --thead: linear-gradient(100deg, #F7F5FC, #FFFFFF 75%); --row-hover: #F6F8FC; --total-bg: #FBFCFE;
  --card-shadow: 0 5px 25px #6E547B0A; --hero-shadow: 0 22px 60px #74638C14; --tip-shadow: 0 10px 30px #494E5224;
  --sky: radial-gradient(ellipse at 0% 8%, #DCE8F4B0, transparent 44%), radial-gradient(ellipse at 100% 32%, #E9E2F3A6, transparent 46%),
    radial-gradient(ellipse at 40% 100%, #F5E1E7A6, transparent 55%);
  --orbit-a: #92A8BE38; --orbit-b: #DDC5CE4A;
  --hero-art: url('assets/observatory-sky.jpg'); --hero-veil: linear-gradient(#0000, #0000); --hero-fill: #F3EEF1; --hero-line: #FFFFFFB8;
  /* Figures (read by figures.js when a figure is drawn). Text never wears a series color. */
  --text-primary: #353D43; --text-secondary: #4E5860; --text-muted: #616B78;
  --grid: #E8EDF1; --axis: #CBD2D9; --wash: #F1F2F4;
  --series-1: #2F3C62;   /* AttnRes-Canon: the residual family's ink on the observatory */
  --series-2: #9B8CBB;   /* Canon-A–D */
  --series-3: #4A6E9A;   /* Full + Canon-A/C */
  --series-4: #A45F6B;   /* Gate + Canon-A/C */
  --series-5: #926F23;   /* Gate */
  --series-6: #7594B8;   /* Full AttnRes */
  --series-7: #74638C;   /* Canon-A/C */
  --series-8: #AC9352;   /* Full + Gate */
  --series-other: #ABADB0; --neutral-mark: #5E656F; --ref-mark: #8A9099;
  --fam-loop: #74638C; --fam-linear: #7594B8; --fam-base: #2F3C62;
  --loop: #74638C; --loop-soft: #F4F1F8; --emph: #A45F6B; --emph-soft: #FBF2F3; --chart-line: #4A6E9A;
  --lr-line: #ADA1C2; --lr-fill: #F4F1F8; --on-fill: #FFFEFD;
  --measure: 840px;   /* the one column shared by text, figures and tables */
  --sans: 'Avenir Next', Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
  --serif: Georgia, 'Times New Roman', 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Source Han Serif SC', SimSun, serif;
  --hand: Kalam, 'Avenir Next', 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --paper: #1E2226; --surface: #252A30; --line: #353B42; --line-cool: #353B42; --hair: #30363D;
    --ink-strong: #F4F5F7; --ink: #E3E6EA; --ink-soft: #C9CED4; --muted: #A2AAB3; --faint: #7C858F;
    --blue: #92A8BE; --purple: #ADA1C2; --rose: #C89CA3; --rose-strong: #B9707D; --accent: #9DB4CC;
    --blue-soft: #283039; --purple-soft: #2C2836; --rose-soft: #3A2B2E;
    --blue-line: #3A4653; --purple-line: #463E57; --rose-line: #5A4247;
    --topbar: #1E2226E8; --mark-bg: #2A2427; --mark-line: #9C737B; --mark-arrow: #C89CA3; --amp: #D98A97;
    --repo-bg: #283039; --repo-line: #45525F; --repo-ink: #C3D0DD; --repo-bg-hover: #313B46;
    --frost: linear-gradient(135deg, #2C2836, #33282C 55%, #262D35); --frost-line: #3A3445;
    --card-bg: linear-gradient(160deg, #2A2733, #252A30 70%); --card-line: #353B42;
    --thead: linear-gradient(100deg, #2A2733, #252A30 75%); --row-hover: #2A3037; --total-bg: #282D33;
    --card-shadow: none; --hero-shadow: none; --tip-shadow: 0 10px 30px #00000080;
    --sky: radial-gradient(ellipse at 0% 8%, #2A364470, transparent 44%), radial-gradient(ellipse at 100% 32%, #33294066, transparent 46%),
      radial-gradient(ellipse at 40% 100%, #3A2B3066, transparent 55%);
    --orbit-a: #92A8BE1F; --orbit-b: #C89CA31F;
    --hero-veil: linear-gradient(#1E2226C7, #1E2226B3); --hero-fill: #23272C; --hero-line: #FFFFFF14;
    --text-primary: #F4F5F7; --text-secondary: #C9CED4; --text-muted: #A2AAB3;
    --grid: #30363D; --axis: #4A525B; --wash: #2D3339;
    --series-1: #E3E8F6; --series-2: #C3B5E3; --series-3: #6C93CB; --series-4: #D97F90; --series-5: #C59A3D;
    --series-6: #A5BEDD; --series-7: #8F78C4; --series-8: #DCC78E; --series-other: #6B727A; --neutral-mark: #9AA1AA; --ref-mark: #7C858F;
    --fam-loop: #8F78C4; --fam-linear: #A5BEDD; --fam-base: #E3E8F6;
    --loop: #ADA1C2; --loop-soft: #2C2836; --emph: #D97F90; --emph-soft: #3A2B2E; --chart-line: #6C93CB;
    --lr-line: #8F78C4; --lr-fill: #2C2836; --on-fill: #1E2226;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1E2226; --surface: #252A30; --line: #353B42; --line-cool: #353B42; --hair: #30363D;
  --ink-strong: #F4F5F7; --ink: #E3E6EA; --ink-soft: #C9CED4; --muted: #A2AAB3; --faint: #7C858F;
  --blue: #92A8BE; --purple: #ADA1C2; --rose: #C89CA3; --rose-strong: #B9707D; --accent: #9DB4CC;
  --blue-soft: #283039; --purple-soft: #2C2836; --rose-soft: #3A2B2E;
  --blue-line: #3A4653; --purple-line: #463E57; --rose-line: #5A4247;
  --topbar: #1E2226E8; --mark-bg: #2A2427; --mark-line: #9C737B; --mark-arrow: #C89CA3; --amp: #D98A97;
  --repo-bg: #283039; --repo-line: #45525F; --repo-ink: #C3D0DD; --repo-bg-hover: #313B46;
  --frost: linear-gradient(135deg, #2C2836, #33282C 55%, #262D35); --frost-line: #3A3445;
  --card-bg: linear-gradient(160deg, #2A2733, #252A30 70%); --card-line: #353B42;
  --thead: linear-gradient(100deg, #2A2733, #252A30 75%); --row-hover: #2A3037; --total-bg: #282D33;
  --card-shadow: none; --hero-shadow: none; --tip-shadow: 0 10px 30px #00000080;
  --sky: radial-gradient(ellipse at 0% 8%, #2A364470, transparent 44%), radial-gradient(ellipse at 100% 32%, #33294066, transparent 46%),
    radial-gradient(ellipse at 40% 100%, #3A2B3066, transparent 55%);
  --orbit-a: #92A8BE1F; --orbit-b: #C89CA31F;
  --hero-veil: linear-gradient(#1E2226C7, #1E2226B3); --hero-fill: #23272C; --hero-line: #FFFFFF14;
  --text-primary: #F4F5F7; --text-secondary: #C9CED4; --text-muted: #A2AAB3;
  --grid: #30363D; --axis: #4A525B; --wash: #2D3339;
  --series-1: #E3E8F6; --series-2: #C3B5E3; --series-3: #6C93CB; --series-4: #D97F90; --series-5: #C59A3D;
  --series-6: #A5BEDD; --series-7: #8F78C4; --series-8: #DCC78E; --series-other: #6B727A; --neutral-mark: #9AA1AA; --ref-mark: #7C858F;
  --fam-loop: #8F78C4; --fam-linear: #A5BEDD; --fam-base: #E3E8F6;
  --loop: #ADA1C2; --loop-soft: #2C2836; --emph: #D97F90; --emph-soft: #3A2B2E; --chart-line: #6C93CB;
  --lr-line: #8F78C4; --lr-fill: #2C2836; --on-fill: #1E2226;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 92px; }
body {
  margin: 0; background: var(--paper); color: var(--ink-soft);
  font: 17px/1.85 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  position: relative; isolation: isolate;
}
html[lang="en"] body { line-height: 1.72; }
a { color: var(--blue); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--blue) 40%, transparent); text-underline-offset: 3px; transition: color 0.2s; }
a:hover { color: var(--purple); text-decoration-color: currentColor; }
strong { font-weight: 650; color: var(--ink-strong); }
code { font: 0.86em var(--mono); background: var(--purple-soft); color: var(--purple); padding: 0.1em 0.35em; border-radius: 6px; }

/* The observatory's sky: three soft washes, two orbits and a few stars, fixed behind the page. */
.dream-sky { position: fixed; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; background: var(--sky); }
.dream-sky i { position: absolute; width: 640px; height: 640px; border: 1px solid var(--orbit-a); border-radius: 50%; left: -430px; top: 300px; }
.dream-sky i:nth-child(2) { width: 740px; height: 740px; left: auto; right: -520px; top: 120px; border-color: var(--orbit-b); }
.dream-sky > span { position: absolute; color: #92A8BE; font-size: 22px; opacity: 0.55; animation: dream-twinkle 7s ease-in-out infinite; }
.dream-sky > span:nth-of-type(1) { top: 19%; left: 3%; }
.dream-sky > span:nth-of-type(2) { top: 44%; right: 3%; font-size: 27px; animation-delay: 2s; color: #C59BA8; }
.dream-sky > span:nth-of-type(3) { bottom: 11%; left: 8%; font-size: 14px; animation-delay: 4s; color: #ADA1C2; }
@keyframes dream-twinkle { 50% { opacity: 0.25; transform: translateY(-7px) rotate(8deg); } }

/* Reading progress: a thin band in the three accents above the top bar. */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 40; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #92A8BE, #ADA1C2 55%, #C89CA3); transform: scaleX(0); transform-origin: left center; }

/* Top bar: the project's mark and wordmark, the IAAI lockup, then links. */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 68px; padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--topbar); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.topbar a { text-decoration: none; }
.brand-cluster { display: flex; align-items: center; min-width: 0; gap: 20px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand b { font-family: var(--hand); font-weight: 700; font-size: 24px; letter-spacing: 0; line-height: 1; transform: translateY(2px); color: var(--ink-strong); white-space: nowrap; }
.brand-mark {
  position: relative; display: grid; place-items: center; flex: none; width: 29px; height: 31px; border: 1.5px solid var(--mark-line); border-radius: 8px;
  font-weight: 600; font-size: 20px; line-height: 1; color: var(--rose); background: var(--mark-bg); transform: rotate(-4deg);
}
.brand-mark span { position: absolute; right: -6px; top: -9px; background: var(--paper); font-size: 18px; line-height: 19px; color: var(--mark-arrow); }
.iaai-brand { display: flex; align-items: center; gap: 10px; padding-left: 20px; border-left: 1px solid var(--line-cool); white-space: nowrap; }
.iaai-brand img { width: 34px; height: 34px; object-fit: contain; }
.iaai-brand b { font-family: var(--hand); font-weight: 400; font-size: 24px; letter-spacing: 0.03em; line-height: 1; transform: translateY(2px); color: var(--ink-soft); }
.iaai-brand > span { font-family: var(--hand); font-weight: 300; font-size: 18px; line-height: 1; transform: translateY(2px); color: var(--muted); }
.iaai-brand > span i { color: var(--amp); font-style: normal; }
.header-actions { display: flex; align-items: center; gap: 18px; flex: none; }
.header-link { font-size: 13px; font-weight: 500; color: var(--muted); }
.header-link:hover { color: var(--ink-strong); }
.repo-button {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--repo-line); border-radius: 999px;
  background: var(--repo-bg); color: var(--repo-ink); font-size: 13px; font-weight: 600; transition: background 0.2s, border-color 0.2s;
}
.repo-button:hover { background: var(--repo-bg-hover); color: var(--repo-ink); }
.repo-button svg { flex: none; }
.pill {
  font: 500 13px/1.5 var(--sans); color: var(--muted); background: var(--surface); border: 1px solid var(--line-cool);
  border-radius: 999px; padding: 5px 13px; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s;
}
a.pill:hover, button.pill:hover { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.pill:focus-visible, .repo-button:focus-visible, .header-link:focus-visible, .trace-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
/* The way into the post's research trace: three staggered bars, as on its time axis. On wide screens it sits in the top
   bar; on narrow ones, where the bar has no room, the same button sits in the title card's meta row instead. */
.trace-button {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border: 1px solid var(--purple-line); border-radius: 999px;
  background: var(--purple-soft); color: var(--purple); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.2s, border-color 0.2s;
}
.trace-button:hover { background: color-mix(in srgb, var(--purple) 14%, var(--surface)); border-color: var(--purple); color: var(--purple); }
.trace-button svg { flex: none; }
.post-meta .meta-trace { display: none; text-decoration: none; }
.post-meta .meta-trace span { color: inherit; font-weight: 600; }

/* Page frame: one centered column on the paper, with a section rail in the left margin on wide screens. */
.page { display: grid; grid-template-columns: minmax(0, 920px); justify-content: center; padding: 0 24px; }
main { min-width: 0; padding: 0 0 56px; }
.rail { display: none; }
@media (min-width: 1420px) {
  .rail {
    display: block; position: fixed; top: 128px; left: calc(50% - 460px - 34px - 168px); width: 168px;
    font-size: 13px; line-height: 1.45; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
  }
  .rail.is-on { opacity: 1; visibility: visible; }
}
.rail-title { color: var(--purple); font-size: 12px; font-weight: 600; letter-spacing: 1.6px; margin: 0 0 10px 12px; }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail a { display: flex; gap: 8px; padding: 6px 10px 6px 12px; color: var(--muted); text-decoration: none; border-left: 2px solid var(--line); transition: color 0.2s, border-color 0.2s; }
.rail a:hover { color: var(--ink-strong); }
.rail a span { flex: none; width: 1.5em; color: var(--rose); font-size: 11px; font-weight: 600; letter-spacing: 1px; font-variant-numeric: tabular-nums; align-self: center; }
.rail a.is-current { color: var(--ink-strong); border-left-color: var(--mark-line); font-weight: 650; }
.rail li.sub a { padding: 3px 10px 3px 40px; font-size: 12px; }

/* Text, figures and tables share one column width; only the title card is wider. */
article > :not(section):not(.post-head), article > section > * { max-width: var(--measure); margin-inline: auto; }

h1, h2, h3 { color: var(--ink-strong); }
h1 { font-size: 44px; line-height: 1.1; font-weight: 650; letter-spacing: -1.3px; margin: 12px 0 0; }
/* Titles: a strong sans line, then a serif accent line in soft blue (italic in Latin text only). */
h1 em { display: block; margin-top: 12px; font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 0.7em; line-height: 1.3; letter-spacing: 0; color: var(--accent); }
html[lang^="zh"] h1 { letter-spacing: -0.5px; line-height: 1.2; }
html[lang^="zh"] h1 em { font-style: normal; }
h2 { font-size: 31px; line-height: 1.22; font-weight: 650; letter-spacing: -0.7px; margin-block: 8px 1rem; }
html[lang^="zh"] h2 { letter-spacing: -0.2px; }
h3 { font-size: 21px; line-height: 1.4; font-weight: 600; letter-spacing: -0.2px; margin-block: 2.9rem 0.6rem; }
h3 .no { margin-right: 0.55em; color: var(--purple); font-variant-numeric: tabular-nums; }
.eyebrow { margin-block: 0; color: var(--purple); font-size: 12px; line-height: 20px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; }
section > .eyebrow { margin-top: 4.4rem; }
.list-lead { margin-block: 1.3rem 0.2rem; color: var(--ink-strong); font-weight: 650; }
p { margin-block: 1rem; }
ul, ol { padding-left: 1.45rem; margin-block: 0.72rem 1.25rem; }
li { margin-block: 0.4rem; }
ul > li::marker { color: var(--mark-line); }
ol > li::marker { color: var(--purple); font-weight: 600; font-variant-numeric: tabular-nums; }
.cite { white-space: nowrap; text-decoration: none; color: var(--purple); font-size: 0.86em; }
/* Read by screen readers and copied with the text, not drawn (the colon between the two title lines). */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Title card: the observatory illustration, as on the homepage. */
.post-head {
  margin-top: 22px; padding: 40px 40px 168px; border: 1px solid var(--hero-line); border-radius: 26px;
  background: var(--hero-veil), var(--hero-fill) var(--hero-art) left bottom / cover no-repeat; box-shadow: var(--hero-shadow); overflow: hidden;
}
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; margin: 18px 0 0; color: var(--ink-soft); font-size: 14px; }
.post-meta span:first-child { color: var(--ink-strong); font-weight: 650; }

/* Abstract: the documentation's frosted panel with a pill label. */
.abstract { margin-block: 26px 22px; padding: 1.35rem 1.7rem 0.8rem; border: 1px solid var(--frost-line); border-radius: 20px; background: var(--frost); }
.abstract-label { display: inline-block; padding: 0.2rem 0.8rem; border: 1px solid var(--purple-line); border-radius: 999px; background: var(--surface); color: var(--purple); font-size: 0.8rem; font-weight: 700; line-height: 1.5; }
.abstract p { margin-block: 0.8rem; }

.toc { margin-block: 0 1rem; padding: 1.15rem 1.5rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--card-shadow); }
.toc-title { margin-bottom: 0.5rem; color: var(--purple); font-size: 12px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; }
/* A flat list: numbered sections, with their subsections as indented entries. */
.toc ol { margin-block: 0; padding-left: 0; list-style: none; counter-reset: toc; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--purple); }
.toc li { position: relative; margin-block: 0.5rem; padding-left: 2.5em; line-height: 1.5; font-weight: 600; counter-increment: toc; }
.toc li::before { content: "0" counter(toc); position: absolute; left: 0; top: 0.28em; color: var(--rose); font-size: 11px; font-weight: 600; letter-spacing: 1.3px; font-variant-numeric: tabular-nums; }
/* A subsection carries its own number (3.1, 3.2) in its text and lines up under its section's title. */
.toc li.sub { margin-block: 0.2rem; font-size: 0.9rem; font-weight: 400; counter-increment: none; }
.toc li.sub a { color: var(--muted); }
.toc li.sub a:hover { color: var(--purple); }
.toc li.sub::before { content: none; }

/* Fact cards (the rules of the arena): the observatory's numbered principle cards. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 1.5rem 1.6rem; }
.cards > div { border: 1px solid var(--card-line); border-radius: 12px; padding: 16px 18px 14px; background: var(--card-bg); }
.cards span { display: block; color: var(--rose); font-size: 11px; line-height: 1.5; font-weight: 600; letter-spacing: 1.3px; }
.cards p { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.cards p.card-title { margin-top: 6px; color: var(--ink); font-size: 16px; line-height: 1.45; font-weight: 600; }

/* Tables: a numbered caption above, then a white card with small letterspaced heads and hairline rows. Plain cells;
   bold marks the best value of a column. */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--card-shadow); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; line-height: 1.6; }
th, td { padding: 0.7rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--hair); }
thead tr { background: var(--thead); }
th { padding-block: 0.85rem 0.7rem; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.7px; line-height: 1.5; vertical-align: bottom; }
html[lang="en"] th { text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td { color: var(--ink-soft); }
td:first-child { color: var(--ink); }
td strong { color: var(--ink-strong); font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num, th.nw { white-space: nowrap; }
/* The compute table ends in a total row. */
tr.total td { border-top: 1px solid var(--line-cool); background: var(--total-bg); color: var(--ink); font-weight: 600; }
/* A table of two columns of sentences. */
table.plain td { width: 50%; }
/* The depth x Canon table: each cell gives dev BPB, then the difference and the step time in small type. */
.matrix td small { display: block; color: var(--muted); font-size: 0.86em; line-height: 1.5; }
.matrix th.num { white-space: nowrap; }
tbody tr { transition: background-color 0.15s; }
tbody tr:hover td { background: var(--row-hover); }

figure { margin-block: 2rem 2.3rem; }
figure.tbl { margin-block: 1.8rem 2rem; }
figcaption { margin: 0.8rem 2px 0; color: var(--muted); font-size: 0.86rem; line-height: 1.6; }
figcaption strong { color: var(--ink-strong); font-weight: 650; margin-right: 0.2em; }
figure.tbl figcaption { margin: 0 2px 0.7rem; }

/* Figures */
.fig-body { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 18px 13px; box-shadow: var(--card-shadow); }
.fig-body svg { display: block; width: 100%; height: auto; font-family: var(--sans); overflow: visible; }
.fig-body svg text { font-variant-numeric: tabular-nums; }
.fig-body svg text.note { font-family: var(--serif); font-style: italic; }
html[lang^="zh"] .fig-body svg text.note { font-style: normal; }
.fig-title { margin: 0 2px 6px 2px; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.45; }
.fig-sub { margin: -4px 2px 6px 2px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
/* Panels stack by default; figures.js sets the columns when the container is wide enough. */
.panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px 22px; }
.panel { min-width: 0; }
.fig-foot { display: flex; align-items: flex-end; gap: 12px; }
.fig-foot .legend { flex: 1 1 auto; }
.fig-replay {
  flex: none; margin: 6px 0 2px auto; width: 28px; height: 28px; padding: 0; display: grid; place-items: center;
  color: var(--blue); background: var(--surface); border: 1px solid var(--blue-line); border-radius: 999px; cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.fig-replay:hover { background: var(--blue-soft); }
.fig-replay:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.fig-replay svg { width: 14px; height: 14px; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 9px 2px 2px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1.5; font-variant-numeric: tabular-nums; white-space: pre; }
.legend-item[data-key] { cursor: default; }
.legend-key { flex: none; width: 18px; height: 0; border-top: 2.5px solid; border-radius: 2px; }
.legend-key.rect { width: 12px; height: 10px; border: 0; border-radius: 3px; }
.legend-key.dot { width: 8px; height: 8px; border: 0; border-radius: 50%; }
.legend-key.band { width: 18px; height: 8px; border: 0; border-radius: 2px; }

/* Hover emphasis inside a figure: the series under the pointer stays, the rest recede. Nothing is revealed that is not
   already drawn. */
.fig-body svg .series, .fig-body svg .node, .fig-body svg .edge { transition: opacity 0.18s; }
.fig-body svg.has-focus .series:not(.is-focus), .fig-body svg.has-focus .node:not(.is-focus) { opacity: 0.22; }
.fig-body svg.has-focus .edge:not(.is-focus) { opacity: 0.12; }
.fig-body svg .hit { cursor: default; }

/* The readout that follows the pointer over a chart; it repeats values the figure or its table already shows. */
.tip {
  position: fixed; z-index: 45; pointer-events: none; max-width: 300px; padding: 9px 11px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--tip-shadow);
  color: var(--ink-soft); font-size: 12.5px; line-height: 1.5; opacity: 0; transition: opacity 0.12s;
}
.tip.is-on { opacity: 1; }
.tip-title { color: var(--muted); margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.tip-row b { margin-left: auto; padding-left: 14px; color: var(--ink-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-key { flex: none; width: 12px; height: 0; border-top: 2.5px solid; border-radius: 2px; }

/* The mechanism figure: two panels side by side; figures.js stacks them when the container is narrow. */
.mech { display: flex; align-items: stretch; }
.mech-a { flex: 1 1 0; min-width: 0; }
.mech-b { flex: 1 1 0; min-width: 0; border-left: 1px solid var(--grid); padding-left: 12px; margin-left: 12px; }
/* Dashes that travel along a path while its figure is in view (the depth reads, the workflow's way back). */
.flowing svg .flow { stroke-dasharray: 3 9; animation: flow 1.1s linear infinite; }
.flowing.is-paused svg .flow { animation-play-state: paused; }
@keyframes flow { to { stroke-dashoffset: -12; } }

.links { font-size: 0.95rem; color: var(--muted); }
.references { margin-top: 3.6rem; padding-top: 1.7rem; border-top: 1px solid var(--line); }
.references h2 { font-size: 22px; letter-spacing: -0.3px; margin-block: 0 0.6rem; }
.references ol { padding-left: 1.35rem; }
.references li { margin-block: 0.7rem; color: var(--muted); font-size: 0.92rem; line-height: 1.65; }
.references li strong { color: var(--ink); }

/* Footer, as on the observatory. */
.site-footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 22px;
  max-width: 920px; margin: 0 auto; padding: 19px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.site-footer a { text-decoration: none; color: var(--muted); }
.site-footer a:hover { color: var(--ink-strong); }
.site-footer .footer-brand { color: var(--blue); font-size: 14px; }
.site-footer .footer-brand span { margin: 0 5px; }
.site-footer > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; }
.site-footer > div > span { font-size: 12px; }
.footer-wrap { padding: 0 24px; }

/* Entrance motion. The hidden start state exists only while site.js has marked the page as animated, so the article
   reads in full without scripts, in print and with reduced motion. */
.js-motion .reveal { opacity: 0; transform: translateY(8px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.js-motion .reveal.is-in { opacity: 1; transform: none; }

@media (max-width: 1100px) {
  .iaai-brand > span { display: none; }
}
/* The trace button: icon only just above the width where the IAAI lockup gets its full name; below 960px the top bar
   has no room for it, and the button in the title card takes over. */
@media (min-width: 1101px) and (max-width: 1150px) {
  .topbar .trace-button { width: 34px; padding: 0; justify-content: center; }
  .topbar .trace-button span { display: none; }
}
@media (max-width: 960px) {
  .topbar .trace-button { display: none; }
  .post-meta .meta-trace { display: inline-flex; height: 30px; padding: 0 12px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  html { scroll-padding-top: 76px; }
  .topbar { height: 60px; padding: 0 16px; gap: 10px; }
  .brand-cluster { gap: 11px; }
  .brand { gap: 7px; }
  .brand b { font-size: 20px; }
  .brand-mark { width: 27px; height: 29px; font-size: 19px; }
  .iaai-brand { gap: 6px; padding-left: 11px; }
  .iaai-brand img { width: 26px; height: 26px; }
  .iaai-brand b { font-size: 21px; }
  .header-actions { gap: 8px; }
  .header-link, .repo-button { display: none; }
  .pill { padding: 4px 10px; }
  .dream-sky i { opacity: 0.5; }
  .dream-sky > span { display: none; }
  .page, .footer-wrap { padding: 0 16px; }
  .post-head { margin-top: 14px; padding: 26px 20px 132px; border-radius: 20px; background-position: 14% 100%; }
  h1 { font-size: 31px; letter-spacing: -0.8px; }
  h2 { font-size: 25px; }
  h3 { font-size: 19px; }
  section > .eyebrow { margin-top: 3.4rem; }
  .abstract { padding: 1.1rem 1.15rem 0.5rem; border-radius: 16px; }
  .toc { padding: 1rem 1.1rem 0.9rem; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  table { font-size: 0.8rem; }
  th { font-size: 10.5px; letter-spacing: 0.2px; }
  html[lang="en"] th { text-transform: none; font-size: 11px; letter-spacing: 0; }
  th, td { padding: 0.5rem 0.45rem; }
  th.nw { white-space: normal; }
  .matrix th, .matrix td, .compute th, .compute td { padding-inline: 0.3rem; }
  .matrix th:first-child, .matrix td:first-child, .compute th:first-child, .compute td:first-child { padding-left: 0.5rem; }
  .matrix td small { font-size: 0.78em; }
  .matrix th.num { white-space: normal; }
  .site-footer { display: block; }
  .site-footer .footer-brand { display: block; margin-bottom: 12px; }
}
@media (max-width: 640px) {
  .fig-body { padding: 14px 10px 10px; }
}
@media (max-width: 420px) {
  .iaai-brand b { display: none; }
}
@media (max-width: 380px) {
  table.matrix { font-size: 0.72rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .flowing svg .flow { animation: none; stroke-dasharray: none; }
  .fig-replay { display: none; }
  .dream-sky > span { animation: none; }
}
@media print {
  .progress, .topbar, .rail, .fig-replay, .tip, .dream-sky { display: none; }
  .flowing svg .flow { animation: none; stroke-dasharray: none; }
  .page { display: block; padding: 0; }
  .post-head { box-shadow: none; }
}
@media (forced-colors: active) {
  .legend-key { forced-color-adjust: none; }
}
