/* ==========================================================================
   Synchro project page. Same system as the blog template: one sans family,
   white paper, a grey ink ramp, one blue accent, light-blue pills.
   Layout: a 180px contents rail on the left and a 720px column. Every figure,
   video, table and block is exactly the column width.
   Blocks instead of lines:  blue = a finding,  grey = a note or details.
   Videos keep their original frame (640 × 368, or the clip's own size):
   nothing is cropped, nothing needs a click to be seen whole.
   ========================================================================== */

:root {
  --paper: #ffffff;
  --paper-2: #f8f9fa;
  --paper-3: #f1f3f4;
  --ink: #202124;
  --ink-2: #3c4043;
  --ink-3: #5f6368;
  --ink-4: #9aa0a6;
  --rule: #dadce0;
  --rule-2: #e8eaed;
  --accent: #1a73e8;
  --accent-hover: #1967d2;
  --accent-soft: rgba(26, 115, 232, 0.08);
  --link-line: rgba(26, 115, 232, 0.35);
  --pill: #d3e3fd;
  --pill-hover: #c2d7fb;
  --pill-ink: #041e49;
  --tint: #e8f0fe;
  --tint-ink: #0b57d0;
  --grey-block: #f3f4f6;
  --deep: #202124;
  --deep-ink: #e8eaed;
  --deep-muted: #9aa0a6;
  --shadow: 0 6px 18px rgba(32, 33, 36, 0.14);

  --font-sans: 'Hanken Grotesk', 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --max: 1180px;
  --col: 720px;
  --rail: 180px;
  --gutter: clamp(20px, 4vw, 56px);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body {
  font-family: var(--font-sans); background: var(--paper); color: var(--ink);
  font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
main { flex: 1 0 auto; }
a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, figure { margin: 0; }
::selection { background: var(--pill-hover); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 600; }
.skip:focus { top: 12px; }

/* Text links: ink on a light-blue underline, blue on hover */
.prose a, .ar-authors a, figcaption a {
  color: var(--ink); border-bottom: 1px solid var(--link-line); padding: 0 1px; transition: color .15s, border-color .15s;
}
.prose a:hover, .ar-authors a:hover, figcaption a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.ar-authors a { color: inherit; }

/* ---------- Top bar ---------- */
.topbar { position: relative; background: var(--paper); border-bottom: 1px solid var(--rule-2); z-index: 30; }
.topbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 26px; height: 26px; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav a { padding: 6px 0; font-weight: 500; border-bottom: 2px solid transparent; transition: color .15s; }
.nav a:hover { color: var(--accent); }
.nav a.nav-cta {
  display: inline-flex; align-items: center; gap: 7px; margin-left: 4px; padding: 7px 14px 7px 12px; border: 0; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink); font-size: 15px; font-weight: 600; transition: background .15s;
}
.nav a.nav-cta:hover { background: var(--pill-hover); color: var(--pill-ink); }
.nav-cta svg { width: 15px; height: 15px; }
.nav-toggle { display: none; width: 40px; height: 40px; margin-right: -8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; place-items: center; }
.nav-toggle:hover { background: var(--paper-3); }
.nav-toggle svg { width: 22px; height: 22px; }

/* ---------- Article frame ---------- */
.ar-page {
  max-width: var(--max); margin: 0 auto; padding: 44px var(--gutter) 0;
  display: grid; grid-template-columns: var(--rail) minmax(0, var(--col)); justify-content: center;
  column-gap: clamp(32px, 4.5vw, 64px);
}
.ar-head { grid-column: 2; }
.ar-toc { grid-column: 1; grid-row: 2; position: sticky; top: 24px; align-self: start; padding-top: 48px; }
.ar-main { grid-column: 2; grid-row: 2; min-width: 0; padding-top: 36px; }

.ar-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 26px; font-size: 14px; color: var(--ink-3); }
.ar-crumb b { font-weight: 600; color: var(--ink); }
.ar-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag { padding: 1px 9px; border-radius: 999px; background: var(--paper-3); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.ar-head h1 { margin-bottom: 20px; font-size: clamp(30px, 3.4vw, 40px); line-height: 1.15; font-weight: 600; letter-spacing: -0.012em; text-wrap: balance; }
.ar-standfirst { margin: 0 0 22px; font-size: 19px; line-height: 1.55; color: var(--ink-2); text-align: justify; hyphens: auto; -webkit-hyphens: auto; }

/* Meta row: date · reading time · institutions */
.ar-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 0; font-size: 14.5px; color: var(--ink); }
.ar-meta > div { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ar-meta > div + div::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-4); margin: 0 14px; }
.ar-meta .k { color: var(--ink-3); }
.ar-meta .v { font-weight: 600; }

