/* ------------------------------------------------------------------
   AMR lab notes: Replicating Success Guided Sampling on AMR Rosie.
   Built on the advancedmetalresearch.com design system: ice ground,
   ink rules, ticket micro-labels, navy panels, brand red as the single
   accent, Saira throughout. Light and dark themes follow the system or
   the header toggle (data-theme on <html>), as on the company site.
   ------------------------------------------------------------------ */

:root {
  color-scheme: light;
  --ice: #d9e7eb;
  --ice-2: #c9dbe0;
  --paper: #eaf2f4;
  --ink: #1b2a30;
  --ink-2: #4e6068;
  --line: #9db3ba;
  --line-2: #b9cbd0;
  --blue: #13294b;
  --blue-ink: #13294b;
  --on-blue: #eaf2f4;
  --block-sub: #b4c3d6;
  /* brand red: logo mark, band edge, primary button, arrows, link rules, current-page marker */
  --red: #b8020d;
  --tt-moon: block;
  --tt-sun: none;

  /* code, as in the company docs */
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --code-inline: rgba(19, 41, 75, .075);
  --t-com: #566d76;
  --t-kw: #13294b;
  --t-fn: #1d5a86;

  /* data series: fixed by the colours baked into the figures */
  --sgs: #6a3fd0;
  --uniform: #4f8a4b;
  --sgs-ink: #6a3fd0;

  --sans: "Saira", "Titillium Web", "Segoe UI", Arial, sans-serif;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 46rem;
  --wide: 72rem;
  --hdr: 4.25rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ice: #0f1c22; --ice-2: #15252c; --paper: #16262d;
  --ink: #e2edf0; --ink-2: #9bb0b7;
  --line: #3d565e; --line-2: #2b424a;
  --blue: #1a355f; --blue-ink: #8fb0d9; --on-blue: #fff; --block-sub: #b9c8da;
  --red: #e0343c;
  --tt-moon: none; --tt-sun: block;
  --code-inline: rgba(226, 237, 240, .09);
  --t-com: #7f959c; --t-kw: #a9c4f2; --t-fn: #8fd0f0;
  --sgs-ink: #b39cff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ice: #0f1c22; --ice-2: #15252c; --paper: #16262d;
    --ink: #e2edf0; --ink-2: #9bb0b7;
    --line: #3d565e; --line-2: #2b424a;
    --blue: #1a355f; --blue-ink: #8fb0d9; --on-blue: #fff; --block-sub: #b9c8da;
    --red: #e0343c;
    --tt-moon: none; --tt-sun: block;
    --code-inline: rgba(226, 237, 240, .09);
    --t-com: #7f959c; --t-kw: #a9c4f2; --t-fn: #8fd0f0;
    --sgs-ink: #b39cff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ice); color: var(--ink);
  font-family: var(--sans); font-size: 1.0625rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4, p, figure { margin: 0; }
[id] { scroll-margin-top: calc(var(--hdr) + 1.25rem); }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 3px solid var(--blue-ink); outline-offset: 2px; }
.skip { position: absolute; left: var(--gutter); top: -3rem; background: #1b2a30; color: #eaf2f4; padding: .5rem .75rem; z-index: 100; }
.skip:focus { top: .5rem; }

/* ticket micro-labels: the one place caps are allowed */
.lbl {
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-2);
}
.lbl b { color: var(--ink); font-weight: 600; }
.dotgrid { background-image: radial-gradient(var(--line-2) 1px, transparent 1.2px); background-size: 16px 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .7rem;
  background: var(--ink); color: var(--paper); text-decoration: none;
  font-weight: 600; font-size: .95rem; padding: .85rem 1.2rem; border-radius: 3px; white-space: nowrap;
}
.btn::after { content: ""; width: 8px; height: 8px; background: var(--red); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.btn-red { background: #b8020d; color: #fff; }
.btn-red::after { background: #fff; }
.btn-red:hover { background: #8e0209; }

/* ---------- header: the company site's ticket header ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2rem;
  padding: .7rem var(--gutter); background: var(--ice); border-bottom: 2px solid var(--ink);
}
.brand { display: inline-flex; align-items: center; gap: .85rem; text-decoration: none; color: var(--ink); }
.brand-mark { width: 3rem; fill: var(--red); flex: none; }
.brand-name { line-height: 1; font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.nav { display: flex; gap: 1.5rem; justify-content: center; }
.nav a { text-decoration: none; font-size: .9rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); border-bottom: 2px solid var(--red); padding-bottom: .1rem; }
.nav .nav-home { color: var(--ink); font-weight: 600; padding-right: 1.5rem; border-right: 1px solid var(--line); }
.nav .nav-home:hover, .nav-menu-panel .nav-home:hover { color: var(--red); }
.nav-menu-panel .nav-home { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--line-2); }
.top-end { display: flex; align-items: center; gap: .6rem; }
.top .btn { padding: .7rem 1rem; font-size: .9rem; }

.theme-toggle {
  position: relative; flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px; margin: 0; padding: 0; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 3px;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .tt-moon { display: var(--tt-moon); }
.theme-toggle .tt-sun { display: var(--tt-sun); }

/* compact site menu for tablets and phones; a <details>, so it works without JS */
.nav-menu { display: none; position: relative; }
.nav-menu summary {
  display: grid; place-items: center; width: 40px; height: 40px; cursor: pointer; list-style: none;
  color: var(--ink); border: 1px solid var(--line); border-radius: 3px;
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary:hover, .nav-menu[open] summary { border-color: var(--ink); }
.nav-menu summary svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + .7rem); z-index: 60; min-width: 13rem;
  display: grid; padding: .4rem 0; background: var(--ice); border: 2px solid var(--ink); border-radius: 3px;
  box-shadow: 0 18px 40px rgba(8, 18, 24, .2);
}
.nav-menu-panel a { padding: .6rem 1rem; text-decoration: none; font-weight: 500; font-size: .95rem; color: var(--ink-2); border-left: 2px solid transparent; }
.nav-menu-panel a:hover { color: var(--ink); background: var(--paper); }
.nav-menu-panel a[aria-current] { color: var(--ink); border-left-color: var(--red); }

@media (max-width: 960px) {
  .top { grid-template-columns: 1fr auto; }
  .nav { display: none; }
  .nav-menu { display: block; }
}
@media (max-width: 760px) {
  .top { gap: .75rem; }
  .top-end { gap: .45rem; }
  .brand { gap: .6rem; }
  .brand-mark { width: 2.5rem; }
  .brand-name { white-space: normal; max-width: 8em; font-size: .85rem; line-height: 1.1; }
  .top .btn { font-size: .78rem; padding: .55rem .8rem; }
  .top .btn::after { display: none; }
  .theme-toggle, .nav-menu summary { width: 34px; height: 34px; }
}
@media (max-width: 480px) { .top .btn { display: none; } }

/* ---------- hero ticket ---------- */
.hero { border-bottom: 2px solid var(--ink); }
.ticket { max-width: 1680px; margin: 0 auto; padding: clamp(2rem, 4.5vw, 4rem) var(--gutter); }
.ticket-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding-bottom: .6rem; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); border-bottom: 1px solid var(--ink);
}
.dots { display: inline-flex; gap: 4px; align-items: center; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); display: block; }
.dots i:nth-child(2) { background: var(--blue-ink); }
.dots i:nth-child(3) { background: var(--red); }

