/* ══════════════════════════════════════════════════════════════════════════
   Scrollbook · base layer
   Warm paper, bubblegum pink lettering, cocoa ink, and hand-drawn doodles.
   Section styles live in css/sections/*.css and MUST be scoped to their
   section id (e.g. #miniatures .thing) so the sections never leak into
   each other.
   ══════════════════════════════════════════════════════════════════════════ */

/* @font-face rules live in css/fonts.css (generated by tools/build.js with
   inlined data URIs so the fonts also load when opened straight from disk) */

:root {
  /* paper */
  --paper: #fbf3e7;
  --paper-2: #f6e9d6;
  --paper-3: #f1dfca;
  --card: #fffaf3;
  /* the PDF's bubblegum pink, sampled from the lettering */
  --pink: #e27ea1;
  --pink-deep: #c75a80;
  --pink-soft: #f4c5d5;
  --blush: #fbe4ea;
  /* ink */
  --ink: #3a2a2a;
  --ink-soft: #6e5a55;
  --ink-faint: #a9968d;
  /* cozy accents pulled from the artwork */
  --butter: #f5d27f;
  --peach: #f3b493;
  --sage: #a9c19a;
  --sage-deep: #6f8f63;
  --lavender: #b9a2dc;
  --plum: #6c4b9a;
  --teal: #57bdb1;
  --sky: #9fc7e6;
  --zine: #aa1a1a;
  --night: #231b38;

  --bg: var(--paper);
  --fg: var(--ink);
  --fg-soft: var(--ink-soft);

  --font-display: 'Sniglet', 'Chewy', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-hand: 'Schoolbell', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --font-label: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;

  --shadow-paper: 0 1px 1px rgba(58, 42, 42, .07), 0 6px 14px -4px rgba(58, 42, 42, .16), 0 22px 40px -18px rgba(58, 42, 42, .26);
  --shadow-lift: 0 2px 2px rgba(58, 42, 42, .06), 0 16px 30px -8px rgba(58, 42, 42, .24), 0 44px 70px -30px rgba(58, 42, 42, .34);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-bounce: cubic-bezier(.34, 1.56, .64, 1);

  --gutter: clamp(20px, 5vw, 84px);
  --maxw: 1360px;
  --t-mega: clamp(72px, 15vw, 260px);
  --t-title: clamp(56px, 10.5vw, 176px);
  --t-sub: clamp(30px, 3.8vw, 56px);
  --t-body: clamp(18px, 1.32vw, 21px);
  --t-small: clamp(15px, 1.05vw, 17px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-hand);
  font-size: var(--t-body);
  line-height: 1.55;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  transition: color .6s var(--ease-out);
}
/* paper grain over everything (cozy, slightly tactile) */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: 90;
  pointer-events: none;
  background: url(../img/grain.png) repeat;
  background-size: 180px;
  opacity: .32;
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::after { mix-blend-mode: screen; opacity: .1; }

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure { margin: 0; }
::selection { background: var(--pink); color: #fff; }

:focus-visible { outline: 3px dashed var(--pink); outline-offset: 4px; border-radius: 6px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 300;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 99px;
  font-family: var(--font-label); font-weight: 700; text-decoration: none; transition: top .3s;
}
.skip-link:focus { top: 16px; }

/* ── Section scaffolding ──────────────────────────────────────────────── */
.sb-section {
  position: relative;
  padding: clamp(90px, 12vh, 160px) var(--gutter);
}
.sb-wrap { max-width: var(--maxw); margin-inline: auto; position: relative; }

/* Big pink chunky title, like the PDF's hand-lettered headings */
.sb-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--t-title);
  line-height: .86;
  letter-spacing: .015em;
  text-transform: uppercase;
  color: var(--pink);
  margin: 0;
}
.sb-title .ch { display: inline-block; will-change: transform; }
.sb-title .wd { white-space: nowrap; }
.sb-title--mega { font-size: var(--t-mega); }
.sb-title--sticker {
  color: var(--pink);
  -webkit-text-stroke: .06em var(--card);
  paint-order: stroke fill;
  filter: drop-shadow(0 .05em .06em rgba(58, 42, 42, .18));
}

.sb-sub {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--t-sub);
  line-height: 1;
  color: var(--pink);
}

