:root {
  color-scheme: dark;
  --paper: #000;
  --ink: #f4f4f4;
  --muted: #8c8c8c;
  --line: #1c1c1c;
  --header-height: 80px;
  /* One left/right margin for the whole site: logo, phone, slide content and footer line up on it. */
  --gutter: clamp(20px, 4vw, 72px);
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
/* Reddit Mono, only for the texts given this class. */
.font-mono { font-family: "Reddit Mono", ui-monospace, Menlo, monospace; }

* { box-sizing: border-box; }
html { scroll-snap-type: y proximity; scroll-padding-top: var(--header-height); }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 6px; }
p, h1, h2 { margin: 0; }
::selection { color: #000; background: #f4f4f4; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 10; padding: 16px; color: var(--paper); background: var(--ink); }
.skip-link:focus { top: 16px; }

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 3;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.wordmark { font-size: 1.375rem; font-weight: 800; letter-spacing: -.07em; }
.wordmark span { color: #777; }
.site-nav, .section-counter, .eyebrow, .format-label, .frame-label { font-size: .875rem; }
.wordmark, .section-counter { flex-shrink: 0; white-space: nowrap; }
/* Main navigation: grey links, the current page in white. */
.site-nav { display: flex; align-items: center; white-space: nowrap; }
/* With the counter moved to the bottom, the navigation stays centred in the header. */
.site-nav { position: absolute; left: 50%; transform: translateX(-50%); }
.site-nav a { color: var(--muted); transition: color .2s ease; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink); }
.nav-divider { padding: 0 12px; color: #555; }
.section-counter { font-variant-numeric: tabular-nums; }
.counter-divider { padding: 0 12px; color: #555; }

main { padding-top: var(--header-height); }
.story-section {
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
  padding: clamp(32px, 5vw, 76px);
  border-bottom: 1px solid var(--line);
  scroll-snap-align: start;
  display: flex;
}
.section-inner { width: 100%; max-width: 1400px; margin: auto; }
.section-heading, .section-bottom, .frame-footer { display: flex; justify-content: space-between; gap: 20px; }
.eyebrow { color: var(--muted); margin-bottom: 32px; line-height: 1.5; }
.eyebrow.font-mono { text-transform: uppercase; }
.format-label { color: var(--muted); text-align: right; }
h1 { font-size: clamp(2.5rem, 4.8vw, 5rem); font-weight: 500; line-height: 1.05; letter-spacing: -.055em; margin-bottom: 30px; }
h2 { font-size: clamp(2.4rem, 3.9vw, 4.7rem); line-height: 1.07; letter-spacing: -.05em; font-weight: 500; }
h2 em { font-style: normal; color: #7a7a7a; }
.placeholder { min-width: 0; min-height: 380px; padding: 24px; border: 1px dashed #3a3a3a; background: #0b0b0b; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; }
.hero-placeholder { min-height: 300px; height: min(48vh, 560px); }
.frame-label { color: var(--muted); }
.placeholder-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.placeholder-symbol { font-size: clamp(2.5rem, 5vw, 5rem); line-height: 1; letter-spacing: -.06em; color: #555; margin-bottom: 8px; }
.placeholder-center p { font-size: clamp(1.125rem, 1.8vw, 1.6rem); letter-spacing: -.03em; line-height: 1.25; }
.placeholder-center > span:last-child, .frame-note, .frame-footer { font-size: .875rem; color: var(--muted); line-height: 1.6; }
.frame-footer > span:last-child { white-space: nowrap; }
.section-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .875rem; line-height: 1.6; }
.section-bottom p { color: var(--muted); }
.section-bottom a { text-decoration: underline; text-underline-offset: 4px; flex-shrink: 0; }
.section-reveal { background: var(--paper); }
.statement { font-size: clamp(3.25rem, 7.2vw, 8rem); max-width: 1000px; line-height: 1.03; letter-spacing: -.065em; }
.statement .statement-period { color: #7a7a7a; }
.reveal-copy { max-width: 490px; font-size: clamp(1.125rem, 1.6vw, 1.375rem); line-height: 1.6; margin-top: 38px; color: var(--muted); }
.section-reveal .section-bottom { margin-top: 80px; }
/* The line under "That feeling was on purpose." comes in once the headline has typed itself out. */
.section-reveal.is-current .reveal-copy { animation: letter-appear .6s ease-out 1.5s both; }

/* "That feeling was on purpose.": the feeling itself, very light. Soft pastel lights to the right of the words come
   one after another (mint, lilac, peach, sky): each fades in, drifts a little and grows, then settles back
   and fades as the next one takes over, like a mood changing. One full round takes 5.6 s. */
.reveal-glow { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity 1s ease; }
.section-reveal.is-current .reveal-glow { opacity: 1; }
.section-reveal .section-inner { position: relative; }
.reveal-glow i { position: absolute; width: var(--size); aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, var(--tint) 0%, transparent 62%); filter: blur(40px); mix-blend-mode: screen; opacity: 0; will-change: transform, opacity; }
.section-reveal.is-current .reveal-glow i { animation: glow-mood 5.6s ease-in-out var(--delay) infinite both; }
.reveal-glow i:nth-child(1) { --tint: #9ff0d0; --alpha: .3; --size: 58vw; --delay: 0s; --dx: 4vw; --dy: -3vh; left: 46%; top: 4%; }
.reveal-glow i:nth-child(2) { --tint: #c9b6ff; --alpha: .32; --size: 60vw; --delay: 1.4s; --dx: -3vw; --dy: 4vh; left: 56%; top: 18%; }
.reveal-glow i:nth-child(3) { --tint: #ffc6ac; --alpha: .26; --size: 54vw; --delay: 2.8s; --dx: 5vw; --dy: 3vh; left: 50%; top: -8%; }
.reveal-glow i:nth-child(4) { --tint: #a9d8ff; --alpha: .3; --size: 58vw; --delay: 4.2s; --dx: -4vw; --dy: -3vh; left: 60%; top: 26%; }
@keyframes glow-mood {
  0% { opacity: 0; transform: translate(0, 0) scale(.85); }
  22% { opacity: var(--alpha); transform: translate(calc(var(--dx) * .5), calc(var(--dy) * .5)) scale(1); }
  45% { opacity: var(--alpha); transform: translate(var(--dx), var(--dy)) scale(1.15); }
  70% { opacity: 0; transform: translate(calc(var(--dx) * .6), calc(var(--dy) * .6)) scale(.95); }
  100% { opacity: 0; transform: translate(0, 0) scale(.85); }
}
.split-layout { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(28px, 5vw, 72px); }
.section-copy > p { max-width: 390px; margin-top: 28px; font-size: 1.125rem; line-height: 1.6; color: var(--muted); }
.story-section.is-current .section-inner { animation: section-enter 440ms ease-out both; }
@keyframes section-enter { from { opacity: .6; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.section-reveal.is-current .section-inner { animation: none; }
.reveal-word { display: inline-block; white-space: nowrap; }
.reveal-letter { display: inline-block; opacity: 0; }
.section-reveal.is-current .reveal-letter {
  animation: letter-appear var(--letter-duration) ease-out var(--letter-delay) both;
}
@keyframes letter-appear { from { opacity: 0; } to { opacity: 1; } }

/* Presentation: one slide at a time and no page scrolling (presenter.js adds .is-presenting;
   without it the page falls back to a normal scrolling layout). */
html.is-presenting, html.is-presenting body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* On very wide screens the whole presentation sits in a centred frame. The transform makes the
   body the reference box for every fixed element (header, slides, narrator, footer). */
html.is-presenting body { position: relative; max-width: 2000px; margin: 0 auto; transform: translateZ(0); }
html.is-presenting main { position: fixed; inset: 0; margin: 0; padding: 0; }
/* The header floats transparently over the slides, so the brain can pass beneath it. */
html.is-presenting .site-header { background: transparent; border-bottom-color: transparent; }
html.is-presenting .story-section {
  position: absolute;
  inset: 0;
  min-height: 0;
  padding-top: calc(var(--header-height) + clamp(32px, 5vw, 76px));
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  padding-bottom: clamp(120px, 18vh, 190px);
  border: 0;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, visibility 0s linear .6s;
}
html.is-presenting .story-section.is-active { opacity: 1; visibility: visible; transition-delay: 0s; }

/* Medical sources: in the header row, right of the nav and on its line, on chapters that cite research. */
.sources { position: fixed; top: calc(var(--header-height) / 2 - 10.5px); right: var(--gutter); z-index: 11; display: flex; align-items: baseline; justify-content: flex-end; gap: 12px; max-width: calc(50% - 170px - var(--gutter)); text-align: right; }
.sources-title { flex: none; }
.sources[hidden] { display: none; }
.sources-title { font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-shadow: 0 0 6px #000, 0 0 12px #000; }
.sources-list { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sources-list a { display: inline-block; font-size: .875rem; line-height: 1.5; color: #000; }
/* The source title in a white highlight box, like selected text; the arrow sits outside it. */
.source-label { padding: 1px 4px; color: #000; background: var(--ink); -webkit-box-decoration-break: clone; box-decoration-break: clone; transition: background-color .2s ease; }
.sources-list a::after { content: "\00a0↗"; color: var(--muted); }
.sources-list a:hover .source-label { background: #fff; }

/* Source frame: a centred card over a dimmed slide. */
.source-frame { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: #0d0d0d; box-shadow: 0 30px 90px rgba(0, 0, 0, .7); }
.source-frame::backdrop { background: rgba(0, 0, 0, .72); }
.source-frame[open] { animation: source-in .25s ease-out; }
@keyframes source-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.source-card { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 32px 32px 24px; }
.source-x { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; color: var(--muted); background: none; border: 1px solid #2a2a2a; border-radius: 50%; cursor: pointer; }
.source-x:hover { color: var(--ink); border-color: var(--ink); }
.source-x svg { width: 18px; height: 18px; }
.source-brand { display: flex; align-items: center; gap: 14px; padding-right: 44px; margin-bottom: 6px; }
.source-logo { flex: 0 0 auto; height: 44px; min-width: 44px; display: grid; place-items: center; padding: 8px 12px; border-radius: 12px; background: #fff; }
.source-logo[hidden] { display: none; }
.source-logo img { display: block; max-height: 28px; max-width: 132px; width: auto; height: auto; }
.source-logo.is-wordmark { color: #111; font-size: 1rem; font-weight: 800; letter-spacing: -.02em; }
.source-publisher { display: flex; flex-direction: column; font-size: .9375rem; font-weight: 600; line-height: 1.3; }
.source-publisher small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.source-eyebrow { font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.source-title { padding-right: 40px; font-size: clamp(1.25rem, 2.2vw, 1.625rem); line-height: 1.25; letter-spacing: -.02em; }
.source-meta { font-size: .875rem; color: var(--muted); }
.source-summary { margin-top: 6px; font-size: 1rem; line-height: 1.6; color: #cfcfcf; }
.source-open { align-self: flex-start; margin-top: 8px; padding: 10px 16px; border-radius: 999px; font-size: .875rem; color: #000; background: var(--ink); }
.source-open:hover { opacity: .85; }
.source-note { font-size: .75rem; line-height: 1.5; color: #6f6f6f; }
.source-close { margin-top: 12px; width: 100%; padding: 16px; font: inherit; font-size: 1rem; color: var(--ink); background: #1a1a1a; border: 0; border-radius: 16px; cursor: pointer; }
.source-close:hover { background: #242424; }

/* Elastic scroll bar on the right edge (elastic.js): a thin frosted jar that fills as you scroll. */
.elastic { position: fixed; top: 14px; bottom: 14px; right: 6px; z-index: 7; width: 7px; border-radius: 4px; background: rgba(255, 255, 255, .07); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: hidden; pointer-events: none; opacity: .55; transition: opacity .3s ease; }
.elastic.is-active { opacity: 1; }
.elastic-fill { position: absolute; left: 0; right: 0; top: 0; height: 0; border-radius: inherit; background: linear-gradient(rgba(244, 244, 244, .95), rgba(244, 244, 244, .7)); box-shadow: 0 0 10px rgba(244, 244, 244, .35); }
/* The snap when the band fires: a quick thicken-and-settle. */
.elastic.is-fired { animation: elastic-snap .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes elastic-snap { 0% { transform: scaleX(1); } 25% { transform: scaleX(1.9); } 100% { transform: scaleX(1); } }
/* Bottom-right pager: the slide counter. */
.pager { position: fixed; right: var(--gutter); bottom: 18px; z-index: 7; display: flex; align-items: center; min-height: 40px; }

/* No system scrollbars anywhere; slides that overflow on small screens still scroll by touch. */
html.is-presenting .story-section { scrollbar-width: none; }
html.is-presenting .story-section::-webkit-scrollbar { display: none; }

/* Opening film: placeholder shots until video/opening.mp4 exists. */
/* Bottom room keeps the film clear of the Book a Call button. */
html.is-presenting .section-video { padding: calc(var(--header-height) + 8px) var(--gutter) 80px; }
.film { position: relative; flex: 1; width: 100%; min-height: 300px; background: #0b0b0b; border: 1px solid var(--line); overflow: hidden; }
.film-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.film-shot { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; padding: 24px; opacity: 0; transition: opacity .7s ease; }
.film-shot.is-active { opacity: 1; }
.film-shot span { font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.film-shot p { font-size: clamp(2.5rem, 7vw, 6.5rem); line-height: 1; letter-spacing: -.05em; font-weight: 500; }
.film-shot.is-active p { animation: film-drift 7s ease-out both; }
@keyframes film-drift { from { transform: scale(1.06); } to { transform: scale(1); } }
.film-hud { position: absolute; top: 18px; left: 20px; display: flex; align-items: center; gap: 12px; font-size: .8125rem; color: var(--muted); }
.film-speed { padding: 4px 10px; border: 1px solid #3a3a3a; border-radius: 999px; color: var(--ink); font-variant-numeric: tabular-nums; opacity: .55; transition: opacity .2s ease, background-color .2s ease, color .2s ease; }
.film[data-fast="true"] .film-speed { opacity: 1; color: #000; background: var(--ink); border-color: var(--ink); }
.film-hint { transition: opacity .3s ease; }
.film[data-fast="true"] .film-hint { opacity: 0; }
.film-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #1c1c1c; }
.film-bar span { display: block; height: 100%; background: var(--ink); transform: scaleX(0); transform-origin: left; }

@media (max-width: 1050px) {
  .story-section { padding: 40px 32px; }
  .split-layout { gap: 28px; }
  .placeholder { min-height: 350px; padding: 20px; }
  .section-bottom { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-snap-type: none; }
  html.is-presenting .story-section, .film-shot { transition: none; }
  .source-frame[open], .elastic.is-fired { animation: none; }
  .film-shot.is-active p { animation: none; }
  .story-section.is-current .section-inner { animation: none; }
  .section-reveal .reveal-letter,
  .section-reveal.is-current .reveal-letter { opacity: 1; animation: none; }
  .section-reveal.is-current .reveal-glow i { animation: none; }
  .reveal-glow i:nth-child(-n+2) { opacity: var(--alpha); }
}
@media print {
  .section-reveal .reveal-letter,
  .section-reveal.is-current .reveal-letter { opacity: 1; animation: none; }
}
