/* ==========================================================================
   kalunho.com: one stylesheet for every page.
   Colours, type and spacing follow the slide deck. Change a token in :root,
   never a hard-coded value further down. Colours come in a light and a dark
   theme, see "Colour themes".
   ========================================================================== */

/* Fonts: self-hosted Open Sans (latin subset), licence in /assets/fonts/OFL.txt */
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 300; font-display: swap; src: url("/assets/fonts/open-sans-300.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/fonts/open-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/fonts/open-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url("/assets/fonts/open-sans-700.woff2") format("woff2"); }

/* Arial, resized to Open Sans metrics, so the font swap does not shift the layout */
@font-face { font-family: "Open Sans Fallback"; src: local("Arial"), local("ArialMT"); ascent-override: 101.65%; descent-override: 27.86%; line-gap-override: 0%; size-adjust: 105.22%; }

/* --- Colour themes -----------------------------------------------------------
   Light is the default. Light values on :root. Dark values in the two blocks
   below: the first applies when a visitor picks dark with the header toggle
   (data-theme="dark" on <html>), the second when a visitor picks "system" and
   the device is set to dark. Keep the two dark blocks identical. Rules further down use only these tokens.
   Brand tints: #174A7E, #10365C (deep), #4671A4 (80 %), #7498C0 (60 %),
   #A3BBD5 (40 %), #D1DDEA (20 %), #E8EEF5 (10 %).
   .video and .slide show slides, so they keep the light values in both themes. */

:root,
.video,
.slide {
  --bg:           #FFFFFF;  /* page background */
  --bg-panel:     #F3F5F7;  /* section backgrounds, notices */
  --bg-tint:      #E8EEF5;  /* panels, cards, takeaway bars, hover fills */
  --text:         #343A40;  /* body text */
  --text-muted:   #6B7280;  /* supporting text. Light theme: only on --bg, below AA on --bg-panel and --bg-tint */
  --heading:      #174A7E;  /* h1, h2, wordmark */
  --accent:       #174A7E;  /* links, buttons, kickers, icons, accent bars */
  --accent-hover: #10365C;  /* link and button hover */
  --accent-soft:  #A3BBD5;  /* nav hover underline, chart bars */
  --chart-2:      #7498C0;  /* second series in charts ("thinking on"): the 60 % tint, darker than --accent-soft so it holds up on white */
  --on-accent:    #FFFFFF;  /* text and icons on --accent fills */
  --rule:         #D9DEE5;  /* rules, borders */
  --positive:     #237A57;  /* only for "good / verified" */
  --risk:         #B54747;  /* only for "adverse / risk" */
  --caution:      #B7791F;  /* only for "caution" */
  --band-bg:      #10365C;  /* dark band (closing call to action) */
  --band-text:    #D1DDEA;  /* paragraphs in the band */
  --on-band:      #FFFFFF;  /* headings, links and the inverse button in the band */
  --inverse-text:       #174A7E;  /* inverse button (in the band), same in both themes */
  --inverse-hover-bg:   #E8EEF5;
  --inverse-hover-text: #10365C;
  --motif-filter: none;     /* motif.svg is drawn for a light background */
  --motif-blend:  normal;
}

:root { color-scheme: light; }

/* Dark, chosen with the toggle. Screen only, so printouts stay light. */
@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --chart-2:      #7498C0;
    --bg:           #10365C;
    --bg-panel:     #174A7E;
    --bg-tint:      #174A7E;
    --text:         #E8EEF5;
    --text-muted:   #A3BBD5;
    --heading:      #FFFFFF;
    --accent:       #A3BBD5;  /* brand brief: #7498C0, raised to the 40 % tint for AA contrast */
    --accent-hover: #E8EEF5;
    --accent-soft:  #7498C0;
    --on-accent:    #10365C;
    --rule:         #4671A4;
    --positive:     #5BB58E;
    --risk:         #E08A8A;
    --caution:      #E0B05A;
    --band-bg:      #174A7E;
    --motif-filter: invert(1) hue-rotate(180deg);
    --motif-blend:  screen;
  }
}

