/* ============================================================================
   styles.css — A Kingdom Made for Her
   Design tokens first, then components in page order.
   ========================================================================== */

/* ── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  /* paper */
  --paper:        #F3EEE4;   /* warm archival ivory */
  --paper-deep:   #E9E2D4;   /* slightly darker parchment */
  --paper-edge:   #DED6C4;   /* frame fills, plate grounds */

  /* ink */
  --ink:          #23261F;   /* charcoal green-black — primary text */
  --graphite:     #6E6B62;   /* softened grey-black — secondary text */
  --graphite-lt:  #918D83;   /* tertiary / captions */

  /* colour */
  --forest:       #243D35;   /* muted deep green */
  --forest-deep:  #16241D;   /* full-bleed dark chapters */
  --oxblood:      #6F2F2B;   /* restrained dark red-brown */
  --brass:        #A4854D;   /* muted antique gold — used sparingly */
  --brass-lt:     #C3A87A;
  --dried:        #8A6A4F;   /* dried-flower brown */

  /* structure */
  --rule:         rgba(35, 38, 31, .12);
  --rule-strong:  rgba(35, 38, 31, .22);
  --shadow-paper: 0 10px 30px rgba(35, 38, 31, .11);
  --shadow-lift:  0 18px 44px rgba(35, 38, 31, .17);

  /* type */
  --serif:  'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --display:'Cormorant', Georgia, serif;
  --hand:   'Italianno', cursive;
  --sans:   'Inter', system-ui, -apple-system, sans-serif;

  /* rhythm */
  --measure: 62ch;           /* 55–70 char target for body copy */
  --gutter: clamp(1.5rem, 4vw, 4rem);
  --ease: cubic-bezier(.32, .72, .29, 1);

  font-size: 19px;
}
@media (max-width: 900px) { :root { font-size: 18px; } }
@media (max-width: 480px) { :root { font-size: 17px; } }

/* ── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.66;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; }
a { color: inherit; }
::selection { background: var(--forest); color: var(--paper); }
::-webkit-scrollbar { width: 0; }

/* Focus: visible but elegant. */
:focus-visible {
  outline: 1.5px solid var(--forest);
  outline-offset: 4px;
  border-radius: 1px;
}

/* Subtle paper variation — two very low-contrast washes, no repeating tile. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 18% 12%, rgba(213,201,178,.30), transparent 62%),
    radial-gradient(ellipse 60% 50% at 86% 78%, rgba(206,193,168,.26), transparent 60%);
}
/* Restrained grain. */
#grain {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none; opacity: .34; mix-blend-mode: multiply;
}

/* ── TYPE PRIMITIVES ─────────────────────────────────────────────────────── */
.folio {
  font-family: var(--display);
  font-size: .82rem;
  letter-spacing: .16em;
  color: var(--brass);
  font-variant-numeric: oldstyle-nums;
}
.eyebrow {
  font-family: var(--sans);
  font-size: .64rem;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--graphite-lt);
}
/* Chapter titles keep their capitals — sentence case, not shouted. */
.title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.16;
  letter-spacing: .005em;
  color: var(--ink);
}
.hand { font-family: var(--hand); color: var(--graphite); line-height: 1.18; }

.prose { max-width: var(--measure); }
.prose p { margin-bottom: 1.35em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }

/* Ornament */
.orn { display: flex; align-items: center; justify-content: center; gap: .55rem; }
.orn i { height: 1px; background: var(--brass); opacity: .5; flex: 1; max-width: 42px; }
.orn svg { flex-shrink: 0; color: var(--brass); }

/* ── PROGRESSIVE ENHANCEMENT ─────────────────────────────────────────────
   Elements animated open by JS start visible. Only once JS is running do we
   hide them, so a blocked CDN can never leave the page blank. */
.js-ready .anim-in { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .js-ready .anim-in { opacity: 1 !important; transform: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   COVER
   ══════════════════════════════════════════════════════════════════════════ */
.cover {
  display: grid;
  grid-template-columns: 1.04fr 1fr;
  min-height: 100svh;              /* fills viewport — no residual band */
  position: relative;
  background: var(--paper);
}
.cover__left {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: clamp(3rem, 7vh, 6rem) var(--gutter);
}
.cover__mark { margin-bottom: 2rem; color: var(--forest); }
.cover__title { margin: 0; }
.cover__title-top {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--forest);
  line-height: 1.04;
}
.cover__title-bottom {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.45rem, 3.1vw, 2.35rem);
  color: var(--forest);
  margin-top: .1em;
}
.cover__orn { margin: 1.4rem auto 1.7rem; max-width: 168px; }
.cover__blurb {
  font-size: 1.02rem; line-height: 1.72;
  color: var(--ink); max-width: 30ch;
}
.cover__star { margin-top: 1.6rem; color: var(--brass); }

