/* Chapters layout (chapters.html only; html.mode-chapters) */
html.mode-chapters, html.mode-chapters body { height: 100%; overflow: hidden; }
html.mode-chapters main {
  position: fixed;
  left: 0;
  right: 0;
  top: 64px;                       /* replaced by js to sit right under the top bar */
  bottom: 0;
  overflow: hidden;
}
html.mode-chapters .chapter {
  position: absolute;
  inset: 0;
  margin-inline: auto;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--dock-h, 140px) + 16px);   /* clear the dock */
}
html.mode-chapters .chapter > .divider,
html.mode-chapters .chapter .section > .divider { display: none; }
html.mode-chapters #later { padding-top: var(--space-5); }
html.mode-chapters .footer { padding-top: var(--space-5); padding-bottom: var(--space-4); }
html.mode-chapters .section { padding-top: var(--space-5); }
html.mode-chapters .section__head { margin-bottom: var(--space-5); }
html.mode-chapters .hero { min-height: 100%; gap: var(--space-4); padding-top: var(--space-4); padding-bottom: calc(var(--dock-h, 140px) + 8px); }
html.mode-chapters #timeline { padding-top: var(--space-6); }

/* ---------- Dock: full-width bar with the mini player on top ---------- */
.dock { display: none; }
html.mode-chapters .dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: grid;
  gap: 2px;
  padding: 10px max(10px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 6px) max(10px, env(safe-area-inset-left, 0px));
  border-top: 2px solid #FFFFFF;
  border-radius: 24px 24px 0 0;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -10px 30px -14px rgba(190, 24, 93, 0.45);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.dock__tabs { display: flex; justify-content: space-between; gap: 4px; width: min(100%, 520px); margin-inline: auto; }