.hero-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(2rem, 4vw, 4rem); align-items: center; }
.hero-copy { display: grid; gap: 1.4rem; align-content: start; }
.hero .kicker { color: var(--ink); }
.hero h1 {
  font-size: clamp(3rem, 6.4vw, 6rem); line-height: .92; font-weight: 600; letter-spacing: -.035em;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--red); }
.dek { font-size: 1.15rem; line-height: 1.5; color: var(--ink-2); max-width: 34rem; text-wrap: pretty; }
.byline { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; width: fit-content; padding-top: .75rem; border-top: 2px solid var(--ink); }
.hero-figure { display: grid; gap: .6rem; }
.hero-figure .lbl-stack { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
.hero-figure .film { border-color: var(--ink); }
.hero-figure figcaption { font-size: .8rem; line-height: 1.45; color: var(--ink-2); max-width: 40rem; }
@media (prefers-reduced-motion: no-preference) {
  .hero-figure .film { clip-path: inset(0 100% 0 0); animation: plot 1.4s cubic-bezier(.65, 0, .2, 1) .15s forwards; }
}
@keyframes plot { to { clip-path: inset(0 0 0 0); } }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

/* ---------- info band: navy under a brand-red edge (pale steel in dark mode) ---------- */
.band {
  --ink: #e2edf0; --ink-2: #b4c3d6;
  background: var(--blue); color: var(--ink); border-top: 4px solid var(--red);
  padding: 1.25rem var(--gutter);
  display: grid; grid-template-columns: auto minmax(4rem, 1fr) auto auto; gap: 2rem; align-items: center;
}
:root[data-theme="dark"] .band { --ink: #1b2a30; --ink-2: #4e6068; background: #c9dbe0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .band { --ink: #1b2a30; --ink-2: #4e6068; background: #c9dbe0; }
}
.band .lbl-stack { display: grid; gap: .25rem; }
.band .lbl { white-space: nowrap; }
.barcode {
  height: 54px;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 5px, var(--ink) 5px 6px, transparent 6px 10px,
    var(--ink) 10px 13px, transparent 13px 15px, var(--ink) 15px 16px, transparent 16px 20px,
    var(--ink) 20px 22px, transparent 22px 23px, var(--ink) 23px 26px, transparent 26px 30px);
}
@media (max-width: 900px) {
  .band { grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; }
  .barcode { grid-column: 1 / -1; grid-row: 1; height: 36px; }
}
@media (max-width: 520px) { .band { grid-template-columns: 1fr; } .band .lbl { white-space: normal; } }