/* Paper block: authors, affiliations, links — a quiet grey panel */
.ar-paper { margin-top: 22px; padding: 16px 20px 18px; border-radius: 12px; background: var(--paper-2); }
.ar-paper-k { font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.ar-authors { font-size: 15.5px; line-height: 1.65; color: var(--ink-2); }
.ar-authors sup, .ar-affil sup { font-size: 0.72em; line-height: 0; margin-left: 1px; color: var(--ink-3); }
.ar-affil { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 4px; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }
.ar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 15px 6px 12px; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink); font-size: 14.5px; font-weight: 600; transition: background .15s;
}
.pill-btn:hover { background: var(--pill-hover); }
.pill-btn svg { width: 15px; height: 15px; }
.pill-btn.soon { background: var(--paper-3); color: var(--ink-3); cursor: default; }

/* ---------- Contents rail ---------- */
.ar-toc h3 { margin-bottom: 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
.ar-toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule-2); }
.ar-toc a {
  display: block; margin-left: -1px; padding: 5px 14px; border-left: 2px solid transparent;
  font-size: 14px; line-height: 1.35; color: var(--ink-3); transition: color .15s;
}
.ar-toc a:hover { color: var(--ink); }
.ar-toc a.active { border-left-color: var(--accent); color: var(--ink); font-weight: 500; }