.dock__item {
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 6px 2px 4px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.dock__item:active { transform: scale(0.94); }
.dock__item svg { width: 24px; height: 24px; fill: var(--pink); }
.dock__item .dock__hole { fill: #FFFFFF; }
.dock__item .dock__flap { fill: none; stroke: #FFFFFF; stroke-width: 2; }
.dock__item[aria-current="page"] { background: var(--rose); color: var(--on-rose); }
.dock__item[aria-current="page"] svg { fill: #FFFFFF; }
.dock__item[aria-current="page"] .dock__flap { stroke: var(--rose); }

/* ---------- Our Story: swipe sideways ---------- */
html.mode-chapters #timeline .timeline__spine { display: none; }
html.mode-chapters #timeline .timeline__list {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding: 22px max(var(--gutter), calc((100% - 460px) / 2)) var(--space-4);
}
html.mode-chapters #timeline .timeline__list::-webkit-scrollbar { display: none; }
html.mode-chapters #timeline .entry,
html.mode-chapters #timeline .entry:nth-child(odd),
html.mode-chapters #timeline .entry:nth-child(even) {
  flex: 0 0 min(calc(100vw - 2 * var(--gutter) - 8px), 460px);
  width: auto;
  padding-left: 0;
  justify-self: auto;
  scroll-snap-align: center;
}
html.mode-chapters #timeline .entry::before { display: none; }
html.mode-chapters #timeline .polaroid { will-change: transform; transition: none; }
html.mode-chapters #timeline .entry .doodle { display: none; }

.story-nav { display: none; }
html.mode-chapters .story-nav {
  margin-top: calc(var(--space-3) * -1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}
.story-nav__arrow {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--blush);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  color: var(--rose);
  cursor: pointer;
}
.story-nav__arrow svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.story-nav__dots { display: flex; align-items: center; }
.story-nav__dot {
  width: 22px;                     /* tap area */
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.story-nav__dot::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  border-radius: 4px;
  background: var(--blush);
  transition: width var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.story-nav__dot.is-on::before { width: 20px; background: var(--rose); }

/* ---------- Scrapbook shelf ---------- */
.shelf { display: grid; justify-items: center; gap: var(--space-4); padding-top: var(--space-6); }
.shelf__row { display: flex; align-items: flex-end; justify-content: center; gap: var(--space-6); padding: 0 var(--space-3); }
.book {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: var(--space-1);
  width: clamp(124px, 36vw, 190px);
  aspect-ratio: 3 / 4;
  padding: var(--space-4);
  border: 0;
  border-radius: 6px 16px 16px 6px;
  color: #FFFFFF;
  text-align: center;
  cursor: pointer;
  box-shadow: inset 12px 0 0 rgba(0, 0, 0, 0.1), 0 20px 28px -14px rgba(74, 23, 52, 0.5);
  -webkit-tap-highlight-color: transparent;
}
.book--pink { background: #EC5F98; transform: rotate(-4deg); }
.book--lilac { background: #9F6FD8; transform: rotate(3deg); }
.book__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.15rem, 5vw, 1.6rem); line-height: 1.1; }
.book__sub { font-family: var(--font-hand); font-weight: 700; font-size: 1.15rem; }
.book__tape {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 60px;
  height: 20px;
  margin-left: -30px;
  background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.55) 0 6px, transparent 6px 12px), #FFD86B;
  opacity: 0.9;
}
.book.is-wiggling { animation: wiggle 420ms var(--ease-out); }
.shelf__plank { width: min(100%, 420px); height: 14px; border-radius: 7px; background: #FFFFFF; box-shadow: 0 8px 14px -8px rgba(190, 24, 93, 0.4); }
.shelf__note { font-family: var(--font-hand); font-weight: 700; font-size: 1.3rem; color: var(--muted); }

/* Phones: the bottom bar is taller now (mini player), so tighten the Us
   screen enough that "See our story" sits above it. */
@media (max-width: 699px) {
  html.mode-chapters .hero { gap: var(--space-3); padding-top: var(--space-3); }
  html.mode-chapters .hero__title { font-size: clamp(3.2rem, 16vw, 4.6rem); }
  html.mode-chapters .counter { padding: var(--space-5) var(--space-4) var(--space-4); }
  html.mode-chapters .counter__unit:first-child .counter__digits { font-size: clamp(4rem, 19vw, 5.6rem); }
  html.mode-chapters .chips { gap: 6px var(--space-2); }
}

/* ---------- Our Playlists: till receipts ---------- */
.receipts {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding: 18px max(var(--gutter), calc((100% - 360px) / 2)) var(--space-6);
}
.receipts::-webkit-scrollbar { display: none; }
.receipt {
  --ink: #2E2A2C;
  --accent: var(--rose);
  --paper: #FFFDFB;
  flex: 0 0 min(calc(100vw - 2 * var(--gutter) - 40px), 360px);
  scroll-snap-align: center;
  filter: drop-shadow(0 10px 14px rgba(120, 40, 80, 0.16)) drop-shadow(0 1px 1px rgba(120, 40, 80, 0.12));
}
.receipt:nth-child(odd) { transform: rotate(-1.2deg); }
.receipt:nth-child(even) { transform: rotate(1deg); }
.receipt--hawwi { --accent: #D6337A; --paper: #FFF8FB; }
.receipt--za { --accent: #2F7BD9; --paper: #F8FBFF; }
.receipt--ours { --accent: #8B4FD6; --paper: #FCF9FF; }
.receipt__paper {
  position: relative;
  padding: 30px 22px 34px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.012) 0 2px, transparent 2px 4px),
    var(--paper);
  color: var(--ink);
  font-family: 'Space Mono', ui-monospace, 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  /* torn zigzag edges, top and bottom */
  -webkit-mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x;
  mask:
    conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x;
}
.receipt__head { text-align: center; }
.receipt__store { font-weight: 700; font-size: 1.05rem; letter-spacing: 0.06em; color: var(--accent); }
.receipt__addr { font-size: 0.7rem; opacity: 0.7; }
.receipt__meta, .receipt__totals { display: grid; gap: 1px; margin: 14px 0 0; }
.receipt__meta div, .receipt__totals div { display: flex; justify-content: space-between; gap: 12px; }
.receipt__meta dd, .receipt__totals dd { margin: 0; text-align: right; font-weight: 700; }
.receipt__totals div:nth-child(2) { font-size: 0.95rem; }
.receipt__rule { border: 0; border-top: 2px dashed currentColor; opacity: 0.35; margin: 12px 0; }
.receipt__name {
  margin: 0 0 10px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.receipt__name.is-emoji { font-size: 2rem; line-height: 1.2; }
.receipt__note { margin: -6px 0 12px; text-align: center; font-style: italic; opacity: 0.75; }
.receipt__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.receipt__items li { display: grid; grid-template-columns: 2.2ch 1fr auto; gap: 10px; align-items: baseline; }
.receipt__qty { opacity: 0.55; }
.receipt__song { min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.receipt__initial { color: var(--accent); font-size: 1.15em; text-transform: uppercase; }
.receipt__song small { display: block; font-weight: 400; font-size: 0.7rem; opacity: 0.7; }
.receipt__more { margin: 10px 0 0; text-align: center; color: var(--accent); font-weight: 700; }
.receipt__thanks { white-space: pre-line; text-align: center; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.05em; margin: 4px 0 14px; }
.receipt__code { display: block; margin: 0 auto; width: 88%; color: var(--ink); }
.receipt__code svg, .receipt__code img { display: block; width: 100%; height: auto; fill: currentColor; }
.receipt__open {
  display: block;
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 16px;
  border: 2px dashed var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  line-height: 24px;
}
.receipt__open.is-soon { border-style: dotted; opacity: 0.6; min-height: 0; }
.receipt__open:active { transform: scale(0.95); }
.receipt__message {
  margin: 16px 6px 4px;
  padding: 10px 12px;
  border: 2px dashed var(--accent);
  border-radius: 10px;
  text-align: center;
  color: var(--accent);
  transform: rotate(-1.5deg);
}
.receipt__message-hint { font-size: 0.68rem; opacity: 0.8; letter-spacing: 0.04em; }
.receipt__message-text { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.08em; line-height: 1.35; }

/* Short phone screens (and browsers with tall toolbars): shrink the hero so
   the little date chips under the counter sit above the bottom bar. */
@media (max-width: 699px) and (max-height: 820px) {
  html.mode-chapters .hero { gap: var(--space-2); padding-top: var(--space-2); }
  html.mode-chapters .hero__title { font-size: clamp(2.7rem, 13.5vw, 3.8rem); }
  html.mode-chapters .counter { padding: var(--space-4) var(--space-4) var(--space-3); }
  html.mode-chapters .counter__unit:first-child .counter__digits { font-size: clamp(3.2rem, 15vw, 4.4rem); }
  html.mode-chapters .counter__label { margin-bottom: 0; }
  html.mode-chapters .chips { gap: 6px; }
  html.mode-chapters .chip { padding: 4px 10px 4px 8px; font-size: 0.8rem; gap: 6px; }
  html.mode-chapters .chip svg { width: 14px; height: 14px; }
}

/* TV icon antenna (Watch tab) */
.dock__item .dock__antenna { fill: none; stroke: var(--pink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock__item[aria-current="page"] .dock__antenna { stroke: #FFFFFF; }
.dock__item[aria-current="page"] .dock__hole { fill: var(--rose); }

/* Compact dock: labels don't fit, so other tabs fold into dots (js/chapters.js) */
.dock__tabs.is-compact { justify-content: center; gap: 6px; }
.dock__tabs.is-compact .dock__item { flex: 0 0 auto; min-width: 44px; padding-inline: 10px; }
.dock__tabs.is-compact:not(.is-open) .dock__item:not([aria-current="page"]) { min-width: 30px; padding-inline: 0; }
.dock__tabs.is-compact:not(.is-open) .dock__item:not([aria-current="page"]) svg,
.dock__tabs.is-compact:not(.is-open) .dock__item:not([aria-current="page"]) span { display: none; }
.dock__tabs.is-compact:not(.is-open) .dock__item:not([aria-current="page"])::before {
  content: "";
  align-self: center;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pink);
  opacity: 0.7;
}
.dock__tabs.is-compact:not(.is-open) .dock__item[aria-current="page"] { flex: 0 1 auto; padding-inline: 18px; }
.dock__tabs.is-compact.is-open .dock__item span { display: none; }
.dock__tabs.is-compact.is-open .dock__item { min-height: 52px; align-content: center; }
.dock__item .dock__lines { fill: none; stroke: #FFFFFF; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dock__item[aria-current="page"] .dock__lines { stroke: var(--rose); }