/* ---------- layout: contents rail beside the article ---------- */
.layout {
  max-width: 1680px; margin: 0 auto; padding: 0 var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1fr);
}
article { min-width: 0; padding-bottom: 1rem; }
.prose > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
.prose > .wide { max-width: var(--wide); }

.toc { width: 100%; max-width: var(--measure); margin: 2rem auto 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.toc summary {
  cursor: pointer; padding: .75rem 0; list-style: none;
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after { content: "+"; float: right; font: 500 .9rem/1 var(--mono); color: var(--ink-2); }
.toc[open] summary::after { content: "\2212"; }
.toc ol { list-style: none; margin: 0; padding: 0 0 .8rem; }
.toc a { display: block; padding: .28rem 0; font-size: .92rem; line-height: 1.35; color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc .n { display: inline-block; min-width: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }

@media (min-width: 1200px) {
  .layout { grid-template-columns: 13rem minmax(0, 1fr); gap: 0 clamp(2rem, 3.4vw, 3.5rem); }
  .prose > * { margin-left: 0; }
  .toc {
    position: sticky; top: var(--hdr); align-self: start; margin: 0; padding: 2.5rem 0 2rem;
    border: 0; max-height: calc(100vh - var(--hdr)); overflow-y: auto; scrollbar-width: thin;
  }
  .toc summary { pointer-events: none; padding: 0 0 .6rem; margin-bottom: .5rem; border-bottom: 1px solid var(--ink); }
  .toc summary::after { display: none; }
  .toc ol { padding: 0; border-left: 1px solid var(--line-2); }
  .toc a { margin-left: -1px; padding: .3rem 0 .3rem .75rem; border-left: 2px solid transparent; font-size: .85rem; }
  .toc a.active { color: var(--ink); font-weight: 600; border-left-color: var(--red); }
  .toc .n { min-width: 1.6rem; font-size: .78rem; }
}

/* ---------- prose ---------- */
.prose { font-size: 1.0625rem; line-height: 1.7; overflow-wrap: break-word; }
.prose p { margin-bottom: 1.1rem; text-wrap: pretty; }
.prose .lead { font-size: 1.22rem; line-height: 1.6; color: var(--ink); }
.prose strong { font-weight: 650; color: var(--ink); }
.prose a {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: 1px; text-underline-offset: .22em;
}
.prose a:hover { text-decoration-thickness: 2px; }
.prose figure a { display: block; }

code {
  font-family: var(--mono); font-size: .855em; padding: .12em .36em; border-radius: 3px;
  background: var(--code-inline); color: var(--ink); white-space: nowrap;
}

.prose ul, .prose ol.refs { margin-top: 0; margin-bottom: 1.1rem; padding-left: 1.35rem; }
.prose ul { list-style: square; }
.prose li + li { margin-top: .45rem; }
.prose li::marker { color: var(--ink-2); }

/* section heads: a ticket rule with the section label and the three dots */
.section-head { margin-top: clamp(3.5rem, 7vw, 5rem); margin-bottom: 1.4rem; }
.section-head .num {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding-bottom: .6rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--ink);
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--ink);
}
.section-head .num::after {
  content: ""; flex: none; width: 5px; height: 5px; margin-right: 18px; border-radius: 50%;
  background: var(--ink); box-shadow: 9px 0 0 var(--blue-ink), 18px 0 0 var(--red);
}
.section-head h2 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.04; font-weight: 600; letter-spacing: -.03em; text-wrap: balance; }
.prose h3 { font-size: 1.3rem; line-height: 1.25; font-weight: 600; letter-spacing: -.012em; margin-top: 2.3rem; margin-bottom: .7rem; }

