/* LMSysDojo project page: the design system.
 * One palette with the paper (asset/style.tex): theme blue #007FFF, shallow blue #5CA8FF, shallow-blue panels #E6F0FA,
 * black #1E2024, grays #52555C / #666 / #A8ACB8, and the figure accents violet (measurement, gap analysis), aqua
 * (evidence E) and orange (assumption A). Type is Google Sans Flex and Google Sans Code, the faces of the paper's figures.
 * Light is the default (white like the paper); dark is a toggle. Component styles live in their own files; everything
 * shared (tokens, layout, nav, cards, tables, code, charts, reveal) lives here. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-soft: #F7F8FA;
  --panel: #F3F4F6;
  --panel-2: #ECEEF2;
  --panel-blue: #E6F0FA;
  --ink: #1E2024;
  --ink-2: #52555C;
  --ink-3: #686C75;
  --ink-4: #A8ACB8;
  --line: #E4E6EB;
  --line-2: #D3D6DD;
  --blue: #007FFF;
  --blue-ink: #0066D6;          /* blue for small text on white: 5.4:1 */
  --blue-2: #5CA8FF;
  --blue-3: #A9CFFF;
  --blue-bg: #E6F0FA;
  --blue-deep: #0B4FA8;
  --violet: #7B4FC9;
  --violet-2: #C7B5EC;
  --violet-bg: #F0EAFA;
  --aqua: #1BAF7A;
  --aqua-ink: #0E7F57;
  --aqua-bg: #E2F5EC;
  --orange: #EB6834;
  --orange-ink: #B8461A;
  --orange-bg: #FCEDE5;
  --block: #1E2024;             /* the figures' black "Implement" blocks */
  --on-block: #FFFFFF;
  --on-blue: #FFFFFF;
  --blue-fill: #0066D6;          /* blue behind small white text: 5.4:1 */
  --dot: rgba(30, 32, 36, .10);
  --scrim: rgba(255, 255, 255, .78);
  --nav-bg: rgba(255, 255, 255, .74);
  --grain-opacity: .045;
  --grain-blend: normal;          /* a blended layer would make the compositor re-blend every animated frame */

  /* chart series: the paper's plot palette */
  --s-vanilla: #5CA8FF;
  --s-ranker: #5CA8FF;
  --s-gap: #7B4FC9;
  --s-structured: #1E2024;
  --s-iterative: #007FFF;
  --s-expert: #A8ACB8;
  --s-muted: #C9CCD3;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 10px 30px -12px rgba(16, 32, 64, .16);
  --shadow-lg: 0 30px 80px -28px rgba(10, 40, 90, .24);
  --ring: 0 0 0 3px color-mix(in srgb, var(--blue) 28%, transparent);

  --sans: "Google Sans Flex", "Google Sans", "Google Sans Text", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Google Sans Code", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --rad-xs: 6px;
  --rad-sm: 10px;
  --rad: 16px;
  --rad-lg: 22px;
  --nav-h: 60px;
  --wrap: 1180px;
  --gutter: 32px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0D11;
  --bg-soft: #0F1217;
  --panel: #151920;
  --panel-2: #1B2029;
  --panel-blue: #0E1F35;
  --ink: #F1F3F6;
  --ink-2: #C5CAD3;
  --ink-3: #9AA1AD;
  --ink-4: #5D6472;
  --line: #222832;
  --line-2: #2D3440;
  --blue: #3B9AFF;
  --blue-ink: #6DB5FF;
  --blue-2: #7DBAFF;
  --blue-3: #2B5C99;
  --blue-bg: #0E1F35;
  --blue-deep: #A9D0FF;
  --violet: #A283EC;
  --violet-2: #5B4592;
  --violet-bg: #1E1730;
  --aqua: #37C997;
  --aqua-ink: #5FDDB0;
  --aqua-bg: #0F2A21;
  --orange: #F48A5C;
  --orange-ink: #FFAA85;
  --orange-bg: #2E1A12;
  --block: #F1F3F6;
  --on-block: #0B0D11;
  --on-blue: #FFFFFF;
  --blue-fill: #1570E0;          /* 4.7:1 under white text */
  --dot: rgba(220, 228, 240, .09);
  --scrim: rgba(11, 13, 17, .74);
  --nav-bg: rgba(11, 13, 17, .72);
  --grain-opacity: .06;
  --grain-blend: normal;

  --s-vanilla: #7DBAFF;
  --s-ranker: #7DBAFF;
  --s-gap: #A283EC;
  --s-structured: #E8EAEE;
  --s-iterative: #3B9AFF;
  --s-expert: #6B7280;
  --s-muted: #3A414D;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -28px rgba(0, 0, 0, .75);
}