/* Dark, "system": the visitor picked system with the toggle and the device is set to dark */
@media screen and (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --chart-2:      #7498C0;
    --bg:           #10365C;
    --bg-panel:     #174A7E;
    --bg-tint:      #174A7E;
    --text:         #E8EEF5;
    --text-muted:   #A3BBD5;
    --heading:      #FFFFFF;
    --accent:       #A3BBD5;  /* brand brief: #7498C0, raised to the 40 % tint for AA contrast */
    --accent-hover: #E8EEF5;
    --accent-soft:  #7498C0;
    --on-accent:    #10365C;
    --rule:         #4671A4;
    --positive:     #5BB58E;
    --risk:         #E08A8A;
    --caution:      #E0B05A;
    --band-bg:      #174A7E;
    --motif-filter: invert(1) hue-rotate(180deg);
    --motif-blend:  screen;
  }
}

:root {
  /* Type: slide pt × ~1.25 on desktop, scaled down fluidly */
  --font: "Open Sans", "Open Sans Fallback", Arial, sans-serif;
  --fs-hero:   clamp(2.125rem, 1.35rem + 3.3vw, 3.125rem);  /* 34 → 50 px */
  --fs-h1:     clamp(1.875rem, 1.3rem + 2.4vw, 2.5rem);     /* 30 → 40 px */
  --fs-h2:     clamp(1.75rem, 1.25rem + 2vw, 2.375rem);     /* 28 → 38 px */
  --fs-h3:     clamp(1.1875rem, 1.05rem + 0.6vw, 1.375rem); /* 19 → 22 px */
  --fs-lead:   clamp(1.125rem, 1rem + 0.55vw, 1.3125rem);   /* 18 → 21 px */
  --fs-body:   clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);   /* 17 → 18 px */
  --fs-kicker: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);/* 13 → 14 px */
  --fs-small:  0.875rem;                                    /* 14 px: labels, captions */
  --fs-meta:   0.8125rem;                                   /* 13 px: footer, sources */

  /* Spacing scale */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 40px;
  --s5: 64px;
  --section: clamp(64px, 8vw, 120px);
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --measure: 70ch;

  --radius-sm: 4px;
  --radius: 8px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

/* --- Base ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3 { margin: 0; color: var(--heading); font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--fs-h1); line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); line-height: 1.15; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-h3); line-height: 1.3; font-weight: 600; color: var(--text); }

p { margin: 0 0 var(--s2); max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.band :focus-visible { outline-color: var(--on-band); }

strong { font-weight: 700; }

address { font-style: normal; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s2); top: -100px; z-index: 10;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--s2); color: var(--on-accent); }

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Icons (sprite: /assets/img/icons.svg, 24 × 24, 1.5 px stroke) -------- */

.icon {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.icon--sm { width: 20px; height: 20px; stroke-width: 1.8; }  /* stays 1.5 px on screen */
.icon--lg { width: 32px; height: 32px; stroke-width: 1.125; }

/* --- Type helpers ---------------------------------------------------------- */

.kicker {
  margin: 0 0 var(--s2);
  color: var(--accent);
  font-size: var(--fs-kicker);
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.accent-bar { width: 72px; height: 4px; margin: 0 0 var(--s3); background: var(--accent); }
.kicker + .accent-bar { margin-top: var(--s3); }

.display { font-size: var(--fs-hero); line-height: 1.1; }

.lead { margin-top: var(--s3); color: var(--text-muted); font-size: var(--fs-lead); line-height: 1.35; max-width: 36em; }

.caption { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; }
.meta { color: var(--text-muted); font-size: var(--fs-meta); line-height: 1.5; }

/* Muted text fails AA on tinted backgrounds in the light theme, so it turns to body text there */
.section--light .lead,
.section--light .caption,
.panel .caption,
.panel .meta { color: var(--text); }

/* --- Buttons and links ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 48px; padding: 11px 24px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 1rem; font-weight: 600; line-height: 1.25;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color 120ms linear, border-color 120ms linear, color 120ms linear;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }

.btn--outline { background: var(--bg); color: var(--accent); }
.btn--outline:hover { background: var(--bg-tint); border-color: var(--accent-hover); color: var(--accent-hover); }

.btn--inverse { background: var(--on-band); border-color: var(--on-band); color: var(--inverse-text); }
.btn--inverse:hover { background: var(--inverse-hover-bg); border-color: var(--inverse-hover-bg); color: var(--inverse-hover-text); }

.btn--small { min-height: 40px; padding: 7px 16px; font-size: 0.9375rem; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 48px;
  color: var(--accent); font-weight: 600; text-decoration: none;
}
.link-arrow:hover { color: var(--accent-hover); text-decoration: underline; }
.band .link-arrow { color: var(--on-band); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-top: var(--s4); }

/* --- Header ----------------------------------------------------------------- */

.site-header { background: var(--bg); border-bottom: 1px solid var(--rule); }

.site-header__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0 var(--s3);
  min-height: 72px; padding-block: 8px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px;
  color: var(--heading); font-size: 1.0625rem; font-weight: 700; letter-spacing: 0.01em;
  text-decoration: none;
}
.brand:hover { color: var(--accent-hover); }
.brand .icon { width: 28px; height: 28px; stroke-width: 1.3; }

.site-nav { display: flex; align-items: center; gap: var(--s3); margin-left: auto; }
.site-nav ul { display: flex; flex-wrap: wrap; column-gap: var(--s3); margin: 0; padding: 0; list-style: none; }
.site-nav ul a {
  display: block; padding-block: 10px;
  border-bottom: 2px solid transparent;
  color: var(--text); font-size: 0.9375rem; font-weight: 600; text-decoration: none;
}
.site-nav ul a:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }
.site-nav ul a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 879px) {
  .site-nav .btn { display: none; }
}
@media (max-width: 479px) {
  .site-header__inner { padding-block: 8px 0; }
  .site-nav { width: 100%; order: 1; }  /* own row, below the wordmark and the theme toggle */
  /* All five links on one row, spread across the full width (iPhone 16 Pro is 402 px wide) */
  .site-nav ul { flex: 1; justify-content: space-between; column-gap: 12px; }
  .site-nav ul a { font-size: 0.875rem; }
}
@media (max-width: 374px) {
  .site-nav ul a { font-size: 0.8125rem; }
}

