/*
 * The archive look for the website, matching the app's theme (mobile/src/lib/theme.tsx):
 * warm paper, deep ink, champagne gold only on dark, Fraunces light with its italic, Nunito.
 */
:root {
  --paper: #f7f4ef;
  --raised: #ffffff;
  --ink: #1b1830;
  --muted: #686274;
  --accent: #38327a;
  --line: #e7e1d6;
  --deep: #1d1a31;
  --deep-edge: rgba(226, 196, 140, 0.42);
  --on-deep: #f3ecdf;
  --on-deep-soft: #b9b1c5;
  --gilt: #e2c48c;
  --bronze: #86663a;
  --shadow: 0 12px 30px rgba(29, 26, 49, 0.07);
  --glow: 0 24px 60px rgba(29, 26, 49, 0.22);
  --focus: #38327a;
  --serif: Fraunces, Georgia, "Times New Roman", serif;
  --sans: Nunito, "Segoe UI", system-ui, sans-serif;
  --measure: 1180px;
}

/* Night, when the phone or computer is in dark mode: the app's night look. */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121019;
    --raised: #1b1825;
    --ink: #f2ece2;
    --muted: #a7a0b2;
    --accent: #e2c48c;
    --line: #2c2838;
    --deep: #1f1b2f;
    --deep-edge: rgba(226, 196, 140, 0.35);
    --bronze: #e2c48c;
    --shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
    --glow: 0 24px 60px rgba(0, 0, 0, 0.55);
    --focus: #e2c48c;
  }
  html:not([data-contrast="high"]) .primary,
  html:not([data-contrast="high"]) .nav .nav-cta {
    background: var(--gilt);
    border-color: var(--gilt);
    color: #1b1830;
  }
  html:not([data-contrast="high"]) input::placeholder { color: #6f6a7c; }
}

html[data-contrast="high"] {
  --paper: #ffffff;
  --raised: #ffffff;
  --ink: #000000;
  --muted: #000000;
  --accent: #000000;
  --line: #000000;
  --deep: #000000;
  --deep-edge: #ffffff;
  --on-deep: #ffffff;
  --on-deep-soft: #ffffff;
  --gilt: #ffe14a;
  --bronze: #000000;
  --shadow: none;
  --glow: none;
  --focus: #000000;
}

html[data-text="large"] { font-size: 125%; }
html[data-way="listen"] { font-size: 125%; }
html[data-way="listen"][data-text="large"] { font-size: 150%; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* The lamplight behind the hero phone reaches past the edge; it must never widen the page. */
  overflow-x: clip;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
}
.skip:focus { top: 1rem; }

.caps {
  margin: 0;
  color: var(--bronze);
  font: 600 0.75rem/1.4 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font: italic 300 1.15rem/1.4 var(--serif);
}

h1, h2, h3 { margin: 0; font-weight: 300; }

h1, h2 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.8rem, 6vw, 4.6rem); line-height: 1.04; }
h2 { font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.1; }
h1 em, h2 em { display: block; font-style: italic; color: var(--accent); }

/* The seal: the gold italic M on ink, as on the app icon. */
.seal {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--deep);
  border: 1px solid var(--deep-edge);
  color: var(--gilt);
  font: italic 300 1.5rem/1 var(--serif);
  box-shadow: var(--shadow);
}
.seal.small { width: 2rem; height: 2rem; font-size: 1.15rem; }

/* Bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.9rem max(1.25rem, calc((100vw - var(--measure)) / 2));
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.75rem; color: var(--ink); text-decoration: none; }
.brand-words { display: grid; line-height: 1.1; }
.wordmark { font: 400 1.6rem/1.1 var(--serif); letter-spacing: -0.01em; }
.brand .caps { color: var(--muted); font-size: 0.66rem; }
.nav { display: flex; align-items: center; gap: 1.6rem; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { text-decoration: underline; }
.nav .nav-cta {
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  background: var(--deep);
  color: var(--on-deep);
}

main { overflow-x: clip; }

main > section {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6.5rem) 1.25rem;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
}
.lede { max-width: 34rem; margin: 1.5rem 0 2rem; font-size: 1.2rem; color: var(--muted); }

.phone {
  margin: 0;
  justify-self: center;
  width: min(100%, 340px);
  padding: 10px;
  border-radius: 48px;
  background: var(--deep);
  box-shadow: var(--glow);
  position: relative;
}
.phone img { border-radius: 38px; }
.hero-phone::before {
  content: "";
  position: absolute;
  inset: -18% -30%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(214, 178, 112, 0.28), rgba(214, 178, 112, 0));
}
.phone.small { width: min(100%, 230px); border-radius: 36px; padding: 7px; }
.phone.small img { border-radius: 29px; }

/* Waitlist */
.waitlist {
  max-width: 34rem;
  padding: 1.5rem;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.9rem;
}
.waitlist .hint { margin: -0.4rem 0 0; color: var(--muted); font-size: 0.95rem; }
.fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.75rem; }
.field { display: grid; gap: 0.3rem; }
.field label { font-weight: 600; font-size: 0.92rem; }
.optional { color: var(--muted); font-weight: 400; }
input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  font: 400 1.05rem var(--serif);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
}
input::placeholder { color: #9b95a6; }
.hp { position: absolute; left: -9999px; }
.form-status:empty { display: none; }
.form-status { margin: 0; color: var(--accent); font-weight: 600; }
/* Joined: the fields step away and the confirmation is set like a line from the book. */
.waitlist[data-joined="true"] .fields,
.waitlist[data-joined="true"] .hint { display: none; }
.waitlist[data-joined="true"] .form-status { font: italic 300 1.35rem/1.4 var(--serif); color: var(--accent); }

button, .button {
  font: 600 1rem var(--sans);
  min-height: 3rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
button:disabled { opacity: 0.45; cursor: default; }
.primary {
  background: var(--deep);
  border-color: var(--deep);
  color: #f2e6cc;
  font: 400 1.15rem var(--serif);
  box-shadow: var(--glow);
}
button[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: var(--on-deep); }

/* Way */
.way {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 1rem 2.5rem;
  align-items: start;
  border-top: 1px solid var(--line);
  padding-top: 3rem !important;
  padding-bottom: 3rem !important;
}
.way-head p { margin: 0.4rem 0 0; color: var(--muted); }
.way-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.way-choices button {
  display: grid;
  justify-items: start;
  text-align: left;
  gap: 0.3rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
}
.way-name { font: 400 1.25rem var(--serif); }
.way-note { font-weight: 400; font-size: 0.95rem; color: inherit; opacity: 0.8; }
.prefs { grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.prefs button { min-height: 2.6rem; font-size: 0.92rem; }
.way-status:empty { display: none; }
.way-status { grid-column: 2; margin: 0; color: var(--accent); }

/* How */
.how h2 { max-width: 40rem; }
.steps {
  list-style: none;
  margin: 3rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  counter-reset: step;
}
.steps li { counter-increment: step; display: grid; gap: 0.6rem; align-content: start; }
.steps .phone { margin-bottom: 1rem; }
.steps h3 { font: 400 1.5rem/1.2 var(--serif); }
.steps h3::before {
  content: counter(step, lower-roman) ". ";
  font-style: italic;
  color: var(--accent);
}
.steps p { margin: 0; color: var(--muted); }

/* The dark, gold-edged card: the sample player */
.deep {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 2.5rem;
  max-width: calc(var(--measure) - 2.5rem) !important;
  margin: 0 auto !important;
  padding: clamp(2rem, 5vw, 3.5rem) !important;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(226, 196, 140, 0.14), rgba(226, 196, 140, 0) 60%),
    var(--deep);
  color: var(--on-deep);
  border: 1px solid var(--deep-edge);
  border-radius: 32px;
  box-shadow: var(--glow);
}
.deep .eyebrow { color: var(--gilt); }
.deep h2 { color: var(--on-deep); }
.deep .note { color: var(--on-deep-soft); max-width: 24rem; }
.deep .caps { color: var(--gilt); }
.deep-player { display: grid; gap: 1rem; }
#memories article p { margin: 0; font: 300 1.45rem/1.45 var(--serif); }
#memories .prompt { font-style: italic; color: var(--gilt); margin-bottom: 0.5rem; }
.story.is-speaking #memories article:not([hidden]) p:not(.prompt) { color: #fffaf0; }
.deep .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.deep button {
  background: rgba(243, 236, 223, 0.07);
  border-color: rgba(226, 196, 140, 0.32);
  color: var(--on-deep);
}
.deep button.gold { background: var(--gilt); border-color: var(--gilt); color: var(--deep); font: 400 1.1rem var(--serif); }
.deep button[aria-pressed="true"] { background: var(--gilt); color: var(--deep); }
#status { margin: 0; min-height: 1.5em; color: var(--on-deep-soft); }
.sounds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.sounds button { width: 100%; display: grid; justify-items: start; gap: 0.1rem; text-align: left; border-radius: 16px; padding: 0.7rem 0.9rem; }
.sound-name { font: 400 1.05rem var(--serif); }
.sound-scene { font-size: 0.82rem; opacity: 0.75; font-weight: 400; }

/* Ages: a ruled ledger, three to a row, like the Profile in the app */
.ledger {
  margin: 2.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}
.ledger div { padding: 1.5rem 1.5rem 1.75rem 0; border-bottom: 1px solid var(--line); }
.ledger div:not(:nth-child(3n + 1)) { padding-left: 1.5rem; border-left: 1px solid var(--line); }
.ledger dt { font: 400 1.35rem/1.25 var(--serif); margin-bottom: 0.4rem; }
.ledger dd { margin: 0; color: var(--muted); }

/* Promise */
.promise { text-align: center; display: grid; justify-items: center; gap: 1.25rem; }
.promise h2 { font-style: italic; max-width: 40rem; }
.promise p { max-width: 36rem; margin: 0; color: var(--muted); font-size: 1.1rem; }

/* Footer */
.foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 2rem max(1.25rem, calc((100vw - var(--measure)) / 2));
  border-top: 1px solid var(--line);
}
.foot .caps { color: var(--muted); flex: 1; }
.foot nav { display: flex; gap: 1.25rem; }
.foot a { color: var(--ink); font-weight: 600; text-decoration: none; }

/* Listening first: the pictures step back and the words take the room. */
html[data-way="listen"] .phone { display: none; }
html[data-way="listen"] .hero,
html[data-way="listen"] .deep { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .nav a:not(.nav-cta) { display: none; }
  .hero, .way, .deep { grid-template-columns: 1fr; }
  .prefs, .way-status { grid-column: 1; }
  .hero-phone { width: min(80%, 300px); }
  .steps { grid-template-columns: 1fr; gap: 3rem; }
  .steps li { grid-template-columns: 150px 1fr; column-gap: 1.25rem; align-items: start; }
  .steps .phone { grid-row: span 2; margin: 0; }
  .ledger { grid-template-columns: 1fr; }
  .ledger div, .ledger div:not(:nth-child(3n + 1)) { padding: 1.25rem 0; border-left: 0; }
  .sounds { grid-template-columns: 1fr 1fr; }
  .fields { grid-template-columns: 1fr; }
  .deep { margin: 0 1rem !important; border-radius: 26px; }
}

@media (max-width: 520px) {
  .way-choices { grid-template-columns: 1fr; }
  .steps li { grid-template-columns: 1fr; }
  .steps .phone { grid-row: auto; width: 70%; }
}

/* Long reading (privacy): one column at a comfortable measure, ruled sections, a plain table. */
.doc { max-width: 46rem; margin: 0 auto; padding: clamp(3rem, 7vw, 5rem) 1.25rem; }
.doc h1 { font-size: clamp(2.6rem, 5vw, 3.6rem); }
.doc h2 { font: 400 1.6rem/1.25 var(--serif); margin: 3rem 0 0.75rem; padding-top: 1.5rem; border-top: 1px solid var(--line); letter-spacing: -0.01em; }
.doc p, .doc li { max-width: 62ch; }
.doc .meta { color: var(--muted); }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.7rem 0.9rem 0.7rem 0; border-bottom: 1px solid var(--line); }
.doc th { font-weight: 600; }

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

