/* Silin — research notes set somewhere between a paper and a blog. */

@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-text.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-text-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4 Display"; src: url("/fonts/source-serif-4-display.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans 3"; src: url("/fonts/source-sans-3-italic.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #fbfaf6;
  --paper-deep: #f2f0e8;
  --panel: #fffefb;
  --ink: #1b1f1c;
  --ink-soft: #383d39;
  --muted: #656a63;
  --faint: #9a9d95;
  --rule: #dcdad0;
  --rule-soft: #e9e7df;
  --rule-strong: #2a2e2b;
  --accent: #1d5592;
  --accent-soft: #e8eff8;
  --accent-line: #c9d8ea;
  --latent: #2c5f9e;
  --latent-soft: #e1ebf7;
  --read: #6a4fbf;
  --read-soft: #f4f0fc;
  --read-ink: #523b9e;
  --transform: #1f7157;
  --transform-soft: #ebf5f0;
  --transform-ink: #175a45;
  --write: #ad5536;
  --write-soft: #fcf1eb;
  --write-ink: #8b4027;
  --serif: "Source Serif 4", "Iowan Old Style", Charter, Georgia, serif;
  --display: "Source Serif 4 Display", "Source Serif 4", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --text: 680px;
  --gutter: 40px;
  --margin: 240px;
  --toc: 208px;
  --toc-gap: 56px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 20px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.62;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
  text-decoration-color: var(--accent-line);
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
strong { font-weight: 650; }
p { margin: 0 0 1.05em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link {
  position: fixed; z-index: 40; top: 12px; left: 12px; transform: translateY(-200%);
  padding: 9px 14px; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--panel); color: var(--ink); font: 600 14px/1.3 var(--sans);
}
.skip-link:focus { transform: none; }

