/* ============================================================
   Chromatics — marketing front door (chromatics.mobile)
   Palette, type, and the hero demo all derive from the product:
   ground/inks match the app's Refined Dark theme; speaker colors
   are the app's verified dark-pool slots for Wuthering Heights.
   ============================================================ */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/fraunces-600-latin.woff2') format('woff2');
}

:root {
  /* Ground — app Refined Dark */
  --bg: #121212;
  --bg-surface: #1e1e1e;
  --bg-elevated: #262626;
  --border: #2e2e2e;

  /* Text — app values */
  --text: #d4cfc4;
  --muted: #928d86;
  --dim: #7a756e;

  /* CTA — app accent gold */
  --gold: #d4a857;

  /* Speaker inks — the app's dark-pool colors as assigned to
     Wuthering Heights (slot-mapped, collision-free) */
  --ink-lockwood: hsl(80, 50%, 72%);
  --ink-heathcliff: hsl(0, 55%, 75%);
  --ink-catherine: hsl(25, 55%, 74%);
  --ink-nelly: hsl(120, 50%, 72%);
  --ink-joseph: hsl(250, 60%, 80%);
  --ink-isabella: hsl(195, 55%, 74%);
  --ink-cathy: hsl(320, 55%, 76%);
  --ink-place-wuthering: hsl(0, 55%, 75%);
  --ink-place-thrushcross: hsl(195, 55%, 74%);

  --serif-body: 'Charter', 'Iowan Old Style', 'Georgia', 'Times New Roman', serif;
  --serif-display: 'Fraunces', 'Georgia', serif;

  --measure: 36rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

::selection { background: rgba(212, 168, 87, 0.3); }

h1, h2 { font-family: var(--serif-display); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.4rem); line-height: 1.08; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); line-height: 1.2; }
h3 { font-size: 1.0625rem; font-weight: 600; }

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- header ---------- */

/* Sections set vertical rhythm with padding-block only, so the .wrap
   inline padding survives on small screens. */
.site-head { padding-block: 1.5rem 0; }
.wordmark {
  display: inline-block;
  font-family: var(--serif-display);
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}
.wordmark-rule {
  display: flex; gap: 2px; margin-top: 4px; height: 3px; width: 5.5rem;
}
.wordmark-rule span { flex: 1; border-radius: 2px; }
.wordmark-rule span:nth-child(1) { background: var(--ink-heathcliff); }
.wordmark-rule span:nth-child(2) { background: var(--ink-lockwood); }
.wordmark-rule span:nth-child(3) { background: var(--ink-catherine); }
.wordmark-rule span:nth-child(4) { background: var(--ink-nelly); }

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 3rem;
  align-items: center;
  padding-block: 4rem 5rem;
}

.hero-sub {
  margin: 1.25rem 0 2rem;
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 26rem;
}
.hero-sub strong { color: var(--text); font-weight: 400; }

.cta {
  display: inline-block;
  background: var(--gold);
  color: #121212;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.8rem 1.6rem;
  border-radius: 10px;
  text-decoration: none;
}
.cta:hover { background: #e0ba70; }

.cta-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--dim);
}
.cta-note a { color: var(--muted); }

/* ---------- reader demo panels ---------- */

.demo {
  position: relative;
}

.toggle-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
}