/* Colour theme toggle: cycles light → dark → system (site.js). Hidden without
   JavaScript; the script in <head> adds .js to <html>. Shows the current state. */
.theme-toggle {
  display: none; place-items: center; flex: none;
  width: 44px; height: 44px; padding: 0;
  margin: 0 -10px 0 -12px;  /* 44 px target, but the icon lines up with the content edge and keeps the nav's 24 px rhythm */
  border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); cursor: pointer;
}
.js .theme-toggle { display: grid; }
.theme-toggle:hover { background: var(--bg-tint); color: var(--accent); }
.theme-toggle .icon { display: none; width: 22px; height: 22px; }
:root:not([data-theme]) .theme-toggle__light,
:root[data-theme="dark"] .theme-toggle__dark,
:root[data-theme="system"] .theme-toggle__system { display: block; }

/* --- Sections ------------------------------------------------------------- */

.section { padding-block: var(--section); }
.section + .section { border-top: 1px solid var(--rule); }
.section--light { background: var(--bg-panel); border-top: 0 !important; }
.section--light + .section { border-top: 0; }

.section-head { max-width: 46rem; margin-bottom: var(--s4); }
.section-head .lead { margin-top: var(--s2); }

/* Two columns on desktop: heading left, content right */
.split { display: grid; gap: var(--s4); }
.split > .section-head { margin-bottom: 0; }
@media (min-width: 960px) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; }
  .split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* --- Hero (home) -------------------------------------------------------- */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero__inner { position: relative; padding-block: clamp(56px, 9vw, 128px); }
.hero__content { position: relative; max-width: 40rem; }
.hero .lead { max-width: 32em; }
.hero__audience { margin-top: var(--s2); max-width: 32em; color: var(--text); font-weight: 600; }

/* Motif from the title slides: right edge on desktop, faint behind the text on mobile */
.hero__motif {
  position: absolute; top: 0; right: 0;
  width: auto; height: 100%; max-width: none;
  pointer-events: none;
}
@media (max-width: 899px) {
  .hero__motif { top: auto; bottom: -120px; right: -60px; height: 360px; opacity: 0.35; }
}

/* --- Page head (inner pages) ------------------------------------------------ */

.page-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.page-head__inner { position: relative; padding-block: clamp(48px, 7vw, 96px); }
.page-head__content { max-width: 46rem; }
.page-head__motif {
  position: absolute; top: 0; right: 0;
  width: auto; height: 100%; max-width: none;
  pointer-events: none;
}
@media (max-width: 899px) { .page-head__motif { display: none; } }

