/* =====================================================================
   A maroon velvet album with gold foil.
   Ivory is for paper (prints, stamps, the letter). Gold is for details.
   ===================================================================== */

@property --track { syntax: '<color>'; inherits: true; initial-value: #4a1526; }
@property --r { syntax: '<length>'; inherits: false; initial-value: 200px; }

:root {
  --velvet-950: #1f0710;
  --velvet-900: #2c0b16;
  --velvet-800: #3a0f1d;
  --velvet-700: #4a1526;
  --velvet-600: #5e1d31;

  --ivory:   #f3e9dc;
  --ivory-2: rgba(243, 233, 220, 0.78);
  --ivory-3: rgba(243, 233, 220, 0.52);
  --print:   #f6efe4;
  --ink:     #3a1520;
  --ink-2:   #6e4a52;

  --gold:      #c9a56a;
  --gold-2:    #e6cd9c;
  --gold-deep: #9a7744;
  --wax:       #a3263b;

  --display: 'GFS Didot', 'Didot', 'Bodoni 72', Georgia, serif;
  --text:    'Literata', Georgia, 'Times New Roman', serif;
  --hand:    'Caudex', 'GFS Didot', Georgia, serif;   /* the letter: a pen-written italic that has Greek */
  /* the techy layer: a monospace for readouts and ASCII, and Apple's own system font for controls */
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --ui:      -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;

  --gutter: clamp(1rem, 5vw, 3rem);
  --measure: 34em;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-settle: cubic-bezier(0.2, 1.25, 0.4, 1);

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  --foil: linear-gradient(100deg, #a8834c 0%, #e6cd9c 28%, #c9a56a 46%, #f4e3bd 58%, #b48f55 76%, #e2c690 100%);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* big monitors: scale the whole album up so it fills the screen instead of floating small */
@media (min-width: 1800px) { html { font-size: 106.25%; } }
@media (min-width: 2300px) { html { font-size: 112.5%; } }

body {
  margin: 0;
  background:
    var(--noise),
    radial-gradient(1200px 700px at 50% -8%, #5a1a2d 0%, transparent 62%),
    var(--velvet-800);
  color: var(--ivory);
  font-family: var(--text);
  font-size: clamp(1rem, 0.2vw + 0.95rem, 1.0625rem);
  line-height: 1.7;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
body.is-sealed { overflow: hidden; }

img { max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--gold); color: var(--velvet-900); }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 4px; }

/* candle-light that follows the pointer */
.glow {
  position: fixed;
  top: -520px;
  left: -520px;
  z-index: 0;
  width: 1040px;
  height: 1040px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s ease;
  will-change: transform;
  background: radial-gradient(closest-side, rgba(230, 205, 156, 0.075), transparent);
}
.glow.is-on { opacity: 1; }
/* decorations (tonearm, flowers, tape) may lean out, but never widen the page */
.album {
  position: relative;
  z-index: 1;
  overflow-x: clip;
  transition: transform 1.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 1.2s ease;
}
body.is-sealed .album { transform: scale(1.06); opacity: 0.4; }

/* the room's light: a soft wash of colour behind everything that shifts from section to section */
.room-light { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.room-light > i {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 85% at 50% 30%, var(--c, transparent), transparent 72%),
    linear-gradient(transparent 55%, color-mix(in srgb, var(--c, transparent) 60%, transparent));
  opacity: 0;
  will-change: opacity;
  transition: opacity 2.2s ease;
}
.room-light > i.is-on { opacity: 1; }

/* gold dust floating through everything */
.ambient { position: fixed; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; }

/* ===================== the cover (seal) ===================== */

.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  color: var(--ivory);
  background: transparent;
}
.cover-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50.2%;
  background:
    var(--noise),
    radial-gradient(110% 75% at 50% 42%, #5a1a2d 0%, var(--velvet-800) 50%, var(--velvet-950) 100%);
  background-size: auto, 200% 100%;
  transition: transform 1.2s cubic-bezier(0.7, 0, 0.18, 1);
  will-change: transform;
}
.cover-door--l { left: 0; background-position: 0 0, 0 0; box-shadow: inset -1px 0 0 rgba(201, 165, 106, 0.25); }
.cover-door--r { right: 0; background-position: 0 0, 100% 0; box-shadow: inset 1px 0 0 rgba(201, 165, 106, 0.25); }
.cover.is-lifting .cover-door--l { transform: translateX(-101%); }
.cover.is-lifting .cover-door--r { transform: translateX(101%); }
/* a warm light blooms out of the broken seal */
.cover-bloom {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60vmax;
  height: 60vmax;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 236, 196, 0.85) 0%, rgba(240, 200, 140, 0.35) 28%, rgba(200, 120, 90, 0.08) 55%, transparent 70%);
  opacity: 0;
  transform: scale(0.1);
  pointer-events: none;
  mix-blend-mode: screen;
}
.cover.is-breaking .cover-bloom { animation: bloom 1.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.35s forwards; }
@keyframes bloom {
  0%   { opacity: 0; transform: scale(0.1); }
  35%  { opacity: 1; }
  100% { opacity: 0; transform: scale(2.4); }
}
.cover-inner { transition: transform 1.1s cubic-bezier(0.6, 0, 0.3, 1), opacity 0.8s ease; }
.cover.is-lifting .cover-inner { transform: scale(1.35); opacity: 0; }
.cover::before, .cover::after { transition: opacity 0.5s ease; }
.cover.is-lifting::before, .cover.is-lifting::after { opacity: 0; }
.cover::before,
.cover::after {
  content: '';
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(201, 165, 106, 0.42);
}
.cover::before { inset: 14px; }
.cover::after { inset: 20px; border-color: rgba(201, 165, 106, 0.2); }

.cover-dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cover-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  align-items: center;
  gap: 2rem;
  min-height: min(38rem, 82svh);
  text-align: center;
}
.cover-to {
  margin: 0;
  font-style: italic;
  font-size: clamp(1.2rem, 0.6vw + 1.05rem, 1.45rem);
  line-height: 1.3;
  color: var(--gold-2);
}
.cover-from {
  margin: 0;
  font-style: italic;
  font-size: 1rem;
  color: var(--ivory-3);
}

.seal {
  position: relative;
  width: clamp(9.5rem, 46vw, 13.5rem);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 18px 20px rgba(10, 2, 5, 0.55));
}
.seal:not(:disabled) { animation: breathe 3.4s ease-in-out infinite; }
.seal:disabled { cursor: default; }
.seal-half { position: absolute; inset: 0; width: 100%; height: 100%; }
.seal-half--l { clip-path: polygon(0 0, 53% 0, 47% 17%, 55% 33%, 45% 51%, 54% 68%, 47% 85%, 52% 100%, 0 100%); }
.seal-half--r { clip-path: polygon(53% 0, 100% 0, 100% 100%, 52% 100%, 47% 85%, 54% 68%, 45% 51%, 55% 33%, 47% 17%); }

