/* Field Notes: Amelie's flannel-covered pastel sketchbook.
   Linen desk, cream paper, watercolour washes, pencil marginalia, ink that boils. */

:root {
  --paper: #FBF6EC;
  --paper-2: #F3EBDB;
  --card: #FFFDF7;
  --desk: #ECE8DE;
  --sage: #B7C9A8;
  --lavender: #C9B8E0;
  --blush: #F2C4C0;
  --butter: #F5E3A1;
  --sky: #B9D3E6;
  --ink: #4A4038;
  --pencil: #6B625A;
  --lav-ink: #6C5797;
  --sage-ink: #56704B;
  --blush-ink: #A8584F;

  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --hand: "Gaegu", "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;

  --bw: min(84vw, 340px);
  --bh: calc(var(--bw) * 1.42);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .29 0 0 0 0 .25 0 0 0 0 .2 .13 0 0 0 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --fuzz: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .5 0 0 0 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  --sprigs: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cg fill='none' stroke='%2396AE86' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M14 34c6-6 6-14 2-21M16 25c-4-2-6-6-6-9M16 20c3-2 5-5 5-8'/%3E%3Cpath d='M64 82c6-6 6-14 2-21M66 73c-4-2-6-6-6-9M66 68c3-2 5-5 5-8'/%3E%3C/g%3E%3Cg fill='%23EDB6B0'%3E%3Ccircle cx='56' cy='24' r='3.2'/%3E%3Ccircle cx='24' cy='72' r='2.6'/%3E%3C/g%3E%3Cg fill='%23EBCF74'%3E%3Ccircle cx='84' cy='44' r='2.2'/%3E%3Ccircle cx='40' cy='52' r='1.8'/%3E%3C/g%3E%3C/svg%3E");
  --squiggle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='8'%3E%3Cpath d='M1 5C6 1 10 7 15 4S24 1 30 4 40 7 45 3 54 2 59 5' fill='none' stroke='%23C9B8E0' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 74px; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  background-color: var(--desk);
  background-image:
    var(--grain),
    repeating-linear-gradient(0deg, rgba(74,64,56,.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 1px, transparent 1px 4px);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
@supports (overflow: clip) { html, body { overflow-x: clip; } }

img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0 0 1em; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--card); padding: 8px 14px; border-radius: 8px; font-family: var(--hand); font-size: 1.2rem;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px dashed var(--lav-ink); outline-offset: 4px; border-radius: 8px; }

/* boil: cycle three wobble filters (driven by data-boil on <html>) */
.boil { filter: url(#boil0); }
html[data-boil="1"] .boil { filter: url(#boil1); }
html[data-boil="2"] .boil { filter: url(#boil2); }

.note {
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--pencil);
}

/* ---------- washi tape ---------- */
.tape {
  position: absolute;
  width: 92px; height: 24px;
  background-color: rgba(201,184,224,.72);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 5px, transparent 5px 11px);
  clip-path: polygon(0 6%, 3% 0, 97% 0, 100% 12%, 97% 26%, 100% 40%, 97% 55%, 100% 70%, 97% 86%, 100% 100%, 3% 100%, 0 88%, 3% 74%, 0 60%, 3% 46%, 0 32%, 3% 18%);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.tape.t-sage { background-color: rgba(183,201,168,.8); background-image: radial-gradient(rgba(255,255,255,.55) 1.6px, transparent 2px); background-size: 9px 9px; }
.tape.t-blush { background-color: rgba(242,196,192,.75); background-image: linear-gradient(90deg, rgba(255,255,255,.3) 50%, transparent 50%), linear-gradient(rgba(255,255,255,.3) 50%, transparent 50%); background-size: 10px 10px; }
.tape.t-butter { background-color: rgba(245,227,161,.85); background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.4) 0 3px, transparent 3px 8px); }
.tape.t-sky { background-color: rgba(185,211,230,.8); background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.4) 0 2px, transparent 2px 7px); }
.tape-mini { width: 34px; height: 13px; left: 50%; top: 42%; translate: -50% 0; rotate: -8deg; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 16px 8px 12px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 18px 22px 19px 23px / 22px 18px 23px 19px;
  font-family: var(--hand); font-size: 1.3rem; line-height: 1; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(74,64,56,.85);
  transition: transform .12s ease, box-shadow .12s ease, background-color .2s;
  touch-action: manipulation;
}
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(74,64,56,.85); }

