/* ====================================================================
   MINETTE M. TORRES (DANG) — CHAPTER 24
   Design: Handcrafted Bookish Keepsake & Literary Journal
   Typography: Fraunces (Display Serif), Plus Jakarta Sans (Body),
               IBM Plex Mono (Index & Code), Patrick Hand (Marginalia)
   ==================================================================== */

:root {
  /* Color Palette — Restrained Deep Paper, Consistent Purple & Warm Linen */
  --bg-dark: #120e17;
  --bg-surface: #191421;
  --bg-surface-elevated: #231b2e;
  --accent-purple: #c4b5fd;
  --accent-thistle: #bfa8d8;
  --accent-violet: #a78bfa;
  --accent-plum: #7c5ba8;
  --accent-dark-purple: #2f223f;
  --accent-linen: #ded5ca;
  --accent-gold: #ded5ca;
  --accent-rose: #bfa8d8;
  --accent-pink-bright: #c4b5fd;
  --text-main: #f5f2eb;
  --text-muted: #a89f97;
  --text-dim: #736b65;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(196, 181, 253, 0.22);
  --border-purple-solid: #3a2d4d;

  /* Typographic System */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-hand: 'Patrick Hand', cursive;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Global Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: #120e17;
  /* Authentic Handcrafted Paper Collage & Ink Grain Texture */
  background-image: 
    /* Layer 1: High-Density Paper Fiber Noise */
    url("data:image/svg+xml,%3Csvg viewBox='0 0 500 500' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paperGrain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0.12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paperGrain)'/%3E%3C/svg%3E"),
    /* Layer 2: Handcrafted Crosshatch & Pencil Stipple Grid */
    url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23c4b5fd' stroke-width='0.5' stroke-opacity='0.05'%3E%3Cpath d='M0 0l80 80M80 0L0 80M40 0v80M0 40h80'/%3E%3Ccircle cx='40' cy='40' r='1' fill='%23ded5ca' fill-opacity='0.08'/%3E%3C/g%3E%3C/svg%3E"),
    /* Layer 3: Organic Thistle Ink Wash & Dark Paper Vignette */
    radial-gradient(circle at 18% 22%, rgba(124, 91, 168, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 82% 75%, rgba(88, 62, 122, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(196, 181, 253, 0.06) 0%, transparent 65%),
    linear-gradient(180deg, #15101b 0%, #110d16 50%, #0d0a12 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.75;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Hide canvas particle element completely to guarantee zero floating dots */
#particles-canvas {
  display: none;
}

/* Main Container Wrapper */
.site-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.6rem 7rem;
}

/* Scroll Reveal Base */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.65s var(--ease-out), transform 0.65s var(--ease-out);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Book Dividers with Purple Accents */
.book-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2.8rem 0;
  color: var(--accent-purple);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  letter-spacing: 0.35em;
  user-select: none;
}

.book-divider::before,
.book-divider::after {
  content: '';
  height: 1px;
  width: 70px;
  background: var(--border-accent);
}

/* ====================================================================
   OPENING GIFT GATE
   ==================================================================== */
#gift-gate {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(14, 11, 19, 0.98);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s var(--ease-out);
}

#gift-gate.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gift-card-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  padding: 3.2rem 2.4rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.gift-prompt {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-purple);
  line-height: 1.25;
  margin-bottom: 0.6rem;
}

.gift-sub {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
}

.btn-open-gift {
  background: var(--accent-purple);
  color: #120e17;
  border: none;
  border-radius: 6px;
  padding: 0.85rem 2rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease, transform 0.2s ease;
}

.btn-open-gift:hover {
  background: #ffffff;
  transform: translateY(-2px);
}

/* ====================================================================
   HERO / TITLE PAGE
   ==================================================================== */
.hero-section {
  padding: 6.5rem 0 3rem;
  text-align: left;
}

.hero-inner {
  max-width: 680px;
  margin-bottom: 3.2rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 3.8rem;
  line-height: 1.08;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.hero-dedication {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--accent-purple);
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.hero-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

.hero-hand-note {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--accent-linen);
  line-height: 1.5;
}

/* ====================================================================
   TABLE OF CONTENTS (TOC)
   ==================================================================== */
.book-toc {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 2rem 2.2rem;
  max-width: 760px;
}

.toc-header {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-purple);
  margin-bottom: 1.4rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 2rem;
}

.toc-grid li a {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.toc-grid li a:hover {
  color: var(--accent-purple);
  transform: translateX(3px);
}

.toc-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-purple);
  font-weight: 500;
  width: 2.2rem;
  flex-shrink: 0;
}

