/* =====================================================================
   DAN-DAN'S SCRAPBOOK — design system
   Cream paper, butter yellow, faded denim, brick red, warm brown.
   You should not need to edit this file for everyday changes.
   ===================================================================== */

:root {
  --cream: #f6eedb;
  --paper: #fbf6e9;
  --kraft: #b9753f;
  --kraft-dark: #8a5528;
  --butter: #f3d36b;
  --denim: #4c6a8c;
  --denim-soft: #cfdcea;
  --brick: #b2392c;
  --brown: #4a3324;
  --ink: #2f2218;
  --muted: #7a6654;

  --font-display: "Alfa Slab One", "Rockwell", Georgia, serif;
  --font-body: "Lora", Georgia, "Times New Roman", serif;
  --font-hand: "Caveat", "Segoe Script", "Bradley Hand", cursive;
  --font-type: "Special Elite", "Courier New", monospace;

  --shadow-sm: 0 2px 4px rgba(60, 40, 20, .22);
  --shadow-md: 0 8px 18px rgba(60, 40, 20, .25);
  --radius: 3px;
  --gutter: 16px;
  --page-max: 720px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--brown);
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--denim); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--denim); outline-offset: 3px; }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--butter); padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; }
.noscript { margin: 40px 20px; padding: 20px; background: var(--paper); border: 2px dashed var(--brick); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Book (the scrolling pages) ---------- */
.book { display: none; max-width: 100%; }
body.is-open .book { display: block; }
body.is-closed { height: 100vh; overflow: hidden; }

.page {
  position: relative;
  padding: 56px var(--gutter) 64px;
  background: var(--paper);
  background-image:
    radial-gradient(rgba(120, 90, 50, .06) 1px, transparent 1px);
  background-size: 14px 14px;
  overflow: hidden;
}
.page + .page { border-top: 10px solid var(--brown); }
.page-inner { max-width: var(--page-max); margin: 0 auto; position: relative; }

/* ---------- Typography ---------- */
.chapter-num {
  font-family: var(--font-type);
  letter-spacing: .12em;
  font-size: 13px;
  color: var(--brick);
  text-transform: uppercase;
  margin: 0 0 6px;
}
.chapter-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 8.5vw, 52px);
  line-height: 1.05;
  margin: 0 0 8px;
  color: var(--brown);
}
.chapter-sub {
  font-family: var(--font-hand);
  font-size: clamp(22px, 5.5vw, 28px);
  color: var(--denim);
  margin: 0 0 24px;
  line-height: 1.15;
}
.hand {
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: 1.35em;
  line-height: 1.15;
  color: var(--brick);
}
.type { font-family: var(--font-type); }
.prose p { margin: 0 0 1em; }
.underline-red { background: linear-gradient(transparent 62%, rgba(178, 57, 44, .35) 62%); }
.highlight { background: linear-gradient(transparent 40%, var(--butter) 40%); padding: 0 2px; }

/* ---------- Tape, stickers, notes ---------- */
.tape {
  position: absolute;
  width: 84px; height: 24px;
  background: rgba(243, 211, 107, .72);
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  z-index: 3;
}
.tape.t-left  { top: -12px; left: 12px; transform: rotate(-6deg); }
.tape.t-right { top: -12px; right: 12px; transform: rotate(5deg); }
.tape.denim   { background: rgba(76, 106, 140, .55); }

.sticker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--butter);
  color: var(--brown);
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--brown);
  transform: rotate(-3deg);
  box-shadow: 2px 2px 0 var(--brown);
}
.sticker.red { background: var(--brick); color: var(--cream); border-color: var(--brown); }
.sticker.blue { background: var(--denim); color: var(--cream); }

.note {
  position: relative;
  background: #fff4b8;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-hand);
  font-size: 24px;
  line-height: 1.2;
  color: var(--ink);
  transform: rotate(-1.2deg);
}
.note.blue { background: var(--denim-soft); transform: rotate(1.4deg); }
.note.plain { background: var(--paper); border: 1px solid rgba(74, 51, 36, .25); }
.note .sig { display: block; margin-top: 8px; text-align: right; color: var(--brick); }

