/* =======================================================================
   scrapbook.css : the painted-scrapbook kit for mukashi.world's pages
   -----------------------------------------------------------------------
   One 12-column folio. Bands alternate WIDE (art spreads across the folio
   and past its edge) and NARROW (one reading column, pushed off centre).
   Painted objects sit on the grid edges as anchors, painted paper carries
   text that would otherwise sit in a CSS card, and a few lines the page
   already says come back as handwritten pull quotes.

   Read scripts/scrapbook/README.md before using it: every offset, tilt and
   overlap a page needs is a TOKEN or a RECIPE here, so a page never invents
   its own. Page-specific placement (which recipe a section uses, which
   object anchors it) lives in the page.

   Rules the kit enforces (Tom, 2026-10-16 + 2026-11-01):
   - Anything sitting ON a painting is painted (tags, paper, stars); never a
     flat CSS shape.
   - Text is set at 0 degrees. Tilt belongs to plates, paper and objects.
   - The star-field (legal.css .page-stars) is untouched.
   - All scroll-driven motion runs in ONE requestAnimationFrame loop
     (scrapbook.js). Reduced motion = drawn and still.
   ======================================================================= */

/* ---------------------------------------------------------------- tokens */
.sb {
  --sb-max: 1240px;                              /* folio width */
  --sb-gap: 24px;                                /* column gap */
  --sb-gutter: clamp(1rem, 4vw, 2.75rem);        /* folio side padding */
  --sb-bleed: max(0px, (100vw - var(--sb-max)) / 2); /* folio edge to window edge */
  --sb-band: clamp(2.5rem, 5vw, 4.5rem);         /* a band's top/bottom padding */
  --sb-rise: clamp(1.1rem, 2.4vw, 2.5rem);       /* one step of a rising row */
  --sb-pull: clamp(3rem, 10vw, 9rem);            /* how far a timeline stop rides up beside the last */
  --sb-overlap: clamp(4rem, 8vw, 8rem);          /* an edge-break figure's reach into the next band */
  --sb-sticky: 6rem;                             /* side anchor's sticky top */

  --sb-ink: #22295a;                             /* text on paper */
  --sb-ink-soft: rgba(34, 41, 90, 0.78);
  --sb-gold: var(--lamp, #FFE9B8);               /* handwriting on the night */
  --sb-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --sb-shadow: drop-shadow(0 18px 22px rgba(4, 8, 32, 0.5)) drop-shadow(0 3px 4px rgba(4, 8, 32, 0.35));

  /* the only tilts a page uses; recipes cycle through them */
  --sb-tilt-1: -1.4deg;
  --sb-tilt-2: 1.6deg;
  --sb-tilt-3: 1deg;
  --sb-tilt-4: -2deg;
  --sb-tilt-5: 1.2deg;
  --sb-tilt-6: -2.2deg;
  overflow-x: clip;
}
.sb h2 { text-wrap: balance; }

/* ---------------------------------------------------------------- folio + grid */
.sb-folio { max-width: var(--sb-max); margin-inline: auto; padding-inline: var(--sb-gutter); box-sizing: border-box; }
.sb .sb-band { position: relative; padding-block: var(--sb-band); }
.sb-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--sb-gap); }
/* place a child on the grid by role, never by a one-off offset */
.sb-col-read   { grid-column: 1 / span 7; }       /* reading column, left */
.sb-col-read-r { grid-column: 6 / span 7; }       /* reading column, right */
.sb-col-mid    { grid-column: 3 / span 8; }       /* centred reading column */
.sb-col-side   { grid-column: 1 / span 4; }       /* side column, left */
.sb-col-side-r { grid-column: 9 / span 4; }       /* side column, right */
.sb-col-full   { grid-column: 1 / -1; }

/* ======================================================================
   PRIMITIVES
   ====================================================================== */

/* -- Pull quote: a line the page already says, in a hand. Decorative
      (aria-hidden), set at 0 degrees, written in once. EN = Caveat,
      JA = Yomogi (subset: scripts/scrapbook/subset-hand-font.mjs). */
.sb-quote {
  font-family: 'Caveat', 'Yomogi', 'M PLUS Rounded 1c', cursive;
  font-weight: 600;
  font-size: clamp(2rem, 3.3vw, 2.9rem);
  line-height: 1.08;
  color: var(--sb-gold);
  text-shadow: 0 0 22px rgba(245, 166, 35, 0.35);
  margin: 0;
  max-width: 16ch;
  text-wrap: balance;
  pointer-events: none;
}
.sb-quote:lang(ja) { font-family: 'Yomogi', 'M PLUS Rounded 1c', sans-serif; font-weight: 400; }
.sb-quote .i18n-jp, .sb-quote:lang(ja) > span {
  font-family: 'Yomogi', 'M PLUS Rounded 1c', sans-serif;
  font-weight: 400;
  font-size: 0.62em;
  line-height: 1.55;
  letter-spacing: 0.04em;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.sb-quote:lang(ja) { max-width: 13em; }
.sb-quote--end { text-align: right; margin-inline-start: auto; }
/* a smaller hand for captions and asides */
.sb-hand { font-family: 'Caveat', 'Yomogi', cursive; font-weight: 600; font-size: 1.35rem; color: var(--sb-gold); }
.sb-hand .i18n-jp, .sb-hand:lang(ja) > span { font-family: 'Yomogi', 'M PLUS Rounded 1c', sans-serif; font-weight: 400; font-size: 0.85em; }
/* written in, left to right, once (scrapbook.js adds .is-in; no JS = shown) */
.sb-js .sb-quote { clip-path: inset(-30% 100% -30% -5%); transition: clip-path 1.3s var(--sb-ease) 0.15s; }
.sb-js .sb-quote.is-in { clip-path: inset(-30% -8% -30% -5%); }

/* -- Object: a painted thing (telescope, logbook, star chart) with the
      kit's shadow and a tilt. data-drift="0.04..0.08" floats it a few px
      against the scroll so it sits on its own layer. */
.sb-object { display: block; height: auto; filter: var(--sb-shadow); transform: rotate(var(--sb-tilt, var(--sb-tilt-4))); }
/* every painted layer with a drop-shadow filter gets its own compositing
   layer: without it WebKit repaints the filters on every scroll frame
   (measured 111 ms/frame at 1440 before, ~17 after) */
.sb [data-drift] { will-change: transform; }

/* -- Plate: a painting with a torn edge. Three tears (a, b, c) so no two
      neighbouring plates share an edge; recipes cycle them, or set
      data-tear on the plate. The shadow sits on the plate, the mask on the
      image, so the shadow follows the tear. */
.sb-plate { position: relative; display: block; filter: var(--sb-shadow); transform: rotate(var(--sb-tilt, 0deg)); will-change: transform; }
.sb-plate > img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  -webkit-mask: var(--sb-tear, url("/Assets/scrapbook/tear-a.webp")) center / 100% 100% no-repeat;
          mask: var(--sb-tear, url("/Assets/scrapbook/tear-a.webp")) center / 100% 100% no-repeat;
}
.sb-plate[data-tear="a"] { --sb-tear: url("/Assets/scrapbook/tear-a.webp"); }
.sb-plate[data-tear="b"] { --sb-tear: url("/Assets/scrapbook/tear-b.webp"); }
.sb-plate[data-tear="c"] { --sb-tear: url("/Assets/scrapbook/tear-c.webp"); }