.toc-title {
  border-bottom: 1px dotted rgba(255, 255, 255, 0.18);
  flex-grow: 1;
  padding-bottom: 0.15rem;
}

/* ====================================================================
   CHAPTER GENERAL STYLING
   ==================================================================== */
.journal-chapter {
  padding: 3.5rem 0 2rem;
  position: relative;
}

.chapter-label {
  margin-bottom: 2.4rem;
}

.chapter-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-purple);
  margin-bottom: 0.4rem;
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: 2.35rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.18;
}

.chapter-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.3rem;
}

/* ====================================================================
   CHAPTER I: THE DEDICATION (EDITORIAL WITH MARGINALIA)
   ==================================================================== */
.editorial-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 2.5rem;
  align-items: start;
}

.editorial-entry {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2.8rem 2.4rem;
}

.entry-body {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.88;
}

.entry-body p {
  margin-bottom: 1.3rem;
}

.entry-body p:last-child {
  margin-bottom: 0;
}

.entry-body p:first-letter {
  font-family: var(--font-serif);
  font-size: 3.2rem;
  float: left;
  line-height: 0.85;
  margin: 0.1rem 0.45rem 0 0;
  color: var(--accent-purple);
  font-weight: 700;
}

.marginal-aside {
  background: var(--bg-surface);
  border-left: 2px solid var(--accent-purple);
  border-radius: 0 6px 6px 0;
  padding: 1.2rem 1.1rem;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.margin-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-purple);
  margin-bottom: 0.4rem;
}

.margin-text {
  font-family: var(--font-serif);
  font-style: italic;
  line-height: 1.55;
  color: var(--accent-linen);
}

/* ====================================================================
   CHAPTER II: SCRAPBOOK / MEMORIES
   ==================================================================== */
.scrapbook-canvas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2.2rem;
  padding: 0.5rem 0;
}

.polaroid-card {
  background: #fbf9f4;
  padding: 0.85rem 0.85rem 1.6rem 0.85rem;
  border-radius: 3px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  transform: rotate(var(--rotation, 0deg));
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
  position: relative;
  cursor: pointer;
}

.polaroid-card:hover {
  transform: scale(1.03) rotate(0deg) !important;
  z-index: 10;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
}

.washi-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 18px;
  background: rgba(196, 181, 253, 0.7);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  z-index: 2;
  opacity: 0.9;
}

.polaroid-img-wrapper {
  width: 100%;
  height: 230px;
  overflow: hidden;
  border-radius: 2px;
  background: #e8e4dc;
}

.polaroid-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.polaroid-caption {
  text-align: center;
  margin-top: 0.85rem;
}

.caption-text {
  font-family: var(--font-hand);
  font-size: 1.3rem;
  color: #1e1820;
  font-weight: 700;
  line-height: 1.25;
}

.caption-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #6b635c;
  display: block;
  margin-top: 0.2rem;
  letter-spacing: 0.04em;
}

/* ====================================================================
   CHAPTER III: FIELD GUIDE (PLAYFUL INTERACTIVE OBSERVATIONS)
   ==================================================================== */
.field-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}

.field-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.4rem 1.3rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.field-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  background: #1e1727;
}

.field-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
}

.field-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-purple);
  font-weight: 500;
  background: rgba(196, 181, 253, 0.08);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.field-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

.field-card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.field-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.25;
}

.field-expand-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-purple);
  white-space: nowrap;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.field-card:hover .field-expand-hint {
  opacity: 1;
}

.field-reveal-body {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.35s ease, margin-top 0.35s ease;
}

.field-card.expanded .field-reveal-body {
  max-height: 250px;
  opacity: 1;
  margin-top: 0.85rem;
}

.field-reading {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-thistle);
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border-subtle);
}

.field-notes {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ====================================================================
   CHAPTER IV: STORYBOOK TIMELINE
   ==================================================================== */
.storybook-flow {
  display: flex;
  flex-direction: column;
  gap: 2.2rem;
  max-width: 760px;
}

.story-node {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 2rem;
  padding-bottom: 2.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.story-node:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.story-date-col {
  padding-top: 0.2rem;
}

.story-date-tag {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--accent-purple);
  letter-spacing: 0.04em;
  display: block;
}

.story-content-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.story-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
}

.story-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
}

.story-photo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 0.85rem;
  border: 1px solid var(--border-subtle);
}

/* ====================================================================
   CHAPTER V: FIELD NOTES (STICKY NOTES)
   ==================================================================== */