/* ---------- Running text ---------- */
.ar-main > :first-child { margin-top: 0; }
.ar-main h2 { margin: 72px 0 16px; font-size: 28px; line-height: 1.22; font-weight: 600; letter-spacing: -0.01em; scroll-margin-top: 24px; }
.ar-main h3 { margin: 40px 0 10px; font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; scroll-margin-top: 24px; }
.ar-main p, .ar-main li { font-size: 17px; line-height: 1.68; color: var(--ink-2); }
.ar-main p { margin-bottom: 20px; text-align: justify; hyphens: auto; -webkit-hyphens: auto; text-wrap: pretty; }
.ar-main ul, .ar-main ol { margin: 0 0 20px; padding-left: 1.35em; }
.ar-main li { margin-bottom: 8px; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.ar-main li::marker { color: var(--ink-4); }
.ar-main strong, .ar-main p b, .ar-main li b { font-weight: 600; color: var(--ink); }
.ar-main sup, .ar-main sub { font-size: .72em; line-height: 0; }
.ar-main p.fine { font-size: 14px; color: var(--ink-3); margin-top: 14px; text-align: left; }

/* Display equation: a quiet grey panel, same family */
.eq { margin: 28px 0 10px; padding: 16px 20px; border-radius: 12px; background: var(--paper-2); overflow-x: auto; text-align: center; white-space: nowrap; font-size: 19px; line-height: 1.5; color: var(--ink); }
.eq i { font-style: italic; }
.eq b { font-weight: 700; }
.eq sub, .eq sup { font-size: .64em; line-height: 0; }
.eq .op { padding: 0 .28em; color: var(--ink-3); }
.eq .big { font-size: 1.3em; vertical-align: -0.1em; padding: 0 .08em; }
.ar-main p.eq-gloss { margin: 0 0 24px; font-size: 14.5px; line-height: 1.6; color: var(--ink-3); text-align: center; hyphens: manual; -webkit-hyphens: manual; }

/* ---------- Blocks: blue finding, grey note, grey fold ---------- */
.callout { margin: 28px 0; padding: 16px 20px 17px; border-radius: 12px; }
.callout.key { background: var(--tint); }
.callout.note { background: var(--grey-block); }
.callout-label { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.callout.key .callout-label { color: var(--tint-ink); }
.callout.note .callout-label { color: var(--ink-3); }
.callout-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ar-main .callout p { margin: 0; font-size: 16px; line-height: 1.62; color: var(--ink); }
.ar-main .callout.note p { color: var(--ink-2); }
.ar-main .callout p + p { margin-top: 10px; }
.ar-main .callout ul { margin: 6px 0 0; }
.ar-main .callout li { font-size: 16px; line-height: 1.62; color: var(--ink-2); margin-bottom: 4px; }

.tldr { margin-top: 32px; }
.tldr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin-top: 8px; }
.tldr-grid > div { display: grid; gap: 2px; align-content: start; }
.tldr-grid b { font-size: 22px; line-height: 1.2; font-weight: 700; color: var(--tint-ink); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tldr-grid span { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.tldr-grid b span { font-size: inherit; line-height: inherit; color: inherit; }  /* a headline's language spans keep the headline's size and colour */

details.fold { margin: 0 0 24px; border-radius: 12px; background: var(--grey-block); }
details.fold > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; cursor: pointer; list-style: none;
  font-size: 15px; font-weight: 600; color: var(--ink-2); border-radius: 12px; transition: color .15s, background .15s;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: ""; width: 7px; height: 7px; margin: -2px 2px 0 0; flex: none;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform .15s;
}
details.fold[open] > summary::before { transform: rotate(45deg); margin-top: -5px; }
details.fold > summary:hover { color: var(--accent); }
details.fold > summary::after { content: "Show"; margin-left: auto; font-size: 13px; font-weight: 500; color: var(--ink-3); }
details.fold[open] > summary::after { content: "Hide"; }
details.fold > :not(summary) { margin-left: 18px; margin-right: 18px; }
details.fold > :last-child { padding-bottom: 16px; margin-bottom: 0; }
.ar-main details.fold p, .ar-main details.fold li { font-size: 15.5px; line-height: 1.62; }
.ar-main details.fold p { margin-bottom: 12px; }
.ar-main details.fold ul { margin-bottom: 0; }
details.fold .table-wrap { margin: 4px 18px 14px; }
details.fold .table-wrap + p.table-cap { margin: -6px 18px 0; padding-bottom: 16px; }

/* ---------- Figures: column width, no frames ---------- */
figure { margin: 36px 0; }
figure > img { width: 100%; height: auto; }
img[data-zoom] { cursor: zoom-in; }
figcaption, .table-cap, .lead-cap { margin-top: 12px; font-size: 14.5px; line-height: 1.6; color: var(--ink-3); }
.ar-main p.table-cap, .ar-main p.lead-cap { font-size: 14.5px; line-height: 1.6; color: var(--ink-3); text-align: left; margin-bottom: 0; hyphens: manual; -webkit-hyphens: manual; }
figcaption b, .table-cap b, .lead-cap b { font-weight: 600; color: var(--ink); }
.chart { width: 100%; position: relative; }
.chart svg { overflow: visible; }
.panel-title { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.panel-sub { font-weight: 500; color: var(--ink-4); }
.two-up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; }
.three-up { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }

/* SVG type: the same family everywhere */
.t-mono { font-family: var(--font-sans); font-size: 12px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.t-mono-s { font-family: var(--font-sans); font-size: 11.5px; fill: var(--ink-4); font-variant-numeric: tabular-nums; }
.t-sans { font-family: var(--font-sans); font-size: 13.5px; fill: var(--ink-2); }
.t-sans-b { font-family: var(--font-sans); font-size: 13.5px; font-weight: 600; fill: var(--ink); }
.t-cell { font-family: var(--font-sans); font-size: 11px; font-weight: 600; fill: var(--ink-3); font-variant-numeric: tabular-nums; pointer-events: none; }
.t-acc { fill: var(--accent) !important; }
.t-ink { fill: var(--ink) !important; }
.t-white { fill: #fff !important; }

/* Legends and small controls */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 12px; font-size: 13.5px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.lg { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-now { background: var(--accent); }
.lg-read { background: #a8c7fa; }
.lg-mem { background: #d7dbe0; }
.lg-given { background: #80868b; }
.lg-base { background: var(--ink-4); border-radius: 50%; }
.lg-ours { background: var(--accent); border-radius: 50%; }
.chip-link {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); cursor: pointer;
  font-size: 13.5px; font-weight: 500; line-height: 1.5; color: var(--ink-2); transition: background .15s, border-color .15s, color .15s;
}
.chip-link:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip-link.small { padding: 2px 10px; font-size: 13px; }
.legend .chip-link { margin-left: auto; }
.readout { display: flex; gap: 10px; align-items: baseline; margin-top: 8px; font-size: 14.5px; color: var(--ink-2); min-height: 24px; }
.readout b { font-weight: 600; color: var(--accent); white-space: nowrap; }

/* Segmented control */
.fig-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 14px; }
.seg { flex: 0 1 auto; max-width: 100%; display: inline-flex; flex-wrap: wrap; padding: 3px; border-radius: 999px; background: var(--paper-3); }
.seg button { border: 0; background: none; padding: 4px 13px; border-radius: 999px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-3); transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(32,33,36,.15); }

/* Cards: operators and training stages */
.ops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 8px 0 28px; }
.ops.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.op { padding: 14px 16px 16px; border-radius: 12px; background: var(--paper-2); }
.op.hl { background: var(--tint); }
.op-tag { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.op.hl .op-tag { color: var(--tint-ink); }
.op h4 { font-size: 16px; line-height: 1.3; font-weight: 600; margin: 8px 0 6px; color: var(--ink); }
.ar-main .op p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-3); text-align: left; hyphens: manual; -webkit-hyphens: manual; }

/* ---------- Interactive grids (orders, memory) ---------- */
.vt-grid { min-height: 100px; }
.vt-grid .hit { cursor: pointer; }

/* ---------- Video figures ---------- */
.vgrid { display: grid; gap: 8px; }
.vgrid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vgrid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vgrid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vgrid.g1 { grid-template-columns: minmax(0, 1fr); }
.vt { position: relative; min-width: 0; }
.vt video, .vt > img { width: 100%; height: auto; aspect-ratio: 640 / 368; border-radius: 6px; background: var(--paper-3); }
.vt.tall video { aspect-ratio: 640 / 740; }
.vt.strip video { aspect-ratio: 2572 / 368; border-radius: 4px; }
.vt.pano > img { aspect-ratio: 960 / 160; }
.vt-name { margin-top: 6px; font-size: 13.5px; font-weight: 600; color: var(--ink-3); line-height: 1.35; }
.vt-name .sub { font-weight: 500; color: var(--ink-4); margin-left: 4px; }
.vt.is-ours .vt-name { color: var(--accent); }
.vt.is-ours video { box-shadow: 0 0 0 2px var(--accent); }
.strip-rows { display: grid; gap: 10px; }
.strip-rows .vt-name { margin: 0 0 4px; }
.vrow-k { margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.vrow-k:first-child { margin-top: 0; }

.thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.thumbs.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.thumbs.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.thumbs button { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 4px; overflow: hidden; opacity: .55; transition: opacity .15s, box-shadow .15s; text-align: left; }
.thumbs button:hover { opacity: .85; }
.thumbs button[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.thumbs img { width: 100%; height: auto; aspect-ratio: 640 / 368; background: var(--paper-3); }
.ar-main p.vdesc { margin: 12px 0 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); text-align: left; hyphens: manual; -webkit-hyphens: manual; }
.vbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 13.5px; color: var(--ink-3); }
.vbar .chip-link { flex: none; }

/* ---------- Tables: column width, no row rules ---------- */
.table-wrap { margin: 28px 0 0; overflow-x: auto; }
.ar-main table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; }
.ar-main th { padding: 7px 8px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.ar-main thead tr:last-child th { border-bottom: 1px solid var(--rule); }
.ar-main td { padding: 8px 8px; color: var(--ink-2); white-space: nowrap; }
.ar-main th:first-child, .ar-main td:first-child { padding-left: 12px; }
.ar-main th:last-child, .ar-main td:last-child { padding-right: 12px; }
.ar-main .num { text-align: right; }
.ar-main tbody tr:nth-child(even) td { background: var(--paper-2); }
.ar-main td.best { font-weight: 600; color: var(--ink); }
.ar-main tr.grp th { color: var(--ink-4); font-weight: 500; padding-bottom: 0; }
.ar-main tr.grp th.c { text-align: center; }
.ar-main tr.ours td { background: var(--tint) !important; color: var(--tint-ink); font-weight: 600; }
.ar-main tr.ours td:first-child { border-radius: 8px 0 0 8px; }
.ar-main tr.ours td:last-child { border-radius: 0 8px 8px 0; }
details.fold table tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .6); }

/* ---------- Citation ---------- */
.bibtex { position: relative; border-radius: 12px; background: var(--paper-2); }
.bibtex pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.65; color: var(--ink-2); white-space: pre; }
.bibtex .chip-link { position: absolute; top: 10px; right: 10px; }
.ar-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 64px; font-size: 15px; font-weight: 500; }
.prose .ar-foot a { padding: 0; border-bottom: 0; color: var(--accent); }
.prose .ar-foot a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */
.foot { margin-top: 112px; padding: 48px 0 40px; background: var(--deep); color: var(--deep-ink); font-size: 15px; }
.foot-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 16px 24px; }
.foot-brand { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.foot-sub { color: var(--deep-muted); }
.foot-meta { color: var(--deep-muted); text-align: right; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(32,33,36,.58); animation: lbIn .18s ease-out; }
@keyframes lbIn { from { opacity: 0; } }
.lb-card { position: relative; max-width: min(1320px, 100%); max-height: 100%; display: grid; border-radius: 16px; overflow: hidden; background: var(--paper); box-shadow: 0 24px 64px rgba(32,33,36,.3); }
.lb-card img { max-width: 100%; max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); width: auto; height: auto; margin: 0 auto; object-fit: contain; }
.lb-foot { display: flex; align-items: center; gap: 12px; padding: 10px 14px; font-size: 14px; color: var(--ink-2); }
.lb-cap { flex: 1; text-align: center; }
.lb-nav { width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--paper-3); cursor: pointer; font-size: 16px; }
.lb-nav:hover { background: var(--tint); color: var(--accent); }
.lb-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.94); box-shadow: var(--shadow); cursor: pointer; }
.lb-close:hover { background: var(--paper-3); }