/* ---------- TL;DR: a paper plate under an ink rule, numbered like the company site's steps ---------- */
.plate {
  margin-top: clamp(2rem, 4vw, 3rem); margin-bottom: 2rem;
  background: var(--paper); border-top: 2px solid var(--ink);
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.25rem, 3vw, 2.25rem) clamp(1.25rem, 3vw, 1.75rem);
}
.plate-head {
  display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: .4rem 1.5rem;
  padding-bottom: .6rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--ink);
}
/* the Rosie forearm and its nameplate, engraved into the empty middle of the plate's head */
.plate-art {
  flex: 1; align-self: stretch; min-height: 3.6rem;
  background: url("assets/drawings/forearm-ink.webp") no-repeat right bottom / contain;
  -webkit-mask-image: linear-gradient(to right, transparent 30%, #000 75%);
  mask-image: linear-gradient(to right, transparent 30%, #000 75%);
  opacity: .3;
}
:root[data-theme="dark"] .plate-art { background-image: url("assets/drawings/forearm-white.webp"); opacity: .26; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .plate-art { background-image: url("assets/drawings/forearm-white.webp"); opacity: .26; }
}
@media (max-width: 760px) { .plate-art { display: none; } }
.plate-head h2 { font-size: 1.6rem; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; }
.plate-head span { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--ink-2); }
.plate ol {
  list-style: none; counter-reset: tl; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem clamp(1.5rem, 3vw, 2.5rem);
}
.plate li {
  counter-increment: tl; position: relative; padding-left: 2.85rem;
  font-size: .98rem; line-height: 1.55; color: var(--ink-2); margin: 0;
}
.plate li::before {
  content: counter(tl, decimal-leading-zero); position: absolute; left: 0; top: .1rem;
  font-size: 1.5rem; font-weight: 600; line-height: 1; letter-spacing: -.04em; color: var(--blue-ink);
}
.plate li + li { margin-top: 0; }

/* ---------- figures ---------- */
.prose figure { margin-top: 2rem; margin-bottom: 2.4rem; }
.prose figure img { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.prose figcaption { margin-top: .6rem; max-width: var(--measure); font-size: .8rem; line-height: 1.45; color: var(--ink-2); }
.prose figcaption b { color: var(--ink); font-weight: 600; }
.film-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.6rem; margin-top: 2rem; margin-bottom: 2.4rem; }
.film-grid figure { margin: 0; }

/* ---------- films: rendered policy rollouts; the poster (sky of the render) holds the frame while loading ---------- */
.film { position: relative; aspect-ratio: 16 / 9; background: #c3ccd3; border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.film video { width: 100%; height: 100%; object-fit: cover; background: transparent; }
.film-head { display: flex; justify-content: space-between; gap: .25rem 1rem; flex-wrap: wrap; padding-bottom: .45rem; margin-bottom: .6rem; border-bottom: 1px solid var(--ink); }
.film-toggle {
  position: absolute; right: .55rem; bottom: .55rem; display: inline-flex; align-items: center; gap: .45rem;
  padding: .42rem .6rem .42rem .5rem; cursor: pointer;
  font: 600 .6rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: #1b2a30; background: rgba(234, 242, 244, .88); border: 1px solid #1b2a30; border-radius: 2px;
  opacity: .78; transition: opacity .15s ease;
}
.film:hover .film-toggle, .film-toggle:focus-visible, .film-toggle[data-paused] { opacity: 1; }
.film-toggle svg { width: 10px; height: 10px; fill: currentColor; }
.film-toggle .i-play, .film-toggle[data-paused] .i-pause { display: none; }
.film-toggle[data-paused] .i-play { display: block; }

.scroll-reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); }
.scroll-reveal.in { opacity: 1; transform: none; }