/* ---------- Media slots ---------- */
.slot { position: relative; margin: 0; }
.slot-frame {
  position: relative;
  background: var(--cream);
  overflow: hidden;
}
.slot-frame img, .slot-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot button.slot-open { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.slot button.slot-open:focus-visible { outline: 3px solid var(--denim); outline-offset: -3px; }

.slot-ph {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 14px;
  color: var(--muted);
  background:
    repeating-linear-gradient(45deg, rgba(122, 102, 84, .08) 0 10px, transparent 10px 20px),
    var(--cream);
  border: 2px dashed rgba(122, 102, 84, .55);
  font-family: var(--font-type);
  font-size: 13px;
  letter-spacing: .04em;
}
.slot-ph .ph-icon { font-size: 30px; line-height: 1; }
.slot-ph .ph-label { text-transform: uppercase; }
.slot-ph .ph-key { font-size: 11px; opacity: .8; }

.ratio-photo     .slot-frame { aspect-ratio: 4 / 3; }
.ratio-portrait  .slot-frame { aspect-ratio: 3 / 4; }
.ratio-square    .slot-frame { aspect-ratio: 1 / 1; }
.ratio-wide      .slot-frame { aspect-ratio: 16 / 9; }
.ratio-vertical-video .slot-frame { aspect-ratio: 9 / 16; }
.ratio-video     .slot-frame { aspect-ratio: 16 / 9; }
.ratio-screenshot .slot-frame { aspect-ratio: 9 / 19; }

/* Frames */
.slot.polaroid {
  background: #fff;
  padding: 10px 10px 8px;
  box-shadow: var(--shadow-md);
}
.slot.polaroid .slot-cap { padding-top: 8px; font-family: var(--font-hand); font-size: 22px; line-height: 1.1; text-align: center; color: var(--ink); }
.slot.plain .slot-cap { padding-top: 6px; font-size: 14px; color: var(--muted); font-style: italic; }
.slot.taped { box-shadow: var(--shadow-md); background: #fff; padding: 8px; }
.slot.taped .slot-cap { padding: 8px 2px 2px; font-family: var(--font-hand); font-size: 21px; line-height: 1.1; }
.slot.film { background: #1d1612; padding: 18px 10px; box-shadow: var(--shadow-md); }
.slot.film::before, .slot.film::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: repeating-linear-gradient(90deg, #f6eedb 0 8px, transparent 8px 18px);
  opacity: .85;
}
.slot.film::before { top: 4px; }
.slot.film::after { bottom: 4px; }
.slot.film .slot-cap { color: var(--cream); font-family: var(--font-type); font-size: 12px; padding-top: 6px; }
.slot-date { font-family: var(--font-type); font-size: 11px; color: var(--muted); letter-spacing: .08em; display: block; text-align: center; }

.slot.rot-l { transform: rotate(-2.5deg); }
.slot.rot-r { transform: rotate(2.5deg); }
.slot.rot-l2 { transform: rotate(-4deg); }
.slot.rot-r2 { transform: rotate(4deg); }

/* ---------- Music card ---------- */
.music {
  display: flex; align-items: center; gap: 12px;
  background: var(--brown); color: var(--cream);
  padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow-sm);
  max-width: 420px;
}
.music-btn {
  flex: none; width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--butter); background: var(--butter); color: var(--brown);
  font-size: 18px; display: grid; place-items: center;
}
.music-meta { min-width: 0; }
.music-label { font-family: var(--font-type); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.music-title { font-family: var(--font-hand); font-size: 22px; line-height: 1.1; }
.music.is-empty { background: transparent; color: var(--muted); border: 2px dashed rgba(122,102,84,.55); box-shadow: none; }
.music.is-empty .music-btn { background: transparent; border-color: var(--muted); color: var(--muted); }
.music-embed { display: block; width: 100%; max-width: 420px; border: 0; border-radius: 12px; }
.music-embed.yt { aspect-ratio: 16 / 9; height: auto; }
.music-fallback { font-size: 14px; margin: 6px 0 0; }

/* ---------- Cover ---------- */
#cover-root { position: fixed; inset: 0; z-index: 50; perspective: 1600px; }
.cover {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 24px var(--gutter);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.14), transparent 55%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.035) 0 2px, transparent 2px 5px),
    var(--kraft);
  transform-origin: left center;
  transition: transform .9s cubic-bezier(.6, .05, .25, 1), opacity .4s .6s;
  overflow-y: auto;
}
.cover.is-opening { transform: rotateY(-100deg); opacity: 0; pointer-events: none; }
.cover-card {
  position: relative;
  width: min(100%, 440px);
  background: var(--paper);
  padding: 34px 22px 26px;
  box-shadow: var(--shadow-md);
  transform: rotate(-1deg);
  text-align: center;
  margin: auto;
}
.cover-kicker { font-family: var(--font-type); font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--brick); margin: 0 0 8px; }
.cover-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(38px, 12vw, 58px); line-height: 1; margin: 0; color: var(--brown); }
.cover-sub { font-family: var(--font-hand); font-size: 28px; line-height: 1.1; color: var(--denim); margin: 10px 0 14px; }
.cover-blurb { margin: 0 0 14px; font-size: 16px; }
.cover-made { font-family: var(--font-hand); font-size: 26px; color: var(--brick); margin: 6px 0 18px; }
.cover-photo { width: 62%; margin: 0 auto 18px; }
.btn-open {
  font-family: var(--font-display);
  font-size: 17px; letter-spacing: .04em;
  background: var(--brick); color: var(--cream);
  border: 3px solid var(--brown); border-radius: 999px;
  padding: 14px 26px; min-height: 52px;
  box-shadow: 4px 4px 0 var(--brown);
  transition: transform .12s, box-shadow .12s;
}
.btn-open:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--brown); }
.cover-music { margin-top: 14px; font-family: var(--font-type); font-size: 12px; color: var(--muted); }
.cover .sticker.pos-a { position: absolute; top: -14px; right: -6px; transform: rotate(7deg); }
.cover .sticker.pos-b { position: absolute; bottom: -12px; left: -6px; }