/* ---------- Lead animation (TokenField) ---------- */
.tf { margin: 0 0 14px; }
.tf-stage { border-radius: 16px; background: var(--paper-2); overflow: hidden; }
.tf-cap { display: grid; gap: 3px; align-content: start; min-height: 80px; padding: 18px 22px 0; }
.tf-step { font-size: 12.5px; font-weight: 700; letter-spacing: .02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.tf-text { font-size: 17.5px; line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; color: var(--ink); transition: opacity .25s ease, transform .25s ease; }
.tf-text.out { opacity: 0; transform: translateY(4px); }
.tf canvas { display: block; width: 100%; }
.tf-bar { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; align-items: start; padding: 4px 22px 16px; }
.tf-play { width: 30px; height: 30px; margin-top: 1px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--pill); color: var(--pill-ink); cursor: pointer; transition: background .15s; }
.tf-play:hover { background: var(--pill-hover); }
.tf-play .i-pause { display: none; }
.tf-play.on .i-play { display: none; }
.tf-play.on .i-pause { display: inline; }
.tf-chapters { display: grid; gap: 6px; }
.tf-ch { min-width: 0; padding: 6px 0 0; border: 0; background: none; text-align: left; cursor: pointer; }
.tf-ch .tr { display: block; height: 3px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.tf-ch .tr i { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--accent); }
.tf-ch .lb { display: block; margin-top: 7px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color .15s; }
.tf-ch.on .lb { color: var(--ink); font-weight: 600; }
.tf-ch:hover .lb { color: var(--accent); }