/* Dark theme: the motif is drawn for white, so it is inverted and screened onto the dark background */
.hero__motif, .page-head__motif { filter: var(--motif-filter); mix-blend-mode: var(--motif-blend); }

/* Page head with a portrait instead of the motif (About) */
.page-head--portrait .page-head__inner { display: grid; gap: var(--s4); align-items: center; }
.page-head--portrait .portrait { max-width: 280px; }
@media (min-width: 900px) {
  .page-head--portrait .page-head__inner { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: var(--s5); }
  .page-head--portrait .portrait { max-width: 400px; justify-self: end; width: 100%; }
}

/* --- Panels, cards, lists ----------------------------------------------- */

.panel { padding: var(--s3); border-radius: var(--radius); background: var(--bg-tint); }

.cards { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 900px) { .cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 720px) { .cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card .icon { margin-bottom: var(--s2); color: var(--accent); }
.card h3 { margin-bottom: var(--s1); }
.card p { font-size: var(--fs-body); }
.card__label { margin: var(--s3) 0 4px; color: var(--accent); font-size: var(--fs-small); font-weight: 600; }

/* Lists that follow a heading */
.section-head + .bullets, .section-head + .actions { margin-top: 0; }
.bullets + .actions, .bullets + p, .cards + .takeaway { margin-top: var(--s4); }

/* Bullets with a short dash, like the slides */
.bullets { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; max-width: var(--measure); }
.bullets li { position: relative; padding-left: 28px; }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: 0.78em;
  width: 14px; height: 2px; background: var(--accent);
}
.bullets--tight { gap: var(--s1); }

/* Numbered method steps */
.steps { display: grid; gap: var(--s3) var(--s4); margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.steps li { padding-top: var(--s2); border-top: 1px solid var(--rule); }
.steps__num { display: block; margin-bottom: var(--s1); color: var(--accent); font-size: 2rem; font-weight: 300; line-height: 1; }
.steps h3 { margin-bottom: 4px; }

/* Method section (home): steps right, portrait left on desktop */
.method { display: grid; gap: var(--s4); }
.method__portrait { max-width: 320px; }
.method .takeaway { margin-top: 0; }
@media (min-width: 900px) {
  .method { grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--s5); align-items: start; }
  .method__portrait { grid-column: 1; grid-row: 1; max-width: none; }
  .method__body { grid-column: 2; grid-row: 1; }
  .method__takeaway { grid-column: 1 / -1; }
}

/* Takeaway bar: closing sentence of a section, starts with a verb */
.takeaway {
  display: flex; align-items: flex-start; gap: 12px;
  max-width: none; margin: var(--s5) 0 0; padding: var(--s2) var(--s3);
  background: var(--bg-tint); color: var(--text); font-weight: 600;
}
.takeaway .icon { margin-top: 1px; color: var(--accent); }

/* Template / to-do notices on the legal pages */
.notice {
  max-width: var(--measure); margin: 0 0 var(--s4); padding: var(--s2) var(--s3);
  border-left: 4px solid var(--caution); background: var(--bg-panel); color: var(--text);
}
.todo { padding: 0 4px; border-bottom: 2px solid var(--caution); background: var(--bg-panel); color: var(--text); }

/* --- Portraits ----------------------------------------------------------- */

.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }

/* --- Latest video: click-to-load ------------------------------------------ */