/* Sound library: shelves of tiles, each a sound you press to hear. */
.library > section { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }
.library-head { padding-top: clamp(3rem, 7vw, 5rem) !important; padding-bottom: 1rem !important; }
.library-head .lede { max-width: 40rem; }
.library-status:empty { display: none; }
.library-status { margin: 0; color: var(--accent); font: italic 300 1.2rem var(--serif); }
.shelf { padding-top: 2.5rem !important; padding-bottom: 1rem !important; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.shelf-head h2 { font-size: clamp(1.8rem, 3vw, 2.3rem); }
.shelf-head p { margin: 0; color: var(--muted); }
.tiles { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.75rem; }
.tile { position: relative; }
.tile-play {
  width: 100%;
  min-height: 6.5rem;
  display: grid;
  align-content: start;
  justify-content: start;
  justify-items: start;
  gap: 0.25rem;
  padding: 1rem 1.1rem 2.2rem 3.4rem;
  text-align: left;
  border-radius: 20px;
  background: var(--raised);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.tile-play::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.05rem;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l8 5-8 5z' fill='%23e2c48c'/%3E%3C/svg%3E") center / 1.1rem no-repeat;
}
.tile-play[aria-pressed="true"] { background: var(--deep); border-color: var(--deep-edge); color: var(--on-deep); }
.tile-play[aria-pressed="true"]::before {
  background: var(--gilt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 7h3v10H8zM13 7h3v10h-3z' fill='%231d1a31'/%3E%3C/svg%3E") center / 1.1rem no-repeat;
}
.tile-name { font: 400 1.2rem/1.2 var(--serif); }
.tile-scene { font-weight: 400; font-size: 0.92rem; color: var(--muted); }
.tile-play[aria-pressed="true"] .tile-scene { color: var(--on-deep-soft); }
.tile-meter { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.tile-meter span { display: block; height: 100%; width: 0; background: var(--gilt); transition: width 0.25s linear; }
.tile-file { position: absolute; right: 1rem; bottom: 0.8rem; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.tile-file:hover, .tile-file:focus-visible { text-decoration: underline; color: var(--ink); }
.tile-play[aria-pressed="true"] + .tile-file { color: var(--on-deep-soft); }
html[data-contrast="high"] .tile-play::before { background-color: #000; }
@media (prefers-color-scheme: dark) {
  html:not([data-contrast="high"]) .tile-play:not([aria-pressed="true"])::before { background-color: #2c2838; }
  html:not([data-contrast="high"]) .tile-play[aria-pressed="true"] { background: #2a2540; }
}

/* FAQ: plain disclosure rows, ruled like the ledger. */
.faq-list { margin-top: 2.5rem; border-top: 1px solid var(--line); max-width: 52rem; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 1.1rem 0;
  font: 400 1.35rem/1.3 var(--serif);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after { transform: rotate(-135deg) translateY(-3px); }
.faq details p { margin: 0 0 1.4rem; max-width: 44rem; color: var(--muted); }

/* The one arrival moment: the title page settles, then the phone rises into the lamplight. */
@media (prefers-reduced-motion: no-preference) {
  .hero-copy > * { animation: settle 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .hero-copy > :nth-child(2) { animation-delay: 0.08s; }
  .hero-copy > :nth-child(3) { animation-delay: 0.16s; }
  .hero-copy > :nth-child(4) { animation-delay: 0.24s; }
  .hero-phone { animation: rise 1.1s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  /* Words move but never fade: text stays at full contrast from the first frame. */
  @keyframes settle { from { transform: translateY(10px); } }
  @keyframes rise { from { opacity: 0; transform: translateY(36px) scale(0.97); } }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
