/* ============================================================
   Janelle Gabay Books — design system
   One flat base color (--ink), one accent per context (--accent).
   Type: Playfair Display (display serif) + Inter (text/UI).
   No gradients, no glassmorphism anywhere.
   ============================================================ */

:root {
  --ink: #0f1626;            /* flat page base */
  --ink-2: #0b111d;          /* flat panel shade */
  --ink-3: #151d30;          /* flat raised shade */
  --cream: #f4eddf;
  --cream-dim: rgba(244, 237, 223, 0.7);
  --cream-faint: rgba(244, 237, 223, 0.45);
  --line: rgba(244, 237, 223, 0.14);
  --accent: #e0474c;         /* Stanton scarlet (site default) */
  --accent-ink: #0f1626;     /* text color on accent fills */

  --font-display: "Playfair Display", "Georgia", serif;
  --font-body: "Inter", -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;

  --w-page: 1140px;
  --w-prose: 46rem;
  --space-section: clamp(6rem, 14vh, 10rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Per-book accents (set on <body>) */
body.theme-stanton   { --accent: #e0474c; }
body.theme-players   { --accent: #e8792f; }
body.theme-firstborn { --accent: #6fc3d4; }
body.theme-awakened  { --accent: #9dbf5a; }
body.theme-lastchance{ --accent: #e05a33; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- type ---------- */

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--cream);
}

h1 { font-size: clamp(2.9rem, 8vw, 6.2rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h3 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 1.25rem;
}

p { max-width: var(--w-prose); color: var(--cream-dim); }
p + p { margin-top: 1.25em; }

a { color: var(--cream); text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.small { font-size: 0.875rem; color: var(--cream-faint); }

em.title { font-style: italic; }

/* ---------- layout ---------- */

.container { width: min(100% - 3rem, var(--w-page)); margin-inline: auto; }
.section { padding-block: var(--space-section); position: relative; }
.section-head { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.center { text-align: center; }
.center p { margin-inline: auto; }

.hairline { border: 0; border-top: 1px solid var(--line); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 1.75rem;
  border: 1px solid var(--accent);
  color: var(--cream);
  background: transparent;
  transition: background 0.25s var(--ease-out), color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}
.btn:hover { background: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.btn.solid { background: var(--accent); color: var(--accent-ink); }
.btn.solid:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); background: transparent; color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 2.25rem; }

/* ---------- nav ---------- */

.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  background: transparent;
  transition: background 0.35s, border-color 0.35s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled { background: var(--ink-2); border-bottom-color: var(--line); }
.nav-inner {
  width: min(100% - 3rem, 1280px);
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 4.5rem;
}
.nav-brand {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.02em;
  color: var(--cream); text-decoration: none;
}
.nav-brand img { height: 2.2rem; width: auto; }
.nav-links { display: flex; align-items: center; gap: 2rem; list-style: none; }
.nav-links a {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cream-dim); text-decoration: none; padding: 0.5rem 0;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--accent); }

/* books dropdown */
.has-drop { position: relative; }
.has-drop > a::after { content: " ▾"; font-size: 0.65em; }
.drop {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 8px);
  min-width: 17rem;
  background: var(--ink-3);
  border: 1px solid var(--line);
  padding: 0.75rem 0;
  list-style: none;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), visibility 0.25s;
}
.has-drop:hover .drop, .has-drop:focus-within .drop, .has-drop.open .drop {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0);
}
.drop a {
  display: block; padding: 0.6rem 1.4rem;
  font-size: 0.75rem; letter-spacing: 0.12em;
}
.drop .drop-note { color: var(--cream-faint); font-size: 0.65rem; letter-spacing: 0.2em; text-transform: uppercase; padding: 0.5rem 1.4rem 0.25rem; }
.drop hr { margin: 0.5rem 0; }

/* mobile nav */
.nav-toggle {
  display: none; background: none; border: 0; color: var(--cream);
  font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0.4rem;
}
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed; inset: 4.5rem 0 0 0;
    background: var(--ink-2);
    flex-direction: column; justify-content: flex-start; gap: 0;
    padding: 2rem 1.5rem; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { width: 100%; border-bottom: 1px solid var(--line); }
  .nav-links a { display: block; padding: 1.1rem 0; font-size: 0.9rem; }
  .drop {
    position: static; transform: none; opacity: 1; visibility: visible; pointer-events: auto;
    border: 0; background: transparent; padding: 0 0 0.5rem 1rem; display: none;
  }
  .has-drop.open .drop { display: block; }
  /* the desktop centring shift must not follow the menu onto a phone */
  .has-drop:hover .drop, .has-drop:focus-within .drop, .has-drop.open .drop { transform: none; }
  .nav-links { overflow-y: auto; }
}

/* ---------- shared components ---------- */

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
}
.stat {
  background: var(--ink-2);
  padding: 2.5rem 1.5rem; text-align: center;
}
.stat .num {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  line-height: 1; color: var(--accent); display: block;
}
.stat .label {
  margin-top: 0.9rem; display: block;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cream-faint);
}