/* Sizes inside the poster use cqi (1% of the player width), so it scales like an image */
.video {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border: 1px solid var(--rule); background: var(--bg); color: var(--text);
  container-type: inline-size;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video__poster {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 7cqi 4cqi;
  color: var(--accent); text-decoration: none;
}
.video__motif { position: absolute; top: 0; right: 0; height: 100%; width: auto; max-width: none; }
.video__kicker { position: relative; font-size: max(10px, 1.6cqi); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.video__bar { position: relative; display: block; width: 9cqi; height: max(3px, 0.5cqi); margin: 2.4cqi 0 3cqi; background: var(--accent); }
.video__title { position: relative; max-width: 58cqi; font-size: max(17px, 5.2cqi); font-weight: 700; line-height: 1.1; }
.video__play {
  position: relative; display: inline-flex; align-items: center; gap: 2.4cqi;
  margin-top: 4.5cqi; color: var(--text); font-size: max(13px, 1.9cqi); font-weight: 600;
}
.video__button {
  display: grid; place-items: center;
  width: max(44px, 9cqi); height: max(44px, 9cqi); border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  transition: background-color 120ms linear;
}
.video__button .icon { width: 42%; height: 42%; margin-left: 6%; }
.video__poster:hover .video__button { background: var(--accent-hover); }
.video__poster:hover .video__play { color: var(--accent); }
.video__footer {
  position: absolute; left: 7cqi; right: 7cqi; bottom: 3.2cqi;
  padding-top: 1.4cqi; border-top: 1px solid var(--rule);
  color: var(--text-muted); font-size: max(11px, 1.5cqi);
}
.video__poster:focus-visible { outline-offset: -4px; }
@container (max-width: 480px) {
  .video__footer { display: none; }
  .video__poster { padding-bottom: 0; }
}

.video-note { margin-top: 12px; }

/* --- Slide mock-up (experiment pages) ------------------------------------ */

.slide-figure { margin: 0; }
.slide {
  container-type: inline-size;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--rule); background: var(--bg); color: var(--text);
}
.slide__inner { display: flex; flex-direction: column; height: 100%; padding: 5cqi 6cqi 3cqi; }
.slide__headline { margin: 0; max-width: none; color: var(--heading); font-size: 3.3cqi; font-weight: 700; line-height: 1.15; }
.slide__context { margin: 1cqi 0 0; max-width: none; color: var(--text-muted); font-size: 2.1cqi; line-height: 1.3; }
.slide__chart { flex: none; width: 100%; height: auto; margin-top: 3cqi; }
.slide__source { margin: auto 0 0; padding-top: 1.2cqi; max-width: none; color: var(--text-muted); font-size: 1.6cqi; }
.slide__footer {
  display: flex; justify-content: space-between;
  margin-top: 1.6cqi; padding-top: 1.2cqi; border-top: 1px solid var(--rule);
  color: var(--text-muted); font-size: 1.6cqi;
}
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { stroke: var(--text-muted); stroke-width: 1; }
.chart-bar { fill: var(--accent-soft); }
.chart-bar--focus { fill: var(--accent); }
.chart-value {
  fill: var(--text); font-size: 17px; font-weight: 600; text-anchor: middle;
  paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round;  /* halo over gridlines */
}
.chart-label { fill: var(--text-muted); font-size: 14px; text-anchor: middle; }
.slide-figure figcaption { margin-top: 12px; }

/* --- Experiments ------------------------------------------------------------ */

/* Facts under the page head: models, settings, items, hardware */
.exp-meta { display: flex; flex-wrap: wrap; gap: 6px var(--s3); margin: var(--s3) 0 0; padding: 0; list-style: none; max-width: 40rem; color: var(--text-muted); font-size: var(--fs-small); }
.exp-meta strong { color: var(--text); font-weight: 600; }

/* KPI tiles: the slide's kpis archetype */
.kpis { display: grid; gap: var(--s3); margin: 0; padding: 0; list-style: none; }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { padding: var(--s3); border-top: 4px solid var(--accent); background: var(--bg-tint); }
.kpi__value { display: block; color: var(--heading); font-size: clamp(2.25rem, 1.8rem + 1.6vw, 3rem); font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.kpi__label { display: block; margin-top: var(--s2); color: var(--text); font-weight: 600; line-height: 1.35; }
.kpi__note { display: block; margin-top: 4px; color: var(--text); font-size: var(--fs-small); line-height: 1.45; }  /* body text: muted fails AA on the tint */
.kpis + .takeaway { margin-top: var(--s4); }

/* One finding: text left, slide right on desktop */
.finding { display: grid; gap: var(--s4); padding-block: var(--s5); border-top: 1px solid var(--rule); }
.finding:first-of-type { border-top: 0; padding-top: 0; }
.finding:last-child { padding-bottom: 0; }
@media (min-width: 960px) { .finding { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; } }
.finding .kicker { margin-bottom: var(--s1); }
.finding h2 { font-size: clamp(1.5rem, 1.25rem + 1.1vw, 2rem); }
.finding h2 + p { margin-top: var(--s2); }
.finding .takeaway { margin-top: var(--s3); }

/* Slide frames for charts: height follows the content, text keeps a readable minimum on phones */
.slide--auto { aspect-ratio: auto; }
.slide--auto .slide__inner { height: auto; }
.slide--auto .slide__headline { font-size: max(16px, 3cqi); }
.slide--auto .slide__context { font-size: max(13px, 2cqi); }
.slide--auto .slide__chart { max-width: 30rem; margin-top: max(12px, 2.4cqi); }
.slide--auto .slide__source { margin-top: max(12px, 2.4cqi); padding-top: 0; font-size: max(11px, 1.6cqi); }
.slide--auto .slide__footer { font-size: max(11px, 1.6cqi); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: max(10px, 1.6cqi) 0 0; padding: 0; list-style: none; color: var(--text); font-size: max(12px, 1.7cqi); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; background: var(--accent); }
.chart-legend .is-b { background: var(--chart-2); }
.chart-legend .is-dot { border-radius: 50%; }
.chart-legend .is-ring { border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--accent); }
.chart-bar--b { fill: var(--chart-2); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.chart-dot--ring { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.chart-text { fill: var(--text); font-size: 14px; }
.chart-text--strong { font-weight: 600; }
.chart-text--muted { fill: var(--text-muted); }
.chart-text--end { text-anchor: end; }
.chart-text--mid { text-anchor: middle; }
.chart-risk { fill: var(--risk); font-weight: 600; }
.chart-risk-line { stroke: var(--risk); stroke-width: 1.5; fill: none; }
.chart-bracket { stroke: var(--text); stroke-width: 1.25; fill: none; }
.slide svg g:hover .chart-bar, .slide svg g:hover .chart-bar--b, .slide svg g:hover .chart-dot, .slide svg g:hover .chart-dot--ring { opacity: 0.8; }

/* Tables of full results: scroll inside the frame on narrow screens, never the page */
.table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--rule); }
.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 9px 12px; border-bottom: 1px solid var(--rule); text-align: left; white-space: nowrap; vertical-align: top; }
.data-table thead th { background: var(--bg-panel); color: var(--text); font-weight: 600; }
.data-table .num { text-align: right; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.wrap, .data-table th.wrap { white-space: normal; min-width: 14rem; }
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
.results > details, .finding > * { min-width: 0; }  /* grid items may shrink below their content, so wide tables scroll inside .table-wrap */
.results details { border-top: 1px solid var(--rule); }
.results details:last-child { border-bottom: 1px solid var(--rule); }
.results summary { display: flex; align-items: center; min-height: 52px; color: var(--heading); font-weight: 600; cursor: pointer; }
.results summary:hover { color: var(--accent-hover); }
.results details[open] summary { margin-bottom: var(--s2); }
.results details > p { margin: var(--s2) 0; }
.results details > :last-child { margin-bottom: var(--s3); }
.section-head + .results, .section-head + .table-wrap { margin-top: 0; }
.table-wrap + .table-wrap, .table-wrap + p, p + .table-wrap { margin-top: var(--s3); }

/* Cite block */
.cite { max-width: var(--measure); margin: var(--s2) 0 0; padding: var(--s2) var(--s3); border-left: 4px solid var(--accent); background: var(--bg-panel); color: var(--text); font-size: var(--fs-small); overflow-wrap: anywhere; }

/* Experiment list (/experiments/) */
.exp-card h3 a { color: var(--heading); text-decoration: none; }
.exp-card h3 a:hover { color: var(--accent-hover); text-decoration: underline; }
.exp-card .meta { margin: 0 0 var(--s1); color: var(--text); }
.exp-card .actions { margin-top: var(--s3); }

/* --- Editorial rows (About) -------------------------------------------------- */

.row { display: grid; gap: var(--s3); padding-block: var(--s5); border-top: 1px solid var(--rule); }
.row:first-child { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row .kicker { margin-bottom: var(--s1); }
@media (min-width: 900px) {
  .row { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); }
}

/* --- Video entries (/videos/): newest first, sources folded ------------------ */

.entries { display: grid; }
.entry { padding-block: var(--s4); border-top: 1px solid var(--rule); }
.entry:first-child { border-top: 0; padding-top: 0; }
.entry .meta { margin-bottom: var(--s1); }
.entry h2 { font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.75rem); }
.entry h2 + p { margin-top: var(--s2); }
.entry .actions { margin-top: var(--s3); }
.entry__sources { max-width: var(--measure); margin-top: var(--s3); }
.entry__sources summary { display: flex; align-items: center; min-height: 44px; color: var(--accent); font-weight: 600; cursor: pointer; }
.entry__sources summary:hover { color: var(--accent-hover); text-decoration: underline; }
.sources { margin: var(--s1) 0 0; padding-left: 1.5em; font-size: var(--fs-small); line-height: 1.5; }
.sources li { margin-bottom: 6px; overflow-wrap: anywhere; }
.entries + .caption { margin-top: var(--s4); }