.reader-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* Scene banner — mirrors the app's .banner: info text left, bookmark right */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}
.demo-banner .banner-info, .banner-chip .banner-info {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-bookmark {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  flex-shrink: 0;
}
.demo-bookmark.bookmarked { color: hsl(50, 50%, 72%); }

.passage {
  padding: 1.4rem 1.5rem 1.6rem;
  font-size: 0.97rem;
}
.passage p { margin-bottom: 0.85em; }
.passage p:last-child { margin-bottom: 0; }
.chapter-heading {
  font-family: var(--serif-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1em;
}

/* Speaker, character, place, and temporal inks — as in the app */
.speaker-lockwood, .char-lockwood { color: var(--ink-lockwood); }
.speaker-heathcliff, .char-heathcliff { color: var(--ink-heathcliff); }
.speaker-catherine, .char-catherine { color: var(--ink-catherine); }
.speaker-nelly, .char-nelly { color: var(--ink-nelly); }
.speaker-joseph, .char-joseph { color: var(--ink-joseph); }
.speaker-isabella, .char-isabella { color: var(--ink-isabella); }
.speaker-cathy, .char-cathy { color: var(--ink-cathy); }
.place-wuthering { color: var(--ink-place-wuthering); }
.place-thrushcross { color: var(--ink-place-thrushcross); }
.temporal { color: var(--gold); }

.passage [class^="speaker-"], .passage [class^="char-"],
.passage [class^="place-"], .passage .temporal {
  transition: color 0.45s ease;
}

/* Plain mode — checked strips every ink back to body color */
.toggle-input:checked ~ .reader-panel :is([class^="speaker-"], [class^="char-"], [class^="place-"], .temporal) {
  color: inherit;
}

/* The toggle control */
.toggle {
  display: flex;
  width: max-content;
  margin: 0.9rem auto 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-surface);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.toggle span { padding: 0.35rem 1rem; border-radius: 999px; color: var(--dim); }
.toggle .opt-color { background: var(--bg-elevated); color: var(--text); }
.toggle-input:checked ~ .toggle .opt-color { background: none; color: var(--dim); }
.toggle-input:checked ~ .toggle .opt-plain { background: var(--bg-elevated); color: var(--text); }
.toggle-input:focus-visible ~ .toggle { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- feature sections ---------- */

.feature {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 3rem;
  align-items: center;
  padding-block: 3.25rem;
  border-top: 1px solid var(--border);
}
.feature:nth-of-type(even) .feature-copy { order: 2; }

.feature-copy p { color: var(--muted); margin-top: 0.9rem; max-width: var(--measure); }
.feature-copy p strong { color: var(--text); font-weight: 400; }

.caption {
  margin-top: 0.7rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: var(--dim);
  text-align: center;
}

/* Reader bottom bar — mirrors the app's .reader-bottom-bar:
   page indicator left, then speed / rewind-10 / play on the right */
.demo-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.demo-page-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  white-space: nowrap;
}
.demo-audio-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 44px;
}
.demo-audio-btn {
  border: none;
  background: none;
  color: var(--text);
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 999px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  font-weight: 600;
}
.demo-speed-btn {
  min-width: 52px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.demo-rewind-btn { color: var(--muted); }
.demo-play-btn { color: var(--gold); }

/* Banner stack for feature three */
.banner-stack { display: grid; gap: 0.6rem; }
.banner-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.banner-chip .banner-info { color: var(--text); }

.theme-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: var(--dim);
}
.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex: none;
}
.swatch-dark { background: #121212; }
.swatch-paper { background: #fbf0d9; }
.swatch-light { background: #f4f4f5; }

/* ---------- catalog ---------- */

.catalog { padding-block: 3.25rem; border-top: 1px solid var(--border); }
.catalog > .lede { color: var(--muted); margin-top: 0.9rem; max-width: var(--measure); }
.catalog > .lede strong { color: var(--text); font-weight: 400; }

/* Book cards — the app's .shelf-book-card, verbatim. Covers come live from
   the app's /api/cover endpoint, so admin cover changes show up here too.
   Three across on phones, exactly as in the app; 6 across on desktop. */
.shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2rem;
  max-width: calc(6 * 150px + 5 * 14px);
}
.shelf-book-card {
  flex: 0 0 calc((100% - 28px) / 3);
  min-width: 90px;
  max-width: 150px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.shelf-book-cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  overflow: hidden;
}
.shelf-book-cover-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.045) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: coverShimmer 1.6s ease-in-out infinite;
  pointer-events: none;
}
.shelf-book-cover-wrap.cover-loaded::after,
.shelf-book-cover-wrap.cover-failed::after {
  animation: none;
  opacity: 0;
}
@keyframes coverShimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -130% 0; }
}
.shelf-book-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cover-loaded .shelf-book-cover { opacity: 1; }
.cover-failed .shelf-book-cover { display: none; }
.shelf-book-cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 10px;
  text-align: center;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: linear-gradient(160deg, #1d1d24 0%, #16161c 60%, #131318 100%);
  box-shadow: inset 3px 0 6px -2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.shelf-book-title {
  font-size: 0.75rem;
  font-weight: normal;
  color: var(--text);
  padding: 8px 10px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: Georgia, 'Times New Roman', serif;
}
.shelf-book-author {
  font-size: 0.67rem;
  color: var(--dim);
  padding: 2px 10px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
}

/* ---------- pricing ---------- */

.pricing { padding-block: 3.25rem; border-top: 1px solid var(--border); }
.plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  max-width: 52rem;
}
.plan {
  padding: 1.4rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.plan h3 { font-family: var(--serif-display); font-size: 1.2rem; }
.plan .price {
  margin-top: 0.4rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--gold);
}
.plan p { margin-top: 0.7rem; color: var(--muted); font-size: 0.95rem; }
.pricing .cta { margin-top: 2rem; }

/* ---------- android waitlist ---------- */

.android { padding-block: 3.25rem; border-top: 1px solid var(--border); }
.android p { color: var(--muted); margin-top: 0.9rem; max-width: var(--measure); }
.waitlist {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
  max-width: 28rem;
}
.waitlist input[type="email"] {
  flex: 1;
  min-width: 14rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
}
.waitlist input::placeholder { color: var(--dim); }
.waitlist button {
  padding: 0.7rem 1.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.waitlist button:hover { border-color: var(--dim); }
.hp { position: absolute; left: -9999px; }

/* ---------- footer ---------- */

.site-foot {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.85rem;
  color: var(--dim);
}
.site-foot .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-bottom: 0.8rem;
}
.site-foot a { color: var(--muted); }

/* ---------- responsive ---------- */

@media (max-width: 56rem) {
  .hero, .feature { grid-template-columns: 1fr; gap: 2rem; padding-top: 2.75rem; padding-bottom: 2.75rem; }
  .feature:nth-of-type(even) .feature-copy { order: 0; }
  .hero { padding-top: 2.5rem; }
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 24rem) {
  .demo-banner, .banner-chip { white-space: normal; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .passage [class^="speaker-"], .passage [class^="char-"],
  .passage [class^="place-"], .passage .temporal { transition: none; }
  .shelf-book-cover-wrap::after { animation: none; }
}