/* CTA — an ink rule that draws itself away, like a page lifting. */
.cover__cta {
  --pad: 1.05rem 2.6rem;
  position: relative;
  margin-top: 2.2rem;
  padding: var(--pad);
  cursor: pointer;
  font-family: var(--display);
  font-size: .76rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--forest);
  border: 1px solid var(--forest);
  transition: color .45s var(--ease), background .45s var(--ease);
  overflow: hidden;
}
.cover__cta::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--paper);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .5s var(--ease);
  z-index: 0;
}
.cover__cta > span { position: relative; z-index: 1; }
.cover__cta:hover { color: var(--forest); }
.cover__cta:hover::after { transform: scaleY(1); }
@media (prefers-reduced-motion: reduce) {
  .cover__cta::after { transition: none; }
}

/* Right panel — the photographic field, cut by an organic torn edge. */
/* The photographic field. Deep and desaturated so the pale paper objects
   read against it — not a flat brown block, not a washed-out panel. */
.cover__right {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 78% 66% at 44% 36%, rgba(120,112,92,.30), transparent 68%),
    linear-gradient(158deg, #2A2C26 0%, #34352C 44%, #3F3B30 100%);
  -webkit-clip-path: url(#tear-clip);
  clip-path: url(#tear-clip);
}
.cover__right::after {   /* fibre shading along the tear */
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 9%;
  background: linear-gradient(90deg, rgba(35,38,31,.16), transparent);
  pointer-events: none;
}

.cover__photo { position: absolute; inset: 0; }
.cover__photo .frame { height: 100%; }
/* .cover__aside is deliberately unpositioned so its children resolve against
   .cover__right — keeps the paper objects anchored to the panel, not the flow. */

/* Botanicals — two deliberate drawings, not a scatter. Asymmetric by design. */
.cover__botanical {
  position: absolute; pointer-events: none;
  color: var(--dried); display: block;
}
.cover__botanical svg { width: 100%; height: auto; }
.cover__botanical--stem  { left: 1.2rem; top: 8%;  width: clamp(74px, 8vw, 108px); opacity: .30; }
.cover__botanical--sprig { left: 2.4rem; bottom: 7%; width: clamp(56px, 6vw, 86px); opacity: .22;
  transform: rotate(6deg); }

/* Paper objects on the right */
.cover__note {
  position: absolute; top: 7%; right: 5.5%; width: clamp(130px, 13vw, 168px);
  z-index: 3; background: var(--paper);
  padding: 1.5rem 1.15rem;
  box-shadow: var(--shadow-lift);
  transform: rotate(1.5deg);
  /* uneven deckled edge */
  clip-path: polygon(0 1.6%, 46% .2%, 100% 1.2%, 98.8% 52%, 99.4% 99%, 52% 100%, .8% 98.4%, 1.4% 48%);
}
.cover__note .hand { font-size: 1.42rem; color: var(--ink); text-align: left; }
.cover__note::before {   /* restrained tape */
  content: '';
  position: absolute; top: -10px; left: 50%;
  transform: translateX(-50%) rotate(-2.5deg);
  width: 58px; height: 21px;
  background: rgba(196,172,120,.30);
  border-left: 1px solid rgba(164,133,77,.2);
  border-right: 1px solid rgba(164,133,77,.2);
}
.cover__frame {
  position: absolute; bottom: 13%; right: 6.5%; width: clamp(92px, 9vw, 116px);
  z-index: 3; background: var(--paper-deep); padding: .6rem;
  box-shadow: var(--shadow-lift); transform: rotate(-1.6deg);
}
.cover__frame-inner {
  border: 1px solid var(--rule-strong);
  padding: .95rem .45rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  color: var(--graphite);
}
.cover__snapshot {
  position: absolute; bottom: 21%; right: 23%; width: clamp(88px, 9vw, 112px);
  z-index: 2; background: var(--paper-deep); padding: .38rem;
  box-shadow: var(--shadow-lift); transform: rotate(2.2deg);
}

/* ══════════════════════════════════════════════════════════════════════════
   PLACEHOLDER FRAMES
   A deliberate proofing frame: corner crop marks, a discreet label, and the
   exact dimensions the final image will occupy.
   ══════════════════════════════════════════════════════════════════════════ */
.frame {
  position: relative;
  width: 100%;
  background: var(--paper-edge);
  overflow: hidden;
}
.frame--empty {
  background:
    linear-gradient(var(--paper-edge), var(--paper-edge)) padding-box,
    repeating-linear-gradient(   /* whisper-fine proofing hatch */
      45deg, transparent 0 11px, rgba(35,38,31,.028) 11px 12px);
}
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame__label {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .55rem;
  font-family: var(--sans);
  font-size: .58rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--graphite-lt);
  text-align: center; padding: 1rem;
}
.frame__label::before {           /* crop-mark bracket */
  content: '';
  position: absolute; inset: 10px;
  border: 1px solid rgba(35,38,31,.13);
  -webkit-mask:
    linear-gradient(#000 0 0) top left    / 16px 16px no-repeat,
    linear-gradient(#000 0 0) top right   / 16px 16px no-repeat,
    linear-gradient(#000 0 0) bottom left / 16px 16px no-repeat,
    linear-gradient(#000 0 0) bottom right/ 16px 16px no-repeat;
          mask:
    linear-gradient(#000 0 0) top left    / 16px 16px no-repeat,
    linear-gradient(#000 0 0) top right   / 16px 16px no-repeat,
    linear-gradient(#000 0 0) bottom left / 16px 16px no-repeat,
    linear-gradient(#000 0 0) bottom right/ 16px 16px no-repeat;
}
/* On the dark cover panel the proofing frame inverts. */
.cover__right .frame,
.cover__right .frame--empty { background: transparent; }
.cover__right .frame--empty {
  background-image: repeating-linear-gradient(
    45deg, transparent 0 11px, rgba(243,238,228,.035) 11px 12px);
}
.cover__right .frame__label { color: rgba(243,238,228,.58); }
.cover__right .frame__label::before { border-color: rgba(243,238,228,.26); }
/* The taped snapshot sits on the dark panel but is itself paper. */
.cover__snapshot .frame--empty {
  background: var(--paper-edge);
  background-image: repeating-linear-gradient(
    45deg, transparent 0 11px, rgba(35,38,31,.03) 11px 12px);
}
.cover__snapshot .frame__label { color: var(--graphite-lt); }
.cover__snapshot .frame__label::before { border-color: rgba(35,38,31,.14); }

/* ══════════════════════════════════════════════════════════════════════════
   CHAPTER INDEX — a book's contents page, not a card grid
   ══════════════════════════════════════════════════════════════════════════ */
.contents {
  max-width: 1180px; margin: 0 auto;
  padding: clamp(4rem, 9vh, 7rem) var(--gutter) clamp(2rem, 5vh, 4rem);
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: clamp(1.2rem, 2.4vw, 2.6rem);
}
.chapter-link {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; cursor: pointer;
  padding: 1.4rem .6rem 1.2rem;
  min-height: 44px;
  position: relative;
  transition: transform .5s var(--ease);
}
/* Hairline separators instead of boxes */
.chapter-link + .chapter-link::before {
  content: '';
  position: absolute; left: calc(-1 * clamp(.6rem, 1.2vw, 1.3rem));
  top: 12%; bottom: 12%; width: 1px; background: var(--rule);
}
.chapter-link__folio { display: block; margin-bottom: .8rem; transition: color .4s var(--ease); }
/* These are spans so the whole card can be one button — force block flow. */
.chapter-link__body,
.chapter-link__title,
.chapter-link__blurb,
.chapter-link__rule { display: block; }
.chapter-link__title {
  font-family: var(--display); font-weight: 400;
  font-size: 1.12rem; line-height: 1.28;
  letter-spacing: .045em;
  color: var(--ink);
  margin-bottom: .55rem;
  transition: transform .5s var(--ease);
}
/* the ink rule that appears on hover */
.chapter-link__rule {
  width: 0; height: 1px; background: var(--oxblood);
  margin: 0 auto .8rem;
  transition: width .55s var(--ease);
}
.chapter-link__blurb {
  font-size: .9rem; line-height: 1.68; color: var(--graphite);
  max-width: 26ch; margin-bottom: 1.5rem; text-wrap: pretty;
}
.chapter-link__art {
  width: 100%; flex: 1; min-height: 190px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.2rem; position: relative;
}
.chapter-link__cue {
  font-family: var(--hand); font-size: 1.32rem; color: var(--graphite);
  display: flex; align-items: center; gap: .5rem;
  transition: color .4s var(--ease);
}
.chapter-link__cue i {
  display: block; width: 30px; height: 1px; background: currentColor;
  opacity: .55; position: relative; transition: width .45s var(--ease);
}
.chapter-link__cue i::after {
  content: ''; position: absolute; right: 0; top: -2px;
  width: 5px; height: 5px;
  border-top: 1px solid currentColor; border-right: 1px solid currentColor;
  transform: rotate(45deg);
}
.chapter-link:hover .chapter-link__title,
.chapter-link:focus-visible .chapter-link__title { transform: translateY(-3px); }
.chapter-link:hover .chapter-link__rule,
.chapter-link:focus-visible .chapter-link__rule { width: 26px; }
.chapter-link:hover .chapter-link__cue,
.chapter-link:focus-visible .chapter-link__cue { color: var(--forest); }
.chapter-link:hover .chapter-link__cue i { width: 40px; }
.chapter-link:hover .chapter-link__folio { color: var(--oxblood); }

/* ══════════════════════════════════════════════════════════════════════════
   HOMEPAGE FOOTER
   ══════════════════════════════════════════════════════════════════════════ */
.colophon {
  text-align: center;
  padding: clamp(2rem, 5vh, 3.4rem) var(--gutter) clamp(3rem, 6vh, 4rem);
}
.colophon p { font-size: 1rem; line-height: 1.78; color: var(--graphite); }
.colophon__sig {
  font-family: var(--hand); font-size: 1.72rem; color: var(--ink);
  margin-top: .7rem; display: block;
}
.colophon__more {
  margin-top: 2.4rem;
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: .4rem 2rem;
}
.colophon__more button {
  cursor: pointer;
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--graphite);
  padding: .55rem .2rem; min-height: 44px;
  position: relative; transition: color .3s var(--ease);
}
.colophon__more button::after {
  content: ''; position: absolute; left: .2rem; right: .2rem; bottom: .35rem;
  height: 1px; background: var(--rule-strong);
  transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.colophon__more button:hover { color: var(--forest); }
.colophon__more button:hover::after { transform: scaleX(1); }
/* Selector matches `.colophon p` specificity so the credit stays small. */
.colophon p.colophon__credit {
  margin-top: 2.6rem;
  font-family: var(--sans); font-size: .62rem; line-height: 1.6;
  letter-spacing: .1em; color: var(--graphite-lt);
}
.colophon__credit a { text-decoration: underline; text-underline-offset: 2px; }

/* ══════════════════════════════════════════════════════════════════════════
   CHAPTER OVERLAY
   Opaque from the first frame — homepage must never show through.
   ══════════════════════════════════════════════════════════════════════════ */
.reader {
  position: fixed; inset: 0; z-index: 600;
  background: var(--paper);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: none;
}
.reader[data-open='true'] { display: block; }
.reader__bar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: .85rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 93%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.reader__back,
.reader__nav button {
  cursor: pointer; min-height: 44px;
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--graphite);
  display: inline-flex; align-items: center; gap: .65rem;
  transition: color .3s var(--ease);
}
.reader__back:hover, .reader__nav button:hover:not(:disabled) { color: var(--forest); }
.reader__nav { display: flex; gap: 1.5rem; }
.reader__nav button:disabled { opacity: .28; cursor: default; }
.reader__back i {
  width: 24px; height: 1px; background: currentColor; position: relative;
  transition: width .4s var(--ease);
}
.reader__back i::after {
  content: ''; position: absolute; left: 0; top: -2px; width: 5px; height: 5px;
  border-bottom: 1px solid currentColor; border-left: 1px solid currentColor;
  transform: rotate(45deg);
}
.reader__back:hover i { width: 32px; }
.reader__label {
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--forest);
  text-align: center;
}
.reader__head { text-align: center; padding: clamp(3rem, 8vh, 5.5rem) var(--gutter) 0; }
.reader__head .folio { display: block; margin-bottom: .9rem; }
.reader__head .orn { max-width: 150px; margin: 1.3rem auto 0; }
.reader__body {
  padding: clamp(2.5rem, 6vh, 4rem) var(--gutter) clamp(5rem, 12vh, 9rem);
  max-width: 1180px; margin: 0 auto;
}

/* ── I · LETTER ──────────────────────────────────────────────────────────── */
.letter { display: grid; grid-template-columns: 1fr .88fr; gap: clamp(2.5rem, 6vw, 6rem); align-items: center; }
.letter__col { position: relative; max-width: 46ch; margin: 0 auto; }
.letter__col p { font-size: 1.02rem; line-height: 1.94; margin-bottom: 1.3em; text-wrap: pretty; }
.letter__folio {
  position: absolute; left: -4.6rem; top: .2rem;
  display: flex; flex-direction: column; gap: .1rem;
  font-family: var(--display); font-size: .8rem; letter-spacing: .14em;
  color: var(--graphite-lt); text-align: center;
}
.letter__sign { margin-top: 2rem; }
.letter__sign span { display: block; font-size: 1.02rem; }
.letter__initial {
  font-family: var(--hand); font-size: 2.7rem; color: var(--ink);
  line-height: 1; margin-top: .2rem;
}
.letter__plate { position: relative; }
.letter__seal { position: absolute; top: 5%; left: -28px; z-index: 4; }
.letter__note {
  position: absolute; bottom: 7%; left: 7%; width: clamp(150px, 15vw, 180px); z-index: 4;
  background: var(--paper); padding: 1.35rem 1.1rem;
  box-shadow: var(--shadow-lift); transform: rotate(-1.9deg);
  clip-path: polygon(0 1.8%, 48% .3%, 100% 1.4%, 98.6% 54%, 99.2% 98.8%, 50% 100%, .9% 98%, 1.6% 46%);
}
.letter__note .hand { font-size: 1.34rem; color: var(--ink); }

/* ── II · ARCHIVE ────────────────────────────────────────────────────────── */
.archive { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(2rem, 4vw, 3.4rem); align-items: start; }
.archive__feature { position: relative; }
.archive__caption { margin-top: 1.05rem; text-align: center; }
.archive__caption em { font-style: italic; font-size: .98rem; color: var(--graphite); display: block; }
.archive__caption .hand { font-size: 1.24rem; display: block; margin-top: .1rem; }
.archive__details {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: clamp(1rem, 2vw, 1.8rem); align-content: start;
}
.archive__note {
  grid-column: 1 / -1; text-align: right; margin-bottom: -.4rem;
}
.archive__note .hand { font-size: 1.3rem; }
/* Editorial asymmetry: nudge alternate plates so the grid never reads uniform */
.archive__details .plate:nth-child(3) { transform: translateY(1.6rem); }
.archive__details .plate:nth-child(5) { transform: translateY(-1rem); }
.plate { cursor: pointer; transition: transform .5s var(--ease); }
.plate:hover { transform: translateY(-4px); }
.archive__details .plate:nth-child(3):hover { transform: translateY(1.2rem); }
.archive__details .plate:nth-child(5):hover { transform: translateY(-1.4rem); }
.plate__meta {
  margin-top: .65rem;
  display: flex; align-items: baseline; gap: .7rem;
}
.plate__meta .folio { font-size: .7rem; flex-shrink: 0; }
.plate__meta span:last-child {
  font-family: var(--serif); font-style: italic;
  font-size: .88rem; color: var(--graphite); line-height: 1.4;
}
.archive__add { text-align: center; margin-top: clamp(2.5rem, 6vh, 4rem); }
.archive__add button {
  cursor: pointer; min-height: 44px;
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--graphite);
  padding: .5rem .2rem; border-bottom: 1px solid var(--rule-strong);
  transition: color .3s var(--ease);
}
.archive__add button:hover { color: var(--forest); }
.archive__extra {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.6rem; margin-top: 2.4rem;
}

/* ── III · MAP ───────────────────────────────────────────────────────────── */
.map__svg { width: 100%; height: auto; }
.map-pin { cursor: pointer; }
.map-pin__hit { fill: transparent; }         /* large invisible tap target */
.map-pin__dot { fill: var(--oxblood); transition: r .35s var(--ease); }
.map-pin__halo { fill: none; stroke: var(--oxblood); stroke-width: .8; opacity: 0; transition: opacity .35s; }
.map-pin:hover .map-pin__dot,
.map-pin[aria-pressed='true'] .map-pin__dot { r: 5; }
.map-pin:hover .map-pin__halo,
.map-pin:focus-visible .map-pin__halo,
.map-pin[aria-pressed='true'] .map-pin__halo { opacity: .5; }
.map-pin__label { font-family: var(--hand); font-size: 21px; fill: var(--oxblood); }
.map-pin__sub { font-family: var(--serif); font-size: 12px; fill: var(--graphite-lt); }
.map__foot {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 3rem; margin-top: 1.8rem;
}
.map__corner { font-family: var(--hand); font-size: 1.32rem; line-height: 1.34; flex-shrink: 0; }
.map__read { max-width: 46ch; text-align: right; min-height: 92px; }
.map__read h3 {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 1.42rem; color: var(--forest); margin-bottom: .45rem;
}
.map__read p { font-size: .96rem; line-height: 1.76; color: var(--graphite); text-wrap: pretty; }
.map__read--idle { font-style: italic; color: var(--graphite-lt); }

/* ── IV · CONSTELLATION ──────────────────────────────────────────────────── */
.constellation {
  background: var(--forest-deep);
  padding: clamp(2rem, 5vw, 3.4rem);
  border: 1px solid var(--rule);
}
.constellation__stage {
  display: grid; grid-template-columns: 1.5fr .8fr;
  gap: clamp(2rem, 4vw, 3rem); align-items: center;
}
.constellation__field { position: relative; }
.constellation__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.star { cursor: pointer; }
.star__hit { fill: transparent; }
.star__dot { fill: var(--brass-lt); transition: r .35s var(--ease), fill .35s; }
.star__ring { fill: none; stroke: var(--brass); stroke-width: .7; opacity: 0; transition: opacity .35s; }
.star:hover .star__dot, .star[aria-pressed='true'] .star__dot { r: 4.6; fill: #F3E8CC; }
.star:hover .star__ring, .star:focus-visible .star__ring,
.star[aria-pressed='true'] .star__ring { opacity: .55; }
.star__name {
  font-family: var(--serif); font-size: 16px;
  fill: rgba(243,238,228,.9); letter-spacing: .04em;
}
/* parchment fragment holding the note */
.constellation__card {
  background: var(--paper); padding: 2rem 1.6rem;
  box-shadow: 0 20px 46px rgba(0,0,0,.42);
  transform: rotate(1.1deg); position: relative;
  clip-path: polygon(0 1.4%, 47% .2%, 100% 1%, 98.8% 50%, 99.4% 99%, 51% 100%, .8% 98.6%, 1.5% 47%);
}
.constellation__card::before {
  content: ''; position: absolute; top: -11px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 62px; height: 22px;
  background: rgba(196,172,120,.32);
  border-left: 1px solid rgba(164,133,77,.22);
  border-right: 1px solid rgba(164,133,77,.22);
}
.constellation__card h3 {
  font-family: var(--display); font-weight: 400;
  font-size: .76rem; letter-spacing: .2em; text-transform: uppercase;
  text-align: center; color: var(--ink); margin-bottom: 1rem;
}
.constellation__card p { font-size: .96rem; line-height: 1.8; color: var(--graphite); text-wrap: pretty; }
.constellation__hint {
  text-align: center; margin-top: 2rem;
  font-style: italic; font-size: .94rem; color: rgba(243,238,228,.44);
}

/* ── V · FIREHEART ───────────────────────────────────────────────────────── */
.fireheart { display: grid; grid-template-columns: 1fr 1.04fr; gap: clamp(2.5rem, 5vw, 5rem); align-items: center; }
.fireheart__text p { font-size: 1.04rem; line-height: 1.9; margin-bottom: 1.25em; text-wrap: pretty; }
.fireheart__text p.is-emphasis { font-style: italic; color: var(--forest); }
.fireheart__quiet { margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.fireheart__quiet .hand { font-size: 1.5rem; }
.fireheart__mark { margin-top: 2rem; color: var(--graphite); opacity: .55; }
.fireheart__art { position: relative; min-height: 520px; overflow: hidden; background: var(--paper-deep); }
.fireheart__art canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fireheart__note { position: absolute; top: 8%; right: 5%; width: 148px; text-align: right; z-index: 4; }
.fireheart__note .hand { font-size: 1.34rem; color: var(--ink); }
.fireheart__crest { position: absolute; top: 6%; left: 6%; color: var(--brass); opacity: .6; z-index: 4; }

/* ── LIBRARY ─────────────────────────────────────────────────────────────── */
.library { text-align: center; }
.library__shelf {
  display: flex; align-items: flex-end; justify-content: center;
  gap: .5rem; flex-wrap: wrap; margin-top: 2.4rem;
}
.book {
  width: 86px; border-radius: 1px 3px 3px 1px;
  padding: 1.4rem .6rem;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  box-shadow: 2px 5px 15px rgba(0,0,0,.3);
  transition: transform .5s var(--ease);
  position: relative; overflow: hidden;
}
.book:hover { transform: translateY(-12px); }
.book::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.13), transparent 22%, transparent 78%, rgba(0,0,0,.3));
}
.book__title {
  font-family: var(--display); font-size: .8rem; letter-spacing: .05em;
  text-transform: uppercase; color: rgba(243,238,228,.95);
  line-height: 1.34; text-align: center; position: relative; z-index: 2;
}
.book__author {
  font-family: var(--display); font-size: .58rem; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(243,238,228,.6);
  line-height: 1.4; position: relative; z-index: 2;
}
.book__mark { color: rgba(196,172,120,.85); position: relative; z-index: 2; }
.library__plank {
  height: 9px; max-width: 820px; margin: 0 auto;
  background: linear-gradient(180deg, #6B5B44, #4A3E2E);
  box-shadow: 0 8px 18px rgba(0,0,0,.22);
}
.library__foot { margin-top: 2.2rem; }
.library__foot .hand { font-size: 1.38rem; }

/* ── MARGINALIA + NOTES (shared card rhythm) ─────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.6rem, 3.4vw, 2.6rem); }
.card {
  position: relative; text-align: center;
  background: var(--paper-deep);
  padding: 2.6rem 1.7rem 2.1rem;
  box-shadow: var(--shadow-paper);
}
.card:nth-child(1) { transform: rotate(-1.3deg); }
.card:nth-child(2) { transform: rotate(.8deg); background: #E6DDC7; }
.card:nth-child(3) { transform: rotate(-.6deg); }
.card::before {
  content: ''; position: absolute; top: -12px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 66px; height: 24px;
  background: rgba(196,172,120,.3);
  border-left: 1px solid rgba(164,133,77,.22);
  border-right: 1px solid rgba(164,133,77,.22);
}
.card__quote {
  font-family: var(--serif); font-style: italic;
  font-size: 1.02rem; line-height: 1.72; color: var(--ink); margin-bottom: .9rem;
}
.card__hand { font-family: var(--hand); font-size: 1.62rem; line-height: 1.36; color: var(--ink); margin-bottom: 1rem; }
.card__attr {
  font-family: var(--display); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--graphite-lt);
}
.card__icon { margin-top: 1.3rem; color: var(--graphite); opacity: .45; display: flex; justify-content: center; }
.cards__foot { margin-top: 2.6rem; text-align: center; }
.cards__foot .hand { font-size: 1.34rem; }
.cards__foot p { font-size: 1rem; line-height: 1.8; color: var(--ink); }

/* ── SOUNDTRACK ──────────────────────────────────────────────────────────── */
.soundtrack { display: grid; grid-template-columns: 1.02fr 1fr; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
.soundtrack__card {
  background: var(--paper-deep); padding: 2.4rem 2.2rem;
  box-shadow: var(--shadow-paper); transform: rotate(-.7deg); max-width: 430px;
}
.soundtrack__list { list-style: none; counter-reset: track; }
.soundtrack__list li {
  font-family: var(--hand); font-size: 1.46rem; color: var(--graphite);
  line-height: 1.76; counter-increment: track; display: flex; gap: .6rem;
}
.soundtrack__list li::before { content: counter(track) "."; flex-shrink: 0; }
.soundtrack__more {
  font-family: var(--hand); font-size: 1.32rem; color: var(--graphite-lt);
  text-align: right; display: block; margin-top: 1rem;
}
.soundtrack__art {
  position: relative; min-height: 440px; overflow: hidden;
  background: linear-gradient(155deg, #3B3529, #524936 55%, #6A5C42);
  display: flex; align-items: center; justify-content: center;
}
.soundtrack__note { position: absolute; left: 6%; bottom: 8%; width: 158px; z-index: 4; }
.soundtrack__note .hand { font-size: 1.32rem; color: rgba(243,238,228,.85); }

/* ── LITTLE THINGS ───────────────────────────────────────────────────────── */
.little {
  display: grid; grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--rule); border-left: 1px solid var(--rule);
}
.little__cell {
  border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 2rem 1rem 1.7rem;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 1rem;
  transition: background .45s var(--ease);
}
.little__cell:hover { background: var(--paper-deep); }
.little__cell svg { color: var(--graphite); opacity: .8; }
.little__cell p { font-size: .9rem; line-height: 1.58; color: var(--graphite); text-wrap: pretty; }

/* ── EPILOGUE ────────────────────────────────────────────────────────────── */
.epilogue { display: grid; grid-template-columns: 1.02fr 1fr; gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
.epilogue__text { text-align: center; }
.epilogue__text p { font-size: 1.02rem; line-height: 1.9; margin-bottom: 1.3em; }
.epilogue__sign span { display: block; font-size: 1.02rem; }
.epilogue__initial { font-family: var(--hand); font-size: 2.8rem; color: var(--ink); line-height: 1; margin-top: .2rem; }
.epilogue__date {
  font-family: var(--display); font-size: .74rem; letter-spacing: .18em;
  color: var(--graphite-lt); margin-top: 1.3rem; display: block;
}
.epilogue__restart {
  margin-top: 2.6rem; cursor: pointer; min-height: 44px;
  font-family: var(--display); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--forest);
  padding: .5rem .2rem; border-bottom: 1px solid var(--rule-strong);
}
.epilogue__art { position: relative; display: flex; align-items: center; justify-content: center; min-height: 460px; }
.epilogue__note { position: absolute; right: 2%; bottom: 8%; width: 130px; text-align: right; z-index: 4; }
.epilogue__note .hand { font-size: 1.36rem; }

/* ══════════════════════════════════════════════════════════════════════════
   LIGHTBOX — warm cream, never a black ecommerce modal
   ══════════════════════════════════════════════════════════════════════════ */
.lightbox {
  position: fixed; inset: 0; z-index: 800;
  background: color-mix(in srgb, var(--paper) 96%, #000);
  display: none;
  align-items: center; justify-content: center; flex-direction: column;
  gap: 1.6rem; padding: clamp(3rem, 8vh, 5rem) var(--gutter);
  overscroll-behavior: contain;
}
.lightbox[data-open='true'] { display: flex; }
.lightbox__stage {
  max-width: min(78vw, 900px); max-height: 62vh;
  width: 100%; display: flex; align-items: center; justify-content: center;
}
.lightbox__stage .frame { max-height: 62vh; }
.lightbox__stage img { max-height: 62vh; width: auto; object-fit: contain; }
.lightbox__meta { text-align: center; max-width: 52ch; }
.lightbox__meta h3 {
  font-family: var(--display); font-weight: 400;
  font-size: 1.16rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); margin-bottom: .45rem;
}
.lightbox__meta .dl {
  font-family: var(--sans); font-size: .64rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--graphite-lt); margin-bottom: .8rem;
}
.lightbox__meta p { font-style: italic; font-size: .98rem; color: var(--graphite); line-height: 1.72; }
.lightbox__controls { display: flex; gap: 2rem; align-items: center; }
.lightbox__controls button, .lightbox__close {
  cursor: pointer; min-height: 44px; min-width: 44px;
  font-family: var(--display); font-size: .7rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--graphite);
  transition: color .3s var(--ease);
}
.lightbox__controls button:hover, .lightbox__close:hover { color: var(--forest); }
.lightbox__controls button:disabled { opacity: .28; cursor: default; }
.lightbox__close { position: absolute; top: 1.5rem; right: var(--gutter); }

/* ══════════════════════════════════════════════════════════════════════════
   SOUND — discreet, never reads as a sixth chapter
   ══════════════════════════════════════════════════════════════════════════ */
.sound {
  position: fixed; bottom: 1.3rem; left: 1.3rem; z-index: 700;
  cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .5rem .7rem .5rem .2rem;
  font-family: var(--sans); font-size: .62rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--graphite-lt);
  transition: color .3s var(--ease);
}
.sound:hover { color: var(--forest); }
.sound__icon { width: 13px; height: 13px; flex-shrink: 0; }
.sound__wave { opacity: 0; transition: opacity .3s; }
.sound[aria-pressed='true'] .sound__wave { opacity: 1; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .contents { grid-template-columns: repeat(3, 1fr); row-gap: 2.6rem; }
  .chapter-link:nth-child(3n+1)::before { display: none; }
}

/* Tablet & below: unwind the spreads. */
@media (max-width: 900px) {
  .cover { grid-template-columns: 1fr; min-height: auto; }
  /* Cover (parchment) first, photographic field beneath it. */
  .cover__left { order: 1; padding: clamp(4rem, 10vh, 6rem) var(--gutter) clamp(2.5rem, 6vh, 4rem); }
  .cover__right {
    order: 2; min-height: 58vh;
    /* simplified horizontal tear for narrow screens */
    -webkit-clip-path: url(#tear-clip-h);
            clip-path: url(#tear-clip-h);
  }
  .cover__right::after { left: 0; top: 0; right: 0; bottom: auto; width: auto; height: 7%;
    background: linear-gradient(180deg, rgba(35,38,31,.14), transparent); }
  .cover__note, .cover__frame, .cover__snapshot { display: none; }

  .letter, .archive, .constellation__stage, .fireheart,
  .soundtrack, .epilogue { grid-template-columns: 1fr; gap: 2.6rem; }
  .letter__folio {
    position: static; flex-direction: row; gap: .55rem;
    justify-content: center; margin-bottom: 1.4rem;
  }
  /* annotations rejoin the normal flow rather than overlapping */
  .letter__seal, .letter__note, .archive__note,
  .fireheart__note, .fireheart__crest,
  .soundtrack__note, .epilogue__note {
    position: static; width: auto; transform: none;
    margin: 1.4rem auto 0; text-align: center;
    box-shadow: none; clip-path: none;
  }
  .letter__note::before, .cover__note::before { display: none; }
  .archive__details .plate:nth-child(n) { transform: none !important; }
  .little { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .map__foot { flex-direction: column; gap: 1.4rem; }
  .map__read { text-align: left; max-width: none; }
  .fireheart__art { min-height: 420px; }
  .reader__nav { display: none; }
  .reader__label { display: none; }
}

/* Phone: contents become a vertical list. */
@media (max-width: 700px) {
  .contents { grid-template-columns: 1fr; gap: 0; padding-top: clamp(3rem, 7vh, 4rem); }
  .chapter-link {
    flex-direction: row; align-items: center; text-align: left;
    gap: 1.1rem; padding: 1.4rem .2rem;
    border-bottom: 1px solid var(--rule);
  }
  .chapter-link + .chapter-link::before { display: none; }
  .chapter-link__folio { margin: 0; min-width: 2.2rem; }
  .chapter-link__art { display: none; }
  .chapter-link__body { flex: 1; }
  .chapter-link__title { margin-bottom: .3rem; }
  .chapter-link__blurb { margin-bottom: .5rem; max-width: none; font-size: .88rem; }
  .chapter-link__rule { margin: 0 0 .6rem; }
  .chapter-link__cue { font-size: 1.16rem; }
  .library__shelf { gap: .35rem; }
  .book { width: 68px; padding: 1rem .45rem; }
  .colophon__more { gap: .2rem 1.2rem; }
}

@media (max-width: 380px) {
  .book { width: 60px; }
  .little { grid-template-columns: 1fr; }
}

/* ── MOTION ──────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── PRINT ───────────────────────────────────────────────────────────────── */
@media print {
  .sound, .reader__bar, .colophon__more { display: none; }
  body::before, #grain { display: none; }
}