/* Site chrome */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner, .site-footer-inner {
  display: flex; align-items: baseline; justify-content: space-between; gap: 24px;
  max-width: 1232px; margin: 0 auto; padding: 18px 24px;
}
.wordmark { color: var(--ink); font: 600 25px/1 var(--display); letter-spacing: -0.015em; text-decoration: none; }
.wordmark span { color: var(--accent); }
.site-nav a { color: var(--muted); font: 500 14.5px/1 var(--sans); letter-spacing: .05em; text-decoration: none; }
.site-nav a:hover { color: var(--ink); }
.site-footer { margin-top: 24px; border-top: 1px solid var(--rule); color: var(--muted); font: 14px/1.4 var(--sans); }
.site-footer-inner { padding-top: 22px; padding-bottom: 34px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

.kicker {
  margin: 0 0 16px; color: var(--accent);
  font: 700 12.5px/1.3 var(--sans); letter-spacing: .15em; text-transform: uppercase;
}

/* Article grid: contents | text | margin notes */
.article {
  display: grid;
  grid-template-columns:
    [full-start] minmax(24px, 1fr) [toc-start] var(--toc) [toc-end] var(--toc-gap)
    [text-start] minmax(0, var(--text)) [text-end] var(--gutter)
    [margin-start] var(--margin) [margin-end] minmax(24px, 1fr) [full-end];
  padding: 60px 0 24px;
}
.front-matter { grid-column: text-start / margin-end; grid-row: 1; }
.lattice-figure:not(.paper-lattice) { grid-column: text-start / margin-end; grid-row: 2; }
.article-layout { display: contents; }
.toc { grid-column: toc-start / toc-end; grid-row: 3; }
.article-body { grid-column: text-start / text-end; grid-row: 3; min-width: 0; }

/* Front matter */
.front-matter h1 {
  max-width: 900px; margin: 0 0 16px;
  font: 600 clamp(38px, 5.2vw, 60px)/1.04 var(--display);
  letter-spacing: -0.024em; text-wrap: balance;
}
.subtitle {
  max-width: 760px; margin: 0 0 32px; color: var(--ink-soft);
  font-size: 22px; font-style: italic; line-height: 1.45; text-wrap: pretty;
}
.intro { max-width: var(--text); margin: 0 0 44px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: 17.5px; line-height: 1.62; }
.front-matter h1:last-child { margin-bottom: 52px; }

/* Contents */
.toc {
  position: sticky; top: 22px; align-self: start;
  max-height: calc(100vh - 44px); overflow-y: auto; scrollbar-width: thin;
  padding: 2px 6px 12px 0; font: 14px/1.35 var(--sans);
}
.toc-title { margin: 4px 0 12px; color: var(--ink-soft); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.toc-list, .toc-list ol { margin: 0; padding: 0; list-style: none; }
.toc-list ol { margin: 1px 0 5px; }
.toc a {
  display: flex; gap: 6px; padding: 4px 4px 4px 10px; border-left: 2px solid var(--rule-soft);
  color: var(--muted); text-decoration: none;
}
.toc-list ol a { padding-left: 20px; font-size: 13.5px; }
.toc-num { flex: none; min-width: 1.9em; color: var(--faint); font-variant-numeric: tabular-nums; }
.toc-list ol .toc-num { min-width: 2.2em; }
.toc a:hover { color: var(--ink); border-left-color: var(--faint); }
.toc a.is-active { color: var(--ink); border-left-color: var(--accent); font-weight: 600; }
.toc a.is-active .toc-num { color: var(--accent); }
.toc-mobile { display: none; margin: 0 0 44px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font: 15px/1.4 var(--sans); }
.toc-mobile summary { padding: 13px 0; color: var(--ink); font-weight: 600; cursor: pointer; }
.toc-mobile nav { padding: 0 0 14px; }
.toc-mobile a { display: flex; gap: 8px; padding: 5px 0; color: var(--ink-soft); text-decoration: none; }
.toc-mobile .toc-list ol a { padding-left: 2.1em; color: var(--muted); }

/* Headings and sections */
.section { margin: 0 0 68px; }
.section > h2, .mechanism-head h3, .appendix h3 { position: relative; scroll-margin-top: 20px; }
.section > h2 {
  margin: 0 0 3px; font: 600 31px/1.18 var(--display); letter-spacing: -0.014em; text-wrap: balance;
}
.standfirst { margin: 0 0 24px; color: var(--muted); font-size: 20px; font-style: italic; line-height: 1.45; }
.secnum {
  position: absolute; right: calc(100% + 18px); top: 0;
  color: var(--faint); font-weight: 500; font-variant-numeric: lining-nums; white-space: nowrap;
}
.heading-anchor {
  margin-left: .32em; color: var(--faint); font: 400 .62em/1 var(--sans);
  text-decoration: none; opacity: 0; transition: opacity .15s;
}
:is(h2, h3):hover > .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.article-body h3 { font-family: var(--display); font-weight: 600; }

/* Section 1 */
.beliefs { display: grid; gap: 22px; margin: 28px 0 32px; }
.belief { min-width: 0; padding-left: 18px; border-left: 2px solid var(--rule); }  /* let wide figures scroll inside */
.belief-title { margin: 0 0 6px; font: italic 600 19.5px/1.42 var(--serif); }
.belief-label { display: block; margin-bottom: 3px; color: var(--accent); font: normal 700 12.5px/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; }
.belief p { margin: 0; }
.research-focus {
  margin: 34px 0 6px; padding: 20px 24px 21px;
  border: 1px solid var(--accent-line); border-radius: 6px; background: var(--accent-soft);
}
.research-focus-label { margin: 0 0 6px; color: var(--accent); font: 700 12.5px/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; }
.research-focus p:last-child { margin: 0; }

/* Section 2 */
.rtw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 24px 0 26px; }
.rtw { position: relative; padding: 13px 16px 15px; border-top: 3px solid; border-radius: 0 0 6px 6px; background: var(--panel); box-shadow: 0 0 0 1px var(--rule-soft); }
.rtw + .rtw::before {
  content: "→"; position: absolute; top: 12px; left: -15px;
  color: var(--faint); font: 16px/1 var(--sans);
}
.rtw dt { font: 700 13px/1.3 var(--sans); letter-spacing: .13em; text-transform: uppercase; }
.rtw dd { margin: 6px 0 0; font-size: 16.5px; line-height: 1.5; }
.rtw[data-phase="read"] { border-color: var(--read); }
.rtw[data-phase="read"] dt { color: var(--read-ink); }
.rtw[data-phase="transform"] { border-color: var(--transform); }
.rtw[data-phase="transform"] dt { color: var(--transform-ink); }
.rtw[data-phase="write"] { border-color: var(--write); }
.rtw[data-phase="write"] dt { color: var(--write-ink); }
.remark { margin: 28px 0 0; padding-left: 18px; border-left: 2px solid var(--rule); color: var(--ink-soft); font-size: 17.5px; }
.remark-label { color: var(--ink); font-style: italic; font-weight: 600; }

/* Tables */
.table-wrap { margin: 32px 0; overflow-x: auto; scrollbar-width: thin; }
table.booktabs {
  width: 100%; border-collapse: collapse;
  border-top: 1.5px solid var(--rule-strong); border-bottom: 1.5px solid var(--rule-strong);
  font: 15.5px/1.45 var(--sans); font-variant-numeric: lining-nums;
}
.booktabs caption { padding: 0 0 10px; caption-side: top; color: var(--muted); font: 15px/1.5 var(--sans); text-align: left; }
.booktabs th, .booktabs td { padding: 9px 14px 9px 0; text-align: left; vertical-align: top; }
.booktabs thead th { padding-top: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--rule-strong); color: var(--ink); font-size: 14px; font-weight: 600; }
.booktabs tbody tr + tr > * { border-top: 1px solid var(--rule-soft); }
.booktabs tbody th { color: var(--ink); font-weight: 600; }
.booktabs td { color: var(--ink-soft); }
.booktabs a { color: var(--ink); text-decoration-color: var(--rule); }
.table-label, .figure-label { color: var(--ink); font-weight: 700; }
.notation-table td:first-child { width: 112px; color: var(--ink); white-space: nowrap; }
.notation-table td:first-child .katex { font-size: 1.12em; }
.table-wrap:has(table:not(.notation-table)) table { min-width: 600px; }