.cover.is-breaking .seal { animation: none; }
.cover.is-breaking .seal-half--l { animation: crack-l 1.05s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.cover.is-breaking .seal-half--r { animation: crack-r 1.05s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.cover-hint { transition: opacity 0.4s ease; }
.cover.is-breaking .cover-hint { opacity: 0; }

@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
/* beat one: the wax cracks and holds; beat two: the halves fall away */
@keyframes crack-l {
  0%   { transform: none; opacity: 1; }
  28%  { transform: translate(-3%, 1%) rotate(-6deg); opacity: 1; }
  45%  { transform: translate(-4%, 2%) rotate(-7deg); opacity: 1; }
  100% { transform: translate(-24%, 30%) rotate(-30deg); opacity: 0; }
}
@keyframes crack-r {
  0%   { transform: none; opacity: 1; }
  28%  { transform: translate(3%, 1.5%) rotate(5deg); opacity: 1; }
  45%  { transform: translate(4%, 2.5%) rotate(6deg); opacity: 1; }
  100% { transform: translate(24%, 34%) rotate(26deg); opacity: 0; }
}

.cover-status { min-height: 4.5rem; }
.cover-hint { margin: 0; font-style: italic; color: var(--ivory-2); }
.cover-wait p { margin: 0; }
.cover-wait-date {
  font-family: var(--display);
  font-size: clamp(1.4rem, 0.8vw + 1.2rem, 1.75rem);
  line-height: 1.2;
}
.cover-wait-left { margin-top: 0.4rem !important; font-style: italic; color: var(--ivory-2); }

/* the key (index.html#pair): a QR where the seal sits; the seal forms out of the gold when her thread arrives */
.pair-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; transition: opacity 1.2s ease; }
.cover.is-lifting .pair-canvas { opacity: 0; }
.pair-note {
  position: absolute;
  left: 1.5rem;
  right: 1.5rem;
  margin: 0;
  text-align: center;
  font-style: italic;
  font-size: clamp(1.1rem, 0.5vw + 1rem, 1.35rem);
  color: var(--ivory-2);
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.pair-note.is-quiet { opacity: 0; }
.cover.is-pairing .cover-to,
.cover.is-pairing .cover-from,
.cover.is-pairing .cover-status { opacity: 0; transition: opacity 1.2s ease; }
.cover.is-pairing .seal { opacity: 0; transform: scale(0.55); transition: opacity 0.9s ease, transform 1.3s var(--ease-settle); }
.cover.is-pairing.is-forming .seal,
.cover.is-pairing.is-forming .cover-to { opacity: 1; transform: none; }

/* ===================== shared pieces ===================== */

.section-title {
  margin: 0 0 0.6em;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 1.6vw + 1.45rem, 2.5rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--ivory);
}
.section-lede {
  max-width: var(--measure);
  margin: -0.5rem 0 0;
  font-style: italic;
  color: var(--ivory-2);
}

.prose p { max-width: var(--measure); margin: 0 0 1em; color: var(--ivory-2); }
.prose p:last-child { margin-bottom: 0; }

.link {
  color: var(--gold-2);
  font-style: italic;
  text-decoration: underline;
  text-decoration-color: rgba(230, 205, 156, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
  transition: text-decoration-color 0.3s ease;
}
.link:hover { text-decoration-color: var(--gold-2); }
/* small line icons in front of links: the icon sits beside the words, only the words are underlined */
.link:has(> svg.i) { display: inline-flex; align-items: center; gap: 0.4em; text-decoration-line: none; }
.link > svg.i + span {
  text-decoration: underline;
  text-decoration-color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
}
.link:has(> svg.i):hover > span { text-decoration-color: currentColor; }
svg.i { flex: none; width: 1.05em; height: 1.05em; opacity: 0.85; }
.pill { display: inline-flex; align-items: center; gap: 0.5em; }

/* gold ornament between sections; it draws itself in */
.ornament {
  display: flex;
  justify-content: center;
  padding: 0 var(--gutter);
}
/* the separators: the thread tied into an infinity knot, in characters */
.ornament--infinity {
  margin: 0 auto;
  width: max-content;
  max-width: 100%;
  font-family: var(--mono);
  font-size: clamp(0.6rem, 0.35vw + 0.55rem, 0.8rem);
  line-height: 1.15;
  color: var(--gold);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.ornament--infinity.is-in { opacity: 0.8; }

/* her cursor: a warm lamp that follows it, and a layer for the trail of characters */
.cursor-lamp {
  position: fixed;
  inset: 0;
  z-index: 48;
  pointer-events: none;
  background: radial-gradient(circle 20rem at var(--mx, -50vw) var(--my, -50vh), rgba(255, 214, 160, 0.075), rgba(255, 214, 160, 0.025) 45%, transparent 70%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.cursor-lamp.is-on { opacity: 1; }
.spark-layer { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }

/* while a song plays, the gold thread breathes in the song's colour */
.thread-glow { transition: stroke 1.4s ease; }
.is-music .thread-glow { stroke: color-mix(in srgb, color-mix(in srgb, var(--track), #fff 40%) 30%, transparent); animation: thread-breathe 1.45s ease-in-out infinite; }
@keyframes thread-breathe { 50% { stroke-width: 10; opacity: 0.55; } }

/* titles assemble letter by letter, drifting up out of a soft blur (no masks, so nothing is ever clipped) */
.rise { display: inline-block; white-space: nowrap; }
.rise > span {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.4em);
  filter: blur(8px);
  transition: opacity 0.9s ease, transform 1.2s var(--ease-out), filter 1.1s ease;
  transition-delay: calc(var(--i, 0) * 32ms);
}
.is-in .rise > span, .rise.is-in > span { opacity: 1; transform: none; filter: blur(0); }

/* ===================== a photo print ===================== */

/* every photo hangs in a gilded frame with an ivory mat, behind glass */
.print {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.85rem;
  border: 11px solid transparent;
  border-image: linear-gradient(135deg, #6f4f22 0%, #e6cd9c 18%, #a8834c 34%, #f2deb0 50%, #94723f 68%, #dcc08a 84%, #6f4f22 100%) 1;
  background: var(--print);
  color: var(--ink);
  text-align: left;
  cursor: zoom-in;
  transform: perspective(900px) rotate(var(--tilt, 0deg));
  transition: transform 0.6s var(--ease-out), box-shadow 0.6s var(--ease-out);
  box-shadow:
    inset 0 0 0 1px rgba(58, 21, 32, 0.06),
    0 2px 2px rgba(0, 0, 0, 0.3),
    0 30px 50px -22px rgba(5, 1, 3, 0.85);
}
.print.is-tilting { transition: transform 0.12s linear, box-shadow 0.6s var(--ease-out); box-shadow: 0 2px 2px rgba(0,0,0,.3), 0 40px 60px -26px rgba(5, 1, 3, 0.9); }
.print::before { display: none; }

/* the photos wait in the dark; the line reaching them (or the album opening, for the first one) switches the light on */
.chapter .print::before,
.opening .print::before {
  content: '';
  display: block;
  position: absolute;
  inset: -11px;                       /* over the gilded frame too */
  z-index: 3;
  background: rgba(16, 3, 8, 0.86);
  pointer-events: none;
  transition: opacity 0.9s ease;      /* scrolling back up: the room goes dark again, gently */
}
.chapter.is-lit .print::before,
.opening.is-lit .print::before { opacity: 0; animation: lights-up 1.3s ease; }
/* …and the picture develops like old film, from warm sepia into colour */
.chapter .print img, .opening .print img { filter: sepia(0.85) saturate(0.55) brightness(0.7) contrast(1.05); transition: filter 2.2s ease 0.3s; }
.chapter.is-lit .print img, .opening.is-lit .print img { filter: none; }
@keyframes lights-up {
  0%   { opacity: 1; }
  14%  { opacity: 0.45; }
  22%  { opacity: 0.9; }
  34%  { opacity: 0.2; }
  42%  { opacity: 0.55; }
  100% { opacity: 0; }
}
/* a soft gloss that catches the light where the pointer is; it slides, never repaints */
.print-gloss-box {
  position: absolute;
  inset: 0.85rem 0.85rem auto;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.print--plain .print-gloss-box { aspect-ratio: 1; }
.print-gloss {
  position: absolute;
  inset: -50%;
  will-change: transform;
  background: radial-gradient(closest-side, rgba(255, 248, 235, 0.22), transparent);
  background-size: 60% 60%;
  background-position: center;
  background-repeat: no-repeat;
}
.print.is-tilting .print-gloss-box { opacity: 1; }
.print img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #e8dccb;
  box-shadow: 0 0 0 1px rgba(58, 21, 32, 0.12), inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.print-caption:empty { display: none; }
.print-caption {
  display: block;
  min-height: 1.75rem;
  padding: 0.4rem 0.2rem 0.55rem;
  font-family: var(--hand);   /* the letter's pen-written italic */
  font-style: italic;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-align: center;
  color: #6e1f33;
}
.print--plain img { object-fit: contain; aspect-ratio: 1; background: #fff; }
/* the first photo arrives as ASCII, then develops underneath the characters */
.print.is-ascii:not(.is-developed) img { opacity: 0; }
.print.is-ascii.is-developed img { animation: develop 1.6s ease both; }
@keyframes develop { from { opacity: 0; } }
.ascii-photo {
  position: absolute;
  z-index: 1;
  margin: 0;
  overflow: hidden;
  display: block;
  pointer-events: none;
  transition: opacity 1.6s ease;
}
.print.is-developed .ascii-photo { opacity: 0; }

.flower {
  position: absolute;
  z-index: 3;
  width: 5.25rem;
  height: 9.45rem;
  pointer-events: none;
}

/* a brass picture light above each frame; it switches on as she walks past */
.picture-light {
  position: absolute;
  z-index: 4;
  top: -1.35rem;
  left: 50%;
  width: 44%;
  height: 0.55rem;
  translate: -50% 0;
  border-radius: 999px;
  background: linear-gradient(#f0dcaa, #b48f55 55%, #7a5a2c);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.chapter .picture-light, .opening .picture-light { transition: box-shadow 0.9s ease; }
.chapter.is-lit .picture-light, .opening.is-lit .picture-light { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(255, 220, 160, 0.45); }
.picture-light::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 0.85rem;
  translate: -50% 0;
  background: linear-gradient(#b48f55, #7a5a2c);
}
.picture-light::after {
  content: '';
  position: absolute;
  top: 70%;
  left: 50%;
  width: 230%;
  height: 26rem;
  translate: -50% 0;
  background: radial-gradient(ellipse 50% 55% at 50% 0%, rgba(255, 228, 175, 0.26), rgba(255, 228, 175, 0.08) 45%, transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 1.4s ease 0.5s;
}
.opening .picture-light::after { transition: opacity 0.9s ease; }
.opening.is-lit .picture-light::after { opacity: 1; animation: lamp-on 1.3s ease; }
/* timeline lamps follow the line, flickering on in step with the photo */
.chapter .picture-light::after { transition: opacity 0.9s ease; }
.chapter.is-lit .picture-light::after { opacity: 1; animation: lamp-on 1.3s ease; }
@keyframes lamp-on { 0% { opacity: 0; } 14% { opacity: 0.55; } 22% { opacity: 0.1; } 34% { opacity: 0.8; } 42% { opacity: 0.45; } 100% { opacity: 1; } }

/* ===================== opening ===================== */

.opening {
  display: grid;
  gap: 3rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(4rem, 13vh, 8rem) var(--gutter) clamp(3rem, 8vw, 5rem);
}
.opening-title {
  margin: 0 0 1.75rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.8rem, 4vw + 1.6rem, 4.9rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.opening-title:focus { outline: none; }
/* gold foil, with one sweep of light when it appears */
.opening-title .rise > span {
  /* the gold is painted only inside each word's box, so the box reaches below the
     tails of χ and ρ and around the accents (the margins keep the words where they were) */
  padding: 0.12em 0.08em 0.3em;
  margin: -0.12em -0.08em -0.3em;
  background: var(--foil);
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.opening.is-in .opening-title .rise > span { animation: foil-sweep 2.6s 0.6s var(--ease-out) both; }
/* the title's full stop: a gold dot that breathes softly (scrolling carries it to the timeline) */
.title-dot {
  position: relative;
  display: inline-block;
  width: 0.15em;
  height: 0.15em;
  margin-left: 0.04em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 55%, var(--gold-deep));
  opacity: 0;
  transition: opacity 1.2s ease 1.4s;
}
.opening.is-in .title-dot { opacity: 1; }
.title-dot.is-away { visibility: hidden; }
.title-dot::after {
  content: '';
  position: absolute;
  inset: -180%;
  border-radius: 50%;
  background: radial-gradient(rgba(255, 228, 175, 0.5), transparent 62%);
  animation: dot-breathe 2.8s ease-in-out infinite;
}
@keyframes dot-breathe { 0%, 100% { opacity: 0.25; transform: scale(0.85); } 50% { opacity: 0.85; transform: scale(1.1); } }

/* the dot in flight, and the gold dust it leaves behind */
.seed {
  position: fixed;
  z-index: 38;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff4dc, var(--gold-2) 40%, var(--gold) 75%);
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}
.seed::after {
  content: '';
  position: absolute;
  inset: -240%;
  border-radius: 50%;
  background: radial-gradient(rgba(255, 236, 196, 0.75), rgba(230, 205, 156, 0.22) 38%, transparent 66%);
  opacity: calc(0.3 + var(--glow, 0) * 0.7);
}
.seed-trail { position: fixed; inset: 0; z-index: 37; overflow: hidden; pointer-events: none; }
.seed-trail i {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--s, 4px);
  height: var(--s, 4px);
  margin: calc(var(--s, 4px) / -2);
  border-radius: 50%;
  background: #ffe9b8;
  box-shadow: 0 0 6px 1px rgba(255, 220, 160, 0.8);
  opacity: 0;
}

@keyframes foil-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes foil-glint { 0%, 70% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.opening-count { margin: 0 0 2.25rem; }
.count-since { margin: 0; font-style: italic; font-size: clamp(0.98rem, 0.3vw + 0.9rem, 1.1rem); color: var(--ivory-2); }
.count-days {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.9rem;
  margin: 0.2rem 0 0;
}
/* the numerals roll into place like an old mechanical counter */
.odometer {
  display: inline-flex;
  font-family: var(--display);
  font-size: clamp(3.6rem, 5vw + 2.2rem, 6.25rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--gold-2);
  /* the glow is drawn around the whole number (not per digit), so no little boxes show */
  filter: drop-shadow(0 0 22px rgba(230, 205, 156, 0.35));
}
.odo-digit { display: inline-block; height: 1em; overflow: hidden; }
.odo-reel {
  display: flex;
  flex-direction: column;
  transition: transform calc(2.2s + var(--d, 0) * 0.45s) cubic-bezier(0.12, 0.75, 0.15, 1) calc(0.6s + var(--d, 0) * 0.12s);
  will-change: transform;
}
.odo-reel span { display: block; height: 1em; line-height: 1; text-align: center; }
.odo-sep { align-self: flex-end; }
.count-unit { font-style: italic; font-size: clamp(1.15rem, 0.6vw + 1rem, 1.4rem); color: var(--gold); }

/* the opening: the room is dark and the counter is the only light… */
.odometer { transition: color 1.2s ease, filter 1.2s ease; }
.opening.is-counting .odometer {
  color: #fff3da;
  filter: drop-shadow(0 0 8px rgba(255, 240, 210, 0.95)) drop-shadow(0 0 30px rgba(255, 214, 150, 0.8)) drop-shadow(0 0 70px rgba(235, 175, 105, 0.6));
}
/* …it flashes as the last digit lands… */
.opening.is-landed .odometer { animation: land-flash 1.8s ease-out; }
@keyframes land-flash {
  0% {
    color: #fffaf0;
    filter: drop-shadow(0 0 14px rgba(255, 250, 235, 1)) drop-shadow(0 0 50px rgba(255, 220, 160, 0.95)) drop-shadow(0 0 110px rgba(240, 180, 110, 0.75));
    transform: scale(1.035);
  }
  100% { transform: none; }
}
/* …and its light floods out over the whole page */
.dawn {
  position: fixed;
  inset: 0;
  z-index: 42;
  pointer-events: none;
  background: radial-gradient(circle at var(--cx, 50%) var(--cy, 40%),
    transparent 0,
    transparent var(--r),
    rgba(255, 214, 160, 0.16) calc(var(--r) + 50px),
    rgba(9, 2, 5, 0.94) calc(var(--r) + 200px));
}
.dawn.is-dawn {
  opacity: 0;
  transition: --r 2s cubic-bezier(0.55, 0, 0.15, 1), opacity 1.2s ease 1.1s;
}
.count-live {
  display: grid;
  gap: 0.15rem;
  margin: 0.8rem 0 0;
  font-family: var(--mono);
  font-weight: 300;
  font-size: clamp(0.72rem, 0.25vw + 0.68rem, 0.82rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--ivory-3);
}
.count-still { color: var(--gold-deep, var(--gold)); opacity: 0.85; }
/* a terminal cursor, blinking at the end of the readout */
.caret { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.3em; vertical-align: -0.18em; background: var(--gold); animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.opening-photo { position: relative; width: min(20rem, 80%); justify-self: center; }

.opening .opening-count,
.opening .opening-body {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}
.opening.is-in .opening-count { opacity: 1; transform: none; transition-delay: 0.35s; }
.opening.is-in .opening-body { opacity: 1; transform: none; transition-delay: 0.85s; }

@media (min-width: 52rem) {
  .opening {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    min-height: 100svh;              /* the opening fills the first screen; the ornament waits just below */
  }
  .opening-photo { width: min(21rem, 100%); justify-self: end; }
}

/* the photo is laid down onto the page */
.opening-photo,
.chapter-figure {
  opacity: 0;
  transform: translateY(-26px) rotate(7deg) scale(1.06);
  transition: opacity 0.9s ease, transform 1.3s var(--ease-settle);
}
.opening.is-in .opening-photo { opacity: 1; transform: none; transition-delay: 0.7s; }


/* ===================== the year (timeline) ===================== */

.year {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) var(--gutter) clamp(2rem, 6vw, 4rem);
}

.chapters {
  position: relative;
  margin: 3rem 0 0;
  padding: 0;
  list-style: none;
  --line-x: 0.55rem;
}
/* a faint track, and a gold stem that grows as she scrolls */
.chapters::before,
.stem {
  content: '';
  position: absolute;
  top: 0.6rem;
  bottom: 6rem;
  left: var(--line-x);
  width: 1.5px;
}
.chapters::before { background: rgba(243, 233, 220, 0.1); }
.stem {
  background: linear-gradient(var(--gold-2), var(--gold) 60%, var(--gold-deep));
  transform-origin: top;
  transform: scaleY(0);
  will-change: transform;
  box-shadow: 0 0 10px rgba(230, 205, 156, 0.35);
}

.stem-tip {
  position: absolute;
  top: 0;
  left: calc(var(--line-x) + 0.75px - 4px);
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #fff4dc;
  box-shadow: 0 0 6px 2px rgba(255, 230, 180, 0.9), 0 0 22px 6px rgba(230, 205, 156, 0.45);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  will-change: transform;
}
.stem-tip.is-on { opacity: 1; animation: spark 1.6s ease-in-out infinite; }

/* the gold thread: the timeline's line carried on down the margin to the letter */
.thread { position: absolute; left: 0; top: 0; z-index: 0; overflow: visible; pointer-events: none; fill: none; }
.thread-line { stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; }
.thread-glow { stroke: rgba(230, 205, 156, 0.16); stroke-width: 7; stroke-linecap: round; }
.thread-branch { stroke: var(--gold-2); stroke-width: 1.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.6s ease; }
.thread-branch.is-drawn { stroke-dashoffset: 0; transition: stroke-dashoffset var(--draw, 0.4s) cubic-bezier(0.45, 0, 0.2, 1); }
.thread-tip {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 0;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: #fff4dc;
  box-shadow: 0 0 6px 2px rgba(255, 230, 180, 0.9), 0 0 22px 6px rgba(230, 205, 156, 0.45);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  will-change: transform;
}
.thread-tip.is-on { opacity: 1; animation: spark 1.6s ease-in-out infinite; }
@keyframes spark { 50% { box-shadow: 0 0 9px 3px rgba(255, 230, 180, 1), 0 0 30px 9px rgba(230, 205, 156, 0.5); } }

.chapter {
  position: relative;
  display: grid;
  gap: 1.75rem;
  padding: 0 0 clamp(4.5rem, 11vw, 7rem) 2.5rem;
}
/* a checkpoint on the line: an empty gold ring that fills when the line reaches it */
.checkpoint {
  position: absolute;
  z-index: 1;
  top: 0.4rem;
  left: calc(var(--line-x) + 0.75px - 0.5625rem);
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 165, 106, 0.55);
  background: var(--velvet-800);
  transition: border-color 0.6s ease, box-shadow 0.9s ease;
}
/* the gold that fills it, from the centre out */
.checkpoint::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 55%, var(--gold-deep));
  /* revealed by a growing circle, not scaled: scaling drew it soft, then snapped it crisp at the end */
  clip-path: circle(0 at 50% 50%);
  transition: clip-path 0.8s var(--ease-out);
}
/* one soft ring of light when it fills */
.checkpoint::after {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-2);
  opacity: 0;
  pointer-events: none;
}
.checkpoint.is-reached { border-color: var(--gold-2); box-shadow: 0 0 14px rgba(230, 205, 156, 0.45); }
.checkpoint.is-reached::before { clip-path: circle(50% at 50% 50%); }
/* the first ring is filled by the dot landing in it, at once (the dot itself grew in flight) */
.checkpoint.is-seed::before { transition: none; }
.checkpoint.is-seed:not(.is-landed)::before { clip-path: circle(0 at 50% 50%); }
.checkpoint.is-seed.is-landed::after { animation: checkpoint-ripple 1.4s var(--ease-out), seed-flash 1.4s var(--ease-out); }
@keyframes seed-flash { 0% { box-shadow: 0 0 0 0 rgba(255, 228, 175, 0.7), 0 0 30px 10px rgba(255, 228, 175, 0.6); } 100% { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; } }
.checkpoint.is-reached::after { animation: checkpoint-ripple 1.1s var(--ease-out) 0.1s; }
@keyframes checkpoint-ripple {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.6); }
}
/* the page that hasn't happened yet: a dashed ring that never fills */
.checkpoint--next { border-style: dashed; border-color: rgba(201, 165, 106, 0.45); }
.checkpoint--next::before, .checkpoint--next::after { display: none; }
.checkpoint--next.is-reached { box-shadow: none; border-color: rgba(230, 205, 156, 0.75); }

.chapter-date {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold);
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 0.9s ease 0.1s, transform 0.9s var(--ease-out) 0.1s;
}
.chapter.is-in .chapter-date { opacity: 1; transform: none; }
.chapter-stamp {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-style: normal;
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ivory-3);
}

.chapter-title {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.45rem, 0.8vw + 1.2rem, 1.8rem);
  line-height: 1.08;
  color: var(--ivory);
}
.chapter-main .prose,
.chapter-main .terminal,
.chapter-main .chapter-links {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s ease, transform 1s var(--ease-out);
  transition-delay: 0.35s;
}
.chapter.is-in .chapter-main .prose,
.chapter.is-in .chapter-main .terminal,
.chapter.is-in .chapter-main .chapter-links { opacity: 1; transform: none; }
.chapter-main .prose p { max-width: 30em; }

.terminal {
  max-width: 30em;
  margin: 1.4rem 0 0;
  padding: 0.75rem 1rem;
  border-left: 2px solid var(--gold);
  background: rgba(10, 2, 5, 0.28);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--ivory-3);
  white-space: pre-wrap;
}
.terminal b { font-weight: 600; color: var(--gold-2); }

.chapter-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.1rem;
}

.chapter-figure {
  position: relative;
  width: min(18.5rem, 80%);
  margin: 0.5rem 0 0 0.75rem;
}
.chapter.is-in .chapter-figure { opacity: 1; transform: none; transition-delay: 0.2s; }
.chapter-figure .flower {
  left: -2.2rem;
  bottom: -2.8rem;
  transform: rotate(-14deg) scale(0.4);
  transform-origin: 50% 100%;
  opacity: 0;
  transition: transform 1.2s var(--ease-settle) 0.9s, opacity 0.6s ease 0.9s;
}
.chapter.is-even .chapter-figure .flower { left: auto; right: -2.2rem; transform: rotate(15deg) scale(0.4); }
.chapter.is-in .chapter-figure .flower { opacity: 1; transform: rotate(-14deg); }
.chapter.is-in.is-even .chapter-figure .flower { transform: rotate(15deg); }

/* several photos: a wheel under the lamp (setupDecks places and turns them); the back ones peek out above */
.print-deck {
  display: grid;
  padding-top: 3.4rem;
  perspective: 1600px;
}
.print-deck > .print {
  grid-area: 1 / 1;
  justify-self: center;
  align-self: start;
  width: 84%;
  transform-origin: 50% 0;   /* they shrink towards their top edge, so the ones behind show above the front one */
}
.print-deck .print-caption { display: none; }
.chapter-figure > .print-add { width: 4.5rem; aspect-ratio: 1; margin: 1.2rem auto 0; }
.print-add {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  border: 1.5px dashed var(--gold);
  border-radius: 4px;
  background: rgba(10, 2, 5, 0.25);
  color: var(--gold-2);
  font-size: 2rem;
  cursor: pointer;
}

/* a chapter without a photo: our initials in gold ASCII on velvet, in the same gilt frame */
.print--mono {
  container-type: inline-size;
  cursor: default;
  background: radial-gradient(120% 90% at 50% 42%, #4a1526 0%, var(--velvet-900) 60%, var(--velvet-950) 100%);
}
.mono-art {
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  font-family: var(--mono);
  font-weight: 400;
  font-size: calc(100cqw / 40 / 0.6);   /* 40 columns across; a mono character is 0.6em wide */
  line-height: 1.2;
  white-space: pre;
  color: var(--gold-2);
  text-shadow: 0 0 6px rgba(230, 205, 156, 0.35);
}

.chapter--next .chapter-title { color: var(--ivory-3); }
.print--empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  padding: 0;
  border-image: none;
  border: 1px dashed rgba(201, 165, 106, 0.5);
  background: rgba(10, 2, 5, 0.12);
  box-shadow: none;
  cursor: default;
}
.print--empty::before, .print--empty::after { display: none; }
.print--empty svg { width: 3.5rem; height: 6.3rem; opacity: 0.45; }

@media (min-width: 40rem) and (max-width: 55.99rem) {
  .chapter {
    grid-template-columns: minmax(0, 1fr) min(16rem, 42%);
    grid-template-areas: "date figure" "main figure";
    grid-template-rows: auto 1fr;   /* a tall figure stretches the text's row, not the gap under the date */
    column-gap: 2.5rem;
    row-gap: 0.75rem;
    align-items: start;
  }
  .chapter-date { grid-area: date; }
  .chapter-main { grid-area: main; }
  .chapter-figure { grid-area: figure; width: 100%; margin: 0.5rem 0 0; }
}
@media (min-width: 56rem) {
  .chapters { --line-x: 12.75rem; }
  .chapter {
    grid-template-columns: 11rem minmax(0, 1fr) 17.5rem;
    grid-template-areas: "date main figure";
    column-gap: 4rem;
    align-items: start;
    padding-left: 0;
  }
  .chapter-date { grid-area: date; text-align: right; padding-top: 0.15rem; transform: translateX(10px); }
  .chapter-main { grid-area: main; }
  .chapter-figure { grid-area: figure; width: 100%; margin: 0; }
}

/* ===================== places (the map) ===================== */

.places {
  position: relative;
  z-index: 0;
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(7rem, 16vw, 11rem) var(--gutter) clamp(7rem, 16vw, 11rem);
}
/* the places live in space: the album's velvet fades into stars, and back out again below */
.places::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  translate: -50% 0;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 244, 225, 0.9), transparent),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 244, 225, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 64% 72%, rgba(255, 244, 225, 0.8), transparent),
    radial-gradient(1px 1px at 30% 84%, rgba(255, 244, 225, 0.6), transparent),
    radial-gradient(1px 1px at 90% 54%, rgba(255, 244, 225, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 6% 62%, rgba(255, 244, 225, 0.6), transparent),
    radial-gradient(1px 1px at 46% 6%, rgba(255, 244, 225, 0.5), transparent),
    radial-gradient(ellipse 45% 40% at 20% 35%, rgba(122, 28, 58, 0.42), transparent 70%),
    radial-gradient(ellipse 40% 38% at 82% 70%, rgba(52, 30, 88, 0.4), transparent 70%),
    #08040b;
  background-size: 260px 260px, 260px 260px, 260px 260px, 260px 260px, 260px 260px, 260px 260px, 260px 260px, 100% 100%, 100% 100%, auto;
  -webkit-mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent);
  mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent);
  pointer-events: none;
}