/* ---------- callouts: the docs admonitions ---------- */
.note {
  position: relative; margin-top: 1.6rem; margin-bottom: 1.6rem;
  padding: .9rem 1.15rem 1rem 1.25rem; background: var(--paper); border-left: 3px solid var(--blue-ink);
  font-size: 1rem; line-height: 1.62;
}
.note .label {
  display: block; margin-bottom: .35rem;
  font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--blue-ink);
}
.note p { margin-bottom: .7rem; }
.note p:last-child { margin-bottom: 0; }
.note.mistake { border-left: 0; padding-left: 1.6rem; }
.note.mistake::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 4px, transparent 4px 8px);
  border-right: 1px solid var(--red);
}
.note.mistake .label { color: var(--red); }

/* ---------- code panels ---------- */
.panel {
  margin-top: 1.4rem; margin-bottom: 1.6rem; padding: 1rem 1.1rem 1.05rem; overflow-x: auto;
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 3px;
  font: .84rem/1.65 var(--mono); color: var(--ink);
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.panel pre { margin: 0; font: inherit; white-space: pre; }
.panel .c { color: var(--t-com); font-style: italic; }
.panel .k { color: var(--t-fn); font-weight: 600; }
.panel .v { color: var(--t-kw); font-weight: 600; }

/* ---------- tables: the docs tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 1.5rem; margin-bottom: 2rem; border-top: 2px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.5; }
caption { caption-side: bottom; text-align: left; padding-top: .7rem; font-size: .8rem; line-height: 1.45; color: var(--ink-2); }
th, td { padding: .62rem 0 .62rem 1.1rem; text-align: right; vertical-align: top; }
th:first-child, td:first-child { padding-left: 0; padding-right: .4rem; text-align: left; }
thead th {
  padding-top: .7rem; padding-bottom: .55rem; border-bottom: 1px solid var(--ink); vertical-align: bottom; white-space: nowrap;
  font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-2);
}
td { border-bottom: 1px solid var(--line-2); }
td.n { white-space: nowrap; font-weight: 500; font-variant-numeric: tabular-nums; }
td.win { color: var(--sgs-ink); font-weight: 700; }
td.lose { color: var(--ink-2); }
tbody tr:hover { background: var(--paper); }
.swatch { display: inline-block; width: .7em; height: .7em; border-radius: 50%; vertical-align: .02em; margin-right: .4em; }
.swatch.sgs { background: var(--sgs); }
.swatch.uniform { background: var(--uniform); }

/* ---------- interactive panels: paper sheets under an ink rule ---------- */
.kernel, .scale-chart { background: var(--paper); border-top: 2px solid var(--ink); }
.kernel {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.5rem;
  padding: 1.25rem 1.4rem; margin-top: 2rem; margin-bottom: 2.4rem;
}
.kernel svg, .scale-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.kernel .controls { display: flex; flex-direction: column; gap: .9rem; font-size: .85rem; }
.kernel label { display: grid; grid-template-columns: 1fr auto; gap: .25rem .6rem; align-items: center; font-weight: 600; color: var(--ink-2); }
.kernel label output { color: var(--ink); font-variant-numeric: tabular-nums; }
.kernel input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--red); }
.kernel .presets { display: flex; flex-wrap: wrap; gap: .4rem; }
.kernel button {
  font: 600 .8rem var(--sans); padding: .5rem .8rem; cursor: pointer;
  color: var(--ink-2); background: transparent; border: 1px solid var(--line); border-radius: 3px;
}
.kernel button:hover { color: var(--ink); border-color: var(--ink); }
.kernel button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.kernel .readout { border-top: 1px solid var(--line-2); padding-top: .7rem; line-height: 1.7; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.kernel .readout b { color: var(--ink); }
.kernel .readout .key { color: var(--red); }
.kernel .axis text, .scale-chart text { font-family: var(--sans); font-size: 11px; fill: var(--ink-2); }
.kernel .axis line { stroke: var(--line); }
.kernel .k-area { fill: var(--red); fill-opacity: .1; }
.kernel .k-target { stroke: var(--red); stroke-width: 1; stroke-dasharray: 3 3; }
.kernel .k-curve { fill: none; stroke: var(--ink); stroke-width: 2.2; }
.kernel .k-dot { fill: var(--paper); stroke: var(--red); stroke-width: 2; }
.kernel-caption { grid-column: 1 / -1; margin: 0; font-size: .8rem; line-height: 1.45; color: var(--ink-2); }
.kernel-caption b { color: var(--ink); font-weight: 600; }

.scale-chart {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem;
  padding: 1.25rem 1.4rem 1.1rem; margin-top: 2rem; margin-bottom: 2rem;
}
.scale-chart h4 { margin: 0 0 .6rem; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink); }
.scale-chart .grid { stroke: var(--line); stroke-dasharray: 2 4; }
.scale-chart .bar { stroke: var(--ink); stroke-width: 1.5; }
.scale-chart .legend { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; font-size: .8rem; color: var(--ink-2); }