/* ------------------------------------------------------------------ reset + base */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
/* film grain over everything: the paper-like texture that keeps flat fills from looking digital */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1.2 -.1'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}
img, video, svg, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: var(--blue-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--blue); }
p { margin: 0 0 1em; }
b, strong { font-weight: 620; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.18; letter-spacing: -.022em; font-weight: 560; text-wrap: balance; }
code, kbd, .mono { font-family: var(--mono); font-feature-settings: "calt" 0; }
code { font-size: .86em; background: var(--panel); padding: .12em .42em; border-radius: 6px; }
:not(pre) > code { white-space: nowrap; }
sup { font-size: .62em; line-height: 0; }
::selection { background: color-mix(in srgb, var(--blue) 22%, transparent); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
a:focus-visible:not([class]) { border-radius: 6px; }
/* sections and main receive focus after an in-page jump; a 5,000 px ring would read as a glitch */
section[tabindex="-1"]:focus, main[tabindex="-1"]:focus, header[tabindex="-1"]:focus { outline: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 200; padding: 10px 16px; border-radius: 999px; background: var(--block); color: var(--on-block); text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; }
html:not(.js) [data-copy], html:not(.js) [data-theme-toggle], html:not(.js) .zoom-btn { display: none; }
html:not(.js) nav.top { background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); border-bottom-color: var(--line); }