.map-frame { position: relative; margin: 1.5rem 0 0; }
.map {
  position: relative;
  z-index: 1;
  height: clamp(24rem, 72svh, 42rem);
  background: transparent;
  font-family: var(--text);
}
/* the globe sleeps in the dark until the gold thread reaches it */
/* (faded, not filtered: a filter on the 3D canvas made scrolling heavier while it lit up) */
.map .maplibregl-canvas { opacity: 0.38; transition: opacity 2s ease; }
.map-frame.is-lit .maplibregl-canvas { opacity: 1; }

/* out in space the places are one gold beacon over Greece; up close they are the wax pins
   (MapLibre sets the markers' own opacity, so the fading happens on what's inside them) */
.beacon { position: relative; width: 14px; height: 14px; padding: 0; border: 0; background: none; cursor: pointer; }
.beacon > span { transition: opacity 0.6s ease, transform 0.8s var(--ease-settle); opacity: 0; }
.beacon-dot {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff4dc, var(--gold-2) 45%, var(--gold) 80%);
  box-shadow: 0 0 10px 3px rgba(255, 220, 160, 0.8);
  transform: scale(0.4);
}
.beacon-dot::before, .beacon-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 228, 175, 0.7);
  animation: beacon-ring 2.4s ease-out infinite;
}
.beacon-dot::after { animation-delay: 1.2s; }
@keyframes beacon-ring { from { transform: scale(0.6); opacity: 1; } to { transform: scale(2.6); opacity: 0; } }
.beacon-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  translate: -50% 0;
  padding: 0.2rem 0.7rem 0.25rem;
  border-radius: 999px;
  background: rgba(24, 6, 13, 0.82);
  box-shadow: 0 0 0 1px rgba(230, 205, 156, 0.45), 0 6px 16px -6px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  font-family: var(--display);
  font-size: 0.95rem;
  color: var(--gold-2);
}
.map-frame.is-awake:not(.is-near) .beacon > span { opacity: 1; transform: none; }
.map-frame:not(.is-awake) .beacon, .map-frame.is-near .beacon { pointer-events: none; }
.map-frame:not(.is-near) .pin { pointer-events: none; }
.map-frame:not(.is-near) .pin > * { visibility: hidden; }
/* round ivory controls */
.map-ctrl { display: grid; gap: 0.45rem; margin: 0.75rem 0 0 0.75rem !important; }
.map-ctrl-btn {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(154, 119, 68, 0.45);
  border-radius: 50%;
  background: rgba(246, 239, 228, 0.94);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(20, 4, 10, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: transform 0.3s var(--ease-settle), background 0.3s ease, color 0.3s ease;
}
.map-ctrl-btn svg { width: 1.15rem; height: 1.15rem; }
.map-ctrl-btn:hover { transform: translateY(-1px) scale(1.05); background: var(--print); color: #8a2a42; }
.map-ctrl-btn:active { transform: scale(0.96); }
.map-ctrl-btn:nth-child(3) { margin-top: 0.35rem; }

/* the map credits: a small ivory "i" that opens into a pill */
.map .maplibregl-ctrl-attrib.maplibregl-compact {
  min-height: 1.6rem;
  margin: 0 0.6rem 0.6rem 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(246, 239, 228, 0.92);
  box-shadow: 0 6px 14px -8px rgba(20, 4, 10, 0.6);
  font-size: 0.66rem;
  color: var(--ink-2);
}
.map .maplibregl-ctrl-attrib.maplibregl-compact-show { padding: 0.2rem 1.9rem 0.2rem 0.75rem; }
.map .maplibregl-ctrl-attrib-button { background-color: transparent; border-radius: 50%; width: 1.6rem; height: 1.6rem; opacity: 0.7; }
.map .maplibregl-ctrl-attrib a { color: var(--ink-2); }

.pin {
  display: block;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.pin svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 1.5px rgba(230, 205, 156, 0.9)) drop-shadow(0 5px 5px rgba(5, 1, 3, 0.55));
  transition: transform 0.3s var(--ease-settle);
  opacity: 0;
  transform: scale(2.2);
}
.pin.is-stamped svg { animation: stamp 0.55s var(--ease-settle) both; animation-delay: var(--d, 0ms); }
@keyframes stamp {
  0%   { opacity: 0; transform: scale(2.2) rotate(-12deg); }
  60%  { opacity: 1; transform: scale(0.92) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.pin.is-stamped:hover svg,
.pin.is-stamped.is-active svg { animation: none; opacity: 1; transform: scale(1.22); }
/* (no position rule on .pin: the map positions markers itself; the label anchors to that) */
.pin-label {
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 50%;
  padding: 0.22rem 0.65rem 0.28rem;
  translate: -50% 4px;
  border-radius: 999px;
  background: rgba(246, 239, 228, 0.96);
  color: var(--ink);
  font-family: var(--display);
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 8px 18px -10px rgba(20, 4, 10, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, translate 0.35s var(--ease-out);
}
@media (pointer: fine) {
  .pin.is-stamped:hover .pin-label, .pin.is-stamped:focus-visible .pin-label { opacity: 1; translate: -50% 0; }
}
.pin.is-active .pin-label { opacity: 0 !important; }

.map .maplibregl-popup-content {
  padding: 0;
  border-radius: 6px;
  background: var(--noise), var(--print);
  color: var(--ink);
  font-family: var(--text);
  font-size: 0.95rem;
  line-height: 1.55;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 2px 6px -2px rgba(20, 4, 10, 0.25),
    0 26px 50px -20px rgba(20, 4, 10, 0.7);
  transform-origin: 50% 100%;
  animation: popup-in 0.45s var(--ease-settle);
}
@keyframes popup-in { from { opacity: 0; transform: translateY(10px) scale(0.94); } to { opacity: 1; transform: none; } }
.map .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--print); }
.map .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.map .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--print); }
.map .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--print); }
.map .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--print); }
/* the close button sits over the photo and stays readable on any picture */
.map .maplibregl-popup-close-button {
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0 0 2px;
  border-radius: 50%;
  background: rgba(31, 7, 16, 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: var(--ivory);
  font: 1.15rem/1 var(--text);
  transition: background 0.25s ease;
}
.map .maplibregl-popup-close-button:hover { background: rgba(31, 7, 16, 0.8); }

.popup { width: min(15.5rem, 72vw); }
.popup-photo { padding: 0.45rem 0.45rem 0; }
.popup-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(58, 21, 32, 0.08);
}
.popup-body { padding: 0.7rem 0.95rem 0.85rem; }
.popup-photo:has(.popup-mono) { container-type: inline-size; }
.popup-mono {
  /* the same 16:10 frame as a photo, with the initials (40 columns, 25 rows) fitted to its height */
  aspect-ratio: 16 / 10;
  display: grid;
  place-content: center;
  font-size: calc(100cqw * 0.625 / 30);   /* frame height / (25 rows x 1.2 line height) */
  border-radius: 3px;
  background: radial-gradient(120% 90% at 50% 42%, #4a1526 0%, var(--velvet-900) 60%, var(--velvet-950) 100%);
}
.popup-date { margin: 0 0 0.1rem; font-style: italic; font-size: 0.8rem; color: var(--gold-deep); }
.popup-name { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.15rem; line-height: 1.15; }
.popup-coords { margin: 0.2rem 0 0; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.02em; color: var(--ink-2); opacity: 0.75; white-space: pre; }
.popup-text {
  max-height: 4.5em;   /* three lines, fading out, until "read all" opens the card */
  margin: 0.45rem 0 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
  mask-image: linear-gradient(#000 55%, transparent);
  transition: max-height 0.6s var(--ease-out);
  white-space: pre-line;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.popup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 1.1rem;
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(154, 119, 68, 0.25);
}
.popup .link { font-size: 0.85rem; color: #8a2a42; text-decoration-color: rgba(138, 42, 66, 0.35); }
.popup .popup-gmaps { color: var(--ink-2); text-decoration-color: rgba(110, 74, 82, 0.35); }

.link-button {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-style: italic;
}

/* ===================== the library ===================== */

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.library {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 5rem) var(--gutter) clamp(4rem, 9vw, 6rem);
}
.bookcase { position: relative; margin-top: 2rem; --shelf: clamp(11rem, 24vw, 14.5rem); }
/* the wooden shelf the books stand on */
.bookcase::after {
  content: '';
  display: block;
  height: 0.9rem;
  border-radius: 2px;
  background: linear-gradient(#5a3a22, #3a2416 55%, #24150c);
  box-shadow: inset 0 1px 0 rgba(230, 205, 156, 0.5), 0 16px 24px -12px rgba(0, 0, 0, 0.85);
}
/* the thread's second station: it runs along the shelf, which fills with warm light from left to right
   (and stays lit), and each title catches the light as it passes */
.bookcase::before {
  content: '';
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.9rem;
  border-radius: 2px;
  background: linear-gradient(rgba(255, 233, 186, 0.95), rgba(218, 172, 102, 0.9) 42%, rgba(128, 86, 38, 0.95));
  box-shadow: 0 0 14px rgba(255, 214, 150, 0.6), 0 -16px 34px -8px rgba(255, 210, 150, 0.5);
  clip-path: inset(-50px 100% -50px -50px);
  pointer-events: none;
  transition: clip-path 0.6s ease;
}
.bookcase.is-threaded::before { clip-path: inset(-50px -50px -50px -50px); transition: clip-path 1.5s cubic-bezier(0.45, 0, 0.2, 1); }
.bookcase.is-threaded .spine-title { animation: spine-glint 1.1s ease both; animation-delay: var(--glint, 0.5s); }
@keyframes spine-glint { 45% { filter: brightness(1.8) drop-shadow(0 0 6px rgba(255, 228, 175, 0.85)); } }

.books {
  display: flex;
  align-items: flex-end;
  justify-content: safe center;
  gap: 0.28rem;
  margin: 0;
  padding: 2.25rem 1rem 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}
.books::-webkit-scrollbar { display: none; }
.books > li { flex: none; }

/* a clothbound spine: gilt bands, the title in gold running down it */
.spine {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  width: 3.25rem;
  height: var(--shelf);
  padding: 0.75rem 0 0.6rem;
  border: 0;
  border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(255, 255, 255, 0.1) 16%, rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, 0.18) 78%, rgba(0, 0, 0, 0.5)),
    var(--noise),
    var(--c, #5b1a2a);
  color: var(--gold-2);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), 0 12px 16px -10px rgba(0, 0, 0, 0.85);
  transition: transform 0.4s var(--ease-settle), box-shadow 0.4s ease;
}
.spine:hover, .spine:focus-visible { transform: translateY(-0.9rem); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3), 0 22px 22px -12px rgba(0, 0, 0, 0.9); }
.spine-band {
  width: 100%;
  height: 0.5rem;
  border-block: 1px solid rgba(230, 205, 156, 0.7);
  margin: 0.15rem 0;
}
.spine-title {
  align-self: center;
  max-height: 100%;
  overflow: hidden;
  padding: 0.7rem 0;
  writing-mode: vertical-rl;
  text-wrap: balance;             /* a long title runs down the spine in two balanced lines */
  line-height: 1.12;
  text-align: center;
  font-family: var(--display);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--gold-2);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.spine-year { font-size: 0.68rem; font-style: italic; color: rgba(230, 205, 156, 0.8); min-height: 1em; }