/* Figures */
figure { margin: 34px 0; }
figcaption {
  max-width: var(--text); margin-top: 12px; color: var(--muted);
  font: 15px/1.52 var(--sans); text-wrap: pretty;
}
figcaption strong { color: var(--ink); font-weight: 600; }
.figure-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 9px; font-family: var(--sans); }
.toolbar-label { margin-right: 4px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.figure-toolbar button, .demo-actions button {
  appearance: none; display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 12px; border: 1px solid var(--rule); border-radius: 999px;
  background: var(--panel); color: var(--ink-soft); font: 500 14px/1.45 var(--sans); cursor: pointer;
  transition: background-color .12s, border-color .12s, color .12s;
}
.figure-toolbar button:hover, .demo-actions button:hover { border-color: var(--faint); color: var(--ink); }
.figure-toolbar button[aria-pressed="true"] { border-color: var(--ink-soft); background: var(--ink); color: var(--paper); }
.swatch { width: 10px; height: 10px; border-radius: 3px; }
button[data-phase="read"] .swatch { background: var(--read); }
button[data-phase="transform"] .swatch { background: var(--transform); }
button[data-phase="write"] .swatch { background: var(--write); }
.figure-toolbar button[data-phase="read"][aria-pressed="true"] { border-color: var(--read); background: var(--read-soft); color: var(--read-ink); }
.figure-toolbar button[data-phase="transform"][aria-pressed="true"] { border-color: var(--transform); background: var(--transform-soft); color: var(--transform-ink); }
.figure-toolbar button[data-phase="write"][aria-pressed="true"] { border-color: var(--write); background: var(--write-soft); color: var(--write-ink); }

.mechanism-figure { width: calc(100% + var(--gutter) + var(--margin)); margin: 26px 0 30px; }
.flow-scroll, .lattice-scroll {
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin;
  border: 1px solid var(--rule); border-radius: 5px; background: var(--panel);
}
.flow-svg { display: block; width: 100%; min-width: 720px; height: auto; }
.flow-svg [data-phase] { transition: opacity .14s ease; }
.flow-svg .phase-dimmed { opacity: .13; }

/* Figure 1 */
.lattice-figure { margin: 0 0 64px; }
.paper-lattice { width: calc(100% + var(--gutter) + var(--margin)); margin: 26px 0 34px; }
.paper-lattice .lattice-svg { min-width: 600px; }
.lattice-node.is-faded, .lattice-pill.is-faded { opacity: .38; }
.lattice-node.is-dest { stroke: var(--ink-soft); stroke-width: 1.8; }
.lattice-node.is-computed { fill: #ecebe4; stroke: #a9a79c; }
.lattice-node.is-receive { stroke: var(--latent); stroke-dasharray: 4 3; }
.lattice-node.is-value { stroke: #9fb6d3; }
.lattice-pill.is-stored { fill: var(--paper-deep); stroke: #9f9d92; }
.lattice-pill.is-partial { fill: var(--paper-deep); stroke: #9f9d92; stroke-dasharray: 4 3; }
.lattice-pill.is-query { fill: var(--transform-soft); stroke: var(--transform); }
.lattice-sum { fill: #fffefb; stroke: var(--ink-soft); stroke-width: 1.3; }
.lattice-sum.is-dest { stroke: var(--write); stroke-width: 2.4; }
.lattice-chip { fill: var(--read-soft); stroke: var(--read); stroke-width: 1; }
.lattice-band { fill: #eef3fa; }
.lattice-band.is-alt { fill: #f6f1e4; }
.lattice-panel { fill: none; stroke: var(--rule); stroke-width: 1.2; }
.key-read { border-color: var(--read); }
.key-write { border-color: var(--write); }
.key-stored { width: 20px; height: 12px; border: 1.3px solid #9f9d92; border-radius: 6px; background: var(--paper-deep); }
.key-band { width: 18px; height: 12px; border: 0; border-radius: 3px; background: #dfe9f6; }
.key-receive { width: 18px; height: 12px; border: 1.3px dashed var(--latent); border-radius: 3px; }
.lattice-svg { display: block; width: 100%; max-width: 800px; min-width: 580px; height: auto; margin: 0 auto; }
.lattice-svg.is-narrow { display: none; }
@media (max-width: 640px) {
  .hero-figure .lattice-svg.is-wide, #fig-lattice .lattice-svg.is-wide { display: none; }
  #fig-lattice .lattice-svg.is-narrow { display: block; min-width: 0; max-width: 420px; }
}
.lattice-layer[hidden] { display: none; }
.lattice-lane { fill: #f2f1eb; }
.lattice-node, .lattice-pill { fill: #fffefb; stroke: #c4c2b8; stroke-width: 1.1; }
.lattice-node.is-chain, .lattice-pill.is-latent { fill: var(--latent-soft); stroke: var(--latent); stroke-width: 1.3; }
.lattice-gate { fill: #fffefb; stroke: var(--latent); stroke-width: 1.3; }
.lattice-gate.is-faded { opacity: .4; }
.lattice-legend {
  display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 11px 0 0; padding: 0;
  color: var(--muted); font: 14px/1.4 var(--sans); list-style: none;
}
.lattice-legend li { display: flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 24px; border-top: 2px solid; }
.key-residual { border-color: #5d625d; }
.key-attention { border-top-style: dashed; border-color: #8b8f8a; }
.key-latent { border-color: var(--latent); border-top-width: 2.5px; }
.key-token { border-top-style: dashed; border-color: #1f7157; }
.key-chain { width: 18px; height: 12px; border: 1.3px solid var(--latent); border-radius: 3px; background: var(--latent-soft); }
.lattice-descriptions { max-width: var(--text); min-height: 4.6em; margin: 12px 0 0; }
.lattice-desc { margin: 0; color: var(--ink-soft); font: 16px/1.55 var(--sans); }
.lattice-figure figcaption { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--rule-soft); }

/* Mechanism subsections */
.mechanism { margin: 60px 0 0; padding-top: 34px; border-top: 1px solid var(--rule); }
.mechanism-head h3 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.mechanism-head .secnum { font-weight: 500; }
.mechanism-meta { margin: 5px 0 0; color: var(--muted); font: 15px/1.4 var(--sans); }
.phase-list { margin: 0 0 6px; }
.phase-para { position: relative; transition: opacity .15s; }
.phase-para::before {
  content: ""; position: absolute; top: .28em; bottom: .28em; left: -15px;
  width: 3px; border-radius: 2px; background: transparent; transition: background-color .15s;
}
.runin { font-weight: 700; }
.phase-para[data-phase="read"] .runin { color: var(--read-ink); }
.phase-para[data-phase="transform"] .runin { color: var(--transform-ink); }
.phase-para[data-phase="write"] .runin { color: var(--write-ink); }
.phase-para.is-highlighted[data-phase="read"]::before { background: var(--read); }
.phase-para.is-highlighted[data-phase="transform"]::before { background: var(--transform); }
.phase-para.is-highlighted[data-phase="write"]::before { background: var(--write); }
.phase-para.is-muted { opacity: .48; }
.mechanism-notes { margin-top: 4px; }

/* Margin notes */
.margin-note {
  float: right; clear: right; position: relative;
  width: var(--margin); margin: 2px calc(-1 * (var(--gutter) + var(--margin))) 16px 0;
  color: var(--muted); font: 14px/1.5 var(--sans);
}
.margin-label { display: block; margin-bottom: 3px; color: var(--ink-soft); font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.margin-note a { color: var(--ink-soft); }

/* Equations */
.katex { font-size: 1.1em; }
.equation-block { margin: 22px 0 26px; }
.equation-label { margin: 0 0 2px; color: var(--muted); font: 600 12.5px/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.display-math { display: flex; align-items: center; gap: 14px; }
.display-math-body { flex: 1; min-width: 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.display-math .katex-display { margin: 0; }
.display-math .katex-display > .katex { font-size: 1.12em; }
.eq-num { flex: none; color: var(--muted); font-variant-numeric: lining-nums; text-decoration: none; }
.eq-num:hover { color: var(--accent); }
.equation-note { margin: 6px 0 0; color: var(--ink-soft); font-size: 16px; }

/* Citations and references */
.citation { color: var(--accent); font: 500 .8em/1 var(--sans); text-decoration: none; white-space: nowrap; }
.citation:hover { text-decoration: underline; }
.xref { color: inherit; text-decoration-color: var(--rule); }
.cite-card {
  position: absolute; z-index: 30; max-width: 380px; padding: 12px 15px;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--panel);
  box-shadow: 0 10px 30px rgba(27, 31, 28, .13), 0 2px 6px rgba(27, 31, 28, .06);
  color: var(--ink-soft); font: 14.5px/1.48 var(--sans);
}
.cite-card[hidden] { display: none; }
/* KaTeX row wrappers overlap neighbouring rows; let the pointer reach marked terms. */
.has-tips .katex-html { pointer-events: none; }
.has-tips [data-tip] { pointer-events: auto; border-radius: 3px; cursor: help; transition: background-color .1s; }
.has-tips [data-tip].is-tipped { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
.has-tips svg [data-tip] { cursor: help; }
.has-tips svg text { pointer-events: none; }  /* labels let the pointer reach the box below */
.has-tips svg [data-tip].is-tipped { background: none; box-shadow: none; }
.has-tips svg [data-tip].is-tipped :is(rect, circle) { stroke: var(--accent); stroke-width: 2.4px; }
.tip-card {
  position: absolute; z-index: 30; padding: 10px 13px 11px; pointer-events: none;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--panel);
  box-shadow: 0 10px 30px rgba(27, 31, 28, .13), 0 2px 6px rgba(27, 31, 28, .06);
  color: var(--ink-soft); font: 14px/1.45 var(--sans);
}
.tip-card[hidden] { display: none; }
.tip-card strong { color: var(--ink); font-weight: 600; }
.tip-card .tip-shape { margin-left: 8px; padding: 1px 6px; border-radius: 4px; background: var(--paper-deep); color: var(--ink-soft); font: 13px/1.4 var(--serif); white-space: nowrap; }
.tip-card p { margin: 4px 0 0; }
.tip-card .katex { font-size: 1.06em; }
.tip-card .tip-shape .katex { font-size: 1.12em; }
.cite-card .ref-title { color: var(--ink); font-weight: 600; }
.reference-list { margin: 8px 0 0; padding: 0; list-style: none; font-size: 16.5px; line-height: 1.5; }
.reference-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr); margin: 0 0 13px; padding: 2px 0; border-radius: 4px; }
.reference-list li:target { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); }
.ref-num { color: var(--muted); font: 500 15px/1.65 var(--sans); }
.ref-title { color: var(--ink); text-decoration-color: var(--rule); }
.ref-venue { font-style: italic; }
.ref-code { color: var(--muted); }
.appendix h3 { margin: 28px 0 10px; font-size: 21px; }
.bibtex {
  margin: 10px 0 0; padding: 15px 18px; overflow-x: auto;
  border-radius: 6px; background: var(--paper-deep);
  color: var(--ink-soft); font: 14px/1.6 var(--mono);
}

/* Interactive figures */
.interactive-figure { margin: 34px 0; }
.demo-panel { padding: 20px 22px; border: 1px solid var(--rule); border-radius: 5px; background: var(--panel); font-family: var(--sans); }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.slider-label { display: inline-flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 600; }
.slider-label output, .gain-summary output { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.slider-label output { min-width: 2.6em; }
input[type="range"] { width: min(100%, 300px); accent-color: var(--accent); cursor: pointer; }
.demo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.demo-actions button:disabled { cursor: default; opacity: .45; }
.schedule-grid { margin: 10px 0 0; overflow-x: auto; scrollbar-width: thin; }
.schedule-row > strong { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
#input-cells, #parallel-cells, #exact-cells { display: grid; grid-template-columns: repeat(8, minmax(54px, 1fr)); gap: 6px; min-width: 480px; }
#mixer-input, #mixer-output { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.signal-cell {
  min-width: 0; padding: 6px 4px 7px; border: 1px solid #d9ddd0; border-radius: 4px;
  background: rgb(31 113 87 / var(--cell-weight, .08)); text-align: center;
  font-size: 13px; line-height: 1.35; font-variant-numeric: tabular-nums;
}
.signal-cell[data-sign="negative"] { border-color: #e4d0c4; background: rgb(173 85 54 / var(--cell-weight, .08)); }
.signal-cell.is-resolved { border-color: var(--transform); box-shadow: inset 0 0 0 1px var(--transform); }
.cell-index { display: block; color: var(--muted); font-size: 11px; }
.signal-cell strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 600; }
#exact-cells.is-highlighted .signal-cell { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.demo-description { min-height: 3.2em; margin: 14px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.demo-equation { margin: 0 0 12px; overflow-x: auto; }
.demo-equation .katex-display { margin: 4px 0; }
.mixer-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 16px 0 12px; }
.mixer-values strong { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.gain-summary { display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); font-size: 15px; }
.js-required { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.has-js .js-required { display: none; }

/* Index page */
.home { max-width: 1000px; margin: 0 auto; padding: 76px 24px 72px; }
.home-intro h1 { max-width: 820px; margin: 0; font: 600 clamp(32px, 4.3vw, 46px)/1.12 var(--display); letter-spacing: -0.02em; text-wrap: balance; }
.index-year {
  margin: 68px 0 22px; padding-bottom: 10px; border-bottom: 1px solid var(--rule);
  color: var(--muted); font: 700 13px/1 var(--sans); letter-spacing: .14em;
}
.post-card-link {
  display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); align-items: center; gap: 36px;
  padding: 22px; border: 1px solid var(--rule); border-radius: 10px; background: var(--panel);
  color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.post-card-link:hover { border-color: #c4c2b8; box-shadow: 0 10px 30px rgba(27, 31, 28, .07); }
.post-index .post-card + .post-card { margin-top: 18px; }
.post-card-art { padding: 10px 4px; border-radius: 6px; background: var(--paper); }
.thumb-svg { display: block; width: 100%; height: auto; }
.thumb-node { fill: #fffefb; stroke: #c4c2b8; stroke-width: 1; }
.thumb-node.is-chain { fill: var(--latent-soft); stroke: var(--latent); }
.thumb-residual { fill: none; stroke: #8b8f8a; stroke-width: 1.2; }
.thumb-slot { fill: var(--transform-soft); stroke: var(--transform); stroke-width: 1; }
.thumb-gather { fill: none; stroke: var(--transform); stroke-width: 1.1; opacity: .7; }
.thumb-latent { fill: none; stroke: var(--latent); stroke-width: 2.2; stroke-linecap: round; }
.post-card-meta { margin: 0 0 8px; color: var(--accent); font: 600 13px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.post-card-title { margin: 0 0 10px; color: var(--ink); font: 600 30px/1.15 var(--display); letter-spacing: -0.015em; }
.post-card-link:hover .post-card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .14em; text-decoration-color: var(--faint); }
.post-card-desc { margin: 0 0 14px; color: var(--ink-soft); font-size: 17.5px; line-height: 1.55; }
.post-card-foot { margin: 0; color: var(--muted); font: 14.5px/1.4 var(--sans); }
.read-arrow { display: inline-block; margin-left: 6px; color: var(--accent); transition: transform .15s; }
.post-card-link:hover .read-arrow { transform: translateX(3px); }

/* Without the contents column */
@media (max-width: 1279px) {
  :root { --margin: 220px; }
  .article {
    grid-template-columns:
      [full-start] minmax(24px, 1fr) [text-start] minmax(0, var(--text)) [text-end] var(--gutter)
      [margin-start] var(--margin) [margin-end] minmax(24px, 1fr) [full-end];
  }
  .toc { display: none; }
  .toc-mobile { display: block; }
  .secnum { position: static; margin-right: .5em; }
}

/* Single column: margin notes and wide figures fold into the text */
@media (max-width: 999px) {
  :root { --gutter: 0px; --margin: 0px; }
  .article {
    grid-template-columns: [full-start] minmax(20px, 1fr) [text-start margin-start] minmax(0, 720px) [text-end margin-end] minmax(20px, 1fr) [full-end];
    padding-top: 44px;
  }
  .margin-note { float: none; width: auto; margin: 0 0 18px; padding: 10px 14px; border-radius: 6px; background: var(--paper-deep); }
  .phase-para::before { left: -11px; }
}

@media (max-width: 640px) {
  body { font-size: 17.5px; }
  .site-header-inner { padding: 15px 18px; }
  .front-matter h1 { font-size: clamp(32px, 9vw, 40px); }
  .subtitle { font-size: 19px; }
  .intro { font-size: 16.5px; }
  .section > h2 { font-size: 27px; }
  .standfirst { font-size: 18.5px; }
  .mechanism-head h3 { font-size: 23px; }
  .rtw-grid { grid-template-columns: 1fr; gap: 12px; }
  .rtw + .rtw::before { content: "↓"; top: -14px; left: 16px; }
  .demo-panel { padding: 16px; }
  .mixer-values { grid-template-columns: 1fr; gap: 6px; }
  .flow-scroll::after {
    content: "Scroll diagram →"; position: sticky; left: 0; display: block; width: 100%;
    padding: 5px 12px 7px; color: var(--muted); background: var(--panel); font: 12px/1.3 var(--sans);
  }
  .table-wrap:has(table:not(.notation-table)) table { min-width: 0; }
  table.booktabs { font-size: 14.5px; }
  .booktabs th, .booktabs td { padding-right: 10px; }
  #input-cells, #parallel-cells, #exact-cells { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; min-width: 0; }
  .signal-cell { padding: 4px 1px 5px; }
  .signal-cell strong { font-size: 12px; }
  .cell-index { font-size: 10px; }
  .display-math .katex-display > .katex { font-size: 1em; }
  .display-math { gap: 8px; }
  .eq-num { font-size: 15px; }
  .home { padding-top: 48px; }
  .post-card-link { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  .post-card-title { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

@media print {
  @page { margin: 0.7in 0.75in; }
  /* Scale the screen sizes uniformly so print keeps their proportions. */
  body { background: #fff; zoom: .76; }
  .site-header, .site-footer, .skip-link, .toc, .toc-mobile, .figure-toolbar,
  .demo-actions, .demo-controls, .heading-anchor, .js-required, .flow-scroll::after { display: none !important; }
  .article { display: block; padding: 0; }
  .front-matter, .lattice-figure, .article-body { max-width: none; }
  .mechanism-figure { width: 100%; }
  .flow-scroll, .lattice-scroll, .demo-panel { border-color: #ccc; }
  .flow-svg, .lattice-svg { min-width: 0; }
  .margin-note { float: none; width: auto; margin: 0 0 8pt; padding: 0; background: none; }
  .secnum { position: static; margin-right: .5em; }
  figure, .equation-block, table, .belief { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* Homepage: drafts sit in their own section below the published posts. */
.post-index-wip { margin-top: 64px; }
.index-note { margin: -6px 0 18px; color: var(--muted); font: 15px/1.5 var(--sans); }
.post-index-wip .post-card { background: var(--paper-deep); }

/* Observation 2: the latent lattice unrolls into one residual sequence. Items are placed by
   custom properties so the move animates; routes fade between the two states. */
.unroll-figure { margin: 22px 0 6px; }
.unroll-figure .unroll-svg { min-width: 540px; max-width: 680px; }
/* More specific than the glossary's .has-tips [data-tip] transition, which would cancel the move. */
.unroll-figure .unroll-item[data-tip] { transform: translate(var(--lx), var(--ly)); transition: transform .85s cubic-bezier(.65, 0, .35, 1) var(--d); }
.unroll-figure[data-state="unrolled"] .unroll-item[data-tip] { transform: translate(var(--ux), var(--uy)); }
.unroll-routes { transition: opacity .3s; }
.unroll-routes.is-row { opacity: 0; pointer-events: none; }
.unroll-figure[data-state="unrolled"] .unroll-routes.is-lattice { opacity: 0; pointer-events: none; }
.unroll-figure[data-state="unrolled"] .unroll-routes.is-row { opacity: 1; pointer-events: auto; transition-delay: 1.35s; }
@media (prefers-reduced-motion: reduce) {
  .unroll-figure .unroll-item[data-tip], .unroll-routes { transition: none !important; }
}