.desk-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  padding: 0.5rem 0;
}

.sticky-note {
  background-color: var(--bg-color, #f5e6d3);
  color: #211c19;
  padding: 1.8rem 1.4rem 1.4rem;
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  transform: rotate(var(--rotation, 0deg));
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
  position: relative;
  cursor: pointer;
  min-height: 190px;
  display: flex;
  flex-direction: column;
}

.sticky-note:hover {
  transform: scale(1.04) rotate(0deg) !important;
  z-index: 10;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.pin {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  line-height: 1;
}

.note-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #63574c;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.note-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  color: #1a1512;
  margin-bottom: 0.45rem;
  line-height: 1.2;
}

.note-summary {
  font-family: var(--font-hand);
  font-size: 1.25rem;
  line-height: 1.35;
  color: #2b231d;
  flex-grow: 1;
}

.note-expand-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #7a6e62;
  text-align: right;
  margin-top: 0.75rem;
}

/* ====================================================================
   CHAPTER VI: WORDS TO KEEP CLOSE (FOLDED NOTES)
   ==================================================================== */
.folded-notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.4rem;
}

.folded-note-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.6rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
  position: relative;
}

.folded-note-card:hover {
  border-color: var(--border-accent);
  background: #1f1828;
}

.folded-note-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.folded-note-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.folded-note-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-purple);
  font-weight: 500;
  flex-shrink: 0;
}

.folded-note-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: none;
}

.folded-note-card.expanded .folded-note-body {
  display: block;
}

.folded-note-card.expanded {
  border-color: var(--border-accent);
  background: #1f1828;
}

/* ====================================================================
   CHAPTER VII: MINI-GAME (STAR CATCH)
   ==================================================================== */
.game-doodle-box {
  max-width: 680px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.8rem 1.6rem;
}

.game-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}

.game-prompt-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.game-score-readout {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-purple);
}

.game-canvas-wrap {
  width: 100%;
  height: 300px;
  background: #0f0c14;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  touch-action: none;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.game-controls {
  display: flex;
  justify-content: center;
  margin-top: 1.2rem;
}

/* Common Action Button */
.btn-clean-action {
  background: var(--accent-purple);
  color: #120e17;
  border: none;
  border-radius: 6px;
  padding: 0.75rem 1.8rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-clean-action:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-clean-action-subtle {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0.75rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.btn-clean-action-subtle:hover {
  color: #fff;
  border-color: var(--accent-purple);
}

/* ====================================================================
   CHAPTER VIII: THE BIRTHDAY LETTER
   ==================================================================== */
.letter-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 2.5rem;
  align-items: start;
}

.letter-envelope-container {
  width: 100%;
}

/* ── Sealed Envelope Card (Tap to Unseal) ── */
.sealed-envelope-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  padding: 3.2rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.sealed-envelope-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-purple);
  background: #1f1728;
}

.wax-seal-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #2a1b38;
  border: 2px solid var(--accent-purple);
  color: var(--accent-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 1.2rem;
  box-shadow: 0 4px 16px rgba(124, 91, 168, 0.35);
  transition: transform 0.25s ease;
}

.sealed-envelope-card:hover .wax-seal-badge {
  transform: scale(1.08);
}

.seal-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.3rem;
}

.seal-desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-thistle);
  margin-bottom: 1.2rem;
}

.seal-tap-hint {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--accent-purple);
  letter-spacing: 0.05em;
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border: 1px dashed var(--border-accent);
  border-radius: 4px;
  background: rgba(196, 181, 253, 0.06);
}

.parchment-letter {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  padding: 3.2rem 2.6rem;
  position: relative;
}

.parchment-letter.sealed-hidden {
  display: none;
  opacity: 0;
  transform: translateY(15px);
}

.parchment-letter.unsealed-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: letterUnfold 0.45s var(--ease-out) forwards;
}

@keyframes letterUnfold {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.letterhead-crest {
  position: absolute;
  top: -12px;
  right: 24px;
  background: var(--accent-purple);
  color: #120e17;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.65rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.letter-salutation {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1.4rem;
}

.letter-body p {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.88;
  margin-bottom: 1.2rem;
}

.letter-closing {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--accent-purple);
  margin-top: 2rem;
}

.letter-signature {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--accent-linen);
  margin-top: 0.35rem;
  font-weight: 600;
}

.letter-foot-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: 2.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

/* ====================================================================
   COLOPHON / FOOTER
   ==================================================================== */