/* ------------------------------------------------------------------ layout */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { max-width: 1360px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }
section.sec { position: relative; padding: 136px 0 120px; }
section.sec + section.sec { border-top: 1px solid var(--line); }
.sec-soft { background: var(--bg-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; align-items: center; }
.split.rev { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.stack > * + * { margin-top: 16px; }
@media (max-width: 1080px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.rev { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 760px) {
  :root { --gutter: 20px; --nav-h: 56px; }
  body { font-size: 16px; }
  section.sec { padding: 88px 0 80px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ type roles */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase;
  color: var(--blue-ink); margin: 0 0 18px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .6; }
.sec-head { max-width: 860px; margin-bottom: 56px; }
.sec-head h2 { font-size: clamp(34px, 4.4vw, 54px); font-weight: 540; letter-spacing: -.032em; line-height: 1.06; }
.sec-head h2 .sec-no {
  display: block; margin-bottom: 18px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--blue-ink);
}
.sec-head h2 em { font-style: normal; color: var(--blue); }
.lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.6; color: var(--ink-2); margin: 22px 0 0; max-width: 760px; }
.lede b { color: var(--ink); font-weight: 600; }
h3.sub { font-size: clamp(22px, 2.2vw, 28px); font-weight: 560; letter-spacing: -.02em; margin: 96px 0 12px; }
h3.sub + .sub-lede { color: var(--ink-2); max-width: 720px; margin: 0 0 28px; }
h4.card-title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; }
.cap, figcaption { font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.blue { color: var(--blue); }
.num { font-variant-numeric: tabular-nums; }
.kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }

/* ------------------------------------------------------------------ nav */
nav.top {
  position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--nav-h);
  background: transparent; border-bottom: 1px solid transparent;
  transition: background-color .35s var(--ease), border-color .35s var(--ease), backdrop-filter .35s;
}
nav.top.scrolled {
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom-color: var(--line);
}
nav.top .row { height: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; max-width: 1440px; margin: 0 auto; padding: 0 24px; }
.brand { justify-self: start; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16.5px; letter-spacing: -.01em; }
.brand b { color: var(--blue); font-weight: 600; }
.brand-mark { width: 26px; height: 26px; flex: none; }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a, .nav-links span.lnk {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--ink); background: var(--panel); }
.nav-links a.on { color: var(--ink); }
.nav-links a.on::after { content: ""; position: absolute; left: 13px; right: 13px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--blue); }
.nav-tools { justify-self: end; display: flex; align-items: center; gap: 10px; }
/* the two pages, Overview and Playgrounds, as a pill switch beside the brand */
.nav-left { justify-self: start; display: flex; align-items: center; gap: 14px; min-width: 0; }
.nav-tabs { display: inline-flex; flex: none; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.nav-tabs a {
  padding: 5px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 550; color: var(--ink-3); text-decoration: none;
  white-space: nowrap; transition: color .2s, background-color .2s, box-shadow .2s;
}
.nav-tabs a:hover { color: var(--ink); }
.nav-tabs a[aria-current="page"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .nav-tabs a[aria-current="page"] { background: var(--panel-2); box-shadow: 0 0 0 1px var(--line-2); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2);
  transition: color .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 17px; height: 17px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (max-width: 1180px) { .nav-links .opt { display: none; } }
@media (max-width: 1000px) { .nav-left .brand > span { display: none; } }
/* below 920 px the links no longer fit between the page tabs and the tools: they become a strip that scrolls sideways,
   centred while it fits (the auto margins) */
@media (max-width: 920px) {
  nav.top .row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .nav-links {
    justify-content: flex-start; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > :first-child { margin-left: auto; }
  .nav-links > :last-child { margin-right: auto; }
  .nav-links .opt { display: inline-flex; }
}
@media (max-width: 680px) {
  nav.top .row { gap: 8px; padding: 0 12px; }
  .brand > span { display: none; }
  .nav-links a, .nav-links span.lnk { padding: 7px 10px; font-size: 14px; }
  .nav-tools .btn { display: none; }
  /* phones keep only the way to the other page */
  .nav-tabs a { padding: 4px 11px; font-size: 13px; color: var(--ink-2); }
  .nav-tabs a[aria-current="page"] { display: none; }
  .nav-tabs a:first-child::before { content: "← "; }
  .nav-tabs a:last-child::after { content: " →"; }
}

/* side rail: the section index, shown once the reader is past the hero */
.rail {
  position: fixed; left: 22px; top: 50%; z-index: 50; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px; padding: 10px 8px;
  border-radius: 16px; background: var(--nav-bg); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .4s var(--ease), transform .4s var(--ease), visibility 0s linear .4s;
}
.rail.show { opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.rail a {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px;
  font-size: 13px; color: var(--ink-3); text-decoration: none; white-space: nowrap;
}
.rail a b { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink-3); width: 18px; }
.rail a span { max-width: 0; overflow: hidden; opacity: 0; transition: max-width .35s var(--ease), opacity .25s; }
.rail:hover a span, .rail:focus-within a span { max-width: 140px; opacity: 1; }
.rail a.on { color: var(--ink); background: var(--panel); }
.rail a.on b { color: var(--blue); }
@media (max-width: 1360px) { .rail { display: none; } }

/* ------------------------------------------------------------------ buttons, chips, tags */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink);
  font-size: 15px; font-weight: 550; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .2s, background-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink-4); box-shadow: var(--shadow-sm); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--blue-fill); color: var(--on-blue); border-color: transparent; box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--blue) 70%, transparent); }