/* ---------- Language ---------- */
html[data-lang="en"] [data-l="zh"], html[data-lang="zh"] [data-l="en"] { display: none !important; }
.lang-switch { margin-left: auto; display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-3); }
.lang-switch button { padding: 3px 12px; border: 0; border-radius: 999px; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-3); transition: background .15s, color .15s; }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(32, 33, 36, .15); }
html[data-lang="zh"] .ar-main p, html[data-lang="zh"] .ar-main li { line-height: 1.85; }
html[data-lang="zh"] .ar-standfirst { line-height: 1.7; }
html[data-lang="zh"] .ar-head h1 { letter-spacing: 0; word-break: keep-all; }
html[data-lang="zh"] details.fold > summary::after { content: "展开"; }
html[data-lang="zh"] details.fold[open] > summary::after { content: "收起"; }

/* ---------- Reveal ---------- */
.js .rv { opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .6s ease; }
.js .rv.in { opacity: 1; transform: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1040px) {
  .ar-page { grid-template-columns: minmax(0, var(--col)); }
  .ar-head, .ar-main { grid-column: 1; }
  .ar-main { grid-row: auto; }
  .ar-toc { display: none; }
}

@media (max-width: 820px) {
  .nav-toggle { display: grid; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 72px; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px var(--gutter) 20px; background: var(--paper); border-bottom: 1px solid var(--rule-2); box-shadow: 0 12px 24px rgba(32,33,36,.08);
  }
  .topbar.open .nav { display: flex; }
  .nav a { padding: 9px 0; font-size: 17px; }
  .nav a.nav-cta { margin: 10px 0 0; padding: 9px 16px 9px 14px; }
}