/* tiny Arial-ish caps labels, like the PDF's running heads */
.label {
  font-family: var(--font-label);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hand { font-family: var(--font-hand); }
.note {
  font-family: var(--font-hand);
  font-size: clamp(20px, 1.7vw, 28px);
  line-height: 1.15;
  color: var(--fg);
}
.lede { font-size: clamp(20px, 1.6vw, 26px); line-height: 1.5; }
.muted { color: var(--fg-soft); }
.pink { color: var(--pink); }

/* ── Paper props ──────────────────────────────────────────────────────── */
.polaroid {
  background: var(--card);
  padding: 12px 12px 46px;
  box-shadow: var(--shadow-paper);
  position: relative;
}
.polaroid--pink { background: #f9d5e1; }
.polaroid > img { width: 100%; display: block; }
.polaroid figcaption {
  position: absolute; left: 0; right: 0; bottom: 10px;
  text-align: center; font-family: var(--font-hand); font-size: 20px; color: var(--ink);
}

.tape {
  position: absolute;
  width: 96px; height: 28px;
  background: rgba(246, 210, 150, .72);
  box-shadow: 0 1px 2px rgba(58, 42, 42, .12);
  clip-path: polygon(3% 8%, 10% 0, 18% 9%, 27% 1%, 36% 8%, 45% 0, 55% 9%, 64% 1%, 73% 9%, 82% 0, 91% 8%, 100% 2%, 97% 50%, 100% 96%, 90% 91%, 81% 100%, 72% 92%, 63% 100%, 54% 91%, 45% 100%, 36% 92%, 27% 100%, 18% 91%, 9% 100%, 0 94%, 3% 50%);
  z-index: 3;
  pointer-events: none;
}
.tape--pink { background: rgba(240, 160, 190, .7); }
.tape--sage { background: rgba(169, 193, 154, .75); }
.tape--lav { background: rgba(185, 162, 220, .7); }
.tape--dots { background: radial-gradient(circle at 6px 6px, rgba(255,255,255,.75) 2.2px, transparent 2.6px) 0 0 / 12px 12px, rgba(240, 160, 190, .72); }

.paper-card {
  background: var(--card);
  box-shadow: var(--shadow-paper);
  border-radius: 4px;
}
.shadow-drop { filter: drop-shadow(0 18px 22px rgba(58, 42, 42, .22)) drop-shadow(0 3px 4px rgba(58, 42, 42, .12)); }

/* images on white paper that should melt into the cream page */
.multiply { mix-blend-mode: multiply; }

.art { cursor: zoom-in; }
.art img { transition: transform .6s var(--ease-out); }

/* ── Doodles ──────────────────────────────────────────────────────────── */
.dd {
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--fg);
  pointer-events: none;
}
.dd path, .dd circle, .dd ellipse, .dd line, .dd polyline, .dd rect { vector-effect: non-scaling-stroke; }
.dd .f { fill: currentColor; stroke: none; }
.dd .dash { stroke-dasharray: 2 10; }
.dd--pink { color: var(--pink); }
.dd--ink { color: var(--ink); }
.dd--butter { color: var(--butter); }
.dd--sage { color: var(--sage-deep); }
.dd--lav { color: var(--lavender); }
.dd--teal { color: var(--teal); }
.dd--thin { stroke-width: 2px; }
.dd--thick { stroke-width: 4.5px; }
.boil { filter: url(#boil); }

/* Pink dry-brush ribbon (draw with DrawSVG) */
.ribbon { overflow: visible; fill: none; pointer-events: none; }
.ribbon path { stroke: var(--pink); stroke-width: 30; stroke-linecap: round; stroke-linejoin: round; filter: url(#rough); opacity: .92; }

/* ── Preloader ────────────────────────────────────────────────────────── */
.preloader {
  position: fixed; inset: 0; z-index: 400;
  background: var(--paper);
  display: grid; place-items: center;
  color: var(--ink);
}
html:not(.js) .preloader, .preloader.is-done { display: none; }
.preloader__inner { display: grid; justify-items: center; gap: 18px; }
.preloader__heart { width: min(240px, 50vw); overflow: visible; }
.preloader__thread { fill: none; stroke: var(--pink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.preloader__text { font-family: var(--font-hand); font-size: 22px; margin: 0; }
.preloader__text em { font-style: normal; color: var(--ink-soft); }
.preloader__count { font-family: var(--font-display); font-weight: 800; color: var(--pink); font-size: 28px; display: inline-block; min-width: 2.2ch; text-align: right; }
.preloader__edge { position: absolute; left: 0; right: 0; top: 100%; width: 100%; height: 80px; fill: var(--paper); }

/* ── Chrome: header, folio, chevrons, progress ─────────────────────────── */
.progress { position: fixed; left: 0; right: 0; top: 0; height: 12px; z-index: 120; pointer-events: none; }
.progress svg { width: 100%; height: 100%; overflow: visible; }
.progress__line { fill: none; stroke: var(--pink); stroke-width: 3px; vector-effect: non-scaling-stroke; stroke-linecap: round; }

.chrome {
  position: fixed; z-index: 110; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 24px;
  padding: 20px var(--gutter) 0;
  pointer-events: none;
  color: var(--fg);
  transition: color .5s var(--ease-out);
}
.chrome > * { pointer-events: auto; }
.chrome__brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--font-hand); font-size: 21px; }
.chrome__mark {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; position: relative;
  background: var(--ink); color: var(--paper);
  font-family: var(--font-display); font-weight: 800; font-size: 21px; line-height: 1; padding-top: 1px;
  transition: transform .5s var(--ease-bounce), background .4s;
}
.chrome__mark i { position: absolute; right: -2px; top: -4px; font-style: normal; color: var(--pink); font-size: 15px; }
.chrome__brand:hover .chrome__mark { transform: rotate(-14deg) scale(1.08); background: var(--pink); }
html[data-theme="dark"] .chrome__mark { background: var(--paper); color: var(--ink); }
.chrome__head { margin: 0 0 0 auto; height: 1.3em; overflow: hidden; font-family: var(--font-label); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.chrome__head-text { display: inline-block; }
.chrome__menu {
  display: inline-flex; align-items: center; gap: 10px;
  border: 2px solid currentColor; border-radius: 99px;
  background: transparent; padding: 7px 14px 7px 18px; cursor: pointer;
  font-family: var(--font-hand); font-size: 19px; line-height: 1;
  transition: background .3s, color .3s, border-color .3s;
}
.chrome__menu:hover { background: var(--pink); border-color: var(--pink); color: #fff; }
.chrome__menu-icon { display: grid; gap: 4px; width: 16px; }
.chrome__menu-icon i { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform .4s var(--ease-out); }
.chrome__menu-icon i:last-child { width: 70%; justify-self: end; }
.chrome__menu:hover .chrome__menu-icon i:last-child { transform: scaleX(1.42) translateX(-15%); }

.folio {
  position: fixed; z-index: 110; left: var(--gutter); bottom: 22px;
  font-family: var(--font-label); font-weight: 800; font-size: 15px; letter-spacing: .04em;
  height: 1.3em; overflow: hidden; color: var(--fg); pointer-events: none;
  transition: color .5s var(--ease-out);
}
.folio__num { display: inline-block; }
.chevrons {
  position: fixed; z-index: 110; right: var(--gutter); bottom: 22px;
  width: 64px; height: 14px; color: var(--fg); transition: color .5s var(--ease-out), transform .5s var(--ease-bounce);
}
.chevrons svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; }
.chevrons.is-up { transform: rotate(-90deg); }

html[data-theme="dark"] { --fg: #fbf1e6; --fg-soft: #d9c8bd; }

/* ── Contents menu ────────────────────────────────────────────────────── */
.menu { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; }
.menu[hidden] { display: none; }
.menu::before { content: ''; position: absolute; inset: 0; background: rgba(58, 42, 42, .38); backdrop-filter: blur(3px); }
.menu__paper {
  position: relative; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--card); color: var(--ink);
  padding: clamp(28px, 4vw, 52px);
  box-shadow: var(--shadow-lift);
  border-radius: 6px;
  transform-origin: 50% 0;
}
.menu__paper::before { /* pink envelope flap peeking out */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 14px;
  background: repeating-linear-gradient(-45deg, var(--pink) 0 10px, var(--card) 10px 20px, var(--sky) 20px 30px, var(--card) 30px 40px);
  opacity: .8;
}
.menu__kicker { font-family: var(--font-label); font-weight: 800; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); margin: 10px 0 6px; }
.menu__title { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; color: var(--pink); font-size: clamp(56px, 9vw, 96px); line-height: .9; margin-bottom: 18px; }
.menu__colhead { display: flex; justify-content: space-between; font-family: var(--font-display); font-weight: 800; color: var(--pink); font-size: 22px; margin: 0 0 6px; }
.menu__list li a {
  display: flex; align-items: baseline; gap: 8px; text-decoration: none;
  font-size: 21px; letter-spacing: .04em; padding: 3px 0; transition: color .2s, transform .3s var(--ease-out);
}
.menu__list li a::after { content: none; }
.menu__list .dots { flex: 1; border-bottom: 2px dotted currentColor; opacity: .5; transform: translateY(-5px); }
.menu__list li a:hover { color: var(--pink); transform: translateX(6px); }
.menu__note { margin: 18px 0 0; color: var(--ink-soft); font-size: 18px; }
.menu__close {
  position: absolute; top: 22px; right: 22px; width: 42px; height: 42px; border-radius: 50%;
  border: 2px solid var(--ink); background: transparent; cursor: pointer; font-size: 18px;
  transition: transform .4s var(--ease-bounce), background .3s, color .3s;
}
.menu__close:hover { transform: rotate(90deg); background: var(--ink); color: var(--card); }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; }
.lightbox[hidden] { display: none; }
.lightbox__backdrop { position: absolute; inset: 0; background: rgba(43, 30, 30, .82); backdrop-filter: blur(6px); }
.lightbox__figure { position: relative; display: grid; justify-items: center; gap: 14px; max-width: 92vw; }
.lightbox__img { max-width: min(92vw, 1100px); max-height: 78vh; object-fit: contain; background: var(--card); padding: 10px; box-shadow: var(--shadow-lift); border-radius: 3px; }
.lightbox__cap { color: var(--paper); font-family: var(--font-hand); font-size: 22px; text-align: center; max-width: 60ch; }
.lightbox__btn {
  position: absolute; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--paper);
  background: rgba(251, 243, 231, .08); color: var(--paper); cursor: pointer; font-size: 22px;
  transition: background .3s, transform .4s var(--ease-bounce);
}
.lightbox__btn:hover { background: var(--pink); border-color: var(--pink); transform: scale(1.08); }
.lightbox__prev { left: 3vw; top: 50%; translate: 0 -50%; }
.lightbox__next { right: 3vw; top: 50%; translate: 0 -50%; }
.lightbox__close { right: 3vw; top: 3vh; }

/* ── Cursor ───────────────────────────────────────────────────────────── */
.cursor { position: fixed; left: 0; top: 0; z-index: 300; pointer-events: none; display: none; }
html.has-cursor .cursor { display: block; }
.cursor__dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--pink); }
.cursor__ring {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  border: 2px solid var(--pink); display: grid; place-items: center;
  transition: width .35s var(--ease-out), height .35s var(--ease-out), margin .35s var(--ease-out), background .35s, border-color .35s;
}
.cursor__label { font-family: var(--font-hand); font-size: 17px; color: #fff; opacity: 0; white-space: nowrap; transition: opacity .2s; }
.cursor.is-link .cursor__ring { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(226, 126, 161, .14); }
.cursor.is-label .cursor__ring { width: 86px; height: 86px; margin: -43px 0 0 -43px; background: var(--pink); border-color: var(--pink); }
.cursor.is-label .cursor__label { opacity: 1; }
.cursor.is-label .cursor__dot { opacity: 0; }
.cursor.is-down .cursor__ring { transform: scale(.82); }

/* pop-up doodles spawned by clicks */
.click-doodle { position: fixed; z-index: 95; width: 34px; height: 34px; pointer-events: none; margin: -17px 0 0 -17px; }

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (max-width: 720px) {
  .chrome { padding-top: 14px; gap: 12px; }
  .chrome__name { display: none; }
  .chrome__head { font-size: 11px; }
  .chrome__menu { font-size: 17px; padding: 6px 12px 6px 14px; }
  .folio, .chevrons { bottom: 14px; }
}

/* Keep navigation legible over every spread and let each spread own its ink. */
main { color: var(--ink); --fg: var(--ink); --fg-soft: var(--ink-soft); }
main [data-theme="dark"] { color: #fbf1e6; --fg: #fbf1e6; --fg-soft: #d9c8bd; }
.chrome__menu { background: var(--paper); color: var(--ink); }
.chrome__head-text, .chrome__brand { text-shadow: 0 0 5px var(--bg); }
.modal-open { overflow: hidden; }
.chrome__head { min-width: 0; white-space: nowrap; text-overflow: ellipsis; }
.chrome__menu, .chrome__brand { flex-shrink: 0; }