/* --- Dark band (closing call to action) ---------------------------------- */

.band { padding-block: var(--section); background: var(--band-bg); color: var(--on-band); }
.band h2 { color: var(--on-band); }
.band p { color: var(--band-text); }
.band a:not(.btn) { color: var(--on-band); }
.band__inner { display: grid; gap: var(--s4); align-items: center; }
.band__text p { margin-top: var(--s2); font-size: var(--fs-lead); line-height: 1.4; }
@media (min-width: 900px) {
  .band__inner { grid-template-columns: minmax(0, 1fr) auto; gap: var(--s5); }
}
.band .actions { margin-top: 0; }
.band .caption { margin-top: var(--s2); color: var(--band-text); font-size: var(--fs-small); }

/* --- Legal / long text --------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose h2 { margin: var(--s5) 0 var(--s2); color: var(--text); font-size: var(--fs-h3); font-weight: 600; line-height: 1.3; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: var(--s4) 0 var(--s1); font-size: 1.0625rem; font-weight: 700; }
.prose ul { margin: 0 0 var(--s2); padding-left: 1.25em; }
.prose li { margin-bottom: 6px; }
.prose .bullets { padding-left: 0; }
.prose .bullets li { margin-bottom: 0; }
.prose address { margin-bottom: var(--s2); }

/* --- Footer: echoes the slide footer -------------------------------------- */