.btn-primary:hover { border-color: transparent; box-shadow: 0 10px 26px -8px color-mix(in srgb, var(--blue) 80%, transparent); }
.btn-dark { background: var(--block); color: var(--on-block); border-color: transparent; }
.btn-sm { padding: 7px 14px; font-size: 13.5px; }
.btn.is-soon { color: var(--ink-3); cursor: default; }
.btn.is-soon:hover { transform: none; box-shadow: none; border-color: var(--line-2); }
.soon {
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-3); line-height: 1.4;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--bg); color: var(--ink-2);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--ink-4); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--block); border-color: var(--block); color: var(--on-block); }
.chip .n { font-family: var(--mono); font-size: 11.5px; opacity: .7; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: var(--panel); color: var(--ink-2); line-height: 1.5;
}
.tag.blue { background: var(--blue-bg); color: var(--blue-ink); }
.tag.violet { background: var(--violet-bg); color: var(--violet); }
.tag.aqua { background: var(--aqua-bg); color: var(--aqua-ink); }
.tag.orange { background: var(--orange-bg); color: var(--orange-ink); }
.tag.dark { background: var(--block); color: var(--on-block); }
/* the single style for SCHEMATIC / ILLUSTRATIVE notes on drawings that are not data */
.tag-note {
  display: inline-flex; align-items: center; font-family: var(--mono); font-size: 10.5px; font-weight: 600; line-height: 1;
  letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border: 1px dashed var(--line-2); border-radius: 999px;
  color: var(--ink-3); background: transparent; white-space: nowrap;
}
/* opens the paper's own figure in the lightbox, next to the interactive version */
.paper-figs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 14px 0 0; font-size: 13.5px; color: var(--ink-3); }
.paper-fig {
  display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; cursor: zoom-in;
  font: inherit; font-weight: 550; color: var(--blue-ink); text-decoration: underline; text-decoration-color: transparent;
  text-underline-offset: 3px; transition: text-decoration-color .2s;
}
.paper-fig:hover { text-decoration-color: currentColor; }
/* the way from the overview's corpus numbers to the Playgrounds tab */
.paper-figs .pg-browse { margin-left: auto; font-weight: 550; text-decoration-color: transparent; transition: text-decoration-color .2s; }
.paper-figs .pg-browse:hover { text-decoration-color: currentColor; }
/* the figures' numbered blue circles */
.nb {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--blue-fill); color: var(--on-blue); font-family: var(--mono); font-size: 12px; font-weight: 600; flex: none;
}
.nb.gray { background: var(--ink-4); }
.nb.dark { background: var(--block); color: var(--on-block); }

/* ------------------------------------------------------------------ cards, boxes */
.card { position: relative; background: var(--panel); border-radius: var(--rad-lg); padding: 28px; }
.card-line { position: relative; background: var(--bg); border: 1px solid var(--line); border-radius: var(--rad-lg); padding: 28px; }
.card-blue { position: relative; background: var(--panel-blue); border-radius: var(--rad-lg); padding: 28px; }
.card-dashed { position: relative; border: 2px dashed color-mix(in srgb, var(--blue) 70%, transparent); border-radius: var(--rad-lg); padding: 26px; }
.card-block { position: relative; background: var(--block); color: var(--on-block); border-radius: var(--rad-lg); padding: 28px; }
.box h4 { display: flex; align-items: baseline; gap: 10px; font-size: 18px; font-weight: 600; margin: 0 0 10px; }
.box h4 .idx { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--blue-ink); }
.box p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; }
/* the paper's insight sentence: one uniform grey block, italic */
.insight {
  position: relative; margin: 0; padding: 26px 30px; border-radius: var(--rad);
  background: var(--panel); font-size: clamp(18px, 1.7vw, 22px); line-height: 1.55; font-style: italic; color: var(--ink);
}
.insight b { font-style: normal; font-weight: 620; }
.note { padding: 18px 22px; border-radius: var(--rad); background: var(--blue-bg); color: var(--ink); font-size: 15.5px; }
.note-title { display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue-ink); margin-bottom: 6px; }

/* stats row */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 26px 20px 24px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat .n { font-size: clamp(32px, 3.4vw, 44px); font-weight: 520; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .n small { font-size: .5em; font-weight: 500; letter-spacing: 0; margin-left: 2px; color: var(--ink-2); }
.stat .n.blue { color: var(--blue); }
.stat .l { margin-top: 10px; font-size: 13.5px; line-height: 1.4; color: var(--ink-3); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2n) { border-right: 0; }
  .stat { border-bottom: 1px solid var(--line); }
}