/* -- Tag: the painted brass tag (Tom's, from PR #62), hung on a plate's
      top-left corner with the words set live on its blank face. At 0 deg. */
.sb-tag {
  position: absolute; top: -1.05rem; left: 0.8rem; z-index: 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 6.4rem; aspect-ratio: 1170 / 474;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  font-weight: 600; font-size: 0.8rem; letter-spacing: 0.02em; line-height: 1;
  color: #5a3a12;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.55);
  background: url('/Assets/eiken/level-tag-w200.webp') center / 100% 100% no-repeat;
  background-image: image-set(url('/Assets/eiken/level-tag-w200.webp') 1x, url('/Assets/eiken/level-tag-w400.webp') 2x);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

/* a tag that grows with its words (world names, longer labels): the same
   painted tag, sliced so the rivets at its ends never stretch */
.sb-tag--wide {
  width: auto; aspect-ratio: auto; height: 2.15rem; padding: 0 1.45rem; box-sizing: border-box;
  white-space: nowrap; font-size: 0.84rem;
  background: none;
  border-image: url('/Assets/eiken/level-tag-w400.webp') 0 64 0 64 fill / 0 1.45rem 0 1.45rem stretch;
}
.sb-tag--wide:lang(ja), .sb-tag--wide .i18n-jp { font-family: 'M PLUS Rounded 1c', sans-serif; font-weight: 800; letter-spacing: 0.04em; font-size: 0.8rem; }

/* -- Caption: the title and line under a plate or timeline stop. Text at
      0 degrees, never on the painting. */
.sb-caption h3 {
  font-family: 'Fraunces', 'M PLUS Rounded 1c', Georgia, serif;
  font-variation-settings: 'opsz' 60, 'wght' 700, 'SOFT' 100, 'WONK' 1;
  font-weight: 700; font-size: 1.15rem; line-height: 1.4;
  color: var(--sb-gold);
  margin: 0.9rem 0 0.2rem;
  word-break: keep-all; overflow-wrap: anywhere;
}
.sb-caption p { font-size: 0.9rem; line-height: 1.75; max-width: 30em; margin: 0; }
[data-size="l"] > .sb-caption h3, [data-size="xl"] > .sb-caption h3, .sb-caption--lead h3 { font-size: 1.45rem; }

/* -- Linked plate: a plate (+ caption) that opens another page, for link
      grids (hubs, What's New, Printables). Wrap them in <a class="sb-link">.
      Hover lifts the plate, focus draws a gold ring, a press settles it. */
.sb-link { display: block; color: inherit; text-decoration: none; border-radius: 8px; -webkit-tap-highlight-color: transparent; }
.sb-link .sb-plate { transition: transform 220ms var(--sb-ease), filter 220ms var(--sb-ease); }
.sb-link .sb-caption h3 { transition: color 180ms ease; }
@media (hover: hover) and (pointer: fine) {
  .sb-link:hover .sb-plate { transform: rotate(var(--sb-tilt, 0deg)) translateY(-5px) scale(1.015); filter: drop-shadow(0 26px 28px rgba(4, 8, 32, 0.55)) drop-shadow(0 3px 4px rgba(4, 8, 32, 0.35)); }
  .sb-link:hover .sb-caption h3 { color: #fff4d6; }
}
.sb-link:focus-visible { outline: 2px solid var(--sb-gold); outline-offset: 8px; }
.sb-link:focus-visible .sb-caption h3 { color: #fff4d6; }
.sb-link:active .sb-plate { transform: rotate(var(--sb-tilt, 0deg)) scale(0.98); transition-duration: 120ms; }

/* ======================================================================
   RECIPE 0 : PAGE HEAD (every scrapbook page opens with it)
   ----------------------------------------------------------------------
   <section class="sb-head"><div class="sb-folio sb-head__grid">
     <div class="sb-head__copy">h1, lead, actions</div>
     <div class="sb-head__art">the page's painting</div></div></section>
   The art is the page's door: it carries view-transition-name from
   --sb-arrival (set per page, e.g. style="--sb-arrival: arrival-eiken"),
   so a link elsewhere can grow into it (phase 3, Arrival). Default none.
   Follow it with a .sb-pinned paper insert to pin a note over its corner.
   ====================================================================== */
.sb .sb-head { padding-top: clamp(1.5rem, 4vw, 3rem); padding-bottom: clamp(2.5rem, 5vw, 4.5rem); }
.sb-head__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.sb-head__copy { padding-top: clamp(1rem, 4vw, 4rem); }
.sb-head__art { justify-self: end; width: min(100%, 540px); margin-right: calc(var(--sb-gutter) * -0.5); view-transition-name: var(--sb-arrival, none); }

/* ======================================================================
   RECIPE 3 : PAPER INSERT (painted paper holding live text)
   ----------------------------------------------------------------------
   <div class="sb-paper sb-paper--note"><div class="sb-paper__ink">…</div></div>
   The painting is 9-sliced onto ::before and only IT tilts; the text in
   .sb-paper__ink stays at 0 degrees, inside the painted margin. Border
   widths scale with the paper's own width (container units), so the pin
   and corners never stretch out of shape.
   ====================================================================== */
.sb-paper {
  --iw: 640;                 /* source width of the art */
  --st: 24; --sr: 24; --sb: 24; --sl: 24;   /* slice, source px */
  --pad: 0.4rem;             /* extra breathing room inside the margin */
  --k: 1;                    /* border scale; < 1 = a thinner painted margin (phone) */
  --u: calc(100cqw / var(--iw) * var(--k));  /* one source px, on screen */
  position: relative; isolation: isolate;
  container-type: inline-size;
  color: var(--sb-ink);
  box-sizing: border-box;
  width: 100%;               /* size containment: the paper takes its width from its column, never its text */
}
.sb-paper::before {
  will-change: transform;
  content: ''; position: absolute; inset: 0; z-index: -1;
  box-sizing: border-box;
  border-style: solid; border-color: transparent;
  border-width: calc(var(--st) * var(--u)) calc(var(--sr) * var(--u)) calc(var(--sb) * var(--u)) calc(var(--sl) * var(--u));
  border-image: var(--art) var(--st) var(--sr) var(--sb) var(--sl) fill / 1 / 0 stretch;
  filter: var(--sb-shadow);
  transform: rotate(var(--sb-tilt, -1.2deg));
  transform-origin: 50% 8%;
}
.sb-paper__ink {
  /* the text inset defaults to the slice; a paper whose painted border is
     wide (the letter) sets a smaller --it/--ir/--ib/--il */
  padding: calc(var(--it, var(--st)) * var(--u) + var(--pad)) calc(var(--ir, var(--sr)) * var(--u) + var(--pad)) calc(var(--ib, var(--sb)) * var(--u) + var(--pad)) calc(var(--il, var(--sl)) * var(--u) + var(--pad));
}
.sb-paper__ink > :first-child { margin-top: 0; }
.sb-paper__ink > :last-child { margin-bottom: 0; }
.sb-paper p { color: var(--sb-ink-soft); }
/* a note pinned at the top (red pin), folded once */
.sb-paper--note { --art: url("/Assets/schools/note-letter-w640.webp"); --st: 112; --sr: 26; --sb: 30; --sl: 26; --pad: 0.6rem; }
/* a letter with a painted border (the comparison letter) */
.sb-paper--letter { --art: url("/Assets/sections/letter-transparent.webp"); --iw: 896; --st: 170; --sr: 130; --sb: 170; --sl: 130; --it: 150; --ir: 132; --ib: 136; --il: 132; --pad: 0.2rem; --sb-tilt: -0.6deg; }
/* the index card (blue pin, curled corner), 9-sliced so it grows with its
   text: for a run of notes that rotate their paper (What's New). The torn
   notebook page (--torn) is defined with the sheets recipe below. */
.sb-paper--memo { --art: url("/Assets/schools/note-card-w640.webp"); --st: 111; --sr: 20; --sb: 101; --sl: 20; --ib: 70; --pad: 0.6rem; }
/* a card with a curled corner (blue pin): fixed shape, never sliced */
.sb-paper--card { aspect-ratio: 640 / 510; display: grid; place-items: center; text-align: center; }
.sb-paper--card::before { border: 0; border-image: none; background: url("/Assets/schools/note-card-w640.webp") center / 100% 100% no-repeat; }
/* pinned over the band above (the hero note): rides up onto it */
.sb-pinned { position: relative; z-index: 3; margin-top: calc(var(--sb-overlap) * -1.1); }

/* -- Contents: a short list of a long page's own headings, for a side
      anchor (articles). Each link gets a small painted star; scrapbook.js
      marks the section being read (.is-current), so the star lights. */
.sb-toc { margin: 0; padding: 0; list-style: none; counter-reset: none; }
.sb-toc-label { font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 233, 184, 0.7); margin: 0 0 0.7rem; }
.sb-toc li { margin: 0; }
.sb-toc a {
  position: relative; display: block; padding: 0.42rem 0 0.42rem 1.55rem;
  font-size: 0.86rem; line-height: 1.5; color: rgba(250, 246, 239, 0.68); text-decoration: none;
  word-break: keep-all; overflow-wrap: anywhere; transition: color 200ms ease;
}
.sb-toc a::before {
  content: ''; position: absolute; left: 0; top: 0.62rem; width: 13px; height: 13px;
  background: url("/Assets/scrapbook/star-unlit.webp") center / contain no-repeat; opacity: 0.7;
}
.sb-toc a::after {
  content: ''; position: absolute; left: 0; top: 0.62rem; width: 13px; height: 13px;
  background: url("/Assets/scrapbook/star-lit.webp") center / contain no-repeat;
  opacity: 0; transform: scale(0.6); transition: opacity 320ms var(--sb-ease), transform 420ms var(--sb-ease);
  filter: drop-shadow(0 0 5px rgba(255, 210, 120, 0.8));
}
.sb-toc a:hover, .sb-toc a:focus-visible { color: var(--sb-gold); }
.sb-toc a:focus-visible { outline: 2px solid var(--sb-gold); outline-offset: 3px; border-radius: 4px; }
.sb-toc a.is-current { color: #fff4d6; }
.sb-toc a.is-current::after { opacity: 1; transform: scale(1); }

/* ======================================================================
   RECIPE 1 : WIDE COLLAGE (plates pasted across the folio)
   ----------------------------------------------------------------------
   <ol class="sb-collage"><li class="sb-collage__item"><div class="sb-plate">…
   Up to six items; sizes, stagger, tilt and tear all come from position.
   ====================================================================== */
.sb-collage {
  list-style: none; margin: 2.6rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--sb-gap); row-gap: 1.5rem; align-items: start;
}
.sb-collage__item { position: relative; }
.sb-collage__item:nth-of-type(6n+1) { grid-column: 1 / span 7; --sb-tilt: var(--sb-tilt-1); }
.sb-collage__item:nth-of-type(6n+2) { grid-column: 8 / span 5; margin-top: calc(var(--sb-rise) * 2.2); --sb-tilt: var(--sb-tilt-2); }
.sb-collage__item:nth-of-type(6n+3) { grid-column: 1 / span 4; margin-top: calc(var(--sb-rise) * 0.6); --sb-tilt: var(--sb-tilt-3); }
.sb-collage__item:nth-of-type(6n+4) { grid-column: 5 / span 4; margin-top: calc(var(--sb-rise) * 2); --sb-tilt: var(--sb-tilt-4); }
.sb-collage__item:nth-of-type(6n+5) { grid-column: 9 / span 4; margin-top: calc(var(--sb-rise) * 0.2); --sb-tilt: var(--sb-tilt-5); }
.sb-collage__item:nth-of-type(6n)   { grid-column: 2 / span 3; --sb-tilt: var(--sb-tilt-6); }

/* ======================================================================
   RECIPE 2 : NARROW RISING (a row that climbs, like Hoshi's steps)
   ----------------------------------------------------------------------
   <ol class="sb-rising"><li>…</li>…</ol>  2 to 6 items, equal columns,
   each one a step higher than the one before. Use it for a real sequence.
   ====================================================================== */
.sb-rising {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  column-gap: clamp(1.2rem, 3vw, 2.4rem); align-items: start;
}
.sb-rising > :nth-last-of-type(2) { margin-top: calc(var(--sb-rise) * 1); }
.sb-rising > :nth-last-of-type(3) { margin-top: calc(var(--sb-rise) * 2); }
.sb-rising > :nth-last-of-type(4) { margin-top: calc(var(--sb-rise) * 3); }
.sb-rising > :nth-last-of-type(5) { margin-top: calc(var(--sb-rise) * 4); }
.sb-rising > :nth-last-of-type(6) { margin-top: calc(var(--sb-rise) * 5); }

/* ======================================================================
   RECIPE 4 : SIDE ANCHOR (a heading and a painted object hold one side
   while the reading runs down the other; the object travels with you)
   ----------------------------------------------------------------------
   <div class="sb-side"><div class="sb-side__aside">h2 + .sb-object (+ quote)</div>
     <div class="sb-side__main">…</div></div>      .sb-side--right flips it.
   ====================================================================== */
.sb-side { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--sb-gap); align-items: start; }
.sb-side__aside { grid-column: 1 / span 4; grid-row: 1; position: sticky; top: var(--sb-sticky); }
.sb-side__main { grid-column: 6 / span 7; grid-row: 1; }
.sb-side--right .sb-side__aside { grid-column: 9 / span 4; }
.sb-side--right .sb-side__main { grid-column: 1 / span 7; }
.sb-side__aside .sb-object { width: min(250px, 80%); margin-top: 0.4rem; }
.sb-side__aside .sb-quote { margin-top: 1.4rem; font-size: clamp(1.7rem, 2.6vw, 2.3rem); }

/* ======================================================================
   RECIPE 5 : EDGE-BREAK FIGURE (a painted object larger than its column,
   breaking out past the folio edge and over the next band)
   ----------------------------------------------------------------------
   <div class="sb-split"><div>text</div>
     <figure class="sb-edge"><img class="sb-object" …></figure></div>
   then the band below gets .sb-tuck so it slides under the figure.
   .sb-edge--left breaks the left edge instead (put the figure first).
   ====================================================================== */
.sb-split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(1.5rem, 5vw, 4.5rem); align-items: start; }
.sb-split--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.sb-edge { position: relative; margin: 0; margin-right: calc((var(--sb-gutter) + var(--sb-bleed) * 0.55) * -1); }
.sb-edge--left { margin-right: 0; margin-left: calc((var(--sb-gutter) + var(--sb-bleed) * 0.55) * -1); }
.sb-edge > .sb-object { width: 100%; }
@media (min-width: 861px) {
  .sb-edge--over { margin-top: calc(var(--sb-overlap) * -0.9); margin-bottom: calc(var(--sb-overlap) * -1.15); }
  .sb .sb-band:has(.sb-edge--over) { z-index: 2; padding-bottom: 1.5rem; }
  .sb .sb-tuck { z-index: 1; padding-top: 0; }
}