.journal-colophon {
  text-align: center;
  padding: 4rem 1rem 2rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ====================================================================
   SOUNDTRACK WIDGET (RESTYLED BOOKMARK COMPANION)
   ==================================================================== */

#soundtrack-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font-family: var(--font-sans);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  transition: width 0.25s var(--ease-out), opacity 0.2s ease;
}

/* ── Collapsed Bookmark Strip ── */
.sw-collapsed {
  display: none;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
}

.sw-bookmark-tag {
  color: var(--accent-purple);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.sw-collapsed-song {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#soundtrack-widget.collapsed {
  width: auto;
  min-width: 220px;
  max-width: 300px;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
}
#soundtrack-widget.collapsed .sw-expanded { display: none !important; }
#soundtrack-widget.collapsed .sw-collapsed { display: flex !important; }

/* ── Toggle button ── */
.sw-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.sw-toggle:hover { color: var(--accent-purple); }

/* ── Expanded top row ── */
.sw-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sw-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-purple);
}

/* ── Spotify Swappable Embed Player ── */
.sw-embed-wrap {
  margin-bottom: 0.65rem;
  border-radius: 8px;
  overflow: hidden;
  background: #181220;
  border: 1px solid var(--border-subtle);
  min-height: 80px;
}

.sw-embed-wrap iframe {
  display: block;
  width: 100%;
  height: 80px;
  border: none;
}

/* ── Now playing: artwork + info ── */
.sw-now {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.65rem;
}

.sw-art {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.sw-song-info {
  flex: 1;
  min-width: 0;
}

.sw-song-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sw-song-artist {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.sw-song-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-thistle);
  opacity: 0.85;
  margin-top: 0.15rem;
}

/* ── Action links ── */
.sw-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.sw-listen-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-purple);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.sw-listen-link:hover { opacity: 0.75; }

.sw-actions-divider {
  color: var(--text-dim);
  font-size: 0.75rem;
  user-select: none;
}

.sw-text-btn {
  background: none;
  border: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
  font-family: var(--font-sans);
}
.sw-text-btn:hover { color: #fff; }

/* ====================================================================
   PLAYLIST BROWSE MODAL
   ==================================================================== */

.pl-modal {
  max-width: 560px;
  width: 94%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-accent) !important;
  border-radius: 12px;
  padding: 1.6rem 1.5rem 1.2rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
}

.pl-header { margin-bottom: 1rem; }

.pl-header h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}

.pl-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── Toolbar: search + surprise ── */
.pl-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.pl-search {
  flex: 1;
  padding: 0.6rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: #fff;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease;
}
.pl-search:focus {
  border-color: var(--accent-purple);
}
.pl-search::placeholder { color: rgba(255, 255, 255, 0.3); }

/* ── Filters: simple text nav ── */
.pl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

.pl-filter-btn {
  background: none;
  border: none;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem 0.65rem;
  border-radius: 0;
  transition: color 0.15s ease;
  font-family: var(--font-sans);
  position: relative;
  white-space: nowrap;
}

.pl-filter-btn:hover {
  color: #fff;
}

.pl-filter-btn.active {
  color: var(--accent-purple);
  font-weight: 600;
}

.pl-filter-btn.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.65rem;
  right: 0.65rem;
  height: 2px;
  background: var(--accent-purple);
  border-radius: 1px;
}

/* ── Vibe note ── */
.pl-vibe-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
}

.pl-vibe-note-text { flex: 1; }

.pl-vibe-note-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}
.pl-vibe-note-clear:hover { color: var(--accent-purple); }