/* textures */
.dotgrid {
  background-image: radial-gradient(var(--dot) 1px, transparent 1.3px);
  background-size: 22px 22px;
}
.fade-mask { -webkit-mask-image: radial-gradient(ellipse at center, #000 40%, transparent 78%); mask-image: radial-gradient(ellipse at center, #000 40%, transparent 78%); }

/* ------------------------------------------------------------------ figures + lightbox */
.fig { margin: 0; }
.fig-frame {
  position: relative; overflow: hidden; border-radius: var(--rad-lg); background: #fff;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
:root[data-theme="dark"] .fig-frame { border-color: var(--line-2); background: #E6E9EE; padding: 10px; }
:root[data-theme="dark"] .fig-frame img { filter: brightness(.88) contrast(1.04); border-radius: 14px; }
.fig-frame img { width: 100%; }
.fig figcaption { margin-top: 14px; max-width: 900px; }
.fig figcaption b { color: var(--ink-2); font-weight: 600; }
.zoom-btn {
  position: absolute; right: 12px; top: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid rgba(30, 32, 36, .12); background: rgba(255, 255, 255, .9); color: #1E2024;
  font-size: 12.5px; font-weight: 550; cursor: zoom-in; opacity: 0; transition: opacity .2s;
}
.fig-frame:hover .zoom-btn, .zoom-btn:focus-visible { opacity: 1; }
@media (hover: none) { .zoom-btn { opacity: 1; } }
dialog.lightbox {
  width: min(96vw, 1800px); max-width: none; max-height: 94vh; padding: 0; border: 0; border-radius: 18px;
  background: #fff; box-shadow: var(--shadow-lg); overflow: auto;
}
dialog.lightbox::backdrop { background: rgba(8, 12, 20, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog.lightbox img { width: 100%; height: auto; }
@media (max-width: 760px) { dialog.lightbox img { width: 240%; max-width: none; } }
dialog.lightbox .lb-bar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px 10px 20px; background: rgba(255,255,255,.94); color: #52555C; font-size: 14px; border-bottom: 1px solid #E4E6EB; }
dialog.lightbox .lb-bar button { border: 0; background: #F3F4F6; color: #1E2024; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }

/* video slot, for screen recordings when they exist */
.video-frame { position: relative; overflow: hidden; border-radius: var(--rad-lg); background: var(--block); aspect-ratio: 16 / 9; }
.video-frame video { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ tables */
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--rad); border: 1px solid var(--line); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl thead th { background: var(--panel-blue); color: var(--ink); font-weight: 600; font-size: 13px; }
.tbl thead tr.grp th { font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--blue-ink); background: var(--bg); }
.tbl td.n, .tbl th.n { text-align: right; font-family: var(--mono); font-size: 13.5px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--bg-soft); }
.tbl .ind1 { padding-left: 30px; color: var(--ink-2); }
.tbl .ind2 { padding-left: 46px; color: var(--ink-2); }
.tbl .best { font-weight: 700; color: var(--ink); }
.tbl .second { text-decoration: underline; text-decoration-color: var(--ink-4); text-underline-offset: 3px; }
.tbl tr.hl td { background: var(--blue-bg); }
.tbl tr.hl:hover td { background: var(--blue-bg); }
.tbl tr.gray td { background: var(--panel); }
.tbl .rowgroup td { font-style: italic; color: var(--ink-3); background: var(--bg-soft); font-size: 13.5px; }

/* ------------------------------------------------------------------ code */
.code {
  position: relative; border-radius: var(--rad); background: var(--panel); overflow: hidden;
  font-family: var(--mono); font-size: 13px; line-height: 1.7;
}
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: var(--ink-3); color: #fff; font-size: 12px; font-weight: 600;
}
.code-head.blue { background: var(--blue-2); }
.code-head.dark { background: var(--block); color: var(--on-block); }
:root[data-theme="dark"] .code-head { background: var(--line-2); color: var(--ink); }
.code-head .meta { font-weight: 400; opacity: .85; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; white-space: pre; color: var(--ink); }
.code .ln { display: block; }
.code .add { background: color-mix(in srgb, var(--aqua) 12%, transparent); }
.code .del { background: color-mix(in srgb, var(--orange) 12%, transparent); }
.code .cm { color: var(--ink-3); font-style: italic; }
.code .kw { color: var(--blue-deep); font-weight: 600; }
/* provenance colouring, as in the paper: C = sealed corpus (blue), E = analyzer's evidence (green), A = declared assumption (orange) */
.pc-C { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--blue-ink); border-radius: 3px; }
.pc-E { background: color-mix(in srgb, var(--aqua) 16%, transparent); color: var(--aqua-ink); border-radius: 3px; }
.pc-A { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange-ink); border-radius: 3px; }

/* ------------------------------------------------------------------ charts (shared by assets/js/charts.js) */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--sans); fill: var(--ink-2); }
.chart .tick text { font-family: var(--mono); font-size: 11.5px; fill: var(--ink-3); }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis-line { stroke: var(--line-2); stroke-width: 1; }
.chart .axis-title { font-size: 12.5px; fill: var(--ink-3); font-weight: 500; }
.chart .ref-line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .ref-label { font-size: 12px; fill: var(--ink-3); }
.chart .series path.line { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart .series circle.pt { stroke: var(--bg); stroke-width: 1.6; }
.chart .series text.end { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.chart .series.dim { opacity: .18; transition: opacity .2s; }
.chart .series { transition: opacity .2s; }
.chart .bar { transition: opacity .2s; }
.chart .bar-label { font-size: 13px; fill: var(--ink-2); }
.chart .bar-value { font-family: var(--mono); font-size: 12px; font-weight: 600; fill: var(--ink); }
.chart .cross { stroke: var(--ink-4); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 14px; font-size: 13.5px; color: var(--ink-2); }
.chart-legend button { display: inline-flex; align-items: center; gap: 8px; padding: 2px 0; border: 0; background: none; cursor: pointer; color: inherit; font: inherit; }
.chart-legend button[aria-pressed="false"] { opacity: .4; }
.chart-legend i { width: 16px; height: 3px; border-radius: 2px; background: var(--c); display: inline-block; }
.chart-legend i.dash { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 150px;
  padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line);
  box-shadow: var(--shadow-md); font-size: 13px; line-height: 1.5; color: var(--ink);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s;
}
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip .tt { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.chart-tip .row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; margin-right: 7px; }
.chart-tip .row b { font-family: var(--mono); font-weight: 600; }
.chart-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--rad-lg); padding: 24px 24px 18px; }
.chart-card h4 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
.chart-card .cap { margin: 0 0 14px; }