.site-footer { padding-block: var(--s4) var(--s5); color: var(--text-muted); font-size: var(--fs-meta); }
.site-footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s2) var(--s4);
  padding-top: var(--s3); border-top: 1px solid var(--rule);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

.social { display: flex; gap: 4px; margin: 0 0 0 -10px; padding: 0; list-style: none; }
.social a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: var(--radius-sm); color: var(--text-muted);
}
.social a:hover { background: var(--bg-tint); color: var(--accent); }
.social .icon { width: 22px; height: 22px; }

@media (min-width: 720px) { .social { margin: 0; } }

/* --- Links page (/links/) --------------------------------------------- */

.page-links { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.page-links main { flex: 1; }
.links { width: 100%; max-width: 440px; margin: 0 auto; padding: var(--s5) var(--s2) var(--s4); text-align: center; }
.links__portrait { width: 112px; height: 112px; margin: 0 auto var(--s3); border-radius: 50%; object-fit: cover; }
.links h1 { font-size: 1.75rem; }
.links .accent-bar { margin: var(--s2) auto; }
.links__intro { margin: 0 auto; color: var(--text-muted); font-size: 1rem; line-height: 1.45; }
.links__list { display: grid; gap: 12px; margin: var(--s4) 0 0; padding: 0; list-style: none; }
.links__list .btn { width: 100%; min-height: 52px; }
.page-links .site-footer__inner { justify-content: center; text-align: center; }
.page-links .social { margin: 0; }

/* --- 404 --------------------------------------------------------------- */

.page-404 .page-head { border-bottom: 0; }
.page-404 .page-head__inner { padding-block: clamp(64px, 10vw, 144px); }

/* --- Motion: fade in with a 12 px rise on first view (JS adds the classes) -- */

.reveal-pending { opacity: 0; transform: translateY(12px); }
.reveal-pending.is-revealed {
  opacity: 1; transform: none;
  transition: opacity 450ms var(--ease), transform 450ms var(--ease);
  transition-delay: calc(var(--reveal-i, 0) * 90ms);
}

/* Theme switch: a short cross-fade while the toggle is used (site.js adds the class) */
@media (prefers-reduced-motion: no-preference) {
  .theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
    transition: background-color 200ms linear, border-color 200ms linear, color 200ms linear, fill 200ms linear, stroke 200ms linear !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal-pending { opacity: 1; transform: none; }
}

@media print {
  .reveal-pending { opacity: 1; transform: none; }
  .site-header, .site-footer, .skip-link, .video { display: none; }
}