.quote-card {
  border: 1px solid var(--line);
  background: var(--ink-2);
  padding: 2.5rem;
}
.quote-card blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-style: italic; line-height: 1.5; color: var(--cream);
}
.quote-card cite {
  display: block; margin-top: 1.5rem; font-style: normal;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
}
.quote-card .star { color: var(--accent); letter-spacing: 0.1em; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 2rem; }
.tag {
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--cream-dim);
  border: 1px solid var(--line);
  padding: 0.45rem 0.9rem; white-space: nowrap;
}

/* ---------- footer ---------- */

footer.site-footer { border-top: 1px solid var(--line); background: var(--ink-2); }
.footer-inner { padding: 4.5rem 0 2.5rem; }
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3rem; }
.footer-grid h3 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 1rem; }
.social-links { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.social-links a { text-decoration: none; font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--cream-dim); }
.footer-base {
  margin-top: 3.5rem; padding-top: 1.75rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
  font-size: 0.75rem; color: var(--cream-faint);
}
.footer-base a { color: var(--cream-faint); }

/* ---------- reveal defaults (JS adds motion) ---------- */
.reveal { opacity: 0; }
.no-js .reveal, .reduced-motion .reveal { opacity: 1; }

/* ---------- utility ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

.cover-frame { position: relative; width: min(21rem, 70vw); margin-inline: auto; }
.cover-frame img { width: 100%; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55); }
.cover-frame::after {
  content: ""; position: absolute; inset: -14px;
  border: 1px solid var(--line); pointer-events: none;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink); padding: 0.75rem 1.25rem;
}
.skip-link:focus { left: 0; }

/* past events */
.past-event { opacity: 0.72; }
.past-event:hover { opacity: 1; }
.past-badge {
  display: inline-block; align-self: flex-start;
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cream-faint); border: 1px solid var(--line);
  padding: 0.25rem 0.6rem; margin-bottom: 0.5rem; width: fit-content;
}

/* ============================================================
   Living pages (js/ambient.js): a themed sky behind every page,
   characters who pass by, and a floating "get the book" button.
   ============================================================ */
main, .site-footer { position: relative; z-index: 1; }
.ambient, .ambient-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.ambient { width: 100%; height: 100%; }
.ambient-layer { overflow: hidden; }