/* ------------------------------------------------------------------ reveal on scroll (site.js adds .in) */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out); transition-delay: var(--d, 0s); }
.js [data-reveal].in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
}

/* ------------------------------------------------------------------ release + cite + footer */
.release { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.release .item { display: flex; flex-direction: column; align-items: flex-start; padding: 22px 20px; border-radius: var(--rad); border: 1px solid var(--line); background: var(--bg); }
.release .item .soon { margin-top: auto; }
.release .item .kicker { display: block; margin-bottom: 10px; }
.release .item h3 { font-size: 16.5px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 6px; }
.release .item p { margin: 0 0 14px; font-size: 14px; color: var(--ink-3); line-height: 1.5; }
@media (max-width: 1080px) { .release { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .release { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .release { grid-template-columns: 1fr; } }
.bib { position: relative; }
.bib pre {
  margin: 0; padding: 22px 24px; border-radius: var(--rad); background: var(--panel); overflow-x: auto;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.7; color: var(--ink);
}
.bib .copy { position: absolute; top: 12px; right: 12px; }
footer.foot { padding: 56px 0 64px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 14px; }
footer.foot .row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; align-items: center; }
footer.foot a { color: var(--ink-2); }

/* ------------------------------------------------------------------ print */
@media print {
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
  body::after, nav.top, .rail, .hero-canvas, .zoom-btn, .skip { display: none !important; }
  svg .bar-anim { transform: none !important; }
  svg path.line { stroke-dashoffset: 0 !important; opacity: 1 !important; }
  svg .pt, svg .end, svg .val-anim, svg .donut-label { opacity: 1 !important; }
  section.sec { padding: 40px 0; }
}