@media (max-width: 680px) {
  .ar-main p, .ar-main li { font-size: 16.5px; }
  .ar-main h2 { margin-top: 56px; font-size: 24px; }
  .ar-main h3 { font-size: 19px; }
  .ar-standfirst { font-size: 17.5px; }
  .two-up, .three-up { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .ops, .ops.two { grid-template-columns: minmax(0, 1fr); }
  .vgrid.g4.tall-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .thumbs.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .eq { font-size: 16.5px; }
  .seg { border-radius: 16px; }
  .seg button { padding: 4px 11px; font-size: 13.5px; }
  .bibtex .chip-link { position: static; margin: 12px 0 0 16px; }
}

@media (max-width: 560px) {
  .tf-cap { min-height: 72px; padding: 14px 16px 0; }
  .tf-text { font-size: 15.5px; }
  .tf-bar { gap: 10px; padding: 2px 16px 12px; }
  .tf-ch { padding-top: 13px; }
  .tf-ch .lb { display: none; }
  /* Justified lines this short open wide gaps between words */
  .ar-main p, .ar-main li, .ar-standfirst { text-align: start; hyphens: manual; -webkit-hyphens: manual; }
  html[data-lang="zh"] .ar-main p, html[data-lang="zh"] .ar-main li { text-align: justify; }
  .tldr-grid { grid-template-columns: 1fr; gap: 10px; }
  .ar-meta { gap: 8px 18px; }
  .ar-meta > div + div::before { display: none; }
  .vgrid { gap: 6px; }
  .vt-name { font-size: 12px; }
  .foot { margin-top: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rv { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* link back to the video gallery, in place of the old crumb text */
.crumb-back { color: var(--accent); font-weight: 600; }
.crumb-back:hover { color: var(--accent-hover); }