/* ======================================================================
   RECIPE 6 : TIMELINE (stops in order, joined by a road of stars)
   ----------------------------------------------------------------------
   <ol class="sb-timeline" data-sb-timeline>
     <li class="sb-tl-item" data-size="l|m|s|xs"><div class="sb-plate sb-node">…
     …<li class="sb-tl-item" data-size="xs"> (the last stop: e.g. a card)
   Stops alternate sides, varied in size and inset, each riding up beside
   the one before. scrapbook.js lays a road through them (behind the
   plates, so it never sits on a painting) and sets painted stars along
   it, which light one by one as the road reaches them, like the app's
   atlas. After the last stop a few unlit stars carry the road on.
   ====================================================================== */
.sb-timeline {
  --sb-tl-star: 15px;        /* a star's size */
  --sb-tl-step: 30px;        /* distance between stars */
  position: relative; list-style: none; margin: 2.6rem 0 0; padding: 0 0 2.5rem;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--sb-gap);
  align-items: start;
}
.sb-tl-item { position: relative; z-index: 1; --w: 5; }
.sb-tl-item[data-size="xl"] { --w: 7; }            /* a lead stop (Hoshi's first scene); 2026-11-01 */
.sb-tl-item[data-size="l"]  { --w: 6; }
.sb-tl-item[data-size="m"]  { --w: 5; }
.sb-tl-item[data-size="s"]  { --w: 4; }
.sb-tl-item[data-size="xs"] { --w: 3; }
/* left stops start on line 1 or 2, right stops end on line -1 or -2 */
.sb-tl-item:nth-of-type(odd)  { grid-column: var(--from, 1) / span var(--w); }
.sb-tl-item:nth-of-type(even) { grid-column: span var(--w) / var(--to, -1); }
.sb-tl-item:nth-of-type(4n+3) { --from: 2; }
.sb-tl-item:nth-of-type(4n)   { --to: -2; }
/* every stop on its own row (so it can ride up beside the last one) */
.sb-tl-item:nth-of-type(1) { grid-row: 1; }
.sb-tl-item:nth-of-type(2) { grid-row: 2; }
.sb-tl-item:nth-of-type(3) { grid-row: 3; }
.sb-tl-item:nth-of-type(4) { grid-row: 4; }
.sb-tl-item:nth-of-type(5) { grid-row: 5; }
.sb-tl-item:nth-of-type(6) { grid-row: 6; }
.sb-tl-item:nth-of-type(7) { grid-row: 7; }
.sb-tl-item:nth-of-type(8) { grid-row: 8; }
.sb-tl-item:nth-of-type(9) { grid-row: 9; }
.sb-tl-item:nth-of-type(10) { grid-row: 10; }
.sb-tl-item:nth-of-type(11) { grid-row: 11; }
.sb-tl-item:nth-of-type(12) { grid-row: 12; }
.sb-tl-item + .sb-tl-item { margin-top: calc(var(--sb-pull) * -1); }
.sb-tl-item:nth-of-type(6n+1) { --sb-tilt: var(--sb-tilt-1); --sb-tear: url("/Assets/scrapbook/tear-a.webp"); }
.sb-tl-item:nth-of-type(6n+2) { --sb-tilt: var(--sb-tilt-2); --sb-tear: url("/Assets/scrapbook/tear-b.webp"); }
.sb-tl-item:nth-of-type(6n+3) { --sb-tilt: var(--sb-tilt-3); --sb-tear: url("/Assets/scrapbook/tear-c.webp"); }
.sb-tl-item:nth-of-type(6n+4) { --sb-tilt: var(--sb-tilt-4); --sb-tear: url("/Assets/scrapbook/tear-a.webp"); }
.sb-tl-item:nth-of-type(6n+5) { --sb-tilt: var(--sb-tilt-5); --sb-tear: url("/Assets/scrapbook/tear-b.webp"); }
.sb-tl-item:nth-of-type(6n)   { --sb-tilt: var(--sb-tilt-6); --sb-tear: url("/Assets/scrapbook/tear-c.webp"); }
.sb-tl-item:nth-of-type(odd) > .sb-caption { padding-right: 0.5rem; }
.sb-tl-item:nth-of-type(even) > .sb-caption { padding-left: 0.5rem; }
/* the road (drawn by scrapbook.js) */
.sb-tl-road { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; will-change: transform; }
.sb-tl-road .sb-tl-line { fill: none; stroke: rgba(255, 233, 184, 0.34); stroke-width: 1.25; stroke-linecap: round; stroke-dasharray: 2 5; }
.sb-tl-star { transition: opacity 0.6s var(--sb-ease); }
.sb-tl-star-in { transform-box: fill-box; transform-origin: center; }
.sb-tl-star .lit { opacity: 0; transition: opacity 0.45s var(--sb-ease); }
.sb-tl-star.is-lit .lit { opacity: 1; }
.sb-tl-star .unlit { opacity: 0.55; transition: opacity 0.45s var(--sb-ease); }
.sb-tl-star.is-lit .unlit { opacity: 0; }
.sb-tl-star-in.is-pop { animation: sb-star-pop 520ms var(--sb-ease); }
.sb-tl-star.is-tail .unlit { opacity: var(--fade, 0.45); }
/* a milestone on the road (<span class="sb-tl-mark"> inside the stop it
   comes BEFORE; scrapbook.js moves it onto the road): the painted brass tag
   with a big lit star, dim until the road reaches it, then it lights */
