/* ==========================================================================
   scrolly.css — ivory paper, pastel pigments, quiet serif typography.
   Structure: 1 tokens · 2 base · 3 hero · 4 prose · 5 Closeread cards & stage
              6 quotes & highlighter · 7 quote wall · 8 data/close · 9 furniture · 10 responsive
   ========================================================================== */

/* ---------- 1 · tokens & fonts ---------- */
@font-face { font-family: 'Newsreader Variable'; src: url('../fonts/newsreader-latin-wght-normal.woff2') format('woff2'); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader Variable'; src: url('../fonts/newsreader-latin-wght-italic.woff2') format('woff2'); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'Instrument Sans Variable'; src: url('../fonts/instrument-sans-latin-wght-normal.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --paper: #faf9f5; --ink: #141413; --card: #f5f4ed; --card-line: #c2c0b6; --hair: #e8e6dc;
  --muted: #5e5d59; --soft: #87867f; --btn-text: #3d3d3a;
  --amber: #f0ac54; --amber-deep: #8f5c00; --sky: #6a9bcc; --sky-deep: #3a6d9c;
  --olive: #788c5d; --olive-deep: #4c6236; --fig: #c46686; --fig-deep: #9c3f61;
  --violet: #918bd6; --violet-deep: #5f58b0; --stone: #b3b0a3;
  --serif: 'Newsreader Variable', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Instrument Sans Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --col: 640px;
  --ease: cubic-bezier(.165, .84, .44, 1);
}
html { background: var(--paper); scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- 2 · base ---------- */
body { background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 17px; line-height: 1.55; font-optical-sizing: auto; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body, #quarto-content, main.content { background: var(--paper); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(20,20,19,.4); }
a:hover { text-decoration-color: currentColor; }
::selection { background: rgba(240,172,84,.35); }
.kicker { font: 600 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }

/* buttons: 13px sans, radius 6 (measured on the reference) */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 500 13px/20px var(--sans); letter-spacing: .01em; padding: 4px 12px; border-radius: 6px; background: var(--card); color: var(--btn-text); border: 1px solid var(--hair); text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s, transform .2s var(--ease); }
.btn:hover { border-color: var(--card-line); background: #efede5; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn--primary:hover { background: #2b2a28; border-color: #2b2a28; }
.btn svg { width: 12px; height: 12px; }

/* ---------- 3 · hero ---------- */
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); column-gap: 30px; align-items: center; min-height: min(100dvh, 880px); padding: 28px 0 88px; }
.hero__art { position: relative; align-self: center; justify-self: start; width: min(100%, calc((100dvh - 96px) * 1.4359)); aspect-ratio: 1120 / 780; }
.hero__art > div { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 100% 100%; }
.hero__paper { background-image: var(--spr-paper-hero); opacity: var(--paper-lines); }
.hero__chain { background-image: var(--spr-hero-chain); --p: 120%;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 var(--p), transparent calc(var(--p) + 12%)); mask-image: linear-gradient(90deg, #000 0, #000 var(--p), transparent calc(var(--p) + 12%)); }
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 120%; }
/* with JS: hold the art back until its image has decoded (scrolly.js adds .is-ready), then draw the chain on from the left */
html.js .hero__chain:not(.is-ready) { visibility: hidden; }
html.js .hero__chain.is-ready { animation: draw-on 3.4s cubic-bezier(.45,.05,.2,1) .25s both; }
@keyframes draw-on { from { --p: -12%; } to { --p: 120%; } }
.hero__copy { position: relative; z-index: 2; padding: 0 32px 0 0; max-width: 400px; }
.hero h1 { font: 400 clamp(29px, 2.5vw, 37px)/1.18 var(--serif); letter-spacing: -.012em; margin: 0 0 26px; text-wrap: balance; }
.hero__copy p { margin: 0 0 1.05em; color: #30302e; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero__cue { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3; }
.hero__cue .btn { border-radius: 999px; background: rgba(245,244,237,.9); }
.hero__meta { margin-top: 30px; font: 400 12.5px/1.5 var(--sans); color: var(--soft); letter-spacing: .01em; }
@media (prefers-reduced-motion: reduce) { html.js .hero__chain.is-ready { animation: none; } }

/* ---------- 4 · prose column ---------- */
.prose { max-width: var(--col); margin: 0 auto; padding: 0 24px; }
.prose p { margin: 0 0 1.1em; }
.prose--open { padding-top: clamp(24px, 6vw, 72px); padding-bottom: clamp(40px, 8vw, 96px); }
.dropcap { float: left; font: 700 5.7em/.76 var(--serif); padding: .075em .1em 0 0; margin-right: .02em; color: var(--ink);
  background-image: var(--spr-dropcap-tex), linear-gradient(rgba(20,20,19,.5), rgba(20,20,19,.5)); background-size: 120% 120%, 100% 100%; background-position: center; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
@supports not ((-webkit-background-clip: text) or (background-clip: text)) { .dropcap { color: var(--ink); -webkit-text-fill-color: currentColor; } }
.lede-break { margin: 44px auto 0; width: min(460px, 80%); aspect-ratio: 460 / 124; background: var(--spr-chain-mini) center / contain no-repeat; }

.finding-head { max-width: var(--col); margin: 0 auto; padding: 0 24px; }
.finding-head .fh-kicker { font: 400 clamp(20px, 2vw, 22px)/1.45 var(--serif); color: var(--soft); margin: 0; }
.finding-head h2 { font: 400 clamp(20px, 2vw, 22px)/1.45 var(--serif); margin: 0 0 18px; color: var(--ink); text-wrap: balance; }

/* ---------- 5 · Closeread: cards + pinned stage ---------- */
.cr-section { background: transparent; }
.cr-section .narrative-col { padding-bottom: 12svh; }
.cr-section .narrative { border: 1px solid var(--card-line); box-shadow: 0 4px 24px rgba(0,0,0,.05); padding: 16px 16px 15px; line-height: 1.55; width: min(416px, calc(100vw - 2 * 16px)); box-sizing: border-box; text-align: left; hyphens: auto; }
.cr-section.overlay-left .narrative { margin-right: auto; }
.cr-section .narrative > *:first-child { margin-top: 0; }
.cr-section .narrative h2 { font: 700 17px/1.35 var(--sans); letter-spacing: -.003em; margin: 0 0 8px; padding: 0; border: 0; color: var(--ink); }
.cr-section .narrative h2 .anchorjs-link { display: none; }
.cr-section .narrative p { margin: 0 0 .75em; font-size: 17px; }
.cr-section .narrative p:last-child { margin-bottom: 0; }
.narrative .tag { display: block; font: 600 11px/1 var(--sans); letter-spacing: .13em; text-transform: uppercase; margin: 0 0 9px; color: var(--tag, var(--muted)); }
.narrative .tag::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tag, var(--muted)); margin-right: 7px; vertical-align: -0.5px; opacity: .9; }
.t-amber { --tag: var(--amber-deep); --q: var(--amber); } .t-sky { --tag: var(--sky-deep); --q: var(--sky); }
.t-olive { --tag: var(--olive-deep); --q: var(--olive); } .t-fig { --tag: var(--fig-deep); --q: var(--fig); } .t-violet { --tag: var(--violet-deep); --q: var(--violet); }

