/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #F7F5F0;
  --bg-2: #EFECE5;          /* tinted sections, tiles */
  --card: #FFFFFF;
  --ink: #1A1917;
  --ink-2: #4A4741;
  --muted: #76726A;
  --line: #E0DCD2;
  --accent: #04806A;        /* marks (validated chart hue) */
  --accent-ink: #03664F;    /* text-safe on --bg */
  --accent-wash: rgba(4, 128, 106, .10);
  --before: #8E897F;        /* de-emphasis mark: "before" values */
  --linkedin: #0A66C2;      /* LinkedIn's brand blue */
  --linkedin-fill: #0A66C2;
  --mail-fill: #04806A;     /* white text stays readable on it in both themes */
  --shadow: 0 1px 2px rgba(26, 25, 23, .04), 0 12px 40px -12px rgba(26, 25, 23, .14);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: 20px;
  --narrow: 760px;
  --wide: 1240px;
  --radius: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --bg-2: #1C1B19;
    --card: #222120;
    --ink: #EEEBE4;
    --ink-2: #C4C0B7;
    --muted: #8F8B82;
    --line: #34322E;
    --accent: #2BA696;
    --accent-ink: #5CC4B3;
    --accent-wash: rgba(43, 166, 150, .14);
    --before: #77736B;
    --linkedin: #71B7FB;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 48px -16px rgba(0, 0, 0, .6);
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 1em; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -.015em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: 1.02; letter-spacing: -.025em; }
h2 { font-size: clamp(2.1rem, 5vw, 3.75rem); line-height: 1.06; }
h3 { font-size: clamp(1.6rem, 3.4vw, 2.6rem); line-height: 1.12; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 100; background: var(--card); padding: 8px 14px; border-radius: 8px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.narrow > * { max-width: var(--narrow); }
.center { text-align: center; }
.center > * { margin-inline: auto; }
.muted { color: var(--muted); }
.dot { color: var(--muted); padding: 0 .2em; }

.eyebrow {
  font-size: .9375rem; font-weight: 600; color: var(--accent-ink);
  margin-bottom: 1.1rem; letter-spacing: .005em; text-wrap: balance;
}
.kicker { font-size: .875rem; font-weight: 500; color: var(--muted); margin-bottom: .9rem; }
.kicker a { color: inherit; }
.lead { font-size: clamp(1.125rem, 2.1vw, 1.3125rem); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .8em 1.4em; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 500 .9375rem/1 var(--sans); text-decoration: none;
  border: 1px solid var(--ink);
  transition: transform .2s var(--ease), background-color .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-sm { padding: .55em 1.05em; font-size: .875rem; }
.btn .ico { width: 1.05em; height: 1.05em; flex: none; margin-left: -.15em; }

/* contact buttons: brand-colored icon at rest, filled with that color on hover */
.btn-li .ico { color: var(--linkedin); }
.btn-li:hover { background: var(--linkedin-fill); border-color: var(--linkedin-fill); color: #fff; }
.btn-mail .ico { color: var(--accent); }
.btn-mail:hover, .btn-mail-solid { background: var(--mail-fill); border-color: var(--mail-fill); color: #fff; }
.btn-li:hover .ico, .btn-mail:hover .ico { color: #fff; }

/* ---------------------------------------------------------------- nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-inner {
  width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto;
  display: flex; align-items: center; gap: 24px; height: 60px;
}
.nav-name { font-family: var(--serif); font-size: 1.1875rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.nav nav { display: none; gap: 28px; }
.nav nav a { color: var(--ink-2); text-decoration: none; font-size: .9375rem; }
.nav nav a:hover { color: var(--ink); }
@media (min-width: 760px) { .nav nav { display: flex; } }

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(72px, 14vh, 150px) 0 clamp(24px, 4vw, 48px); }
.hero h1 { margin-bottom: .45em; max-width: 17ch; position: relative; }

/* the landing intro (intro.js): until it lands, only the headline's words that have arrived show. The head script
   adds .intro, intro.js adds .intro-live when it takes over, then .intro-done to bring the rest of the hero in. */
.hero { overflow-x: clip; }
.hero h1 .v { position: relative; }
html.intro .nav { opacity: 0; pointer-events: none; }
html.intro .hero .reveal { opacity: 0; transform: translateY(14px); pointer-events: none; }
html.intro.intro-clear .nav, html.intro.intro-clear .hero .reveal { transition: opacity .35s var(--ease), transform .35s var(--ease); }   /* a replay clears the page first */
html.intro:not(.intro-done) .hero h1 .ink { opacity: 0; transition: opacity .3s var(--ease); }
html.intro .hero h1.reveal { opacity: 1; transform: none; transition: none; isolation: isolate; }
html.intro .hero h1 .w { opacity: 0; filter: blur(.06em); transition: opacity .34s var(--ease), filter .34s var(--ease); }
html.intro .hero h1 .w.on { opacity: 1; filter: none; }
html.intro.intro-done .nav { opacity: 1; pointer-events: auto; transition: opacity .7s var(--ease) .1s; }
html.intro.intro-done .hero .reveal { opacity: 1; transform: none; pointer-events: auto; transition: opacity .8s var(--ease), transform .8s var(--ease); }
html.intro.intro-done .hero .lead { transition-delay: .1s; }
html.intro.intro-done .hero .actions { transition-delay: .2s; }
html.intro.intro-done .hero .replay-row { transition-delay: .3s; }
html.intro.intro-done .hero .stats { transition-delay: .35s; }

/* hand-drawn underline under .mark phrases, one stroke per line of text (main.js) */
h1:has(> .mark), h2:has(> .mark) { position: relative; }
.ink { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.ink path { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.hero .lead { max-width: 640px; margin-inline: auto; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 2rem; }

/* "Replay intro" (main.js shows it when motion is allowed; intro.js plays it with a speed pill) */
.replay-row { margin: 1rem auto 0; }
.intro-replay {
  appearance: none; background: none; border: 0; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; gap: .45em; padding: .55em .9em; border-radius: 999px;
  font: 500 .875rem/1 var(--sans); transition: color .2s, background-color .2s;
}
.intro-replay:hover { color: var(--ink); background: var(--bg-2); }
.intro-replay .ico { width: 1.05em; height: 1.05em; transition: transform .6s var(--ease); }
.intro-replay:hover .ico { transform: rotate(-320deg); }

.stats {
  display: grid; gap: 12px; margin-top: clamp(64px, 10vw, 120px);
  grid-template-columns: 1fr;
}
@media (min-width: 860px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: var(--bg-2); border-radius: var(--radius); padding: clamp(28px, 3.4vw, 40px); }
.stat-num {
  font: 600 clamp(2.5rem, 5.2vw, 3.75rem)/1 var(--sans);
  letter-spacing: -.035em; margin-bottom: .5em; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat-num .arrow { color: var(--accent); font-weight: 400; display: inline-block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* stat tiles animate once (main.js): the arrow slides in and the count climbs, the total rolls up, the cards type */
.stat-num .later { transition: opacity .3s; }
.stat-num.pre .later { opacity: 0; }
.stat-num.pre .arrow { opacity: 0; transform: translateX(-.7em); }
.stat-num .arrow { transition: opacity .35s var(--ease), transform .6s var(--ease); }
.reel { display: inline-block; height: 1.1em; overflow: hidden; vertical-align: top; margin-top: -.05em; }
.reel > span { display: block; transition: transform 1.5s cubic-bezier(.16, .84, .3, 1); }
.reel b { display: block; height: 1.1em; line-height: 1.1em; font-weight: inherit; }
.typed .rest { visibility: hidden; }
.caret { display: inline-block; width: .06em; height: .9em; margin: 0 .02em -.08em; background: var(--accent); }
.caret.blink { animation: blink 1s steps(1) infinite; }
.caret.gone { opacity: 0; transition: opacity .4s; }
@keyframes blink { 50% { opacity: 0; } }
.stat-cap { color: var(--ink-2); margin: 0; font-size: 1rem; line-height: 1.5; max-width: 30ch; }

/* ---------------------------------------------------------------- sections */
.section { padding: clamp(88px, 13vw, 168px) 0; }
.section.tint { background: var(--bg-2); }
.section > .narrow { margin-bottom: clamp(40px, 6vw, 72px); }

/* case studies */
.case { margin-top: clamp(72px, 11vw, 144px); }
.sep { height: 1px; background: var(--ink-2); opacity: .35; margin-bottom: clamp(48px, 7vw, 88px); transform-origin: left; }
.org { font: 600 clamp(1.4rem, 2.6vw, 1.875rem)/1.15 var(--sans); letter-spacing: -.02em; color: var(--ink); margin-bottom: .4rem; }
.case h3 { max-width: 20ch; }
.shot { margin-top: clamp(28px, 4vw, 48px); margin-bottom: 0; }
.shot img { border-radius: var(--radius); box-shadow: var(--shadow); background: var(--bg-2); }
.shot figcaption { color: var(--muted); font-size: .8125rem; margin-top: 14px; text-align: center; }

/* the walkthrough videos: each fades in over its still, plays once, and ends on that same still */
.motion { position: relative; }
.motion video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius);
  opacity: 0; transition: opacity .6s var(--ease); pointer-events: none; }
.motion.playing video { opacity: 1; }
.replay {
  position: absolute; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 0; border-radius: 999px; background: rgba(20, 20, 19, .55); color: #fff;
  font: 500 .8125rem/1 var(--sans); cursor: pointer; opacity: 0; pointer-events: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: opacity .4s var(--ease), background .2s;
}
.motion.ended .replay { opacity: 1; pointer-events: auto; }
.replay:hover { background: rgba(20, 20, 19, .72); }
.replay:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.story {
  display: grid; gap: 28px 48px; margin-top: clamp(40px, 6vw, 72px);
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .story { grid-template-columns: repeat(3, 1fr); } }
.beat-h, .fact-h, .rule-h, .lookback-h {
  font-weight: 600; color: var(--ink); margin-bottom: .45em; font-size: 1.0625rem;
}
.beat p:not(.beat-h) { color: var(--ink-2); }

.facts {
  display: grid; gap: 12px; margin-top: clamp(32px, 4vw, 48px);
  grid-template-columns: 1fr;
}
@media (min-width: 700px) { .facts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .facts-3 { grid-template-columns: repeat(3, 1fr); } }
.fact { background: var(--bg-2); border-radius: 20px; padding: 26px 28px; }
.fact p:last-child { margin: 0; color: var(--ink-2); font-size: 1rem; }
.fact-feature { grid-column: 1 / -1; display: grid; gap: 4px 48px; padding: clamp(26px, 3.4vw, 40px); }
@media (min-width: 900px) { .fact-feature { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; } }
.fact-big { font: 600 clamp(2rem, 4vw, 2.75rem)/1.05 var(--sans); letter-spacing: -.035em; color: var(--ink); margin: .2em 0 .25em; }
.fact-big .arrow { color: var(--accent); font-weight: 400; }
.fact-sub { color: var(--muted); font-size: .9375rem; margin: 0 0 .9em; }

/* projects */
.projects { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .projects { grid-template-columns: repeat(2, 1fr); } }
.project {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(28px, 4vw, 48px);
}
.project h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
.project > p:not(.kicker) { color: var(--ink-2); }
.project > p:last-child { margin-bottom: 0; }
.project strong { color: var(--ink); }

/* ---------------------------------------------------------------- charts (HTML, so they reflow on phones) */
.chart { margin: 28px 0; padding: 22px 22px 18px; border: 1px solid var(--line); border-radius: 18px; }
.chart-title { font-weight: 600; margin-bottom: .2em; }
.chart-sub { color: var(--muted); font-size: .875rem; line-height: 1.45; margin-bottom: 14px; }
.chart figcaption { color: var(--muted); font-size: .8125rem; line-height: 1.5; margin-top: 18px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 6px; font-size: .8125rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.key { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.key-before { background: var(--before); }
.key-after { background: var(--accent); }

/* shared track + axis: positions come from --x / --a / --b percentages set inline */
.db-track, .ci-track, .bar-track {
  position: relative; height: 28px;
  background:
    linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat;
}
.db-label, .ci-label, .bar-label { font-size: .875rem; color: var(--ink-2); margin: 12px 0 2px; display: flex; justify-content: space-between; gap: 12px; }
.ci-label b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.muted-row .ci-label b { color: var(--muted); font-weight: 500; }
.axis { position: relative; height: 22px; margin-top: 8px; border-top: 1px solid var(--line); }
.axis span {
  position: absolute; left: var(--x); top: 6px; transform: translateX(-50%);
  font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.axis span:first-child { transform: none; }
.axis span:last-child { transform: translateX(-100%); }

/* dumbbell */
.db-line {
  position: absolute; top: 50%; height: 2px; margin-top: -1px;
  left: var(--a); width: calc(var(--b) - var(--a)); background: var(--before); opacity: .6;
}
.db-dot {
  position: absolute; top: 50%; left: var(--x); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; box-shadow: 0 0 0 2px var(--card); cursor: default;
}
.db-dot.before { background: var(--before); }
.db-dot.after { background: var(--accent); }
.db-dot b {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font: 600 .75rem/1 var(--sans); color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.db-track { margin-top: 14px; }

/* bars */
.bar-track { display: flex; align-items: center; background: none; padding-right: 36px; }
.bar {
  position: relative; height: 20px; width: var(--w); background: var(--before);
  border-radius: 0 4px 4px 0;
}
.bar.hot { background: var(--accent); }
.bar b {
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 8px;
  font: 600 .875rem/1 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums;
}
.bars .axis { margin-right: 36px; }

/* confidence intervals */
.ci-zero { position: absolute; left: var(--x); top: 2px; bottom: 2px; width: 1px; background: var(--ink-2); opacity: .5; }
.ci-bar {
  position: absolute; top: 50%; height: 2px; margin-top: -1px;
  left: var(--a); width: calc(var(--b) - var(--a)); background: var(--accent); border-radius: 2px;
}
.ci-dot {
  position: absolute; top: 50%; left: var(--x); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card);
}
.muted-row .ci-bar, .muted-row .ci-dot { background: var(--before); }
.stage .chart { background: var(--card); }
.stage-shot { margin: 20px 0 28px; }
.stage-shot img, .stage-shot .motion video { border-radius: 18px; }
.stage-shot figcaption { text-align: left; }

/* ---------------------------------------------------------------- research thread */
.thread {
  --rail: 28px;
  list-style: none; padding: 0; position: relative;
}
.stage { max-width: 900px; }
.thread::before, .thread::after {
  content: ""; position: absolute; left: calc(var(--rail) / 2 - 1px); top: 10px; bottom: 10px; width: 2px;
  border-radius: 2px;
}
.thread::before { background: var(--line); }
.thread::after { background: var(--accent); transform-origin: top; transform: scaleY(var(--p, 1)); }

.stage { position: relative; padding-left: calc(var(--rail) + clamp(16px, 4vw, 40px)); }
.stage + .stage { margin-top: clamp(72px, 12vh, 140px); }
.node {
  position: absolute; left: calc(var(--rail) / 2 - 7px); top: 4px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--line);
  transition: background-color .4s, border-color .4s, transform .4s var(--ease);
}
.stage.lit .node, html:not(.js) .node { background: var(--accent); border-color: var(--accent); }
.stage-when { font-size: .875rem; font-weight: 500; color: var(--muted); margin-bottom: .8rem; }
.stage > p { color: var(--ink-2); }
.stage-links { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .9375rem; margin-top: 1.2rem; }
.stage-links a { font-weight: 500; }

/* cards grow toward the thesis */
.s1 h3 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); }
.s2 h3 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.s3 h3 { font-size: clamp(1.9rem, 4vw, 3rem); }
.s3 {
  isolation: isolate;
  padding: clamp(28px, 4vw, 48px) clamp(20px, 4vw, 48px) clamp(28px, 4vw, 48px) calc(var(--rail) + 8px + clamp(20px, 4vw, 44px));
}
.s3::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 0 calc(var(--rail) + 8px);
  background: var(--bg-2); border-radius: var(--radius);
}
.s3 .node { top: calc(clamp(28px, 4vw, 48px) + 4px); }
.s4 h3 { font-style: italic; font-size: clamp(1.45rem, 2.6vw, 1.9rem); }

.finding { color: var(--ink) !important; font-size: 1.0625rem; }
.finding-num {
  font: 600 2.25rem/1 var(--sans); letter-spacing: -.03em; color: var(--ink);
  display: block; margin-bottom: .2em;
}
.finding-num.sm { display: inline; font-size: inherit; letter-spacing: 0; }

.lookback {
  border-left: 2px solid var(--accent); padding: 4px 0 4px 18px; margin: 20px 0;
}
.lookback p:last-child { margin: 0; color: var(--ink-2); font-size: 1rem; }

.pull {
  font-family: var(--serif); font-style: italic; font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.3;
  margin: 28px 0; padding: 0; color: var(--ink); text-wrap: balance;
}

.chips { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li {
  font-size: .8125rem; line-height: 1; padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.chips li.new { background: var(--accent-wash); border-color: transparent; color: var(--accent-ink); font-weight: 500; }

/* ---------------------------------------------------------------- how I work */
.rules { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .rules { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .rules { grid-template-columns: repeat(3, 1fr); } }
.rule { background: var(--card); border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.rule-n { font: 500 .8125rem/1 var(--sans); color: var(--accent-ink); margin-bottom: 1.4rem; font-variant-numeric: tabular-nums; }
.rule-h { font-family: var(--serif); font-weight: 400; font-size: 1.375rem; line-height: 1.2; }
.rule p:last-child { color: var(--ink-2); margin: 0; font-size: 1rem; }

/* ---------------------------------------------------------------- about */
.about p { font-size: clamp(1.0625rem, 1.8vw, 1.1875rem); color: var(--ink-2); }
.contact { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2rem; }
.where { color: var(--muted); font-size: .9375rem; margin-top: 1.4rem; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .875rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; }
.footer p { margin: 0; }

/* ---------------------------------------------------------------- PDF viewer (wide screens; phones open a new tab) */
html.modal-open { overflow: hidden; }
.pdf {
  width: min(1100px, 100vw - 48px); height: min(92vh, 1240px); max-width: none; max-height: none;
  padding: 0; border: 0; border-radius: 20px; overflow: hidden;
  background: var(--card); color: var(--ink);
  box-shadow: 0 40px 100px -24px rgba(0, 0, 0, .5);
}
.pdf[open] { display: flex; flex-direction: column; animation: pdf-in .35s var(--ease); }
.pdf::backdrop { background: rgba(20, 20, 19, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pdf-bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--line); }
.pdf-title { margin: 0 auto 0 0; font-weight: 600; font-size: .9375rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-close {
  width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line);
  background: transparent; color: var(--ink); font: 400 1.375rem/1 var(--sans); cursor: pointer;
}
.pdf-close:hover { border-color: var(--ink-2); }
.pdf iframe { flex: 1; width: 100%; border: 0; background: var(--bg-2); }
@keyframes pdf-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }

/* ---------------------------------------------------------------- motion (JS adds .js; content shows without it) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  /* separators draw left to right */
  .js .sep { transform: scaleX(0); transition: transform 1.4s var(--ease); }
  .js .sep.in { transform: none; }

  /* charts build when they scroll into view; --d staggers the rows */
  .bar-row:nth-child(2), .db-row:nth-child(2) { --d: .15s; }
  .bar-row:nth-child(3), .db-row:nth-child(3) { --d: .3s; }
  .ci-row:nth-child(2) { --d: .35s; }
  .ci-row:nth-child(3) { --d: 1s; }        /* the placebo lands last, on its own beat */

  .js .chart .bar { width: 0; transition: width 1s var(--ease) var(--d, 0s); }
  .js .chart .bar b { opacity: 0; transition: opacity .4s calc(var(--d, 0s) + .8s); }
  .js .chart.in .bar { width: var(--w); }
  .js .chart.in .bar b { opacity: 1; }

  /* dumbbell: each inflated value appears, then the per-company value slides down from it */
  .js .chart .db-dot.before { transform: scale(0); transition: transform .45s var(--ease) var(--d, 0s); }
  .js .chart .db-dot.after { left: var(--from); opacity: 0;
    transition: left 1.1s var(--ease) calc(var(--d, 0s) + .8s), opacity .2s calc(var(--d, 0s) + .8s); }
  .js .chart .db-line { transform: scaleX(0); transform-origin: right; transition: transform 1.1s var(--ease) calc(var(--d, 0s) + .8s); }
  .js .chart.in .db-dot.before, .js .chart.in .db-line { transform: none; }
  .js .chart.in .db-dot.after { left: var(--x); opacity: 1; }

  /* confidence intervals: the estimate pops in, then its interval opens out from it */
  .js .chart .ci-dot { transform: scale(0); transition: transform .4s var(--ease) var(--d, 0s); }
  .js .chart .ci-bar { transform: scaleX(0); transition: transform .8s var(--ease) calc(var(--d, 0s) + .25s); }
  .js .chart.in .ci-dot, .js .chart.in .ci-bar { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .thread::after { transform: none; }
  .node { transition: none; }
  .btn { transition: none; }
  .pdf[open] { animation: none; }
}

/* ---------------------------------------------------------------- built with (under each case study) */
.stack { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 14px; margin-top: 22px; }
.stack-h { margin: 0; font-size: .8125rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.stack-list { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 0; }
.stack-list li {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: .8125rem; line-height: 1.2; color: var(--ink-2);
}
.stack-list svg { width: 15px; height: 15px; flex: none; color: var(--c, var(--ink)); }
.stack-list .evals span { color: var(--muted); font-size: .75rem; }

/* ---------------------------------------------------------------- fact icons (each plays once, when it scrolls in) */
.fact-ico { display: block; width: 44px; height: 44px; margin-bottom: 14px; color: var(--accent); overflow: visible; }
.fact-ico * { transform-box: fill-box; transform-origin: center; }
.ico-devices .d1, .ico-devices .d2, .ico-devices .d3 { opacity: 0; }
.ico-camera .flash { opacity: 0; }

@media (prefers-reduced-motion: no-preference) {
  .js .fact-ico:not(.in) * { animation-play-state: paused !important; }

  .js .ico-sparkle .a { animation: ico-pop .7s cubic-bezier(.3, 1.6, .5, 1) both; }
  .js .ico-sparkle .b { animation: ico-twinkle 1s .45s ease-out both; }
  .js .ico-graded .a { animation: ico-rise .6s var(--ease) both; }
  .js .ico-graded .b { stroke-dasharray: 1; animation: ico-draw .55s .5s ease-out both; }
  .js .ico-audit .a { animation: ico-scan 1.4s .1s var(--ease) both; }
  .js .ico-devices .d1 { animation: ico-blink .75s .05s both; }
  .js .ico-devices .d2 { animation: ico-blink .75s .8s both; }
  .js .ico-devices .d3 { animation: ico-blink .75s 1.55s both; }
  .js .ico-devices .d4 { animation: ico-settle .5s 2.3s var(--ease) both; }
  .js .ico-camera .a { animation: ico-shutter .5s .35s ease-in-out both; }
  .js .ico-camera .flash { animation: ico-flash .7s .45s ease-out both; }
  .js .ico-tag .a { transform-origin: 74% 22%; animation: ico-swing 1.3s .1s ease-out both; }
  .js .ico-tally .a { animation: ico-fade .5s .3s both; }
  .js .ico-tally .b { transform-origin: bottom; animation: ico-grow .6s .6s var(--ease) both; }
  .js .ico-tally .c { stroke-dasharray: 1; animation: ico-draw .45s 1.1s ease-out both; }
  .js .ico-shield .a { animation: ico-pop .6s cubic-bezier(.3, 1.5, .5, 1) both; }
  .js .ico-shield .b { stroke-dasharray: 1; animation: ico-draw .5s .45s ease-out both; }
}
@keyframes ico-pop { from { transform: scale(.3) rotate(-35deg); opacity: 0; } }
@keyframes ico-twinkle { 0% { transform: scale(0); } 55% { transform: scale(1.35); } 100% { transform: scale(1); } }
@keyframes ico-rise { from { transform: translateY(8px); opacity: 0; } }
@keyframes ico-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes ico-scan { 0% { transform: translateX(-20px); } 60% { transform: translateX(2px); } 100% { transform: none; } }
@keyframes ico-blink { 0% { opacity: 0; transform: scale(.85); } 25%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(1.05); } }
@keyframes ico-settle { from { opacity: 0; transform: scale(.85); } }
@keyframes ico-shutter { 50% { transform: scale(.55); } }
@keyframes ico-flash { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: .35; } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes ico-swing { 0% { transform: rotate(-28deg); opacity: 0; } 15% { opacity: 1; } 40% { transform: rotate(14deg); } 65% { transform: rotate(-6deg); } 85% { transform: rotate(2deg); } 100% { transform: none; } }
@keyframes ico-fade { to { opacity: 0; } }
@keyframes ico-grow { from { transform: scaleY(.15); } }

/* ---------------------------------------------------------------- the finale between Research and About */
.has-finale { padding-bottom: 24px; }
.finale { position: relative; height: clamp(520px, 78vh, 760px); }
html:not(.js) .finale { display: none; }
.finale-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.finale-svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.finale-svg .turn-base { stroke: var(--line); stroke-width: 2; }
.finale-svg .turn { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 1; stroke-dashoffset: 1; }
.finale-svg .drop { stroke: var(--accent); stroke-width: 3; visibility: hidden; }
.band {
  position: absolute; left: 0; right: 0; top: 112px; display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px 12px; padding: 0 clamp(4px, 4vw, 56px);
}
.band > span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; border-radius: 999px; opacity: 0; will-change: transform, opacity; }
.band .tool {
  padding: 8px 14px 8px 10px; background: var(--card); border: 1px solid var(--line); font-size: .875rem; color: var(--ink-2);
  box-shadow: 0 6px 18px -12px rgba(26, 25, 23, .3);
}
.band .tool svg { width: 18px; height: 18px; flex: none; color: color-mix(in srgb, var(--accent) var(--mix, 0%), var(--c)); }
.band .chip { padding: 7px 12px; background: var(--accent-wash); color: var(--accent-ink); font-size: .8125rem; font-weight: 500; }
.glow {
  position: absolute; left: 50%; top: 58%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 12px var(--accent-wash); transform: scale(0);
}
@media (max-width: 700px) { .band .x-sm { display: none; } .band { top: 96px; gap: 10px; } }
@media (prefers-reduced-motion: reduce) {
  .finale { height: 120px; }
  .band, .glow, .finale-svg .drop { display: none; }
  .finale-svg .turn { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .js .stack-list li { opacity: 0; transform: translateY(6px); transition: opacity .4s calc(var(--i) * 45ms), transform .5s var(--ease) calc(var(--i) * 45ms); }
  .js .stack.in .stack-list li { opacity: 1; transform: none; }
}