/* each book's world tints the whole page, with a fine film grain on top */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.mood-rain   { background: radial-gradient(70% 55% at 10% 0%, rgba(90,120,145,0.22), transparent 70%) fixed, radial-gradient(60% 50% at 100% 100%, rgba(224,71,76,0.10), transparent 70%) fixed, #0c1220; }
body.mood-sun    { background: radial-gradient(60% 50% at 95% 0%, rgba(232,121,47,0.26), transparent 70%) fixed, radial-gradient(60% 50% at 0% 100%, rgba(62,124,89,0.22), transparent 70%) fixed, #16110e; }
body.mood-snow   { background: radial-gradient(60% 50% at 15% 0%, rgba(150,190,255,0.22), transparent 70%) fixed, radial-gradient(60% 60% at 100% 100%, rgba(111,195,212,0.12), transparent 70%) fixed, #0a1324; }
body.mood-fog    { background: radial-gradient(80% 50% at 50% 100%, rgba(110,190,120,0.18), transparent 70%) fixed, radial-gradient(50% 40% at 0% 0%, rgba(60,90,70,0.2), transparent 70%) fixed, #0b1411; }
body.mood-embers { background: radial-gradient(80% 55% at 30% 100%, rgba(255,90,30,0.22), transparent 70%) fixed, radial-gradient(50% 40% at 100% 0%, rgba(80,20,10,0.35), transparent 70%) fixed, #130b0a; }
body.mood-dust   { background: radial-gradient(50% 45% at 0% 100%, rgba(255,190,110,0.14), transparent 70%) fixed, radial-gradient(50% 45% at 100% 0%, rgba(150,110,200,0.10), transparent 70%) fixed, #110f15; }

/* rain: fog along the ground and a distant flash of lightning now and then */
.amb-fog { position: absolute; left: -30%; bottom: -12%; width: 160%; height: 38%; border-radius: 50%; filter: blur(40px);
  background: radial-gradient(50% 50% at 50% 50%, rgba(150,165,190,0.16), transparent 70%); animation: ambFog 34s ease-in-out infinite alternate; }
.amb-fog.f2 { bottom: 10%; height: 26%; animation-duration: 48s; animation-direction: alternate-reverse; opacity: 0.7; }
.amb-fog.green { background: radial-gradient(50% 50% at 50% 50%, rgba(110,200,120,0.2), transparent 70%); }
@keyframes ambFog { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
.amb-flash { position: absolute; inset: 0; background: rgba(200,215,255,0.9); opacity: 0; animation: ambFlash 19s linear infinite 6s; }
@keyframes ambFlash { 0%, 71%, 74%, 77%, 100% { opacity: 0; } 72% { opacity: 0.07; } 75.5% { opacity: 0.1; } }
/* embers: the Pall's smoke gathers along the bottom */
.amb-pall { position: absolute; left: -20%; right: -20%; bottom: -15%; height: 45%; filter: blur(30px);
  background: radial-gradient(40% 60% at 30% 70%, rgba(0,0,0,0.75), transparent 70%), radial-gradient(40% 60% at 75% 80%, rgba(0,0,0,0.7), transparent 70%);
  animation: ambFog 26s ease-in-out infinite alternate; }
/* sun: a warm sky with slowly turning light */
.amb-sun { position: absolute; right: -25vmax; top: -25vmax; width: 60vmax; height: 60vmax; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255,200,120,0.07) 0 6deg, transparent 6deg 18deg); animation: ambSpin 90s linear infinite; }
@keyframes ambSpin { to { transform: rotate(360deg); } }
/* sun: a tennis ball bounces across the page every so often */
.amb-ball { position: absolute; left: 0; bottom: 6vh; width: 30px; height: 30px; opacity: 0; animation: ballCross 14s linear infinite 5s; }
.amb-ball i { display: block; width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f2ff8a, #cde02c 55%, #9fb21a);
  box-shadow: 0 0 14px rgba(220,240,80,0.4); animation: ballHop 0.9s cubic-bezier(0.3, 0, 0.7, 1) infinite alternate; }
@keyframes ballCross { 0% { translate: -5vw 0; opacity: 0; } 2% { opacity: 0.85; } 34% { opacity: 0.85; } 36% { translate: 105vw 0; opacity: 0; } 100% { translate: 105vw 0; opacity: 0; } }
@keyframes ballHop { from { transform: translateY(0) scale(1.15, 0.85); } 15% { transform: translateY(-6vh) scale(1); } to { transform: translateY(-26vh) rotate(360deg); } }
/* snow: moonlight */
.amb-moon { position: absolute; left: 6%; top: 8%; width: 22vmin; height: 22vmin; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(220,235,255,0.35), rgba(160,200,255,0.08) 60%, transparent); animation: ambMoon 8s ease-in-out infinite; }
@keyframes ambMoon { 50% { transform: scale(1.12); opacity: 0.75; } }
/* dust: candlelight in the corners, loose pages crossing */
.amb-candle { position: absolute; left: -8vmax; bottom: -8vmax; width: 34vmax; height: 34vmax; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,190,100,0.16), transparent); animation: ambCandle 3.4s ease-in-out infinite; }
.amb-candle.c2 { left: auto; right: -8vmax; animation-duration: 4.3s; }
@keyframes ambCandle { 0%, 100% { opacity: 0.8; } 35% { opacity: 1; } 38% { opacity: 0.6; } 41% { opacity: 0.95; } }
.amb-pages i { position: absolute; left: -60px; width: 34px; height: 44px; border-radius: 2px; background: linear-gradient(135deg, rgba(255,243,214,0.55), rgba(232,207,154,0.4));
  opacity: 0; animation: ambPage 38s linear infinite; }
.amb-pages i:nth-child(1) { top: 30%; }
.amb-pages i:nth-child(2) { top: 62%; animation-delay: 13s; animation-duration: 44s; }
.amb-pages i:nth-child(3) { top: 14%; animation-delay: 26s; animation-duration: 50s; }
@keyframes ambPage { 0% { transform: translate(0, 0) rotate(0) rotateX(0); opacity: 0; } 5% { opacity: 1; } 50% { transform: translate(55vw, 8vh) rotate(160deg) rotateX(180deg); } 95% { opacity: 1; } 100% { transform: translate(115vw, -6vh) rotate(340deg) rotateX(360deg); opacity: 0; } }

/* the cast: characters from the books who pass behind the page */
.passerby { position: absolute; left: 0; opacity: 0; will-change: translate, transform; }
.passerby.ground { bottom: 0; height: 24vh; }
.passerby.sky { top: 16%; height: 12vh; }
.passerby.walk-right, .passerby.run-right { animation-name: passRight, bob; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite; }
.passerby.walk-left { animation-name: passLeft, bob; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite; }
.passerby.fly-left { animation-name: flyLeft, glide; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite; }
@keyframes passRight { 0% { translate: -25vw 0; opacity: 0; } 4% { opacity: 0.5; } 46% { opacity: 0.5; } 50% { translate: 105vw 0; opacity: 0; } 100% { translate: 105vw 0; opacity: 0; } }
@keyframes passLeft  { 0% { translate: 105vw 0; opacity: 0; } 4% { opacity: 0.5; } 46% { opacity: 0.5; } 50% { translate: -25vw 0; opacity: 0; } 100% { translate: -25vw 0; opacity: 0; } }
@keyframes flyLeft   { 0% { translate: 105vw 0; opacity: 0; } 5% { opacity: 0.6; } 40% { opacity: 0.6; } 45% { translate: -20vw -8vh; opacity: 0; } 100% { translate: -20vw -8vh; opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-2%) rotate(0.6deg); } }
@keyframes glide { 50% { transform: translateY(14%) rotate(-3deg) scaleY(0.92); } }

/* the way to the book is always one click away */
.buy-float {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50;
  padding: 0.95rem 1.5rem; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent); text-decoration: none;
  box-shadow: 0 14px 34px rgba(0,0,0,0.45); overflow: hidden;
  opacity: 0; transform: translateY(20px); pointer-events: none;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), filter 0.3s;
}
.buy-float.show { opacity: 1; transform: none; pointer-events: auto; }
.buy-float:hover { filter: brightness(1.1); }
.buy-float::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,0.45) 50%, transparent 65%); transform: translateX(-100%); animation: buyShine 4s ease-in-out infinite 2s; }
@keyframes buyShine { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* the emblem next to her name catches the light */
.nav-brand img { animation: emblemGlint 5s ease-in-out infinite; }
@keyframes emblemGlint { 0%, 100% { filter: drop-shadow(0 0 4px rgba(247,200,107,0.35)); } 50% { filter: drop-shadow(0 0 12px rgba(247,200,107,0.8)); } }

@media (prefers-reduced-motion: reduce) { .ambient, .ambient-layer { display: none; } .nav-brand img { animation: none; } }

/* the display font draws an odd ampersand; use the text font for it */
.amp { font-family: var(--font-body); font-style: normal; font-weight: 400; }
.passerby.run-left { animation-name: passLeft, bob; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite; }