/* ---------- the reader: an open book ---------- */

.reader {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.reader[open] {
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 3.5rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}
.reader[open] .reader-stage { animation: fade-in 0.45s ease; }
.reader.is-closing .reader-stage, .reader.is-closing .reader-nav, .reader.is-closing .reader-close { animation: fade-out 0.26s ease forwards; }
.reader-close { position: fixed; top: 1rem; right: 1rem; z-index: 3; }
.reader-stage { display: grid; place-items: center; width: 100%; height: 100%; min-height: 0; perspective: 2400px; }
.reader-nav { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.reader-count { font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--ivory-3); min-width: 3.2em; text-align: center; }

.book {
  --pw: min(28rem, 46vw, calc((100svh - 9rem) * 0.7));     /* one page's width */
  position: relative;
  display: grid;
  grid-template-columns: var(--pw) var(--pw);
  height: calc(var(--pw) / 0.7);
  transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(0.65, 0, 0.25, 1);
  filter: drop-shadow(0 40px 50px rgba(0, 0, 0, 0.6));
}
.book.is-single { --pw: min(24rem, 88vw, calc((100svh - 9rem) * 0.7)); grid-template-columns: var(--pw); }
.book.is-single .page--left { display: none; }
/* closed, the cover faces her in the middle; open, the spread is centred */
.book.is-closed:not(.is-single) { transform: translateX(-25%); }
/* closed, only the cover shows; the endpaper appears as the cover swings away from it */
.book .page--left { transition: opacity 0.45s ease 0.45s; }
.book.is-closed .page--left { opacity: 0; transition: none; }

.page {
  position: relative;
  overflow: hidden;
  background: var(--noise), #f1e7d4;
  color: var(--ink);
  cursor: pointer;
}
/* the gentle shadow where the pages curve into the spine */
.page--left { border-radius: 4px 0 0 4px; box-shadow: inset -26px 0 30px -18px rgba(70, 40, 20, 0.45), inset 0 0 0 1px rgba(90, 60, 30, 0.12); }
.page--right { border-radius: 0 4px 4px 0; box-shadow: inset 26px 0 30px -18px rgba(70, 40, 20, 0.45), inset 0 0 0 1px rgba(90, 60, 30, 0.12); }
.book.is-single .page--right { border-radius: 4px; box-shadow: inset 14px 0 18px -14px rgba(70, 40, 20, 0.45), inset 0 0 0 1px rgba(90, 60, 30, 0.12); }

.page-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  height: 100%;
  overflow-y: auto;
  padding: clamp(1.5rem, 4%, 2.6rem) clamp(1.4rem, 9%, 2.6rem) 2.8rem;
  scrollbar-width: none;
}
.page-text p { margin: 0 0 0.9em; font-size: clamp(0.9rem, 0.25vw + 0.82rem, 1.02rem); line-height: 1.75; color: #3f2228; }
.page-text p:last-child { margin-bottom: 0; }
.page-text p:first-child::first-letter { font-family: var(--display); font-size: 2.4em; line-height: 0.8; float: left; margin: 0.08em 0.1em 0 0; color: #8a2a42; }
.page-photo { margin: 0; }
.page-photo img {
  display: block;
  width: 100%;
  max-height: 72%;
  max-height: calc(var(--pw) / 0.7 - 9rem);
  object-fit: cover;
  border: 6px solid #fbf6ec;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 10px 18px -10px rgba(60, 30, 20, 0.6);
  transform: rotate(-1deg);
}
.page-photo figcaption { margin-top: 0.7rem; font-style: italic; font-size: 0.85rem; text-align: center; color: #7a5a5e; }
.folio { position: absolute; left: 0; right: 0; bottom: 1.1rem; text-align: center; font-style: italic; font-size: 0.78rem; color: #9a7f72; }

.page-inner--title { align-items: center; text-align: center; }
.title-page-name { margin: 0; font-family: var(--display); font-size: clamp(1.5rem, 1vw + 1.2rem, 2rem); line-height: 1.15; color: #3a1520; }
.title-page-date { margin: 0; font-style: italic; font-size: 0.92rem; color: var(--gold-deep); }
.title-page-ornament { width: 6rem; height: auto; }
.title-page-ornament path { fill: none; stroke: var(--gold-deep); stroke-width: 1; stroke-linecap: round; }
/* the endpaper inside the cover: marbled in the book's colour */
.page-inner--endpaper {
  align-items: center;
  background:
    radial-gradient(60% 40% at 30% 30%, rgba(255, 255, 255, 0.14), transparent 70%),
    radial-gradient(50% 35% at 75% 70%, rgba(0, 0, 0, 0.25), transparent 70%),
    repeating-radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 11px),
    color-mix(in srgb, var(--c) 75%, #f1e7d4);
}
.endpaper-mark { font-family: var(--display); font-size: 1.6rem; color: rgba(241, 231, 212, 0.75); }
.page-inner--end { align-items: center; color: #b49c8c; font-family: var(--display); font-size: 1.6rem; }

/* the cover: cloth with a gilt frame; it swings open over the spine */
.book-cover {
  position: absolute;
  top: -0.4rem;
  bottom: -0.4rem;
  left: 50%;
  width: calc(50% + 0.4rem);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 1.2s cubic-bezier(0.55, 0, 0.2, 1);
  z-index: 5;
  pointer-events: none;
}
.book.is-single .book-cover { left: 0; width: calc(100% + 0.4rem); }
.cover-front, .cover-back { position: absolute; inset: 0; border-radius: 0 6px 6px 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cover-front {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.6rem;
  padding: 2rem;
  text-align: center;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 7%, rgba(255, 255, 255, 0.06) 9%, rgba(0, 0, 0, 0) 14%),
    var(--noise),
    var(--c, #5b1a2a);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.cover-front::before {
  content: '';
  position: absolute;
  inset: 1.1rem 1.1rem 1.1rem 1.6rem;
  border: 1px solid rgba(230, 205, 156, 0.7);
  outline: 1px solid rgba(230, 205, 156, 0.35);
  outline-offset: 4px;
  pointer-events: none;
}
.cover-title { font-family: var(--display); font-size: clamp(1.5rem, 1.2vw + 1.1rem, 2.2rem); line-height: 1.15; color: var(--gold-2); text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); max-width: 14ch; }
.cover-date { font-style: italic; font-size: 0.9rem; color: rgba(230, 205, 156, 0.8); }
.cover-back { transform: rotateY(180deg); border-radius: 6px 0 0 6px; background: var(--noise), color-mix(in srgb, var(--c) 75%, #f1e7d4); }
.book.is-opening .book-cover { transform: rotateY(-178deg); }
.book.is-open .book-cover { transform: rotateY(-178deg); visibility: hidden; }
.book.is-single.is-opening .book-cover, .book.is-single.is-open .book-cover { opacity: 0; transition: transform 1.2s cubic-bezier(0.55, 0, 0.2, 1), opacity 0.4s ease 0.8s; }

/* a turning leaf: the page lifts and folds over the spine */
.leaf { position: absolute; top: 0; bottom: 0; width: 50%; transform-style: preserve-3d; z-index: 6; pointer-events: none; }
.leaf--fwd { left: 50%; transform-origin: left center; }
.leaf--back { left: 0; transform-origin: right center; }
.leaf-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.leaf-face--back { transform: rotateY(180deg); }

/* ===================== the record room ===================== */

.song {
  position: relative;
  padding: clamp(4rem, 9vw, 6.5rem) var(--gutter) clamp(3.5rem, 8vw, 5.5rem);
  background:
    var(--noise),
    radial-gradient(40% 50% at 24% 34%, color-mix(in srgb, var(--track) 38%, transparent), transparent 75%),
    radial-gradient(80% 70% at 28% 40%, rgba(74, 21, 38, 0.88) 0%, rgba(44, 11, 22, 0.82) 60%, rgba(31, 7, 16, 0.9) 100%);
  border-block: 1px solid rgba(201, 165, 106, 0.22);
  transition: --track 1.4s ease;
}

/* the room takes the colours of the playing cover: the cover itself, blurred and dimmed */
.song { overflow: hidden; isolation: isolate; }
.song > :not(.song-backdrop) { position: relative; z-index: 1; }
.song-backdrop { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.backdrop-img {
  position: absolute;
  inset: -15%;
  width: 130%;
  height: 130%;
  object-fit: cover;
  filter: blur(64px) saturate(1.7) brightness(0.62);
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.6s ease, visibility 0s 1.6s;
}
.backdrop-img.is-on { opacity: 0.9; visibility: visible; transition: opacity 1.6s ease, visibility 0s; }
/* keep the words readable and let the room melt into the maroon above and below */
.song-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(var(--velvet-800), transparent 18%, transparent 82%, var(--velvet-800)),
    radial-gradient(120% 90% at 50% 45%, rgba(20, 4, 10, 0.15), rgba(20, 4, 10, 0.55));
}

/* compact: turntable on the left, what's playing on the right */
.song-inner {
  display: grid;
  gap: 2.25rem;
  max-width: 62rem;
  margin: 0 auto;
  align-items: center;
}
.records-title { margin: 0; }
/* laptop: turntable on the left, title and what's playing on the right; phone: title first */
@media (min-width: 52rem) {
  .song-inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "deck title" "deck info";
    column-gap: 4.5rem;
    row-gap: 1.4rem;
    align-content: center;
  }
  .records-title { grid-area: title; align-self: end; }
  .turntable { grid-area: deck; align-self: center; }
  .song-text { grid-area: info; align-self: start; }
}
.turntable { position: relative; justify-self: center; }

/* while a song plays, the turntable breathes a soft glow in the song's colour */
.turntable::before {
  content: '';
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--track) 55%, transparent) 0%, transparent 65%);
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.song.is-playing .turntable::before { opacity: 0.8; animation: breathe-glow 4.5s ease-in-out infinite; }
@keyframes breathe-glow { 50% { opacity: 0.45; transform: scale(0.94); } }
.now-label { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.35rem; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--gold); }

/* a little equalizer that dances while a song plays, like Apple Music's */
.eq { display: inline-flex; flex: none; align-items: flex-end; gap: 2px; width: 13px; height: 11px; color: var(--gold-2); }
.eq i { flex: 1; height: 100%; border-radius: 1px; background: currentColor; transform-origin: bottom; transform: scaleY(0.22); transition: transform 0.4s ease; }
.is-playing .eq i { animation: eq 0.9s ease-in-out infinite alternate; }
.is-playing .eq i:nth-child(2) { animation-duration: 0.62s; animation-delay: -0.35s; }
.is-playing .eq i:nth-child(3) { animation-duration: 1.06s; animation-delay: -0.7s; }
.is-playing .eq i:nth-child(4) { animation-duration: 0.78s; animation-delay: -0.2s; }
@keyframes eq { 0% { transform: scaleY(0.2); } 35% { transform: scaleY(0.95); } 65% { transform: scaleY(0.45); } 100% { transform: scaleY(0.8); } }
.song-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.45rem, 0.8vw + 1.2rem, 1.8rem);
  line-height: 1.05;
  color: var(--ivory);
}
.song-artist { margin: 0.35rem 0 0; font-style: italic; color: var(--gold); }

.record-wrap {
  position: relative;
  display: block;
  width: min(58vw, 16.5rem);
  aspect-ratio: 1;
  margin-right: 3rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
/* the platter: what you see while the record is away */
.platter {
  position: absolute;
  inset: 1.5%;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--gold) 0 1.6%, #2a0a14 1.9% 3%, transparent 3.2%),
    repeating-radial-gradient(circle, #1d070e 0 2px, #240a12 2px 5px);
  box-shadow: inset 0 0 0 1px rgba(201, 165, 106, 0.25), inset 0 8px 22px rgba(0, 0, 0, 0.6), 0 30px 46px -24px rgba(5, 1, 3, 0.85);
}
.record {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 1.5%, var(--wax) 1.6% 23.5%, #120408 23.8% 24.6%, transparent 25%),
    repeating-radial-gradient(circle, #160509 0 1px, #261017 1.6px 2.8px);
  box-shadow: 0 34px 50px -24px rgba(5, 1, 3, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(201, 165, 106, 0.18);
  animation: spin 1.8s linear infinite paused;
}
.song.is-playing .record { animation-play-state: running; }
.record-cover {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 33%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 3px #14060b, 0 0 0 4px rgba(201, 165, 106, 0.35);
}
.record::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--velvet-950);
  box-shadow: 0 0 0 1px rgba(201, 165, 106, 0.5);
}
.record-label { position: absolute; inset: 0; display: grid; place-items: center; }
.record-label span {
  translate: 0 -1.5rem;
  max-width: 28%;
  font-family: var(--display);
  font-size: clamp(0.72rem, 2.4vw, 0.9rem);
  line-height: 1.15;
  text-align: center;
  color: var(--gold-2);
}
.record-sheen {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(from 20deg, transparent 0 6%, rgba(255, 240, 215, 0.1) 11%, transparent 17% 50%, rgba(255, 240, 215, 0.08) 61%, transparent 67%);
  transition: opacity 0.25s ease;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* the tonearm rests off the record, and swings on when the song plays */
.tonearm {
  position: absolute;
  top: -6%;
  right: -16%;
  width: 40%;
  height: auto;
  overflow: visible;
  transform-origin: 76.6% 10%;
  transform: rotate(-24deg);
  transition: transform 1.1s var(--ease-settle);
  filter: drop-shadow(0 10px 8px rgba(5, 1, 3, 0.5));
  pointer-events: none;
}
.song.is-playing .tonearm { transform: rotate(4deg); }
/* the thread's station: it reaches the arm's pivot, the power runs down the arm, and the needle lowers onto the record's edge */
.tonearm-power { stroke: #f3e2bd; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; transition: stroke-dashoffset 0.5s ease, opacity 0.5s ease; }
.song.is-threaded .tonearm-power { opacity: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s cubic-bezier(0.45, 0, 0.2, 1) 0.9s, opacity 0.2s ease 0.9s; }
.song.is-threaded .tonearm-pivot { animation: pivot-power 1.3s ease-out 0.75s; }
@keyframes pivot-power { 25% { fill: #fff6e0; } }
.song.is-threaded .tonearm { filter: drop-shadow(0 10px 8px rgba(5, 1, 3, 0.5)) drop-shadow(0 0 5px rgba(230, 205, 156, 0.5)); }
.song.is-threaded:not(.is-playing) .tonearm { transform: rotate(-4deg); transition: transform 1.6s var(--ease-settle) 1.8s, filter 1s ease 0.9s; }

/* controls: one compact row */
.player { display: flex; align-items: center; gap: 1rem; margin-top: 1.4rem; }
.controls { display: flex; align-items: center; gap: 0.55rem; flex: none; }
.ctl {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(230, 205, 156, 0.35);
  border-radius: 50%;
  background: transparent;
  color: var(--ivory);
  cursor: pointer;
  transition: transform 0.35s var(--ease-settle), background 0.25s ease, opacity 0.25s ease;
}
.ctl svg { width: 1.1rem; height: 1.1rem; }
.ctl:hover:not(:disabled) { background: rgba(230, 205, 156, 0.1); transform: scale(1.06); }
.ctl:disabled { opacity: 0.3; cursor: default; }
.ctl--main {
  width: 3.4rem;
  height: 3.4rem;
  border: 0;
  background: var(--foil);
  background-size: 200% 100%;
  color: var(--velvet-900);
  box-shadow: 0 14px 28px -14px rgba(230, 205, 156, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.35s var(--ease-settle), background-position 0.8s var(--ease-out);
}
.ctl--main svg { width: 1.4rem; height: 1.4rem; }
.ctl--main:hover:not(:disabled) { background: var(--foil); background-size: 200% 100%; background-position: 100% 0; transform: scale(1.05); }
.ctl--main:active { transform: scale(0.96); }
.progress { position: relative; flex: 1; min-width: 3rem; height: 2px; border-radius: 2px; background: rgba(243, 233, 220, 0.16); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--gold-2); box-shadow: 0 0 8px rgba(230, 205, 156, 0.6); transition: width 0.5s linear; }
.time { flex: none; font-family: var(--mono); font-weight: 300; font-size: 0.76rem; font-variant-numeric: tabular-nums; color: var(--ivory-3); white-space: nowrap; }

/* Spotify's own small player: it does the actual playing */
.spotify { margin-top: 1.1rem; transition: opacity 0.4s ease, visibility 0.4s; }
.spotify.is-resting { opacity: 0; visibility: hidden; }   /* keeps its place, so nothing below jumps */
.spotify-embed, .spotify iframe { display: block; width: 100%; height: 80px; border: 0; border-radius: 12px; }
.spotify iframe { box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.8); transition: box-shadow 0.4s ease; }
.spotify.is-asking iframe { box-shadow: 0 0 0 2px var(--gold-2), 0 0 26px rgba(230, 205, 156, 0.45); animation: ask 1.8s ease-in-out infinite; }
@keyframes ask { 50% { box-shadow: 0 0 0 2px var(--gold-2), 0 0 8px rgba(230, 205, 156, 0.2); } }

/* ---------- the shelf: a plain row of record sleeves on a ledge ---------- */
.shelf-wrap {
  --s: clamp(7rem, 20vw, 9rem);
  position: relative;
  max-width: 72rem;
  margin: 2rem auto 0;
}
.shelf-wrap::before {
  content: '';
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: calc(2.4rem + var(--s));
  height: 0.8rem;
  border-radius: 2px;
  background: linear-gradient(#5a3a22, #3a2416 55%, #24150c);
  box-shadow: inset 0 1px 0 rgba(230, 205, 156, 0.5), 0 12px 20px -10px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}
.shelf {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 1.1rem;
  margin: 0;
  padding: 2.4rem 3rem 0.5rem;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
  cursor: grab;
  user-select: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf.is-dragging { cursor: grabbing; }
.shelf.is-dragging .sleeve { pointer-events: none; }
.sleeve-item { flex: 0 0 var(--s); min-width: 0; }
.sleeve {
  position: relative;
  display: block;
  width: var(--s);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.sleeve-cover {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 2px;
  background: var(--velvet-700);
  box-shadow: 0 12px 18px -12px rgba(0, 0, 0, 0.9);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.sleeve-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sleeve-blank { display: grid; place-items: center; height: 100%; padding: 0.6rem; font-family: var(--display); color: var(--ivory); text-align: center; }
/* the record inside the sleeve: it peeks out when you reach for it */
.sleeve-disc {
  position: absolute;
  z-index: 1;
  inset: 4%;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--wax) 0 22%, #14060b 22.5% 24%, transparent 24.5%),
    repeating-radial-gradient(circle, #1c0a10 0 1px, #3a1d27 1.5px 2.6px);
  box-shadow: 0 0 0 1.5px rgba(230, 205, 156, 0.4);
  transition: transform 0.3s ease;
}
.sleeve:hover .sleeve-cover, .sleeve:focus-visible .sleeve-cover { transform: translateY(-4px); }
.sleeve:hover .sleeve-disc, .sleeve:focus-visible .sleeve-disc { transform: translateY(-24%); }
.sleeve-item.is-current .sleeve-disc { transform: translateY(-24%); }
.sleeve-item.is-current .sleeve-cover { box-shadow: 0 0 0 2px var(--gold-2), 0 12px 18px -12px rgba(0, 0, 0, 0.9); }
.sleeve-title, .sleeve-artist { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sleeve-title { margin-top: 1.2rem; font-family: var(--display); font-size: 0.98rem; line-height: 1.2; color: var(--ivory); }
.sleeve-artist { font-style: italic; font-size: 0.78rem; color: var(--ivory-3); }
.sleeve-item.is-current .sleeve-title { color: var(--gold-2); }

.shelf-arrow {
  position: absolute;
  z-index: 6;
  top: calc(2.4rem + var(--s) / 2);
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  translate: 0 -50%;
  padding: 0;
  border: 1px solid rgba(230, 205, 156, 0.4);
  border-radius: 50%;
  background: rgba(31, 7, 16, 0.85);
  color: var(--ivory);
  cursor: pointer;
  transition: opacity 0.3s ease, background 0.25s ease;
}
.shelf-arrow svg { width: 1.2rem; height: 1.2rem; }
.shelf-arrow:hover:not(:disabled) { background: rgba(74, 21, 38, 0.95); }
.shelf-arrow:disabled { opacity: 0; pointer-events: none; }
.shelf-arrow--prev { left: 0; }
.shelf-arrow--next { right: 0; }
@media (pointer: coarse) { .shelf-arrow { display: none; } .shelf { padding-inline: 0.25rem; cursor: auto; } }

/* ===================== the arrow that says "there's more below" ===================== */

.scroll-cue {
  position: fixed;
  z-index: 39;
  left: 50%;
  bottom: calc(1.75rem + env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  padding: 0.5rem 0.9rem;
  translate: -50% 0;
  color: var(--gold-2);
  /* a soft dark halo, so it reads over a photo too */
  background: radial-gradient(closest-side, rgba(20, 4, 10, 0.6), rgba(20, 4, 10, 0.35) 60%, transparent);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.7s ease, transform 0.7s var(--ease-out);
}
.scroll-cue.is-shown { opacity: 1; transform: none; pointer-events: auto; }
.scroll-cue:focus-visible { outline-offset: 2px; border-radius: 999px; }
.scroll-cue-line {
  position: relative;
  display: block;
  width: 1px;
  height: 2.6rem;
  overflow: hidden;
  background: linear-gradient(rgba(230, 205, 156, 0), rgba(230, 205, 156, 0.55));
}
/* the same spark as the timeline's gold line, travelling down */
.scroll-cue-spark {
  position: absolute;
  left: 50%;
  top: 0;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: #fff4dc;
  box-shadow: 0 0 6px 2px rgba(255, 230, 180, 0.85);
  animation: cue-spark 2.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes cue-spark {
  0%   { transform: translateY(0); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(2.6rem); opacity: 0; }
}
.scroll-cue-chevron {
  width: 1.15rem;
  height: auto;
  overflow: visible;
  animation: cue-bob 2.2s ease-in-out infinite;
}
.scroll-cue-chevron path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cue-bob { 0%, 100% { transform: translateY(0); } 55% { transform: translateY(4px); } }
.scroll-cue:hover .scroll-cue-chevron { color: #fff4dc; }
/* phones: a small round button just above the little music player (it often sits over a photo) */
@media (max-width: 40rem) {
  .scroll-cue {
    bottom: calc(5.8rem + env(safe-area-inset-bottom));
    place-items: center;
    width: 2.6rem;
    height: 2.6rem;
    padding: 0;
    border: 1px solid rgba(230, 205, 156, 0.45);
    border-radius: 50%;
    background: rgba(31, 7, 16, 0.82);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.8);
  }
  .scroll-cue-line { display: none; }
  .scroll-cue-chevron { width: 1rem; margin-top: 2px; }
}

/* ===================== the little record that follows her ===================== */

/* a drawer in the top left: a small tab (the record, and the equalizer while it plays) that
   slides open to the song and its controls when she points at it, taps it, or tabs to it */
.mini {
  --tab: 5.4rem;
  position: fixed;
  z-index: 40;
  top: calc(1rem + env(safe-area-inset-top));
  left: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  width: var(--tab);
  padding: 0.45rem 0.6rem 0.45rem max(0.7rem, env(safe-area-inset-left));
  overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, 0.18);
  border-left: 0;
  border-radius: 0 999px 999px 0;
  background:
    linear-gradient(110deg,
      color-mix(in srgb, var(--track) 42%, rgba(24, 8, 14, 0.5)) 0%,
      color-mix(in srgb, var(--track) 16%, rgba(24, 8, 14, 0.5)) 55%,
      rgba(24, 8, 14, 0.55) 100%);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
  backdrop-filter: blur(28px) saturate(1.8);
  box-shadow: 0 22px 50px -20px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateX(-105%);
  /* it waits a moment before folding back, so it doesn't snap shut as the pointer leaves */
  transition: opacity 0.45s ease, transform 0.6s var(--ease-settle), width 0.5s var(--ease-settle) 0.35s, --track 1.4s ease;
}
.mini.is-shown { opacity: 1; transform: none; }
.mini:not(.is-playing) { --tab: 4rem; }
.mini.is-open, .mini:focus-within, .mini.is-blocked { width: min(23rem, calc(100vw - 1rem)); transition-delay: 0s; }
@media (hover: hover) { .mini:hover { width: min(23rem, calc(100vw - 1rem)); transition-delay: 0s; } }
/* the song and its controls only show while it's open */
.mini-info, .mini-controls { opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0s linear 0.6s; }
.mini.is-open :is(.mini-info, .mini-controls), .mini:focus-within :is(.mini-info, .mini-controls), .mini.is-blocked :is(.mini-info, .mini-controls) { opacity: 1; visibility: visible; transition: opacity 0.35s ease 0.15s, visibility 0s; }
@media (hover: hover) { .mini:hover :is(.mini-info, .mini-controls) { opacity: 1; visibility: visible; transition: opacity 0.35s ease 0.15s, visibility 0s; } }
/* the tab's own equalizer steps aside once it's open (the title has one) */
.mini.is-open .mini-peek, .mini:focus-within .mini-peek { width: 0; margin-right: -0.6rem; opacity: 0; }
@media (hover: hover) { .mini:hover .mini-peek { width: 0; margin-right: -0.6rem; opacity: 0; } }

.mini-disc, .mini-info { padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.mini-record {
  position: relative;
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--velvet-950) 0 6%, transparent 6.5%),
    repeating-radial-gradient(circle, #160509 0 1px, #2a121b 1.4px 2.4px);
  box-shadow: 0 0 0 1px rgba(230, 205, 156, 0.45), 0 0 18px -2px color-mix(in srgb, var(--track) 80%, transparent), 0 6px 12px -6px rgba(0, 0, 0, 0.8);
}
.mini-cover {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46%;
  height: 46%;
  translate: -50% -50%;
  border-radius: 50%;
  object-fit: cover;
}
.mini.is-playing .mini-record { animation: spin 2.4s linear infinite; }
.mini-info { display: grid; min-width: 0; }
.mini-line { display: flex; align-items: center; gap: 0.45rem; min-width: 0; }
.mini .eq { transition: width 0.35s ease, opacity 0.35s ease, margin 0.35s ease; }
.mini:not(.is-playing) .eq { width: 0; margin-right: -0.45rem; opacity: 0; }
.mini:not(.is-playing) .mini-peek { margin-right: -0.6rem; }
.mini-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--ui); font-weight: 600; font-size: 0.92rem; letter-spacing: -0.01em; line-height: 1.25; color: var(--ivory); }
.mini-artist { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--ui); font-size: 0.78rem; letter-spacing: -0.005em; color: rgba(243, 233, 220, 0.62); }
.mini-controls { display: flex; align-items: center; gap: 0.2rem; }
.mini-btn {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ivory);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.3s var(--ease-settle), opacity 0.25s ease;
}
.mini-btn svg { width: 1rem; height: 1rem; }
.mini-btn:hover:not(:disabled) { background: rgba(230, 205, 156, 0.12); }
.mini-btn:disabled { opacity: 0.3; cursor: default; }
.mini-btn--main { width: 2.6rem; height: 2.6rem; background: rgba(255, 255, 255, 0.92); color: #1a0a10; box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6); }
.mini-btn--main svg { width: 1.15rem; height: 1.15rem; }
.mini-btn--main:hover:not(:disabled) { background: #fff; transform: scale(1.06); }
/* if the browser blocked the music, the play button breathes until she taps it */
.mini.is-blocked .mini-btn--main { animation: ask-play 1.6s ease-in-out infinite; }
@keyframes ask-play { 50% { box-shadow: 0 0 0 6px rgba(230, 205, 156, 0.18); } }
.mini-progress { position: absolute; left: 0.8rem; right: 1.2rem; bottom: 0; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.mini-progress span { display: block; height: 100%; width: 0; background: var(--gold-2); transition: width 0.5s linear; }

/* ===================== the letter ===================== */

.letter {
  padding: clamp(4.5rem, 11vw, 7.5rem) var(--gutter) clamp(4rem, 10vw, 6rem);
  text-align: center;
}
.letter-heading { margin-bottom: 1.2em; }

/* the scroll: two rolls of papyrus meeting in the middle, tied with a ribbon and sealed */
.scroll {
  --knob: 0.6rem;
  --over: 0.7rem;
  --unroll: 2s;
  --ease-roll: cubic-bezier(0.5, 0, 0.2, 1);
  position: relative;
  max-width: 41rem;
  margin: 2rem auto 4.5rem;
  padding-inline: calc(var(--knob) + var(--over));
}

/* papyrus: strips laid across and along, so the fibres run both ways */
.scroll {
  --fibres: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='h'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.003 .2' numOctaves='2' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .31 0 0 0 0 .12 0 0 0 1.4 -.55'/%3E%3C/filter%3E%3Cfilter id='v'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.18 .004' numOctaves='2' seed='8' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .31 0 0 0 0 .12 0 0 0 1.2 -.55'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23h)' opacity='.55'/%3E%3Crect width='100%25' height='100%25' filter='url(%23v)' opacity='.3'/%3E%3C/svg%3E");
  --papyrus: #e3cc98;
}

.scroll-roll {
  position: relative;
  z-index: 2;
  display: block;
  height: 1.9rem;
  margin-inline: calc(-1 * var(--over));
  border-radius: 0.4rem / 50%;
  background:
    linear-gradient(rgba(70, 40, 12, 0.6), rgba(255, 238, 196, 0.28) 38%, rgba(255, 238, 196, 0) 52%, rgba(70, 40, 12, 0.35) 78%, rgba(50, 26, 6, 0.75)),
    var(--fibres) 0 0 / 420px 420px,
    var(--papyrus);
  box-shadow: 0 10px 18px -8px rgba(10, 2, 5, 0.65);
}
/* the wooden rods' ends */
.scroll-roll::before, .scroll-roll::after {
  content: '';
  position: absolute;
  top: 18%;
  bottom: 18%;
  width: var(--knob);
  border-radius: 45%;
  background: linear-gradient(#2a140b, #7d4c2b 40%, #4a2814 75%, #1f0e06);
}
.scroll-roll::before { left: calc(-1 * var(--knob) + 1px); }
.scroll-roll::after { right: calc(-1 * var(--knob) + 1px); }
/* the lower roll gives up its papyrus as it unrolls, and turns while it does */
.scroll-roll--bottom {
  /* a soft shadow where the papyrus curls into the roll, so the two read as one */
  box-shadow: 0 -7px 10px -5px rgba(60, 34, 10, 0.5), 0 10px 18px -8px rgba(10, 2, 5, 0.65);
  transition: height var(--unroll) var(--ease-roll);
}
.scroll.is-open .scroll-roll--bottom { height: 1.5rem; animation: roll-turn var(--unroll) var(--ease-roll); }
@keyframes roll-turn {
  from { background-position: 0 0, 0 0, 0 0; }
  to   { background-position: 0 0, 0 -260px, 0 0; }
}

/* the sheet between the rolls: closed it has no height; opening grows it by exactly the letter's
   height (script.js), so the lower roll moves only as fast as the papyrus comes off it */
.scroll-sheet { height: 0; overflow: hidden; }
.scroll.is-open .scroll-sheet { height: auto; }

/* the ribbon and the seal: one button over the closed scroll */
.scroll-tie {
  position: absolute;
  z-index: 3;
  inset: -1.25rem 0 auto;
  height: calc(3.8rem + 2.5rem);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.scroll.is-breaking .scroll-tie { pointer-events: none; cursor: default; }
.scroll-ribbon {
  position: absolute;
  left: 50%;
  top: 0.55rem;
  bottom: 0.55rem;
  width: 1.05rem;
  translate: -50% 0;
  border-radius: 2px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0.1) 30%, rgba(255, 255, 255, 0) 60%, rgba(0, 0, 0, 0.3)),
    #7a1c30;
  box-shadow: 0 2px 4px rgba(10, 2, 5, 0.45);
  transition: opacity 0.6s ease 0.45s, transform 0.9s var(--ease-out) 0.45s;
}
.scroll-seal {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4.6rem;
  aspect-ratio: 1;
  translate: -50% -50%;
  filter: drop-shadow(0 4px 5px rgba(10, 2, 5, 0.5));
  transition: transform 0.5s var(--ease-out);
}
/* the thread reaches the letter: the seal warms once */
.scroll.is-threaded .scroll-seal { animation: seal-warm 2.2s ease-out; }
/* the thread's last station: it runs in behind the scroll to the seal, which answers like the
   globe's beacon: soft gold rings keep pulsing out of it until she breaks it */
.scroll-seal::before, .scroll-seal::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 228, 175, 0.75);
  opacity: 0;
  pointer-events: none;
}
.scroll.is-threaded:not(.is-breaking) .scroll-seal::before { animation: beacon-ring 2.6s ease-out 0.6s infinite; }
.scroll.is-threaded:not(.is-breaking) .scroll-seal::after { animation: beacon-ring 2.6s ease-out 1.9s infinite; }
@keyframes seal-warm { 25% { filter: drop-shadow(0 4px 5px rgba(10, 2, 5, 0.5)) drop-shadow(0 0 16px rgba(255, 214, 160, 0.95)); } }
.scroll-tie:hover .scroll-seal, .scroll-tie:focus-visible .scroll-seal { transform: scale(1.06) rotate(-4deg); }
.scroll-tie:focus-visible { outline: none; }
.scroll-tie:focus-visible .scroll-seal { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 50%; }
.scroll-hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.4rem;
  font-style: italic;
  font-size: 1rem;
  color: var(--ivory-2);
  transition: opacity 0.4s ease;
}
.scroll.is-breaking .scroll-seal { transform: none; }
.scroll.is-breaking .seal-half--l { animation: crack-l 1.05s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.scroll.is-breaking .seal-half--r { animation: crack-r 1.05s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.scroll.is-breaking .scroll-ribbon { opacity: 0; transform: translateY(1.5rem); }
.scroll.is-breaking .scroll-hint { opacity: 0; }

/* the letter itself, written on the papyrus */
.letter-paper {
  position: relative;
  padding: clamp(2rem, 7vw, 3.5rem) clamp(1.4rem, 6vw, 3.5rem) clamp(2rem, 6vw, 3rem);
  background: var(--fibres) 0 0 / 420px 420px, var(--noise), var(--papyrus);
  color: var(--ink);
  font-family: var(--hand);
  font-style: italic;
  text-align: left;
  /* darker where the papyrus meets the rolls and along its edges */
  box-shadow:
    inset 0 14px 14px -10px rgba(70, 40, 12, 0.55),
    inset 0 -14px 14px -10px rgba(70, 40, 12, 0.55),
    inset 18px 0 30px -18px rgba(110, 70, 25, 0.45),
    inset -18px 0 30px -18px rgba(110, 70, 25, 0.45);
}
.scroll:not(.is-open) .letter-body p, .scroll:not(.is-open) .letter-signoff { animation: none; }
.letter-body p {
  margin: 0 0 1.15em;
  font-size: 1.2em;
  line-height: 1.75;
  opacity: 0;
  transform: translateY(8px);
  animation: line-in 1.1s var(--ease-out) both;
  animation-delay: calc(1.1s + var(--i, 0) * 0.35s);
}
.letter-body p:first-child { font-style: italic; }
@keyframes line-in { to { opacity: 1; transform: none; } }
.letter-signoff {
  margin: 2.25rem 0 0;
  font-style: italic;
  font-size: 1.32em;
  text-align: right;
  color: #8a2a42;
  opacity: 0;
  animation: line-in 1.2s var(--ease-out) both;
  animation-delay: var(--sign-delay, 2s);
}
.letter-flower {
  display: block;
  width: min(13rem, 52%);
  height: auto;
  margin: 1rem -0.5rem 0 auto;
  mix-blend-mode: multiply;   /* sits in the papyrus like it was printed on it */
}

.petals { position: fixed; inset: 0; z-index: 46; overflow: hidden; pointer-events: none; }
.petal {
  position: absolute;
  top: -5vh;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * 1.3);
  border-radius: 80% 0 80% 0;
  background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--tone) 60%, #fff) 0%, var(--tone) 60%);
  opacity: 0;
  animation: petal-fall var(--dur) cubic-bezier(0.35, 0.1, 0.55, 1) var(--delay) forwards;
}
@keyframes petal-fall {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); }
  10%  { opacity: 0.95; }
  50%  { transform: translate3d(calc(var(--drift) * -0.6), 55vh, 0) rotate(calc(var(--rot) * 0.5)); }
  85%  { opacity: 0.9; }
  100% { opacity: 0; transform: translate3d(var(--drift), 112vh, 0) rotate(var(--rot)); }
}

/* ===================== the heart at the end of the thread ===================== */

.heart-room {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  padding: clamp(9rem, 20vw, 13rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem);
}
/* its room is darker than the rest, so the heart's own light is what you see */
.heart-room::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(6, 1, 3, 0.6) 22%, rgba(6, 1, 3, 0.72) 70%, rgba(6, 1, 3, 0.6));
  pointer-events: none;
}
.heart-stage { position: relative; display: grid; place-items: center; width: min(620px, 100%); }
.heart-stage:has(.gift) { width: min(1040px, 100%); }

/* the gifts around the heart: grey sketches while it's cold, lit one by one when it starts, glowing on every beat */
.gift {
  --breath: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  width: max-content;
  max-width: 11rem;
  padding: 0.4rem 0.6rem;
  text-align: center;
  text-decoration: none;
  color: rgba(150, 155, 170, 0.55);
  will-change: transform;
  transition: color 1.2s ease calc(var(--i) * 0.14s);
}
.gift-name { font-family: var(--display); font-size: 1.12rem; line-height: 1.2; }
.gift-date { font-style: italic; font-size: 0.8rem; opacity: 0.8; }
.gift-name::after {   /* a thin line under the name, like a link in the album */
  content: '';
  display: block;
  height: 1px;
  margin: 0.3rem auto 0;
  width: 2.2rem;
  background: currentColor;
  opacity: 0.45;
  transition: width 0.4s var(--ease-out), opacity 0.4s ease;
}
.heart-stage.is-alive .gift {
  color: var(--gold-2);
  text-shadow: 0 0 calc(4px + var(--breath) * 8px) rgba(240, 120, 140, calc(0.18 + var(--breath) * 0.25));
}
.gift-last { white-space: nowrap; }
.gift-icon { width: 0.72em; height: 0.72em; margin-left: 0.3em; vertical-align: 0.02em; opacity: 0.6; transition: opacity 0.3s ease, transform 0.3s var(--ease-out); }
.gift:hover .gift-icon, .gift:focus-visible .gift-icon { opacity: 1; transform: translate(1px, -1px); }
.gift[download]:hover .gift-icon, .gift[download]:focus-visible .gift-icon { transform: translateY(1px); }
.heart-stage.is-alive .gift-date { color: rgba(243, 233, 220, 0.7); }
.gift:hover .gift-name::after, .gift:focus-visible .gift-name::after { width: 100%; opacity: 0.8; }
.gift:focus-visible { outline: 1px solid var(--gold-2); outline-offset: 2px; border-radius: 3px; }
@media (max-width: 819px) {
  .heart-stage:has(.gift) { margin-block: 4.5rem; }   /* room for the pairs above and below the heart */
  .gift { max-width: 6.8rem; padding: 0.25rem 0.15rem; }
  .gift-name { font-size: 0.8rem; }
  .gift-name::after { margin-top: 0.2rem; }
  .gift-date { font-size: 0.62rem; white-space: nowrap; }
}
.heart-halo {
  position: absolute;
  inset: 6% 8% 14%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(225, 45, 80, 0.6), rgba(200, 30, 60, 0.2) 55%, transparent);
  filter: blur(28px);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, transform;
}
.big-heart { position: relative; display: block; }
/* the jolt that starts it: a flash of light from the heart over the whole screen */
.heart-flash {
  position: fixed;
  inset: 0;
  z-index: 47;
  pointer-events: none;
  background: radial-gradient(circle at var(--cx) var(--cy), rgba(255, 246, 225, 0.95), rgba(255, 170, 170, 0.35) 16%, transparent 52%);
  mix-blend-mode: screen;
  opacity: 0;
}
/* the light that runs back up the thread on every beat */
.thread-pulse { stroke: #fff1d0; stroke-width: 2.5; stroke-linecap: round; opacity: 0; }

/* ===================== footer ===================== */

.footer {
  padding: 1rem var(--gutter) calc(4rem + env(safe-area-inset-bottom));
  background: var(--noise), var(--velvet-950);
  color: var(--ivory-3);
  text-align: center;
  font-style: italic;
}
.footer p { margin: 0; }
.footer-mark {
  background-size: 250% 100% !important;
  animation: foil-glint 7s ease-in-out infinite;
  margin: 0 !important;
  font-family: var(--display);
  font-style: normal;
  font-size: clamp(3rem, 5vw + 1.5rem, 4.75rem);
  line-height: 1.1;
  letter-spacing: 0.04em;
  background: var(--foil);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ===================== dialogs: shared pieces ===================== */

html.has-dialog { overflow: hidden; }

.x-btn,
.nav-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.35s var(--ease-settle), background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}
.x-btn svg, .nav-btn svg { width: 1.25rem; height: 1.25rem; }
.x-btn {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(154, 119, 68, 0.5);
  background: rgba(246, 239, 228, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 24px -12px rgba(10, 2, 5, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.x-btn:hover { transform: rotate(90deg); color: #8a2a42; }
.nav-btn {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(154, 119, 68, 0.45);
  background: transparent;
  color: var(--ink);
}
.nav-btn:hover:not(:disabled) { background: rgba(154, 119, 68, 0.12); transform: scale(1.06); }
.nav-btn:disabled { opacity: 0.3; cursor: default; }
.nav-btn--dark { border-color: rgba(230, 205, 156, 0.4); color: var(--ivory); }
.nav-btn--dark:hover:not(:disabled) { background: rgba(230, 205, 156, 0.12); }

.pill {
  padding: 0.6rem 1.15rem;
  border: 0;
  border-radius: 999px;
  background: var(--velvet-800);
  color: var(--ivory);
  font-style: italic;
  cursor: pointer;
  box-shadow: 0 10px 20px -12px rgba(58, 15, 29, 0.8);
  transition: background 0.25s ease, transform 0.3s var(--ease-settle);
}
.pill:hover { background: var(--velvet-600); transform: translateY(-1px); }

/* ---------- a place's whole memory ("read all" on the map) ---------- */
.place-reader {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 4.25rem 1rem calc(2rem + env(safe-area-inset-bottom));
  border: 0;
  background: transparent;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.place-reader[open] { display: grid; justify-items: center; align-items: start; }
.place-reader-close { position: fixed; top: 1rem; right: 1rem; z-index: 2; }
.popup--full {
  width: min(34rem, 100%);
  margin: auto 0;
  background: var(--print);
  border-radius: 4px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
  color: var(--ink);
  animation: fade-in 0.45s ease;
}
.place-reader.is-closing .popup--full, .place-reader.is-closing .place-reader-close { animation: fade-out 0.26s ease forwards; }
.popup--full .popup-photo { padding: 0.6rem 0.6rem 0; }
.popup--full .popup-body { padding: 1.1rem 1.5rem 1.3rem; }
.popup--full .popup-date { font-size: 0.92rem; }
.popup--full .popup-name { font-size: 1.7rem; }
.popup--full .popup-coords { font-size: 0.75rem; }
.popup--full .popup-text { max-height: none; overflow: visible; -webkit-mask-image: none; mask-image: none; margin-top: 0.9rem; font-size: 1.02rem; line-height: 1.7; max-width: 60ch; }
.popup--full .popup-actions { margin-top: 1.1rem; }

dialog::backdrop {
  background: rgba(24, 5, 12, 0.78);
  -webkit-backdrop-filter: blur(7px) saturate(0.85);
  backdrop-filter: blur(7px) saturate(0.85);
}
dialog[open]::backdrop { animation: fade-in 0.45s ease; }
dialog.is-closing::backdrop { animation: fade-out 0.26s ease forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
dialog:focus { outline: none; }

.viewer-count { font-size: 0.9rem; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 3.2em; text-align: center; }

/* ===================== the photo viewer ===================== */

.viewer {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}
.viewer[open] {
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: 4.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}
.viewer[open] .viewer-figure { animation: fade-in 0.4s ease; }
.viewer.is-closing .viewer-figure,
.viewer.is-closing .viewer-nav,
.viewer.is-closing .viewer-close { animation: fade-out 0.26s ease forwards; }

.viewer-figure {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1rem;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  touch-action: pan-y;
  user-select: none;
}
.viewer-print {
  padding: 0.6rem;
  min-height: 0;
  background: var(--print);
  border-radius: 2px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
}
.viewer-print img {
  display: block;
  max-width: min(88vw, 64rem);
  max-height: calc(100svh - 14rem);
  object-fit: contain;
}
.viewer-caption { display: grid; justify-items: center; gap: 0.1rem; text-align: center; }
.viewer-title { font-family: var(--display); font-size: 1.15rem; line-height: 1.2; color: var(--ivory); }
.viewer-date { font-style: italic; font-size: 0.92rem; color: var(--gold); }
.viewer-nav { display: flex; align-items: center; gap: 1rem; margin-top: 0.9rem; }
.viewer-count { color: var(--ivory-3); }
.viewer-close { position: fixed; top: 1rem; right: 1rem; z-index: 2; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  background: var(--velvet-800);
  color: var(--ivory);
  text-align: center;
}

/* ===================== reduced motion: everything simply appears ===================== */

@media (prefers-reduced-motion: reduce) {
  .is-playing .eq i, .caret, .is-music .thread-glow { animation: none; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; transition-delay: 0ms !important; }
  .seal:not(:disabled) { animation: none; }
  .cover { transition: opacity 0.4s ease !important; }
  .cover.is-lifting { opacity: 0; }
  .cover.is-lifting .cover-door--l, .cover.is-lifting .cover-door--r { transform: none; }
  body.is-sealed .album { transform: none; }
  .rise > span { filter: none; }
  .dawn { display: none; }
  .book, .book-cover { transition: none !important; }
  .scroll-cue-spark, .scroll-cue-chevron { animation: none; }
  .chapter .print img, .opening .print img { filter: none; }
  .song.is-playing .record { animation: spin 6s linear infinite !important; }
}