/* ---------- sound toggle: a flannel shirt button ---------- */
.sound {
  position: fixed; z-index: 60;
  top: max(10px, env(safe-area-inset-top)); left: 10px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 4px; min-height: 48px;
  background: rgba(251,246,236,.94);
  border: 0; border-radius: 30px;
  box-shadow: 0 1px 0 rgba(74,64,56,.12), 0 6px 14px -8px rgba(74,64,56,.4);
  cursor: pointer; touch-action: manipulation;
}
.sound-btn { width: 40px; height: 40px; transition: transform .35s cubic-bezier(.3,1.6,.5,1); }
.sound-btn svg { width: 40px; height: 40px; }
.sb-rim { fill: #DCCDEE; stroke: #8C79B5; stroke-width: 1.4; }
.sb-in { fill: #E6DAF3; stroke: #A592C8; stroke-width: 1; }
.sb-hole { fill: #9F8CC4; }
.sb-thread { fill: none; stroke: #FBF6EC; stroke-width: 2.2; stroke-linecap: round; transition: stroke-dashoffset .4s ease; stroke-dasharray: 13; stroke-dashoffset: 0; }
.sound-label { font-family: var(--hand); font-size: 1.15rem; font-weight: 700; color: var(--ink); white-space: nowrap; max-width: 6em; overflow: hidden; transition: max-width .35s ease, opacity .25s; }
.inside .sound { padding-right: 4px; }
.inside .sound-label { max-width: 0; opacity: 0; }
.sound[aria-pressed="false"] .sb-thread { stroke-dashoffset: 13; }
.sound[aria-pressed="false"] .sound-btn { transform: rotate(-40deg); }
.sound[aria-pressed="false"] .sound-label { color: var(--pencil); }

/* ---------- fixed ribbon bookmark ---------- */
.ribbon-fixed {
  position: fixed; z-index: 55; top: 0; right: 12px;
  width: 34px; height: 92px; padding-top: 10px;
  display: flex; justify-content: center;
  background: linear-gradient(90deg, #E2A39D, #F2C4C0 35%, #F8D9D5 52%, #E8B1AB 80%, #DA9C96);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 86%, 0 100%);
  text-decoration: none;
  font-family: var(--hand); font-weight: 700; font-size: 1.05rem; color: #6E3A35;
  filter: drop-shadow(0 3px 3px rgba(74,64,56,.25));
  transform: translateY(-110%);
  transition: transform .5s cubic-bezier(.3,1.4,.5,1);
}
.ribbon-fixed span { writing-mode: vertical-rl; letter-spacing: .04em; }
.ribbon-fixed.show { transform: translateY(0); }
.ribbon-fixed:active { transform: translateY(6px); }

/* =====================================================================
   THE DESK + THE BOOK
   ===================================================================== */
.desk {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 76px 12px 40px;
  overflow: hidden;
}
@supports (overflow: clip) { .desk { overflow: clip; } }
.desk-kicker {
  font-family: var(--hand); font-size: 1.35rem; color: var(--pencil);
  margin: 0 0 18px; rotate: -2deg;
  opacity: 0; animation: fadeUp .8s .5s ease forwards;
}
.desk-props { position: absolute; inset: 0; pointer-events: none; }
.prop { position: absolute; opacity: .95; }
.prop-pencil { display: none; width: 230px; right: -60px; bottom: 6%; rotate: -24deg; filter: drop-shadow(0 6px 6px rgba(74,64,56,.2)); }
.prop-tin { display: none; }
.prop-leaf { width: 40px; left: 4%; top: 12%; rotate: -30deg; opacity: .7; }

.book-wrap { position: relative; width: var(--bw); height: var(--bh); }
.book {
  position: absolute; inset: 0;
  rotate: -1.4deg;
  transform: perspective(1400px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg));
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  animation: bookDrop 1s cubic-bezier(.2,.9,.25,1) both;
}
@keyframes bookDrop {
  from { translate: 0 -34px; scale: 1.06; opacity: 0; rotate: -5deg; }
  60% { opacity: 1; }
  to { translate: 0 0; scale: 1; opacity: 1; rotate: -1.4deg; }
}
@keyframes fadeUp { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }

/* stack of page edges peeking out behind the cover */
.page-stack {
  position: absolute; top: 4px; right: -5px; bottom: -6px; width: var(--bw);
  border-radius: 4px 10px 10px 4px;
  background:
    repeating-linear-gradient(90deg, transparent 0 2px, rgba(74,64,56,.08) 2px 3px) right / 7px 100% no-repeat,
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(74,64,56,.08) 2px 3px) bottom / 100% 7px no-repeat,
    var(--paper-2);
  box-shadow: 0 26px 40px -22px rgba(74,64,56,.6), 0 8px 14px -8px rgba(74,64,56,.3);
}

.paper {
  background-color: var(--paper);
  background-image: var(--grain), radial-gradient(120% 90% at 50% 40%, transparent 60%, rgba(214,196,160,.28));
}

.title-page {
  position: absolute; top: 0; right: 0; width: var(--bw); height: 100%;
  border-radius: 3px 8px 8px 3px;
  padding: 26px 24px 20px 26px;
  box-shadow: inset 14px 0 18px -14px rgba(74,64,56,.35);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 1;
}
.tp-volume { font-family: var(--hand); font-size: 1.05rem; color: var(--pencil); margin: 0 0 4px; }
.tp-title {
  margin: 0; font-weight: 400; font-style: italic;
  font-size: clamp(2.6rem, 13vw, 3.4rem); line-height: .95; letter-spacing: -.02em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
.tp-notes { color: var(--lav-ink); }
.tp-for { font-family: var(--hand); font-size: 1.4rem; margin: 8px 0 0; line-height: 1.1; }
.tp-from { font-size: .82rem; letter-spacing: .14em; text-transform: uppercase; color: var(--pencil); margin: 2px 0 14px; }
.toc { flex: 1; min-height: 0; }
.toc-title {
  font-family: var(--hand); font-weight: 700; font-size: 1.25rem; margin: 0 0 4px; color: var(--ink);
  display: inline-block; padding: 0 6px; background: linear-gradient(transparent 55%, rgba(245,227,161,.9) 55% 92%, transparent 92%);
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li a {
  display: flex; align-items: baseline; gap: 8px;
  padding: 3px 0; min-height: 30px;
  text-decoration: none; font-size: 1rem; line-height: 1.3;
}
.toc .t-n { width: 24px; flex: none; font-style: italic; color: var(--lav-ink); font-size: .95rem; }
.toc .t-t { flex: none; max-width: 70%; }
.toc .t-d { flex: 1; border-bottom: 2px dotted rgba(107,98,90,.45); translate: 0 -4px; min-width: 12px; }
.toc .t-p { flex: none; font-family: var(--hand); font-size: 1.1rem; color: var(--pencil); }
.toc li.t-letter a { font-weight: 600; }
.toc li.t-letter .t-t { background: linear-gradient(transparent 58%, rgba(242,196,192,.95) 58% 94%, transparent 94%); padding: 0 3px; }
.toc a:active .t-t { color: var(--lav-ink); }
.tp-psst { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; font-family: var(--hand); font-size: 1.02rem; color: var(--pencil); rotate: -1.5deg; text-align: center; line-height: 1.05; }
.sp-tp { position: absolute; right: 12px; top: 8px; width: 30px; rotate: 8deg; }

/* flutter: a few pages that flick over after the cover */
.flutter {
  position: absolute; top: 3px; right: 2px; width: calc(var(--bw) - 4px); height: calc(100% - 6px);
  background: var(--paper); border-radius: 3px 8px 8px 3px;
  transform-origin: left center; opacity: 0; pointer-events: none;
  box-shadow: inset 10px 0 14px -10px rgba(74,64,56,.3);
  z-index: 2;
}
.is-open .flutter { animation: flutter 1s cubic-bezier(.4,.05,.3,1) both; }
.is-open .fl1 { animation-delay: .32s; }
.is-open .fl2 { animation-delay: .44s; }
.is-open .fl3 { animation-delay: .58s; }
@keyframes flutter {
  0% { opacity: 1; transform: perspective(2000px) rotateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: perspective(2000px) rotateY(-178deg); }
}

/* ---------- the cover ---------- */
.cover {
  position: absolute; top: 0; right: 0; width: var(--bw); height: 100%;
  transform-origin: left center; transform-style: preserve-3d;
  transform: perspective(2200px) rotateY(0deg);
  transition: transform 1.25s cubic-bezier(.5,.05,.2,1), opacity .25s ease, visibility 0s;
  z-index: 3;
}
.is-open .cover {
  transform: perspective(2200px) rotateY(-180deg);
  transition: transform 1.25s cubic-bezier(.5,.05,.2,1), opacity .4s ease 1s, visibility 0s linear 1.4s;
}
.cover-front, .cover-back {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  border-radius: 6px 14px 14px 6px;
  overflow: hidden;
}
.cover-front {
  display: block; width: 100%; height: 100%; padding: 0; margin: 0; border: 0;
  cursor: pointer; text-align: left;
  background: #CBDABE;
  box-shadow: inset 0 0 0 1px rgba(74,64,56,.18), inset 0 -3px 6px rgba(74,64,56,.12), inset 0 3px 4px rgba(255,255,255,.35);
  touch-action: manipulation;
}
.cover-front:focus-visible { outline-offset: 6px; }
.cover-back {
  transform: rotateY(180deg);
  border-radius: 14px 6px 6px 14px;
  background-color: #EDE5F3;
  background-image: var(--sprigs);
  box-shadow: inset 0 0 0 10px #D9CFE7, inset 0 0 0 11px rgba(74,64,56,.15), inset -16px 0 20px -12px rgba(74,64,56,.3);
  display: grid; place-items: center; cursor: pointer;
}

.flannel {
  position: absolute; inset: 0;
  background-color: #CBDABE;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgba(74,64,56,.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,
      transparent 0 16px,
      rgba(178,158,212,.5) 16px 50px,
      transparent 50px 56px,
      rgba(236,170,164,.7) 56px 60px,
      transparent 60px 72px,
      rgba(255,253,247,.55) 72px 73.5px,
      transparent 73.5px 92px,
      rgba(240,214,128,.75) 92px 96px,
      transparent 96px 116px),
    repeating-linear-gradient(0deg,
      transparent 0 16px,
      rgba(178,158,212,.45) 16px 50px,
      transparent 50px 56px,
      rgba(236,170,164,.65) 56px 60px,
      transparent 60px 72px,
      rgba(255,253,247,.5) 72px 73.5px,
      transparent 73.5px 92px,
      rgba(240,214,128,.7) 92px 96px,
      transparent 96px 116px);
}
.fuzz {
  position: absolute; inset: 0;
  background-image: var(--fuzz);
  opacity: .55;
  mix-blend-mode: soft-light;
}
.fuzz::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 30% 20%, rgba(255,255,255,.18), transparent 55%), radial-gradient(120% 100% at 80% 110%, rgba(74,64,56,.16), transparent 60%);
}
.spine {
  position: absolute; left: 0; top: 0; bottom: 0; width: 26px;
  background: linear-gradient(90deg, rgba(74,64,56,.32), rgba(74,64,56,.1) 55%, rgba(255,255,255,.28) 80%, rgba(74,64,56,.18) 96%);
}
.spine::after {
  content: ""; position: absolute; top: 10px; bottom: 10px; right: 5px; width: 0;
  border-right: 2px dashed rgba(251,246,236,.7);
}
.stitch {
  position: absolute; left: 38px; top: 12px; width: calc(100% - 50px); height: calc(100% - 24px);
  overflow: visible; pointer-events: none;
}
.stitch rect {
  fill: none; stroke: rgba(251,246,236,.92); stroke-width: 2.2; stroke-dasharray: 7 6; stroke-linecap: round;
  filter: drop-shadow(0 1px 0 rgba(74,64,56,.35));
}

.label {
  position: absolute; left: 22%; right: 16%; top: 19%;
  padding: 14px 10px 12px;
  display: flex; flex-direction: column; align-items: center;
  background-color: #FBF6EC;
  background-image:
    repeating-linear-gradient(0deg, rgba(74,64,56,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(74,64,56,.035) 0 1px, transparent 1px 3px);
  border-radius: 3px;
  rotate: -2deg;
  box-shadow: 0 1px 1px rgba(74,64,56,.3), 0 8px 14px -8px rgba(74,64,56,.5);
  text-align: center;
}
.label::before {
  content: ""; position: absolute; inset: 5px;
  border: 1.6px dashed #A592C8; border-radius: 2px;
}
.label-kicker { font-family: var(--serif); font-size: .7rem; letter-spacing: .28em; text-transform: uppercase; color: var(--pencil); }
.label-name { font-family: var(--hand); font-weight: 700; font-size: clamp(3rem, 15vw, 3.7rem); line-height: .9; margin: 6px 0 2px; color: var(--ink); }
.label-sub { font-family: var(--hand); font-size: 1.05rem; color: var(--pencil); line-height: 1; }

.cv-sticker { position: absolute; display: block; pointer-events: none; }
.cv-violin { width: 46px; right: 64px; top: 4.5%; rotate: 16deg; }
.cv-maple { width: 58px; left: 13%; bottom: 7%; rotate: -14deg; }
.cv-badge {
  left: 13%; top: 4.5%;
  width: 70px; height: 70px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: var(--butter);
  border: 2px solid var(--ink);
  box-shadow: 0 0 0 4px #FFFDF7, 0 2px 4px 3px rgba(74,64,56,.22);
  rotate: -9deg;
  font-family: var(--hand); line-height: .9; color: var(--ink);
}
.cv-badge span { font-size: .95rem; }
.cv-badge b { font-size: 1.45rem; }
.cv-slot {
  position: absolute; right: 54px; bottom: 7%; width: 104px; height: 104px; border-radius: 50%;
  border: 2px dashed rgba(255,253,247,.8);
  display: grid; place-items: center; text-align: center; rotate: 8deg;
  font-family: var(--hand); font-size: .98rem; line-height: 1; color: rgba(255,253,247,.92);
  text-shadow: 0 1px 0 rgba(74,64,56,.25);
  pointer-events: none;
}
.has-doodle .cv-slot { display: none; }
.cv-doodle {
  position: absolute; right: 48px; bottom: 5%; width: 118px; height: 118px; rotate: 7deg;
  pointer-events: none;
  animation: stickOn .7s cubic-bezier(.3,1.5,.5,1) both;
}
.cv-doodle canvas { width: 100%; height: 100%; }
.cv-doodle[hidden] { display: none; }
@keyframes stickOn { from { scale: 1.4; opacity: 0; rotate: -10deg; } to { scale: 1; opacity: 1; rotate: 7deg; } }

.elastic {
  position: absolute; top: -2px; bottom: -2px; right: 30px; width: 13px;
  background:
    linear-gradient(90deg, rgba(60,40,90,.28), transparent 30%, rgba(255,255,255,.25) 50%, transparent 70%, rgba(60,40,90,.3)),
    repeating-linear-gradient(0deg, #B09BD3 0 2px, #C2B1DF 2px 4px);
  box-shadow: -2px 0 4px rgba(74,64,56,.3), 2px 0 3px rgba(74,64,56,.2);
  transition: transform .45s cubic-bezier(.5,-.4,.6,1), opacity .3s ease .25s;
}
.is-open .elastic { transform: translateX(46px) rotate(5deg); opacity: 0; }
.tucked { position: absolute; right: 8px; top: 34%; width: 46px; rotate: -34deg; pointer-events: none; filter: drop-shadow(0 2px 1px rgba(74,64,56,.25)); }
.tucked + .sheen { z-index: 1; }
.elastic { z-index: 2; }
.tucked { z-index: 1; }
.sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(160px 160px at var(--mx, 70%) var(--my, 20%), rgba(255,255,255,.28), transparent 70%);
  mix-blend-mode: soft-light;
}

.bookplate {
  width: 72%; padding: 18px 14px; text-align: center;
  background: var(--card);
  border: 1.5px solid #B9A9D6; outline: 4px solid var(--card); outline-offset: 0;
  box-shadow: 0 0 0 5px #B9A9D6, 0 10px 18px -10px rgba(74,64,56,.4);
  rotate: 1deg;
}
.bookplate p { margin: 0; }
.bp-kicker { font-style: italic; font-size: .95rem; color: var(--lav-ink); letter-spacing: .06em; }
.bp-line { font-family: var(--hand); font-size: 1.1rem; color: var(--pencil); line-height: 1.1; }
.bp-name { font-family: var(--hand); font-weight: 700; font-size: 2.6rem; line-height: 1; margin: 2px 0 6px !important; border-bottom: 1.5px solid rgba(74,64,56,.35); }

/* ribbon tail: the bookmark marks the letter's page */
.ribbon-tail {
  position: absolute; top: calc(100% - 6px); right: 22%;
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; z-index: 4;
  transform-origin: 50% 0;
  animation: sway 4.5s ease-in-out infinite;
  min-width: 48px;
}
.rt-ribbon {
  width: 18px; height: 54px;
  background: linear-gradient(90deg, #E2A39D, #F2C4C0 35%, #F8D9D5 52%, #E8B1AB 80%, #DA9C96);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}
.rt-tag {
  margin-top: -14px;
  padding: 3px 12px 4px;
  background: var(--card);
  border-radius: 4px 12px 12px 4px;
  font-family: var(--hand); font-weight: 700; font-size: 1.15rem; color: var(--blush-ink); white-space: nowrap;
  box-shadow: 0 1px 1px rgba(74,64,56,.25), 0 6px 10px -6px rgba(74,64,56,.5);
  rotate: -7deg;
  position: relative;
}
.rt-tag::before { content: ""; position: absolute; left: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; border: 1.5px solid rgba(74,64,56,.4); }
.rt-tag { padding-left: 16px; }
@keyframes sway { 0%, 100% { rotate: -3deg; } 50% { rotate: 3deg; } }

.desk-hint {
  margin: 96px 0 0; display: flex; align-items: center; gap: 4px;
  font-family: var(--hand); font-size: 1.35rem; color: var(--pencil);
  opacity: 0; animation: fadeUp .8s 1.1s ease forwards;
}
.desk-hint svg { width: 46px; height: 30px; color: var(--lav-ink); translate: 0 -8px; }
.dh-open { display: none; }
.book-open .dh-closed { display: none; }
.book-open .dh-open { display: inline; }

/* =====================================================================
   SHEETS (pages; spreads on desktop)
   ===================================================================== */
main { padding: 8px 10px 0; }
.sheet {
  position: relative;
  max-width: 1160px;
  margin: 0 auto 64px;
  padding: 46px 22px 56px;
  border-radius: 3px 6px 6px 3px;
  background-color: var(--paper);
  background-image: var(--grain), radial-gradient(130% 90% at 50% 30%, transparent 62%, rgba(214,196,160,.26));
  box-shadow:
    0 1px 0 #E4D9C2, 0 2px 0 var(--paper), 0 3px 0 #E0D4BB, 0 4px 0 #F7F0E2, 0 5px 0 #DBCDB2,
    0 26px 36px -22px rgba(74,64,56,.45);
}
.js .sheet {
  transform: perspective(1600px) rotateX(-9deg) translateY(36px) scale(.97);
  transform-origin: 50% 0;
  opacity: .25;
  transition: transform 1s cubic-bezier(.2,.75,.2,1), opacity .7s ease;
}
.js .sheet.in { transform: none; opacity: 1; }
.sheet[hidden] { display: none; }

.runhead {
  position: absolute; top: 14px; left: 22px; right: 22px;
  display: flex; justify-content: space-between;
  font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: rgba(107,98,90,.8);
}
.folio { font-family: var(--hand); font-size: 1rem; letter-spacing: 0; text-transform: none; padding-right: 50px; }

.chap { margin: 0 0 14px; padding-right: 46px; }
.chap-num {
  position: relative; display: inline-grid; place-items: center;
  width: 50px; height: 50px; margin-left: -4px;
  color: var(--lav-ink); font-size: 1.3rem; font-weight: 500;
}
.chap-num svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: var(--lavender); stroke-width: 2.6; stroke-linecap: round; }
.chap-num i { position: relative; font-variation-settings: "SOFT" 100, "WONK" 1; }
.chap-title {
  margin: 4px 0 2px;
  font-weight: 400; font-style: italic;
  font-size: clamp(2.3rem, 1.6rem + 3vw, 3.6rem); line-height: 1; letter-spacing: -.015em;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
  text-wrap: balance;
}
.chap-when {
  display: inline-block; margin: 6px 0 0; padding-bottom: 6px;
  font-family: var(--hand); font-weight: 700; font-size: 1.45rem; line-height: 1.1; color: var(--lav-ink);
  background: var(--squiggle) left bottom / 60px 8px repeat-x;
}
.body { max-width: 34em; text-wrap: pretty; }

/* specimens: pressed flowers taped into the margins; each plays a note */
.specimen {
  position: absolute; z-index: 5;
  width: 48px; padding: 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 2px 2px rgba(74,64,56,.18));
  touch-action: manipulation;
}
.specimen svg { width: 100%; height: auto; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.specimen .sp-name {
  position: absolute; right: -2px; top: 100%;
  font-family: var(--hand); font-size: 1rem; color: var(--pencil); white-space: nowrap;
  opacity: 0; transition: opacity .3s, translate .3s;
}
.specimen.sing .sp-name { opacity: 1; translate: 0 4px; }
.specimen.sing svg { animation: wiggle .7s cubic-bezier(.3,1.6,.5,1); }
@keyframes wiggle { 0% { rotate: 0deg; scale: 1; } 25% { rotate: -9deg; scale: 1.08; } 55% { rotate: 6deg; } 80% { rotate: -2deg; } 100% { rotate: 0deg; scale: 1; } }
.sp-a { top: 40px; right: 10px; rotate: 14deg; }
.sp-b { top: 34px; right: 8px; rotate: -10deg; width: 52px; }
.sp-c { top: 150px; right: 10px; rotate: 10deg; width: 52px; }
.sp-d { top: 34px; right: 6px; rotate: -8deg; width: 52px; }
.sp-e { top: 36px; right: 14px; rotate: 12deg; width: 34px; }
.sp-f { top: 40px; right: 10px; rotate: -16deg; width: 50px; }
.sp-g { bottom: 16px; left: 14px; rotate: -20deg; width: 42px; }
.sp-f svg { stroke-width: 3; }

.puff { position: fixed; z-index: 70; width: 8px; height: 8px; border-radius: 50% 50% 50% 0; pointer-events: none; }

/* dog-ear: fold the corner of any page */
.dogear {
  position: absolute; right: 0; bottom: 0; z-index: 4;
  width: 46px; height: 46px; padding: 0; border: 0; cursor: pointer;
  background: linear-gradient(315deg, rgba(214,196,160,.0) 0 40%, rgba(214,196,160,.35) 50%, transparent 51%);
  border-radius: 0 0 6px 0;
  transition: background .3s;
  touch-action: manipulation;
}
.dogear[aria-pressed="true"] {
  background: linear-gradient(315deg, var(--desk) 0 49%, #E7DBC2 50%, #F1E7D4 100%);
  box-shadow: -4px -4px 8px -4px rgba(74,64,56,.3);
  border-radius: 0 0 6px 0;
}

/* ---------- photos taped in ---------- */
.snaps { display: flex; flex-wrap: wrap; gap: 26px 16px; justify-content: center; align-items: flex-start; padding-top: 14px; }
.snap {
  position: relative; margin: 0;
  width: 100%;
  padding: 9px 9px 0;
  background: #FFFEFA;
  box-shadow: 0 1px 1px rgba(74,64,56,.2), 0 12px 20px -12px rgba(74,64,56,.55);
  rotate: var(--r, 0deg);
  transition: rotate .4s cubic-bezier(.3,1.5,.5,1), translate .4s cubic-bezier(.3,1.5,.5,1);
}
.snap-btn { display: block; width: 100%; padding: 0; border: 0; background: #E9E2D3; cursor: zoom-in; }
.snap img { width: 100%; height: auto; aspect-ratio: var(--ar, 4 / 3); object-fit: cover; }
.snap figcaption { font-family: var(--hand); font-size: 1.22rem; line-height: 1.1; padding: 8px 4px 11px; text-align: center; color: var(--ink); }
.snap .tape { top: -12px; left: 50%; translate: -50% 0; rotate: var(--tr, -3deg); }
.snap:active { rotate: 0deg; translate: 0 -3px; }
.snaps-collage .snap { width: calc(50% - 8px); }
.snaps-collage .snap:first-child { width: 100%; }
.snap-empty {
  width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center;
  border: 2px dashed rgba(107,98,90,.4); border-radius: 6px; color: var(--pencil);
  font-family: var(--hand); font-size: 1.3rem;
}

/* ---------- art figures ---------- */
.art { position: relative; margin: 18px -6px 0; }
.art svg { width: 100%; height: auto; overflow: visible; }
.art figcaption { margin-top: 2px; text-align: right; rotate: -2deg; }
.svg-hand { font-family: var(--hand); font-size: 15px; fill: var(--ink); }
.svg-hand.small { font-size: 12px; fill: var(--pencil); }
.lake-hit, .tree { cursor: pointer; outline: none; }
.tree { transform-box: fill-box; transform-origin: 50% 100%; }
.tree.rustle { animation: rustle .9s ease; }
@keyframes rustle { 0%, 100% { rotate: 0deg; } 20% { rotate: -4deg; } 45% { rotate: 3deg; } 70% { rotate: -1.5deg; } }
.lake-hit:focus-visible, .tree:focus-visible { outline: 2px dashed var(--lav-ink); }
.cloud { animation: drift 9s ease-in-out infinite alternate; }
.cloud.c2 { animation-duration: 12s; animation-direction: alternate-reverse; }
@keyframes drift { from { translate: -6px 0; } to { translate: 10px 0; } }
.steps .step { opacity: 0; }
.sheet.in .steps .step { animation: stepIn .25s ease forwards; animation-delay: calc(.6s + var(--i) * .17s); }
@keyframes stepIn { from { opacity: 0; } to { opacity: .55; } }
.ripple { transform-box: fill-box; transform-origin: center; animation: ripple 1.6s cubic-bezier(.2,.6,.3,1) forwards; }
@keyframes ripple { from { scale: .1; opacity: .9; } to { scale: 1; opacity: 0; } }

/* ---------- the hub ---------- */
.tally-wrap { margin-top: 18px; }
.tally-wrap .note { margin: 0 0 4px; }
.tally { width: 220px; height: 44px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.tally path { animation: tallyIn .3s ease both; }
@keyframes tallyIn { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
.tally-lost { margin: 4px 0 0; min-height: 1.2em; color: var(--lav-ink); }

.hub {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  min-height: 300px; padding: 10px 2px 14px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 22%);
  mask-image: linear-gradient(transparent, #000 22%);
}
.bub { display: flex; align-items: flex-end; gap: 8px; animation: bubIn .5s cubic-bezier(.25,1.5,.45,1) both; transform-origin: 0 100%; }
.bub.r { flex-direction: row-reverse; transform-origin: 100% 100%; }
@keyframes bubIn { from { scale: .3; opacity: 0; } to { scale: 1; opacity: 1; } }
.bub-who {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--card);
  font-family: var(--hand); font-weight: 700; font-size: 1.2rem; line-height: 1;
}
.bub-say {
  position: relative;
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  background: var(--c, var(--lavender));
  border: 2px solid var(--ink);
  border-radius: 20px 24px 22px 18px / 18px 22px 20px 24px;
  color: var(--ink);
}
.bub-say svg { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.bub-say::after {
  content: ""; position: absolute; bottom: 6px; left: -9px; width: 12px; height: 12px;
  background: var(--c, var(--lavender)); border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink);
  transform: skewY(-30deg) rotate(10deg);
}
.bub.r .bub-say::after { left: auto; right: -9px; border-left: 0; border-right: 2px solid var(--ink); transform: skewY(30deg) rotate(-10deg); }
.bub-name { font-family: var(--hand); font-size: 1rem; color: var(--pencil); align-self: center; }
.btn-talk { margin-top: 6px; }
.btn-talk svg { stroke-width: 2.6; }

/* ---------- formal: fairy lights ---------- */
.lights { position: relative; height: 74px; margin: -16px -12px 4px; touch-action: pan-y; cursor: pointer; }
.lights svg { width: 100%; height: 100%; overflow: visible; }
.lights .wire { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linecap: round; }
.lights .bulb-glow { opacity: 0; transition: opacity .9s ease; }
.lights .bulb.lit .bulb-glow { opacity: 1; transition-duration: .05s; }
.lights .bulb-body { stroke: var(--ink); stroke-width: 1.4; transition: fill .9s; }
.lights .bulb.lit .bulb-body { fill: #FFFBE6 !important; transition-duration: .05s; }
.lights .bulb-cap { fill: var(--ink); }
.lights .bulb.cur .bulb-body { stroke-width: 2.6; }
.note-lights { margin-top: 8px; rotate: -2deg; }

/* ---------- abilities: stickers ---------- */
.stickers {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px 6px; padding: 8px 0 4px;
  position: relative;
}
.sticker {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0; border: 0; background: none; cursor: grab;
  translate: var(--dx, 0px) var(--dy, 0px);
  rotate: var(--r, 0deg);
  transition: scale .25s cubic-bezier(.3,1.6,.5,1), filter .25s, rotate .3s;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.sticker svg { width: 100%; max-width: 112px; height: auto; overflow: visible; }
.st-label { font-family: var(--hand); font-weight: 700; font-size: 1.12rem; color: var(--ink); line-height: 1; }
.sticker.peeled { z-index: 20; scale: 1.12; rotate: calc(var(--r) * -.5); filter: drop-shadow(0 14px 10px rgba(74,64,56,.3)); cursor: grabbing; transition: scale .25s cubic-bezier(.3,1.6,.5,1), filter .25s; }
.sticker.dropped { animation: press .35s ease; }
@keyframes press { 0% { scale: 1.12; } 50% { scale: .94; } 100% { scale: 1; } }
.sticker.pop svg { animation: popSt .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes popSt { 0% { scale: 1; } 30% { scale: 1.12; } 100% { scale: 1; } }
.ab-caption { min-height: 1.3em; margin: 10px 0 0; text-align: center; color: var(--lav-ink); }
.sticker-next .st-label { color: var(--pencil); }
.sticker-next { grid-column: 2; }

.ab-bow { transition: translate .2s; }
.sticker.play .ab-bow { animation: bowing .45s ease-in-out 4 alternate; }
@keyframes bowing { from { translate: -14px -8px; } to { translate: 12px 7px; } }
.ab-keys .k { transition: fill .15s; }
.ab-keys .k.down { fill: var(--lavender); }
.ab-page { transform-box: view-box; transform-origin: 65px 50px; }
.sticker.play .ab-page { animation: pageFlip .42s ease-in-out 3; }
@keyframes pageFlip { from { transform: scaleX(1); } to { transform: scaleX(-1); } }
.ab-stem { stroke-dasharray: 60; stroke-dashoffset: 0; }
.ab-bloom { transform-box: fill-box; transform-origin: 50% 70%; }
.sticker.play .ab-stem { animation: drawStem .6s ease both; }
.sticker.play .ab-leafl { animation: popIn .4s .4s cubic-bezier(.3,1.6,.5,1) both; transform-box: fill-box; transform-origin: 100% 100%; }
.sticker.play .ab-bloom { animation: popIn .6s .55s cubic-bezier(.3,1.6,.5,1) both; }
.ab-bird { opacity: 0; }
.sticker.play .ab-bird { animation: birdFly 1.6s .3s ease-in-out both; }
@keyframes drawStem { from { stroke-dashoffset: 60; } to { stroke-dashoffset: 0; } }
@keyframes popIn { from { scale: 0; } to { scale: 1; } }
@keyframes birdFly { 0% { opacity: 0; translate: -10px 20px; } 20% { opacity: 1; } 100% { opacity: 0; translate: 90px -16px; } }
.ab-brush { transform-box: fill-box; transform-origin: 20% 80%; }
.sticker.play .ab-brush { animation: brushy .3s ease-in-out 4 alternate; }
@keyframes brushy { from { rotate: -10deg; } to { rotate: 12deg; } }
.ab-frame { font-family: var(--hand); font-size: 12px; fill: var(--pencil); }
.ab-ghosts { opacity: 0; transition: opacity .2s; }
.sticker.play .ab-ghosts { opacity: 1; }
.ab-next { transform-box: fill-box; transform-origin: center; }
.sticker.play .ab-next { animation: shuffle .9s ease; }
@keyframes shuffle { 0% { rotate: 0deg; } 30% { rotate: -14deg; scale: .9; } 70% { rotate: 10deg; scale: 1.1; } 100% { rotate: 0deg; scale: 1; } }

.bloom {
  position: absolute; z-index: 0; pointer-events: none;
  width: 140px; height: 140px; border-radius: 46% 54% 50% 50% / 52% 44% 56% 48%;
  background: radial-gradient(circle at 50% 50%, var(--c) 0 45%, transparent 70%);
  filter: url(#wash);
  mix-blend-mode: multiply;
  animation: bloom 7s cubic-bezier(.15,.7,.3,1) forwards;
}
@keyframes bloom { 0% { scale: .1; opacity: .9; } 15% { scale: 1; opacity: .9; } 70% { opacity: .55; } 100% { scale: 1.1; opacity: 0; } }

/* ---------- LIVING INK ---------- */
.ink-psst { margin-top: -2px; rotate: -1deg; }
.ink-ideas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; }
.ink-ideas .note { margin: 0; }
.idea {
  border: 0; cursor: pointer; padding: 4px 10px; min-height: 36px;
  font-family: var(--hand); font-size: 1.15rem; color: var(--ink);
  background: linear-gradient(transparent 52%, rgba(245,227,161,.95) 52% 92%, transparent 92%);
  touch-action: manipulation;
}
.idea:nth-of-type(2) { background: linear-gradient(transparent 52%, rgba(201,184,224,.9) 52% 92%, transparent 92%); }
.idea:nth-of-type(3) { background: linear-gradient(transparent 52%, rgba(183,201,168,.95) 52% 92%, transparent 92%); }
.idea:nth-of-type(4) { background: linear-gradient(transparent 52%, rgba(242,196,192,.95) 52% 92%, transparent 92%); }

.pad-wrap { position: relative; padding: 10px 2px 4px; }
.pad {
  position: relative;
  width: 100%; aspect-ratio: 4 / 5;
  background-color: #FFFDF6;
  background-image:
    var(--grain),
    radial-gradient(circle, rgba(107,98,90,.13) 1px, transparent 1.4px);
  background-size: auto, 22px 22px;
  background-position: 0 0, 11px 11px;
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(74,64,56,.2), 0 3px 0 -1px #F1E8D6, 0 4px 0 -1px rgba(74,64,56,.12), 0 18px 28px -16px rgba(74,64,56,.5);
  transition: translate .45s cubic-bezier(.5,0,.75,0), rotate .45s cubic-bezier(.5,0,.75,0), opacity .4s;
}
.pad.tearing { translate: 40px -60px; rotate: 14deg; opacity: 0; }
.pad.fresh { animation: freshPage .6s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes freshPage { from { translate: 0 30px; opacity: 0; rotate: -3deg; } to { translate: 0 0; opacity: 1; rotate: 0deg; } }
.tape-pad { top: -12px; left: 50%; translate: -50% 0; rotate: -2deg; width: 110px; z-index: 3; }
.ink-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
#ink-wet { touch-action: none; cursor: crosshair; z-index: 2; }
#ink-ghost { opacity: 0; transition: opacity .5s; }
.pad.replaying #ink-ghost { opacity: 1; }
.pad-hint {
  position: absolute; left: 0; right: 0; top: 14px; margin: 0; text-align: center; pointer-events: none;
  font-family: var(--hand); font-size: 1.3rem; color: var(--pencil); z-index: 1;
  transition: opacity .4s;
}
.pad-hint.gone { opacity: 0; }
.pad-status {
  position: absolute; left: 12px; bottom: 10px; z-index: 3;
  display: flex; align-items: center; gap: 8px; pointer-events: none;
  font-family: var(--hand); font-size: 1.05rem; color: var(--pencil);
}
.frames { display: flex; gap: 3px; }
.frames i { width: 13px; height: 10px; border: 1.5px solid rgba(107,98,90,.6); border-radius: 2px; background: transparent; }
.pad.alive .frames i:nth-child(1), .pad.replaying .frames i:nth-child(1) { background: var(--lavender); }
html[data-boil="1"] .pad.alive .frames i:nth-child(1), html[data-boil="2"] .pad.alive .frames i:nth-child(1) { background: transparent; }
html[data-boil="1"] .pad.alive .frames i:nth-child(2) { background: var(--blush); }
html[data-boil="2"] .pad.alive .frames i:nth-child(3) { background: var(--butter); }
.spark { position: absolute; z-index: 4; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }

.ink-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.tin {
  display: flex; gap: 6px; padding: 7px 8px;
  background: var(--card); border: 2px solid var(--ink); border-radius: 12px;
  box-shadow: 0 3px 0 rgba(74,64,56,.85);
}
.pan {
  position: relative; width: 36px; height: 36px; padding: 0; cursor: pointer;
  border: 1.6px solid rgba(74,64,56,.7); border-radius: 9px;
  background: var(--c);
  background-image: radial-gradient(70% 60% at 35% 30%, rgba(255,255,255,.55), transparent 60%), radial-gradient(90% 80% at 70% 80%, rgba(74,64,56,.12), transparent 70%);
  transition: translate .2s cubic-bezier(.3,1.6,.5,1), box-shadow .2s;
  touch-action: manipulation;
}
.pan[aria-checked="true"] { translate: 0 -5px; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink); }
.sizes { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 3px 0 rgba(74,64,56,.85); }
.sizes button { width: 40px; height: 40px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; }
.sizes button i { display: block; border-radius: 50%; background: var(--ink); }
.sizes button[data-size="0"] i { width: 5px; height: 5px; }
.sizes button[data-size="1"] i { width: 10px; height: 10px; }
.sizes button[data-size="2"] i { width: 17px; height: 17px; }
.sizes button[aria-checked="true"] { background: var(--butter); }
.ink-actions { display: flex; flex-wrap: wrap; gap: 10px 8px; margin-top: 14px; }
.ink-actions .btn { padding: 6px 14px 6px 10px; font-size: 1.2rem; min-height: 44px; }
.btn-play { background: var(--lavender); }
.btn-play svg path { fill: currentColor; stroke-width: 1.6; }
.btn-play.on { background: var(--blush); }
.ink-msg { min-height: 1.3em; margin: 10px 0 0; color: var(--lav-ink); }

/* ---------- Canada ---------- */
.art-canada { cursor: pointer; }
.art-canada svg { touch-action: manipulation; }
.leaf-fall { position: absolute; left: 0; right: 0; top: -30px; height: 60px; overflow: hidden; pointer-events: none; }
.leaf-fall svg { position: absolute; width: 22px; height: 22px; stroke: var(--ink); stroke-width: 3; }
.postcard-wrap { padding: 20px 4px 0; }
.postcard {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 2;
  padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  perspective: 1400px; rotate: -2.5deg;
  touch-action: manipulation;
}
.pc-face {
  position: absolute; inset: 0;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: #FFFDF8; border-radius: 4px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(74,64,56,.2), 0 16px 24px -14px rgba(74,64,56,.55);
  transition: transform .9s cubic-bezier(.4,.1,.2,1);
}
.pc-back { transform: rotateY(180deg); display: grid; grid-template-columns: 1.25fr 1fr; padding: 14px; gap: 12px; }
.postcard[aria-pressed="true"] .pc-front { transform: rotateY(-180deg); }
.postcard[aria-pressed="true"] .pc-back { transform: rotateY(0deg); }
.pc-art { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
.pc-greet {
  position: absolute; left: 22px; top: 16px; display: flex; flex-direction: column; line-height: .9;
  color: var(--ink);
}
.pc-small { font-family: var(--hand); font-weight: 700; font-size: 1.2rem; }
.pc-big { font-style: italic; font-weight: 600; font-size: clamp(2.3rem, 11vw, 3.3rem); font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; color: var(--lav-ink); text-shadow: 0 0 2px #FFFDF8, 0 0 6px #FFFDF8, 0 0 12px rgba(255,253,248,.9); }
.pc-msg { display: flex; flex-direction: column; gap: 0; border-right: 1.5px solid rgba(74,64,56,.3); padding-right: 10px; }
.pc-dear { font-family: var(--hand); font-size: 1.25rem; font-weight: 700; }
.pc-line { display: block; height: 22px; border-bottom: 1.4px solid rgba(107,98,90,.35); }
.pc-pencil { font-family: var(--hand); font-size: .98rem; color: var(--pencil); margin-top: 6px; line-height: 1.05; }
.pc-side { position: relative; display: flex; flex-direction: column; align-items: flex-end; }
.pc-stamp {
  width: 58px; height: 68px; padding: 9px; background: var(--butter);
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 3px, transparent 96%, #000) -4px -4px / 8px 8px;
  -webkit-mask-composite: source-over;
  mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 3px, transparent 96%, #000) -4px -4px / 8px 8px;
  mask-composite: add;
  rotate: 4deg;
}
.pc-stamp svg { width: 100%; height: 100%; }
.pc-postmark {
  position: absolute; right: 34px; top: 30px; width: 54px; height: 54px; border-radius: 50%;
  border: 1.6px solid rgba(108,87,151,.65); display: grid; place-items: center; text-align: center;
  font-size: .55rem; letter-spacing: .12em; line-height: 1.2; color: rgba(108,87,151,.85); rotate: -14deg;
}
.pc-addr { margin-top: auto; font-family: var(--hand); font-size: 1.05rem; line-height: 1.15; align-self: stretch; border-top: 1.4px solid rgba(107,98,90,.35); padding-top: 4px; }
.pc-note { text-align: center; margin-top: 14px; }

/* =====================================================================
   THE BACK: classes + the letter pocket
   ===================================================================== */
.sheet-back { padding: 0; overflow: hidden; }
.sheet-back .runhead { z-index: 2; }
.sheet-back .leaf-l { padding: 46px 22px 34px; }
.chap-small .chap-title { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); }
.classes { margin-bottom: 26px; }
.classes[hidden] { display: none; }
.libcard-wrap { position: relative; margin: 14px auto 0; max-width: 430px; }
.libcard {
  position: relative; z-index: 1;
  padding: 14px 14px 46px;
  background-color: #FFFDF5;
  background-image: repeating-linear-gradient(transparent 0 37px, rgba(140,180,210,.45) 37px 38.5px);
  background-position: 0 70px;
  border: 1px solid #E3D8C0;
  box-shadow: 0 1px 1px rgba(74,64,56,.15), 0 10px 18px -12px rgba(74,64,56,.45);
  rotate: -1.4deg;
}
.lc-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 2px solid #D79A94; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; color: var(--pencil); }
.lc-head b { font-family: var(--hand); font-size: 1.4rem; letter-spacing: 0; text-transform: none; color: var(--ink); }
.lc-table { width: 100%; border-collapse: collapse; }
.lc-table th { font-size: .66rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--pencil); text-align: left; padding: 2px 4px 6px; border-bottom: 1.5px solid #D79A94; }
.lc-table td { height: 38.5px; padding: 2px 4px; vertical-align: middle; }
.lc-table th:first-child, .lc-table td:first-child { width: 4.6em; border-right: 1.5px solid #D79A94; }
.lc-class { font-family: var(--hand); font-size: 1.3rem; line-height: 1; }
.lc-teacher { font-family: var(--hand); font-size: 1.12rem; line-height: 1; color: var(--pencil); }
.stamp {
  display: inline-block; padding: 1px 5px;
  font-weight: 700; font-size: .82rem; letter-spacing: .1em;
  color: #7A63AC; border: 2px solid currentColor; border-radius: 4px;
  rotate: var(--sr, -4deg); opacity: .82;
}
.js .classes .stamp { opacity: 0; scale: 1.7; }
.classes.stamped .stamp { animation: stampIn .28s cubic-bezier(.5,0,.7,1) forwards; animation-delay: calc(.2s + var(--i) * .22s); }
@keyframes stampIn { 0% { opacity: 0; scale: 1.7; } 100% { opacity: .82; scale: 1; } }
.libpocket {
  position: relative; z-index: 2; display: grid; place-items: center;
  height: 64px; margin: -40px 12px 0;
  background: #F2DFAE; background-image: var(--grain);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 -1px 0 rgba(74,64,56,.12), 0 8px 12px -8px rgba(74,64,56,.4);
  font-size: .68rem; letter-spacing: .24em; text-transform: uppercase; color: rgba(74,64,56,.7);
}
.last-page { position: relative; padding: 10px 0 0; }
.lp-big { font-style: italic; font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); line-height: 1; margin: 0 0 6px; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.lp-note { margin: 0; }
.lp-arrow { width: 64px; height: 64px; margin: 4px 0 0 40%; }
.sheet-back .folio { display: none; }
.fern-fig { display: none; margin: 30px 0 0; max-width: 340px; }
.fern-art { width: 100%; height: auto; overflow: visible; fill: none; stroke: #6F8C60; stroke-width: 2; stroke-linecap: round; }
.fern-fig figcaption { text-align: center; rotate: -3deg; margin-top: -10px; }
.herbarium { margin: 0 0 30px; }
.herb-title { margin: 0; font-weight: 400; font-style: italic; font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.4rem); line-height: 1.05; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.herb-note { margin: 4px 0 12px; rotate: -1deg; color: var(--lav-ink); }
.herb-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; }
.specimen.herb {
  position: relative; inset: auto; width: auto; rotate: none;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px;
  padding: 10px 4px 6px; min-height: 120px;
  background: var(--card); border-radius: 3px;
  box-shadow: 0 1px 1px rgba(74,64,56,.15), 0 6px 10px -8px rgba(74,64,56,.4);
  filter: none;
}
.specimen.herb:nth-child(odd) { rotate: -1.5deg; }
.specimen.herb:nth-child(even) { rotate: 1.5deg; }
.specimen.herb svg { width: auto; height: 74px; max-width: 100%; }
.specimen.herb[data-sp="maple"] svg { height: 54px; stroke-width: 3; margin-bottom: 10px; }
.herb-name { font-family: var(--hand); font-size: .98rem; line-height: 1; color: var(--pencil); text-align: center; }
.herb-name i { font-style: normal; font-family: var(--serif); font-size: .8rem; color: var(--lav-ink); }
.specimen.herb.sing { background: #FFFBEA; }

.endpaper {
  position: relative;
  padding: 34px 22px 40px;
  background: #CBDABE;
  isolation: isolate;
}
.endpaper::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-color: #CBDABE;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.09) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, transparent 0 16px, rgba(178,158,212,.5) 16px 50px, transparent 50px 56px, rgba(236,170,164,.7) 56px 60px, transparent 60px 92px, rgba(240,214,128,.75) 92px 96px, transparent 96px 116px),
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(178,158,212,.45) 16px 50px, transparent 50px 56px, rgba(236,170,164,.65) 56px 60px, transparent 60px 92px, rgba(240,214,128,.7) 92px 96px, transparent 96px 116px);
}
.endpaper::after {
  content: ""; position: absolute; inset: 12px; z-index: -1;
  background-color: #EEE6F4; background-image: var(--sprigs);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(74,64,56,.12), inset 0 0 30px rgba(108,87,151,.08);
}
.letter-title {
  margin: 8px 0 0; text-align: center;
  font-weight: 400; font-style: italic; font-size: clamp(2.3rem, 1.6rem + 3vw, 3.4rem); line-height: 1;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144;
}
#letter:focus { outline: none; }

.pocket-stage {
  position: relative; margin: 20px auto 0;
  width: min(100%, 360px); height: 400px;
  transition: height .8s cubic-bezier(.3,.8,.3,1);
}
.pocket {
  position: absolute; left: 0; right: 0; bottom: 18px; height: 196px; z-index: 3;
  background-color: var(--paper); background-image: var(--grain);
  clip-path: polygon(0 0, 50% 22%, 100% 0, 100% 100%, 0 100%);
  border-radius: 0 0 10px 10px;
  display: grid; place-items: center; padding-top: 34px;
}
.pocket-stage::after {
  content: ""; position: absolute; left: 4px; right: 4px; bottom: 12px; height: 190px; z-index: 2;
  border-radius: 0 0 12px 12px; box-shadow: 0 14px 24px -12px rgba(74,64,56,.5);
  pointer-events: none;
}
.pocket-flap {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(74,64,56,.08), transparent 30%), linear-gradient(200deg, rgba(74,64,56,.08), transparent 30%);
}
.pocket-label {
  position: relative; text-align: center; font-family: var(--hand); font-weight: 700; font-size: 1.6rem; line-height: 1; rotate: -2deg;
  padding: 8px 18px; border-top: 1.5px solid rgba(74,64,56,.3); border-bottom: 1.5px solid rgba(74,64,56,.3);
}
.pocket-label small { font-weight: 400; font-size: 1.1rem; color: var(--pencil); }
.tape-pocket { width: 80px; top: 30%; right: -14px; rotate: 62deg; }

.sealed {
  position: absolute; left: 14px; right: 14px; top: 0; z-index: 1;
  animation: peek 5s ease-in-out infinite;
}
@keyframes peek { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
.sealed-card {
  margin: 0; padding: 16px 18px 120px;
  background: var(--card);
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(74,64,56,.18), 0 6px 14px -8px rgba(74,64,56,.4);
  font-size: 1rem; line-height: 1.5; text-align: center;
  rotate: 1.5deg;
}
.sc-title { display: block; font-family: var(--hand); font-weight: 700; font-size: 1.7rem; color: var(--lav-ink); line-height: 1; margin-bottom: 6px; }

.folded { position: absolute; left: 30px; right: 30px; top: 40px; z-index: 1; cursor: grab; touch-action: none; transition: translate .5s cubic-bezier(.3,1.3,.5,1); }
.folded-paper {
  display: block; height: 230px; border-radius: 2px;
  background: #FFFDF8;
  background-image: linear-gradient(transparent 32%, rgba(74,64,56,.07) 33%, transparent 34.5%), repeating-linear-gradient(transparent 0 15px, rgba(140,180,210,.3) 15px 16px);
  box-shadow: 0 1px 1px rgba(74,64,56,.2), 0 8px 14px -8px rgba(74,64,56,.4);
  rotate: -2deg;
  position: relative;
}
.fp-to { position: absolute; left: 18px; top: 16px; font-family: var(--hand); font-weight: 700; font-size: 1.5rem; color: var(--lav-ink); background: #FFFDF8; padding: 0 6px; }
.folded:hover { translate: 0 -8px; }
.folded.pulling { translate: 0 -260px !important; transition: translate .6s cubic-bezier(.5,0,.3,1); }
.btn-open { position: absolute; z-index: 5; left: 50%; bottom: -6px; translate: -50% 0; background: var(--blush); white-space: nowrap; }
.pocket-stage.emptied { height: 250px; }
.pocket-stage.emptied .folded, .pocket-stage.emptied .btn-open { display: none; }

.snail {
  position: absolute; z-index: 4; bottom: 0; left: 0; width: 92px; height: 62px;
  padding: 0; border: 0; background: none; cursor: pointer;
  animation: crawl 46s linear infinite;
  touch-action: manipulation;
}
.snail svg { width: 92px; height: 62px; overflow: visible; animation: inch 1.3s ease-in-out infinite; transform-origin: 30% 100%; }
.snail.hurry { animation-duration: 12s; }
.snail.hurry svg { animation-duration: .4s; }
@keyframes crawl {
  0% { left: 0; scale: 1 1; }
  48% { left: calc(100% - 92px); scale: 1 1; }
  50% { left: calc(100% - 92px); scale: -1 1; }
  98% { left: 0; scale: -1 1; }
  100% { left: 0; scale: 1 1; }
}
@keyframes inch { 0%, 100% { scale: 1 1; } 50% { scale: 1.07 .95; } }
.snail-say {
  position: absolute; bottom: 100%; left: 50%; translate: -50% 0;
  padding: 3px 10px; white-space: nowrap;
  background: var(--card); border: 1.6px solid var(--ink); border-radius: 14px;
  font-family: var(--hand); font-weight: 700; font-size: 1.05rem;
  opacity: 0; transition: opacity .25s;
}
.snail-say.on { opacity: 1; }
.snail.flipped .snail-say { scale: -1 1; }

.letter {
  position: relative; z-index: 2;
  margin: 18px auto 0; max-width: 620px;
  padding: 34px 24px 40px;
  background-color: #FFFDF8;
  background-image:
    linear-gradient(transparent calc(33.3% - 1px), rgba(74,64,56,.06) 33.3%, rgba(255,255,255,.7) calc(33.3% + 1px), transparent calc(33.3% + 3px)),
    linear-gradient(transparent calc(66.6% - 1px), rgba(74,64,56,.06) 66.6%, rgba(255,255,255,.7) calc(66.6% + 1px), transparent calc(66.6% + 3px)),
    var(--grain);
  border-radius: 2px;
  box-shadow: 0 1px 1px rgba(74,64,56,.2), 0 20px 34px -18px rgba(74,64,56,.55);
}
.letter[hidden] { display: none; }
.letter.unfold { animation: unfold 1.15s cubic-bezier(.2,.8,.25,1) both; transform-origin: 50% 0; }
@keyframes unfold {
  0% { transform: perspective(1200px) rotateX(-82deg) scaleY(.35) translateY(-40px); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}
.letter-inner { max-width: 34em; margin: 0 auto; }
.l-sprig { position: absolute; right: 14px; top: -18px; width: 30px; rotate: 18deg; pointer-events: none; }
.l-sprig svg { width: 100%; height: auto; fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.l-sprig .tape-mini { top: 55%; }
@media (max-width: 899px) { .letter { margin-left: -12px; margin-right: -12px; padding: 32px 20px 38px; } }
.l-greeting { font-family: var(--hand); font-weight: 700; font-size: 2rem; line-height: 1.1; margin-bottom: .8em; color: var(--ink); }
.l-body p { font-size: 1.15rem; line-height: 1.75; margin: 0 0 1.05em; text-wrap: pretty; font-variation-settings: "SOFT" 50, "opsz" 16; }
.l-signoff { font-style: italic; margin: 1.6em 0 0; font-size: 1.15rem; }
.l-signature { font-family: var(--hand); font-weight: 700; font-size: 2.7rem; line-height: 1; color: var(--lav-ink); margin: 0; rotate: -3deg; display: inline-block; }
.l-images:empty { display: none; }
.l-images { margin-top: 26px; }

/* =====================================================================
   BACK COVER
   ===================================================================== */
.backcover { display: flex; flex-direction: column; align-items: center; padding: 20px 12px 80px; }
.bc-book {
  position: relative; width: min(84vw, 340px); aspect-ratio: 1 / 1.1;
  border-radius: 14px 6px 6px 14px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(74,64,56,.18), 0 26px 40px -22px rgba(74,64,56,.6);
  rotate: 1.2deg;
  display: grid; place-items: center;
}
.bc-book .stitch { left: 12px; width: calc(100% - 24px); }
.bc-label {
  position: relative; text-align: center; padding: 20px 22px 22px;
  background: #FBF6EC; border-radius: 3px; rotate: -2deg;
  box-shadow: 0 1px 1px rgba(74,64,56,.3), 0 8px 14px -8px rgba(74,64,56,.5);
}
.bc-label::before { content: ""; position: absolute; inset: 5px; border: 1.6px dashed #A592C8; pointer-events: none; }
.bc-end { margin: 0; font-style: italic; font-size: 2.6rem; line-height: 1; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 144; }
.bc-sub { margin: 0 0 14px; font-family: var(--hand); font-size: 1.2rem; color: var(--pencil); }
.colophon { margin: 26px 0 0; font-family: var(--hand); font-size: 1.15rem; color: var(--pencil); text-align: center; }

/* =====================================================================
   LIGHTBOX + PETALS
   ===================================================================== */
.lightbox {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: rgba(43,37,32,.9); color: var(--paper);
}
.lightbox::backdrop { background: rgba(43,37,32,.6); }
.lightbox[open] { display: grid; place-items: center; animation: lbIn .3s ease; }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lb-fig { margin: 0; display: flex; flex-direction: column; align-items: center; padding: 56px 12px 24px; max-height: 100%; }
.lb-fig img { max-width: min(94vw, 1400px); max-height: calc(100svh - 150px); width: auto; height: auto; background: #FFFEFA; padding: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.lb-fig figcaption { margin-top: 12px; font-family: var(--hand); font-size: 1.4rem; text-align: center; max-width: 34em; }
.lb-btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 2px solid rgba(251,246,236,.7);
  background: rgba(251,246,236,.12); color: var(--paper); font-size: 2rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.lb-close { top: max(10px, env(safe-area-inset-top)); right: 10px; }
.lb-prev { left: 8px; top: 50%; translate: 0 -50%; }
.lb-next { right: 8px; top: 50%; translate: 0 -50%; }
.lightbox.single .lb-prev, .lightbox.single .lb-next { display: none; }

.petals { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.desk, main, .backcover { position: relative; z-index: 1; }

/* =====================================================================
   DESKTOP: the book becomes spreads
   ===================================================================== */
@media (min-width: 900px) {
  :root { --bw: 404px; --bh: 566px; }
  body { font-size: 1.1875rem; }
  .desk { padding-top: 70px; }
  .book-wrap { width: calc(var(--bw) * 2); translate: -25% 0; transition: translate 1.25s cubic-bezier(.5,.05,.2,1); }
  .is-open .book-wrap, .book-wrap.is-open { translate: 0 0; }
  .book { rotate: -.6deg; }
  @keyframes bookDrop {
    from { translate: 0 -34px; scale: 1.06; opacity: 0; rotate: -4deg; }
    60% { opacity: 1; }
    to { translate: 0 0; scale: 1; opacity: 1; rotate: -.6deg; }
  }
  .page-stack { left: auto; }
  .is-open .page-stack { width: calc(var(--bw) * 2 + 10px); right: -5px; border-radius: 10px; }
  .is-open .cover { transition: transform 1.25s cubic-bezier(.5,.05,.2,1); }
  .prop-tin { display: block; width: 210px; left: 4%; bottom: 9%; rotate: 8deg; filter: drop-shadow(0 8px 8px rgba(74,64,56,.18)); }
  .prop-pencil { display: block; width: 300px; right: 3%; bottom: 12%; rotate: -16deg; }
  .prop-leaf { width: 58px; left: 12%; top: 14%; }
  .title-page { padding: 34px 34px 24px 38px; }
  .tp-title { font-size: 3.6rem; }
  .toc li a { font-size: 1.05rem; }

  main { padding: 20px 28px 0; }
  .sheet {
    display: grid; grid-template-columns: 1fr 1fr; align-items: start;
    padding: 0;
    margin-bottom: 96px;
    border-radius: 4px;
  }
  .sheet::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 90px; translate: -50% 0; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(150,128,96,.12) 42%, rgba(110,92,70,.22) 50%, rgba(150,128,96,.12) 58%, transparent);
  }
  .leaf { padding: 64px 64px 72px; min-width: 0; }
  .leaf-full { grid-column: 1 / -1; }
  .runhead { top: 22px; left: 64px; right: 64px; }
  .chap { padding-right: 0; }
  .art { margin-left: 0; margin-right: 0; }
  .snaps { padding-top: 30px; }
  .lights { grid-column: 1 / -1; margin: 30px 30px -50px; height: 90px; }
  #formal .leaf { padding-top: 40px; }
  .sp-a, .sp-b, .sp-c, .sp-d, .sp-e, .sp-f { top: auto; bottom: 34px; right: auto; left: calc(50% - 110px); width: 62px; }
  .sp-a, .sp-f { top: 22px; bottom: auto; left: calc(50% + 26px); }
  .sp-e { width: 42px; }
  .fern-fig { display: block; }
  .lp-arrow { rotate: -80deg; margin: -6px 0 0 62%; }
  .herb-grid { grid-template-columns: repeat(4, 1fr); }
  .stickers { gap: 26px 14px; margin-top: 10px; }
  .hub { min-height: 380px; }
  .sheet-ink .leaf-l { padding-right: 40px; }
  .pad-wrap { padding-top: 6px; }
  .sheet-back { overflow: visible; }
  .sheet-back .leaf-l { padding: 64px 56px 72px; }
  .endpaper { padding: 56px 48px 64px; border-radius: 0 4px 4px 0; align-self: stretch; }
  .snaps-collage .snap { width: calc(50% - 10px); }
  .snaps-collage .snap:first-child { width: 100%; }
  #loose .snaps-collage .snap, #loose .snaps-collage .snap:first-child { width: calc(33% - 12px); }
  .backcover { padding-bottom: 110px; }
  .lb-prev { left: 24px; } .lb-next { right: 24px; }
  .ribbon-fixed { right: 32px; }
}
@media (min-width: 1200px) {
  .leaf { padding: 72px 80px 80px; }
  .runhead { left: 80px; right: 80px; }
}

/* phones only */
@media (max-width: 899px) {
  :root { --bw: min(80vw, 330px); --bh: calc(var(--bw) * 1.39); }
  .desk { padding-top: 62px; }
  .tp-volume { display: none; }
  .title-page { padding: 22px 20px 20px 24px; }
  .toc li a { min-height: 27px; padding: 2px 0; font-size: .97rem; }
  .tp-from { margin-bottom: 10px; }
  .desk-kicker { order: 1; margin-bottom: 0; }
  .desk-hint { order: 2; margin: 0 0 10px; font-size: 1.2rem; color: var(--lav-ink); }
  .desk-hint svg { scale: 1 -1; translate: 0 6px; width: 36px; }
  .book-wrap { order: 3; }
  .is-open .cover { opacity: 0; visibility: hidden; }
  .leaf-r { margin-top: 26px; }
  .sheet-back .leaf-r { margin-top: 0; }
  .sp-g { display: none; }
}
@media (max-width: 370px) {
  body { font-size: 1.0625rem; }
  .tin { gap: 4px; padding: 6px; }
  .pan { width: 32px; height: 32px; }
}

/* =====================================================================
   REDUCED MOTION: keep it all usable, swap big motion for fades
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .25s !important; transition-delay: 0s !important; }
  .boil, html[data-boil] .boil { filter: none !important; }
  .js .sheet { transform: none; opacity: 1; }
  .cover { transition: opacity .4s ease !important; }
  .is-open .cover { transform: none; opacity: 0; visibility: hidden; }
  .is-open .flutter { animation: none; }
  .book { animation: none; }
  .snail { animation: none; left: 8px; }
  .ribbon-tail { animation: none; }
  .letter.unfold { animation: lbIn .4s ease both !important; }
}