/* ---------- stats row ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 2px solid var(--ink); margin-top: 2rem; margin-bottom: 2rem; }
.stats div { padding: 1rem 1.25rem 0 0; display: grid; gap: .5rem; align-content: start; min-width: 0; }
.stats div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.stats .big { font-size: clamp(1.6rem, 2.3vw, 2.25rem); line-height: .95; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stats .big .vs { font-size: .5em; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.stats .lbl { font-size: .85rem; line-height: 1.4; letter-spacing: 0; text-transform: none; font-weight: 400; }

/* ---------- references and fine print ---------- */
.prose ol.refs { font-size: .95rem; line-height: 1.55; }
.refs li + li { margin-top: .8rem; }
.refs li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }
.prose .fineprint { font-size: .85rem; color: var(--ink-2); }

/* ---------- footer: the company site's ---------- */
.foot {
  max-width: calc(1680px - 2 * var(--gutter)); margin: clamp(3.5rem, 7vw, 5.5rem) var(--gutter) 0;
  padding: 1.25rem 0 2.5rem; border-top: 2px solid var(--ink);
  display: grid; gap: .75rem; font-size: .8rem; color: var(--ink-2);
}
@media (min-width: 1780px) { .foot { margin-left: auto; margin-right: auto; } }
.foot-row { display: flex; flex-wrap: wrap; gap: .3rem 2.5rem; }
.foot-row span:not(.foot-pages) > a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: .22em; }
.foot-pages { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.foot-pages a { color: var(--ink-2); text-decoration: none; }
.foot-pages a:hover { color: var(--ink); }

/* ---------- narrow screens ---------- */
@media (max-width: 860px) {
  .plate ol { grid-template-columns: 1fr; }
  .kernel { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats div:nth-child(3) { border-left: 0; padding-left: 0; }
  .stats div:nth-child(n+3) { margin-top: 1rem; border-top: 1px solid var(--line-2); }
}
@media (max-width: 600px) {
  .prose { font-size: 1.02rem; line-height: 1.66; }
  .panel { font-size: .78rem; padding: .85rem .9rem; }
  .kernel, .scale-chart { padding: 1rem; }
}

/* a short cross-fade when the visitor flips the theme */
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .18s ease, color .18s ease, border-color .18s ease, fill .18s ease, stroke .18s ease !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-reveal { opacity: 1; transform: none; transition: none; }
}

@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --ice: #fff; --paper: #fff; --ink: #000; --ink-2: #333; --line: #999; --line-2: #ccc; color-scheme: light;
  }
  .top, .toc, .foot, .skip { display: none !important; }
  .band { background: #fff; --ink: #000; --ink-2: #333; }
  .dotgrid { background: none; }
  .scroll-reveal { opacity: 1; transform: none; }
}