/* ── Track list ── */
.pl-list {
  overflow-y: auto;
  flex-grow: 1;
  max-height: 54vh;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ── Track row ── */
.pl-track {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.pl-track:last-child { border-bottom: none; }

.pl-track:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pl-track.active {
  background: rgba(196, 181, 253, 0.08);
}

.pl-track.active .pl-track-title {
  color: var(--accent-purple);
}

.pl-track.active .pl-track-fav {
  opacity: 1;
}

/* active indicator bar */
.pl-track.active::before {
  content: '';
  display: block;
  width: 3px;
  align-self: stretch;
  background: var(--accent-purple);
  border-radius: 2px;
  margin-right: -0.25rem;
  flex-shrink: 0;
}

.pl-track-fav {
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text-muted);
  opacity: 0.4;
  padding: 0.15rem;
  flex-shrink: 0;
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}
.pl-track:hover .pl-track-fav { opacity: 0.7; }
.pl-track-fav:hover { opacity: 1; transform: scale(1.15); }
.pl-track-fav.favorited { color: var(--accent-purple); opacity: 1; }

.pl-track-art {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.pl-track-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.pl-track-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.pl-track-sub {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-track-listen {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0;
  font-weight: 500;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.pl-track:hover .pl-track-listen { opacity: 0.7; }

.pl-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.pl-empty-reset {
  background: none;
  border: none;
  color: var(--accent-purple);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  margin-top: 0.5rem;
  padding: 0;
  font-family: var(--font-sans);
}
.pl-empty-reset:hover { text-decoration: underline; }

/* ====================================================================
   MODALS & LIGHTBOXES
   ==================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 8, 14, 0.88);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease;
}
.modal-close-btn:hover {
  color: #fff;
}

/* Lightbox Modal Specifics */
.lightbox-card {
  max-width: 720px;
  background: none;
  padding: 0;
  text-align: center;
  position: relative;
}

.lightbox-img-wrapper img {
  max-width: 100%;
  max-height: 72vh;
  border-radius: 4px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border-subtle);
}

.lightbox-caption-text {
  font-family: var(--font-hand);
  font-size: 1.55rem;
  color: var(--accent-purple);
  margin-top: 0.85rem;
}

/* Sticky Modal Specifics */
.sticky-modal-card {
  background-color: #f5e6d3;
  color: #1e1814;
  border-radius: 6px;
  max-width: 480px;
  width: 92%;
  padding: 2.8rem 2.2rem 2.2rem;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.modal-pin {
  top: -12px !important;
}

.modal-note-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  line-height: 1.25;
}

.modal-note-text {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  color: #2b231c;
}

/* Secret Message Modal Specifics */
.secret-note-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: 10px;
  max-width: 480px;
  width: 92%;
  padding: 2.8rem 2.2rem 2.2rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  position: relative;
}

.secret-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-purple);
  margin-bottom: 0.85rem;
}

.secret-title {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
}

.secret-body {
  font-size: 0.96rem;
  line-height: 1.8;
  color: var(--text-main);
  margin-bottom: 1.6rem;
  white-space: pre-line;
}

/* ====================================================================
   RESPONSIVE MEDIA QUERIES & LAYOUT POLISH
   ==================================================================== */
@media (max-width: 900px) {
  .site-wrapper {
    padding: 0 1.5rem 6.5rem;
  }
  .scrapbook-canvas {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.8rem;
  }
  .editorial-layout,
  .letter-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .marginal-aside {
    border-left: none;
    border-top: 2px solid var(--accent-purple);
    border-radius: 0 0 6px 6px;
  }
}

@media (max-width: 768px) {
  .hero-section {
    padding: 4.5rem 0 2.5rem;
  }
  .hero-title { font-size: 2.8rem; }
  .toc-grid { grid-template-columns: 1fr; gap: 0.6rem; }
  .chapter-label { margin-bottom: 2rem; }
  .chapter-title { font-size: 1.85rem; }
  .editorial-entry { padding: 2.2rem 1.6rem; }
  .story-node {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding-bottom: 2rem;
  }
  .story-date-col {
    padding-top: 0;
  }
  .story-photo {
    max-height: 260px;
  }
  .parchment-letter { padding: 2.5rem 1.6rem; }
  .letterhead-crest { top: -12px; right: 16px; }
  .site-wrapper { padding: 0 1.2rem 6.5rem; }
  
  .desk-notes {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .folded-notes-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
  .field-guide-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
  }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2.2rem; line-height: 1.15; }
  .gift-card-wrapper { padding: 2.5rem 1.4rem; }
  .gift-prompt { font-size: 1.55rem; }
  .editorial-entry { padding: 1.8rem 1.2rem; }
  .entry-body { font-size: 1rem; line-height: 1.8; }
  .entry-body p:first-letter { font-size: 2.6rem; margin: 0.1rem 0.35rem 0 0; }
  .polaroid-card {
    padding: 0.75rem 0.75rem 1.4rem;
    transform: rotate(calc(var(--rotation, 0deg) * 0.4)) !important;
  }
  .polaroid-img-wrapper { height: 220px; }
  .sticky-note {
    padding: 1.5rem 1.2rem 1.2rem;
    min-height: auto;
    transform: rotate(calc(var(--rotation, 0deg) * 0.4)) !important;
  }
  .parchment-letter { padding: 2rem 1.2rem; }
  .letter-salutation { font-size: 1.55rem; }
  .letter-body p { font-size: 0.98rem; line-height: 1.8; }
  .letter-signature { font-size: 1.4rem; }
  #soundtrack-widget { right: 10px; bottom: 10px; max-width: calc(100vw - 20px); }
}