/* ---------- Contents drawer ---------- */
.contents-btn {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 40;
  background: var(--butter); color: var(--brown);
  border: 2px solid var(--brown); border-radius: 999px;
  padding: 10px 16px; min-height: 44px;
  font-family: var(--font-type); font-size: 14px;
  box-shadow: 2px 2px 0 var(--brown);
}
.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(340px, 88vw); z-index: 45;
  background: var(--paper); box-shadow: -10px 0 30px rgba(0,0,0,.4);
  padding: 70px 20px 24px; overflow-y: auto;
}
.drawer h2 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0 0 12px; color: var(--brown); }
.drawer ol { list-style: none; margin: 0; padding: 0; }
.drawer li a {
  display: flex; gap: 12px; align-items: baseline;
  padding: 12px 4px; min-height: 44px; text-decoration: none; color: var(--ink);
  border-bottom: 1px dashed rgba(74, 51, 36, .35);
}
.drawer li a:hover, .drawer li a:focus-visible { background: rgba(243, 211, 107, .35); }
.drawer .d-num { font-family: var(--font-type); color: var(--brick); font-size: 13px; }
.drawer .d-title { font-weight: 700; line-height: 1.2; }
.drawer .d-sub { display: block; font-family: var(--font-hand); font-size: 19px; color: var(--denim); line-height: 1.1; }
.drawer-close { position: absolute; top: 12px; right: 12px; min-width: 44px; min-height: 44px; border: 2px solid var(--brown); background: var(--butter); border-radius: 999px; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(20, 12, 6, .92); display: grid; place-items: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 100%; max-height: 100%; display: grid; gap: 8px; justify-items: center; }
.lightbox img { max-height: 80vh; width: auto; border: 8px solid #fff; box-shadow: var(--shadow-md); }
.lightbox figcaption { color: var(--cream); font-family: var(--font-hand); font-size: 24px; text-align: center; }
.lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; min-width: 48px; min-height: 48px; border-radius: 50%; border: 2px solid var(--butter); background: var(--brown); color: var(--butter); font-size: 20px; }

/* ---------- Generic chapter divider ---------- */
.fallback-note { margin-top: 20px; }

/* ---------- Reveal-on-scroll (subtle) ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Larger screens ---------- */
@media (min-width: 760px) {
  :root { --gutter: 32px; --page-max: 860px; }
  body { font-size: 18px; }
  .page { padding-top: 80px; padding-bottom: 88px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cover { transition: opacity .2s; }
  .cover.is-opening { transform: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

.nw { display: inline-block; white-space: nowrap; }