.sb-tl-mark {
  position: absolute; z-index: 2; left: 0; top: 0;
  transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  width: 9.6rem; aspect-ratio: 1170 / 474; padding: 0 0.9rem 0 1.5rem; box-sizing: border-box;
  font-family: 'Fredoka', 'M PLUS Rounded 1c', sans-serif;
  font-weight: 600; font-size: 0.76rem; line-height: 1.15; letter-spacing: 0.01em;
  color: #5a3a12; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.55);
  background: url('/Assets/eiken/level-tag-w400.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)) saturate(0.35) brightness(0.62);
  opacity: 0.75;
  transition: filter 0.6s var(--sb-ease), opacity 0.6s var(--sb-ease);
  pointer-events: none;
  will-change: transform;
}
.sb-tl-mark::before {
  content: ''; position: absolute; left: -0.95rem; top: 50%; width: 2.1rem; height: 2.1rem; transform: translateY(-50%);
  background: url('/Assets/scrapbook/star-unlit.webp') center / contain no-repeat;
}
.sb-tl-mark.is-lit { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 14px rgba(245, 166, 35, 0.35)); opacity: 1; }
.sb-tl-mark.is-lit::before { background-image: url('/Assets/scrapbook/star-lit.webp'); filter: drop-shadow(0 0 8px rgba(255, 220, 140, 0.8)); }
.sb-tl-mark.is-pop { animation: sb-mark-pop 640ms var(--sb-ease); }
.sb-tl-mark.on-rail { transform: translate(0, -50%); }
@keyframes sb-mark-pop { 0% { transform: translate(-50%, -50%) scale(0.86); } 55% { transform: translate(-50%, -50%) scale(1.08); } 100% { transform: translate(-50%, -50%) scale(1); } }
.sb-tl-mark.on-rail.is-pop { animation-name: sb-mark-pop-rail; }
@keyframes sb-mark-pop-rail { 0% { transform: translate(0, -50%) scale(0.86); } 55% { transform: translate(0, -50%) scale(1.08); } 100% { transform: translate(0, -50%) scale(1); } }
@keyframes sb-star-pop { 0% { transform: scale(0.55); } 55% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ======================================================================
   RECIPE 7 : SHEETS (printable sheets pinned into the scrapbook)
   Added 2026-11-01 for the Printables pages (resources, coloring,
   letter-paper). A printable is real paper, not a painting, so it is not
   torn: it keeps its own edge and printed border, and a painted pin
   (cropped from Tom's painted notes into Assets/scrapbook/pin-red|blue|
   brass.webp) holds it to the page.
   ----------------------------------------------------------------------
   Sheet   <figure class="sb-sheet"><img …></figure>
           the pin is the figure's ::after; data-pin="red|blue|brass|none"
           picks one by hand, the recipes below cycle them.
   Pile    <div class="sb-pile"> 2 or 3 .sb-sheet (or .sb-plate) </div>
           stacked in one cell, the first in front, the others peeking out
           left and right; it fans out once when it comes into view
           (scrapbook.js adds .is-in). For a page head's art, and for a
           linked hub tile that stands for a whole set (.sb-link).
   Mosaic  <ol class="sb-sheets"><li class="sb-sheets__item">
             <figure class="sb-sheet">…</figure> caption + downloads </li>
           4 to 6 sheets: the first big over two rows, the rest staggered
           round it (rows are explicit, so a page may mirror the columns). Tablet: three across, the middle one lower. Phone: two
           across, the right one lower. Each sheet settles onto its pin once,
           the first time it scrolls in. .sb-sheets--row: up to four sheets
           the same size, one climbing row, no lead.
   ====================================================================== */
.sb {
  --sb-tilt-pile-l: -6deg;                       /* a sheet peeking out left of a pile */
  --sb-tilt-pile-r: 5deg;                        /* … and right */
  --sb-pin-w: clamp(20px, 2.1vw, 30px);          /* a pin's width */
}
.sb-sheet {
  position: relative; margin: 0; display: block;
  filter: var(--sb-shadow);
  transform: rotate(var(--sb-tilt, 0deg));
  will-change: transform;
}
.sb-sheet > img { display: block; width: 100%; height: auto; background: #fff; }
.sb-sheet::after {
  /* the pin's point sits ~30% across and ~85% down its image: that point
     lands just inside the sheet's top edge, so the head stands above it */
  content: ''; position: absolute; z-index: 1; top: 0; left: 50%;
  width: var(--sb-pin-w); aspect-ratio: 79 / 127;
  transform: translate(-30%, calc(-85% + 0.6rem));
  background: var(--sb-pin, url("/Assets/scrapbook/pin-red.webp")) center / contain no-repeat;
  pointer-events: none;
}
.sb-sheet[data-pin="red"]   { --sb-pin: url("/Assets/scrapbook/pin-red.webp"); }
.sb-sheet[data-pin="blue"]  { --sb-pin: url("/Assets/scrapbook/pin-blue.webp"); }
.sb-sheet[data-pin="brass"] { --sb-pin: url("/Assets/scrapbook/pin-brass.webp"); }
.sb-sheet[data-pin="none"]::after { display: none; }

/* -- Pile */
.sb-pile { position: relative; display: grid; align-items: start; }
.sb-pile > * { grid-area: 1 / 1; transition: translate 900ms var(--sb-ease); }
.sb-pile > :nth-child(1) { z-index: 3; width: 64%; justify-self: center; margin-top: 3%; --sb-tilt: var(--sb-tilt-3); }
.sb-pile > :nth-child(2) { z-index: 2; width: 54%; justify-self: start; margin-top: 11%; --sb-tilt: var(--sb-tilt-pile-l); --sb-pin: url("/Assets/scrapbook/pin-blue.webp"); transition-delay: 120ms; }
.sb-pile > :nth-child(3) { z-index: 1; width: 54%; justify-self: end; margin-top: 19%; --sb-tilt: var(--sb-tilt-pile-r); --sb-pin: url("/Assets/scrapbook/pin-brass.webp"); transition-delay: 220ms; }
/* tucked behind the front sheet until it fans out (JS only; no JS = fanned) */
.sb-js .sb-pile:not(.is-in) > :nth-child(2) { translate: 22% -4%; }
.sb-js .sb-pile:not(.is-in) > :nth-child(3) { translate: -22% -10%; }
.sb-link .sb-sheet { transition: transform 220ms var(--sb-ease), translate 900ms var(--sb-ease), filter 220ms var(--sb-ease); }
.sb-link .sb-pile > :nth-child(2) { transition: transform 220ms var(--sb-ease), translate 900ms var(--sb-ease) 120ms, filter 220ms var(--sb-ease); }
.sb-link .sb-pile > :nth-child(3) { transition: transform 220ms var(--sb-ease), translate 900ms var(--sb-ease) 220ms, filter 220ms var(--sb-ease); }
@media (hover: hover) and (pointer: fine) {
  .sb-link:hover .sb-sheet { transform: rotate(var(--sb-tilt, 0deg)) translateY(-5px) scale(1.015); filter: drop-shadow(0 26px 28px rgba(4, 8, 32, 0.55)) drop-shadow(0 3px 4px rgba(4, 8, 32, 0.35)); }
  .sb-link:hover .sb-pile > :nth-child(2) { transform: rotate(calc(var(--sb-tilt) - 2deg)) translateX(-5%); }
  .sb-link:hover .sb-pile > :nth-child(3) { transform: rotate(calc(var(--sb-tilt) + 2deg)) translateX(5%); }
}
.sb-link:active .sb-sheet { transform: rotate(var(--sb-tilt, 0deg)) scale(0.98); transition-duration: 120ms; }

/* -- Mosaic */
.sb-sheets {
  list-style: none; margin: 2.4rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--sb-gap); row-gap: clamp(1.5rem, 3vw, 2.6rem); align-items: start;
}
.sb-sheets__item { position: relative; min-width: 0; }
.sb-sheets__item:nth-of-type(1) { grid-column: 1 / span 4; grid-row: 1 / span 2; --sb-tilt: var(--sb-tilt-1); --sb-pin: url("/Assets/scrapbook/pin-red.webp"); }
.sb-sheets__item:nth-of-type(2) { grid-column: 6 / span 3; grid-row: 1; --sb-tilt: var(--sb-tilt-2); --sb-pin: url("/Assets/scrapbook/pin-blue.webp"); --sb-i: 1; }
.sb-sheets__item:nth-of-type(3) { grid-column: 10 / span 3; grid-row: 1; margin-top: calc(var(--sb-rise) * 2.4); --sb-tilt: var(--sb-tilt-4); --sb-pin: url("/Assets/scrapbook/pin-brass.webp"); --sb-i: 2; }
.sb-sheets__item:nth-of-type(4) { grid-column: 5 / span 3; grid-row: 2; margin-top: calc(var(--sb-rise) * -0.6); --sb-tilt: var(--sb-tilt-5); --sb-pin: url("/Assets/scrapbook/pin-red.webp"); --sb-i: 3; }
.sb-sheets__item:nth-of-type(5) { grid-column: 9 / span 3; grid-row: 2; margin-top: calc(var(--sb-rise) * 1.4); --sb-tilt: var(--sb-tilt-3); --sb-pin: url("/Assets/scrapbook/pin-blue.webp"); --sb-i: 4; }
.sb-sheets__item:nth-of-type(6) { grid-column: 1 / span 3; grid-row: 3; --sb-tilt: var(--sb-tilt-6); --sb-pin: url("/Assets/scrapbook/pin-brass.webp"); --sb-i: 5; }
/* --row: up to 4 sheets the same size in one climbing row (no lead) */
.sb-sheets--row .sb-sheets__item:nth-of-type(n) { grid-row: 1; }
.sb-sheets--row .sb-sheets__item:nth-of-type(1) { grid-column: 1 / span 3; margin-top: 0; }
.sb-sheets--row .sb-sheets__item:nth-of-type(2) { grid-column: 4 / span 3; margin-top: calc(var(--sb-rise) * 2.6); }
.sb-sheets--row .sb-sheets__item:nth-of-type(3) { grid-column: 7 / span 3; margin-top: calc(var(--sb-rise) * 0.8); }
.sb-sheets--row .sb-sheets__item:nth-of-type(4) { grid-column: 10 / span 3; margin-top: calc(var(--sb-rise) * 3.4); }
/* settles onto its pin once, the first time it scrolls in (JS only) */
.sb-sheets__item .sb-sheet { transition: transform 800ms var(--sb-ease) calc(var(--sb-i, 0) * 90ms); }
.sb-js .sb-sheets__item:not(.is-in) .sb-sheet { transform: rotate(calc(var(--sb-tilt, 0deg) + 2.5deg)) translateY(14px); }
/* hover: the sheet lifts off the board a little and swings on its pin,
   a damped sway that settles (Tom, 2026-11-06). Uses the separate rotate /
   translate properties so it composes with the tilt and the settle-in
   transform instead of fighting them. Fine pointers only; never with
   reduced motion. */
@keyframes sb-sheet-sway {
  0%   { rotate: 0deg; }
  18%  { rotate: 2.4deg; }
  40%  { rotate: -1.7deg; }
  60%  { rotate: 1deg; }
  80%  { rotate: -0.45deg; }
  100% { rotate: 0deg; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .sb-sheets__item .sb-sheet { transform-origin: 50% 0; transition: transform 800ms var(--sb-ease) calc(var(--sb-i, 0) * 90ms), translate 260ms var(--sb-ease); }
  .sb-sheets__item:hover .sb-sheet { translate: 0 -6px; animation: sb-sheet-sway 1.7s cubic-bezier(.3, .7, .4, 1) both; }
}

/* -- Paper insert, torn variant (brass pin, torn top, curled corner) */
.sb-paper--torn { --art: url("/Assets/schools/note-torn-w640.webp"); --st: 150; --sr: 130; --sb: 150; --sl: 26; --it: 118; --ir: 64; --ib: 124; --il: 34; --pad: 0.6rem; --sb-tilt: 1.2deg; }

@media (max-width: 860px) {
  .sb-sheets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sb-sheets__item:nth-of-type(n) { grid-column: auto / span 2; grid-row: auto; margin-top: 0; }
  .sb-sheets__item:nth-of-type(3n+2) { margin-top: calc(var(--sb-rise) * 2.2); }
  .sb-sheets--row .sb-sheets__item:nth-of-type(n) { grid-column: auto / span 3; grid-row: auto; margin-top: 0; }
  .sb-sheets--row .sb-sheets__item:nth-of-type(even) { margin-top: calc(var(--sb-rise) * 2.4); }
}
@media (max-width: 600px) {
  .sb { --sb-pin-w: 20px; }
  .sb-sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; row-gap: 1.8rem; }
  .sb-sheets__item:nth-of-type(n) { grid-column: auto; margin-top: 0; }
  .sb-sheets__item:nth-of-type(even) { margin-top: calc(var(--sb-rise) * 2.4); }
  .sb-sheets--row .sb-sheets__item:nth-of-type(n) { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .sb-pile > *, .sb-sheets__item .sb-sheet, .sb-link .sb-sheet, .sb-link .sb-pile > * { transition: none !important; }
  .sb-js .sb-pile:not(.is-in) > * { translate: none; }
  .sb-js .sb-sheets__item:not(.is-in) .sb-sheet { transform: rotate(var(--sb-tilt, 0deg)); }
  .sb-link:hover .sb-sheet, .sb-link:active .sb-sheet, .sb-link:hover .sb-pile > * { transform: rotate(var(--sb-tilt, 0deg)); }
}

/* ======================================================================
   TABLET (<= 860): two-column collage, rising row in pairs, the side
   anchor becomes a header row, edge-breaks stay inside the folio.
   ====================================================================== */
@media (max-width: 860px) {
  .sb-head__grid { grid-template-columns: minmax(0, 1fr); }
  .sb-head__copy { padding-top: 0; text-align: center; }
  .sb-head__art { order: -1; justify-self: center; margin-inline: auto; width: min(100%, 440px); }
  .sb-col-read, .sb-col-read-r, .sb-col-mid { grid-column: 1 / -1; }
  .sb-collage__item:nth-of-type(n) { grid-column: auto / span 6; margin-top: 0; }
  .sb-collage__item:nth-of-type(even) { margin-top: 3rem; }
  .sb-collage__item:nth-of-type(6n+1) { grid-column: 1 / -1; }
  .sb-collage__item:nth-of-type(6n+1) .sb-plate { width: 82%; }

  .sb-rising { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2.6rem; }
  .sb-rising > :nth-of-type(n) { margin-top: 0; }
  .sb-rising > :nth-of-type(odd) { margin-top: calc(var(--sb-rise) * 2.5); }

  .sb-side__aside { grid-column: 1 / -1; position: relative; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
  .sb-side__main, .sb-side--right .sb-side__main { grid-column: 1 / span 11; grid-row: 2; }
  .sb-side--right .sb-side__aside { grid-column: 1 / -1; }
  .sb-side__aside .sb-object { width: 170px; margin-top: -2rem; flex: none; }
  .sb-side__aside .sb-quote { display: none; }

  .sb-split, .sb-split--flip { grid-template-columns: 1fr; }
  .sb-edge { margin: 1rem calc(var(--sb-gutter) * -1) 0 22%; }
  .sb-edge--left { margin: 1rem 22% 0 calc(var(--sb-gutter) * -1); }

  .sb-tl-item[data-size="xs"] { --w: 4; }
  .sb-tl-item[data-size="s"]  { --w: 5; }
  .sb-tl-item[data-size="xl"] { --w: 7; }
  .sb-tl-item[data-size="l"]  { --w: 6; }
  .sb-tl-item[data-size="m"]  { --w: 6; }
  .sb-tl-item:nth-of-type(n) { --from: 1; --to: -1; }
}

/* ======================================================================
   PHONE (<= 600): one column, same rhythm. Plates alternate their inset,
   the timeline's road runs down the left edge, headings keep clear of the
   fixed Menu bell (top right).
   ====================================================================== */
@media (max-width: 600px) {
  .sb { --sb-band: 3rem; --sb-overlap: 3rem; }
  .sb h2 { max-width: calc(100% - 3.4rem); }
  .sb-quote { font-size: 2rem; }
  .sb-pinned { margin-top: -1.5rem; }
  .sb-head__art { width: min(100%, 300px); }
  /* a thinner painted margin, so what the paper holds (a table) keeps its width */
  .sb-paper--letter { --k: 0.4; }

  .sb-collage { display: block; margin-top: 1.8rem; }
  .sb-collage__item:nth-of-type(n) { margin: 0 0 2.2rem; width: 86%; }
  .sb-collage__item:nth-of-type(even) { margin-left: auto; }
  .sb-collage__item:nth-of-type(6n+1), .sb-collage__item:nth-of-type(6n+1) .sb-plate { width: 100%; }

  .sb-rising { grid-template-columns: 1fr; row-gap: 1.8rem; }
  .sb-rising > :nth-of-type(n) { margin-top: 0; }

  .sb-side__aside .sb-object { width: 112px; margin-top: -1.4rem; }
  .sb-side__main, .sb-side--right .sb-side__main { grid-column: 1 / -1; }

  .sb-edge { margin: 1rem -1.5rem 0 8%; }
  .sb-edge--left { margin: 1rem 8% 0 -1.5rem; }

  /* the road runs down a rail on the left; the stops hang off it */
  .sb-timeline { display: block; padding: 0 0 3.5rem 1.6rem; margin-top: 1.8rem; --sb-tl-star: 12px; --sb-tl-step: 30px; }
  .sb-tl-item:nth-of-type(n) { margin: 0 0 2.4rem; width: 92%; }
  .sb-tl-item:nth-of-type(even) { margin-left: auto; width: 88%; }
  .sb-tl-item[data-size="xs"]:nth-of-type(n) { width: 68%; }
  .sb-tl-item.has-mark:nth-of-type(n) { margin-top: 6.75rem; }
  .sb-tl-item:nth-of-type(n) > .sb-caption { padding: 0; }
}

/* ============= Reduced motion: drawn and still ============= */
@media (prefers-reduced-motion: reduce) {
  .sb-js .sb-quote { clip-path: none; transition: none; }
  .sb [data-drift] { translate: none !important; }
  .sb-tl-star, .sb-tl-star .lit, .sb-tl-star .unlit { transition: none; animation: none; }
  .sb-tl-mark { transition: none; animation: none !important; }
  .sb-link .sb-plate, .sb-link:hover .sb-plate, .sb-link:active .sb-plate { transition: none; transform: rotate(var(--sb-tilt, 0deg)); }
  .sb-toc a, .sb-toc a::after { transition: none; }
}