/* quotes inside cards */
.narrative blockquote { margin: 12px 0 0; padding: 2px 0 2px 13px; border-left: 3px solid var(--q, var(--card-line)); font-style: italic; font-size: 16px; line-height: 1.5; color: #22211f; }
.narrative blockquote p { font-size: inherit; margin: 0 0 .35em; }
.narrative blockquote p:last-child { margin: 0; font: 500 12px/1.4 var(--sans); font-style: normal; letter-spacing: .03em; color: var(--muted); margin-top: .5em; }

/* the pinned stage */
.sticky.scene { width: 100%; height: 100dvh; position: relative; overflow: hidden; background: var(--paper); }
.scene .stage-paper { position: absolute; inset: 0; opacity: var(--paper-lines); }
.scene .stage-paper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.1s var(--ease); }
.scene .stage-paper img.on { opacity: 1; }
.scene .stage-view { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
/* .el = a pose (position / rotation / opacity), .ly = one sprite layer (cross-fades when a link changes colour), .sp = its scale + image */
.scene .el { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; pointer-events: none; transition: transform var(--dur, 900ms) var(--ease), opacity .55s ease; }
.scene .ly { position: absolute; left: 0; top: 0; transition: opacity .6s ease; }
.scene .sp { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; transition: transform var(--dur, 900ms) var(--ease); }
.scene .sp img, .scene .drawn-sprite, .scene .drawn-sprite > svg { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
@media (prefers-reduced-motion: reduce) { .scene .draw-path { transition: none !important; stroke-dashoffset: 0 !important; } }
.scene .sp.mask { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; background: var(--c, var(--ink)); }
.scene .ly.breathe { animation: breathe 5.5s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.scene .lbl { position: absolute; left: 0; top: 0; width: max-content; transform: translate(-50%, -50%) rotate(var(--rt, 0deg)); white-space: normal; text-align: center; font: 500 16px/1.12 var(--sans); letter-spacing: .005em; color: var(--ink); pointer-events: none; }
.scene .lbl.l { transform: translate(0, -50%) rotate(var(--rt, 0deg)); transform-origin: 0 50%; text-align: left; }
.scene .lbl.r { transform: translate(-100%, -50%) rotate(var(--rt, 0deg)); transform-origin: 100% 50%; text-align: right; }
.scene .lbl.on-ink { color: var(--paper); }
.scene .lbl.badge { font-weight: 700; }
.scene .lbl.cap { font: 600 12px/1.25 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.scene .lbl.note { font: italic 400 17px/1.25 var(--serif); letter-spacing: 0; color: var(--nc, var(--muted)); }
.scene .lbl.wrap { line-height: 1.15; }
.scene .lbl.big { font-family: var(--serif); font-weight: 500; line-height: 1.12; color: var(--violet-deep); }
.scene.no-tr .el, .scene.no-tr .ly, .scene.no-tr .sp { transition: none !important; }
.scene.reduce .el, .scene.reduce .ly, .scene.reduce .sp, .scene.reduce .stage-paper img { transition: none !important; }
.scene.reduce .ly.breathe { animation: none; }
.scene .loading-veil { position: absolute; inset: 0; background: var(--paper); transition: opacity .6s; pointer-events: none; }
.scene.ready .loading-veil { opacity: 0; }
.c-amber { --c: var(--amber); --nc: var(--amber-deep); } .c-sky { --c: var(--sky); --nc: var(--sky-deep); } .c-olive { --c: var(--olive); --nc: var(--olive-deep); }
.c-fig { --c: var(--fig); --nc: var(--fig-deep); } .c-violet { --c: var(--violet); --nc: var(--violet-deep); } .c-ink { --c: var(--ink); --nc: var(--muted); } .c-stone { --c: #d9d6cb; --nc: var(--muted); }

/* progress bar (fixed; slides in while a pinned section is on screen) */
.cr-progress { position: fixed; z-index: 1000; left: 0; right: 0; top: 0; height: 8px; background: var(--card); transform: translateY(-100%); transition: transform .35s var(--ease); pointer-events: none; }
.cr-progress.on { transform: none; }
.cr-progress i { display: block; height: 100%; background: #d1cfc5; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* ---------- 6 · highlighter (coded phrases) ---------- */
/* The swash sprites are 420×46 of paint inside 30px of soft margin (480×106). `114% 140%` scales the painted core to the text's width
   and to a ~12px band; position 50%/30% centres that band on the x-height. Tune these three numbers by eye. */
mark { --mk-w: 114%; --mk-h: 140%; --mk-y: 30%;
  background-color: transparent; color: inherit; padding: 0 .16em; margin: 0 -.16em; background-repeat: no-repeat; background-size: var(--mk-w) var(--mk-h); background-position: 50% var(--mk-y);
  transition: background-size 1.1s var(--ease) .15s, background-position 1.1s var(--ease) .15s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark.amber { background-image: var(--spr-swash-amber-a); } mark.sky { background-image: var(--spr-swash-sky-a); }
mark.olive { background-image: var(--spr-swash-olive-a); } mark.fig { background-image: var(--spr-swash-fig-a); } mark.violet { background-image: var(--spr-swash-violet-a); }
mark.b.amber { background-image: var(--spr-swash-amber-b); } mark.b.sky { background-image: var(--spr-swash-sky-b); } mark.b.olive { background-image: var(--spr-swash-olive-b); } mark.b.fig { background-image: var(--spr-swash-fig-b); }
/* with JS, phrases in the prose and in the story cards are "painted" as they scroll into view (no JS → simply visible) */
html.js .prose:not(.in) mark, html.js .narrative:not(.in) mark { background-size: 0% var(--mk-h); background-position: 0 var(--mk-y); }
@media (prefers-reduced-motion: reduce) { mark { transition: none; } html.js .prose:not(.in) mark, html.js .narrative:not(.in) mark { background-size: var(--mk-w) var(--mk-h); background-position: 50% var(--mk-y); } }

/* ---------- 7 · data & closing ---------- */
[hidden] { display: none !important; }
.method { max-width: 1040px; margin: 0 auto; padding: clamp(48px, 7vw, 96px) 24px; }
.method h2 { font: 400 clamp(24px, 2.6vw, 30px)/1.25 var(--serif); max-width: var(--col); margin: 0 auto 34px; text-align: center; text-wrap: balance; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.stat { text-align: center; }
.stat b { display: inline-block; font: 400 clamp(42px, 5vw, 60px)/1.05 var(--serif); letter-spacing: -.015em; padding: 0 .14em; background-repeat: no-repeat; background-size: 114% 66%; background-position: 50% 88%; transition: background-size 1.1s var(--ease) .15s, background-position 1.1s var(--ease) .15s; }
html.js .stat:not(.in) b { background-size: 0% 66%; background-position: 0 88%; }
.stat:nth-child(1) b { background-image: var(--spr-swash-sky-a); } .stat:nth-child(2) b { background-image: var(--spr-swash-olive-a); } .stat:nth-child(3) b { background-image: var(--spr-swash-fig-a); }
.stat span { display: block; margin-top: 12px; font: 400 13.5px/1.5 var(--sans); color: var(--muted); letter-spacing: .01em; }
.site-foot { max-width: var(--col); margin: 56px auto 0; padding: 26px 24px 64px; border-top: 1px solid var(--hair); font: 400 12.5px/1.6 var(--sans); color: var(--muted); }
.site-foot a { color: var(--muted); }

/* the coda: the opening chain, read the other way — from where it dissolves back toward the intact links */
.coda { padding: clamp(64px, 9vw, 120px) 0 0; overflow: hidden; }
.coda__text { max-width: var(--col); margin: 0 auto; padding: 0 24px; }
.coda__text .kicker { margin-bottom: 18px; }
.coda__quote blockquote { margin: 0 0 22px; padding: 0; border: 0; font: 400 clamp(25px, 2.8vw, 34px)/1.28 var(--serif); letter-spacing: -.012em; text-wrap: balance; color: var(--ink); }
.coda__quote blockquote p { margin: 0; }
.coda__quote .coda__attribution { margin: 0; color: var(--muted); font: 400 13px/1.5 var(--sans); }
.coda__text > p { margin: 0 0 1.1em; }
.coda__art { position: relative; width: min(100%, 1180px); margin: 40px auto 0; aspect-ratio: 1120 / 780; transform: scaleX(-1);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 74%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 74%, transparent); }
.coda__art > div { position: absolute; inset: 0; background-repeat: no-repeat; background-size: 100% 100%; }
.coda__paper { background-image: var(--spr-paper-hero); opacity: var(--paper-lines); }
.coda__chain { background-image: var(--spr-hero-chain); }
.coda .site-foot { margin-top: -56px; position: relative; z-index: 2; }

/* ---------- 9 · responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 0 0 80px; row-gap: 0; }
  .hero__art { order: 1; width: 100%; }
  .hero__copy { order: 2; padding: 8px 24px 0; max-width: 620px; margin: 0 auto; }
  .hero__cue { display: none; }
  .stats { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 575px) {
  body { font-size: 16.5px; }
  .cr-section.cr-column-screen .narrative-col .trigger { padding-inline: 8px; }
  .cr-section .narrative { padding: 14px; width: calc(100vw - 32px); }
}


/* the pencil rules are baked fairly dark (2H graphite); this is the single knob for how loud the paper is */
:root { --paper-lines: .62; }
.scene .stage-paper { opacity: var(--paper-lines); }
