/* Brand fonts (DESIGN.md), self-hosted because the plan forbids a third-party font
   CDN. Both are subsets of Armenian, Latin and punctuation, made from the Google Fonts
   originals (SIL OFL, licenses next to them). Google Sans sets Armenian and English in
   one face, so a mixed line like "— $15" never switches fonts mid-sentence. */
@font-face {
  font-family: 'Google Sans';
  src: url('content/fonts/google-sans.woff2') format('woff2');
  font-weight: 400 700; font-display: swap;
}
@font-face {
  font-family: 'Noto Serif Armenian';
  src: url('content/fonts/noto-serif-armenian.woff2') format('woff2');
  font-weight: 400 800; font-display: swap;
}
/* Fallback while the fonts load: the system Armenian fonts, limited to the Armenian
   block (their digits and punctuation are a serif cut). */
@font-face {
  font-family: 'Armenian Text';
  src: local('Noto Sans Armenian'), local('NotoSansArmenian-Regular'), local('Mshtakan'), local('Sylfaen');
  unicode-range: U+0530-058F, U+FB13-FB17;
}
@font-face {
  font-family: 'Armenian Text';
  font-weight: 600 800;
  src: local('Noto Sans Armenian Bold'), local('NotoSansArmenian-Bold'), local('Mshtakan Bold'), local('Mshtakan-Bold'), local('Sylfaen');
  unicode-range: U+0530-058F, U+FB13-FB17;
}

:root {
  /* Gandzuk palette (DESIGN.md): velvet, lavash, tuff, charm gold. */
  --ink: #f4e6cd;
  --ink-dim: #cf8c78;
  --bg: #2b0a0d;
  --bg-2: #3a1418;
  --line: #52242a;
  --gold: #e8aa4e;
  --gold-dim: #a8692a;
  --on-gold: #2b0a0d;
  --radius: 14px;
  --font: 'Google Sans', 'Armenian Text', ui-sans-serif, system-ui, sans-serif;
  --serif: 'Noto Serif Armenian', 'Armenian Text', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2 { line-height: 1.2; margin: 0 0 .5em; font-family: var(--serif); font-weight: 700; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ── Pitch ─────────────────────────────────────────────── */
.pitch {
  background:
    radial-gradient(120% 90% at 20% 0%, #44161b 0%, transparent 60%),
    linear-gradient(180deg, #3a1418, var(--bg));
  border-bottom: 1px solid var(--line);
  padding: clamp(1.5rem, 6vw, 5rem) 1.25rem clamp(2rem, 5vw, 3.5rem);
}
.pitch__inner { max-width: 52rem; margin: 0 auto; }
.kicker {
  color: var(--gold); letter-spacing: .06em; font-size: 1.05rem;
  margin: 0 0 .75rem; text-transform: none;
}
.brand { display: flex; align-items: center; gap: .7rem; }
.brand__logo { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__name { color: var(--ink); font-family: var(--serif); font-weight: 700; letter-spacing: .01em; }
.brand__sub { font-size: .9em; }
.pitch h1 { font-size: clamp(1.9rem, 5.5vw, 3rem); }
.pitch__title { margin: 1.1rem 0 1.4rem; max-width: 34rem; }
.section__title { font-size: clamp(1.25rem, 3.2vw, 1.5rem); margin: 0 0 .9rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.lede { color: var(--ink-dim); font-size: clamp(1rem, 2.4vw, 1.15rem); max-width: 38rem; }


/* The voice-switch ad, muted and looping; a tap anywhere on it plays it with sound. */
.clip {
  position: relative; margin: 0; justify-self: center;
  height: min(41vh, 26rem); height: min(41svh, 26rem); aspect-ratio: 9 / 16;
  border-radius: var(--radius); overflow: hidden; background: var(--bg-2);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .05);
}
.clip__video { width: 100%; height: 100%; object-fit: cover; display: block; }
.clip__tap {
  position: absolute; inset: 0; background: transparent; border: 0; padding: .55rem .3rem;
  display: flex; align-items: flex-start; justify-content: center;
}
.clip__pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(43, 10, 13, .78); color: var(--ink); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px; padding: .35rem .7rem; font-size: .85rem; font-weight: 600; white-space: nowrap;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.clip__tap:hover .clip__pill { border-color: var(--gold); }
.clip__tap[aria-pressed="true"] .clip__pill { background: rgba(43, 10, 13, .55); color: var(--ink-dim); font-weight: 500; }


/* The three stories under the play button; each card starts its story. */
.shelf {
  list-style: none; margin: .7rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem;
}
.shelf__card {
  width: 100%; height: 100%; display: flex; flex-direction: column; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 0 .55rem; overflow: hidden; transition: border-color .15s, transform .15s;
}
.shelf__card:hover { border-color: var(--gold-dim); transform: translateY(-1px); }
.shelf__art { position: relative; display: block; aspect-ratio: 4 / 3; margin-bottom: .4rem; }
.shelf__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf__play {
  position: absolute; right: .4rem; bottom: .4rem; width: 1.75rem; height: 1.75rem;
  border-radius: 50%; background: var(--gold); color: var(--on-gold);
  display: grid; place-items: center; font-size: .7rem; box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.shelf__min {
  position: absolute; left: .4rem; bottom: .55rem; padding: .05rem .45rem; border-radius: 999px;
  background: rgba(43, 10, 13, .78); color: var(--ink); font-size: .7rem; line-height: 1.5;
}
.shelf__title { padding: 0 .5rem; font-family: var(--serif); font-weight: 700; font-size: .875rem; line-height: 1.25; text-wrap: balance; }
.shelf__sub { padding: .1rem .5rem 0; color: var(--ink-dim); font-size: .72rem; line-height: 1.3; text-wrap: balance; }


.cta-open {
  background: var(--gold); color: var(--on-gold); border: 0;
  padding: .85rem 1.6rem; border-radius: 12px; font-weight: 600; font-size: 1rem;
  min-height: 44px;
}
.cta-open:hover { background: #f0bc6a; }
.cta-open:active { background: var(--gold-dim); }


/* ── Books first (layout B): the covers are the buy links ── */
.shop__covers {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem;
}
.shop__cover { display: flex; flex-direction: column; gap: .1rem; color: var(--ink); text-decoration: none; }
.shop__cover img {
  width: 100%; height: auto; aspect-ratio: 1; display: block; margin-bottom: .45rem;
  border-radius: 3px 6px 6px 3px; background: var(--bg-2); transition: transform .15s;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .06);
}
.shop__cover:hover img { transform: translateY(-2px); }
.shop__title { font-family: var(--serif); font-weight: 700; font-size: .9rem; line-height: 1.25; }
.shop__sub { color: var(--ink-dim); font-size: .75rem; line-height: 1.3; }
.shop__status { color: var(--gold); font-size: .72rem; font-weight: 600; line-height: 1.3; margin-top: .15rem; }
.shop__fine { color: var(--ink-dim); margin: 1.1rem 0 0; max-width: 36rem; }
.shop__buy { display: flex; justify-content: center; text-decoration: none; margin-top: 1.1rem; }

/* ── The weekly story ── */
.signup { margin-top: 2.75rem; }
.signup__form {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; max-width: 36rem;
}
.signup__form .section__title { margin-bottom: .35rem; }
.signup__sub { color: var(--ink-dim); margin: 0 0 .9rem; }
.signup__row { display: flex; gap: .5rem; }
.signup__row input {
  flex: 1; min-width: 0; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); padding: .7rem .8rem; min-height: 44px; font: inherit;
}
.signup__send {
  background: var(--gold); color: var(--on-gold); border: 0; border-radius: 10px;
  padding: 0 1.1rem; min-height: 44px; font-weight: 600; white-space: nowrap;
}
.signup__send:hover { background: #f0bc6a; }
.signup__send:disabled { opacity: .5; cursor: default; }
.signup__fine { color: var(--ink-dim); font-size: .8rem; margin: .7rem 0 0; }
.signup__thanks { color: var(--gold); font-weight: 600; margin: .7rem 0 0; }

/* ── The voice: the switch shown, then the $6 offer ── */
.voice-offer {
  margin-top: 2.75rem; padding-top: 2rem; border-top: 1px solid var(--line);
  display: grid; gap: 1.25rem;
}
.voice-offer .section__title { margin: 0; }
.voice-offer__copy .lede { margin-top: 0; }

@media (min-width: 44rem) {
  .shop__buy { display: inline-flex; }
  .voice-offer { grid-template-columns: 15rem minmax(0, 1fr); column-gap: 2.75rem; align-items: center; }
  .voice-offer .section__title { grid-column: 1 / -1; }
  .voice-offer__clip { height: auto; width: 100%; }
}

/* ── Gate: the tap that tags a child-viewing session ───── */
/* The free stories, under the books. */
.gate { margin-top: 2.75rem; }
.gate__note { color: var(--ink-dim); font-size: .85rem; margin: .9rem 0 0; }

/* ── Player ────────────────────────────────────────────── */
.player { max-width: 60rem; margin: 0 auto; padding: 0 1rem 4rem; }

.stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: #1c0609; isolation: isolate;
  /* A phone on its side is shorter than 16:9 of its width; crop, don't overflow. */
  max-height: 100dvh;
}
.stage__layer {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; will-change: transform, opacity;
  /* No CSS transition on transform: it is written every frame from audio time. */
}
.stage__tap { position: absolute; inset: 0; background: transparent; border: 0; z-index: 3; }
.stage__caption {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  z-index: 4; max-width: min(90%, 44rem); text-align: center;
  font-size: clamp(1rem, 2.6vw, 1.5rem); line-height: 1.35;
  padding: .5em .85em; border-radius: 10px;
  background: rgba(28, 6, 9, .72); text-wrap: balance; white-space: pre-line;
}
.stage__caption:empty { display: none; }

.controls {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .9rem .25rem; border-bottom: 1px solid var(--line);
}
.btn {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  min-width: 44px; min-height: 44px; padding: 0 .75rem;
}
.btn:hover { border-color: var(--gold-dim); }
.btn--primary { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.btn--toggle[aria-pressed="false"] { opacity: .45; }
.btn:disabled { opacity: .45; cursor: default; }
.btn--close, .btn--stories { display: none; }
.time { color: var(--ink-dim); font-variant-numeric: tabular-nums; font-size: .9rem; min-width: 3.2rem; }
.scrub { flex: 1 1 8rem; accent-color: var(--gold); min-height: 44px; }

/* ── Voice switcher ────────────────────────────────────── */
.voices { padding: 1.5rem 0 .5rem; }
.voices__label { margin: 0 0 .7rem; color: var(--ink-dim); font-size: .95rem; }
.voices__row { display: flex; gap: .6rem; flex-wrap: wrap; }
.voice {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: .6rem 1.15rem; min-height: 44px; display: flex; flex-direction: column;
  align-items: flex-start; line-height: 1.25;
}
.voice small { color: var(--ink-dim); font-size: .78rem; }
.voice[aria-pressed="true"] { border-color: var(--gold); background: rgba(232, 170, 78, .14); }
.voice:hover { border-color: var(--gold-dim); }
.voices__hint { color: var(--ink-dim); font-size: .85rem; margin: .7rem 0 0; }

/* ── Episodes ──────────────────────────────────────────── */
.episodes { padding: 1.5rem 0; border-top: 1px solid var(--line); margin-top: 1.5rem; }
.episodes__label { margin: 0 0 .8rem; color: var(--ink-dim); font-size: .95rem; }
.episodes__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.ep {
  width: 100%; text-align: left; display: flex; gap: .95rem; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem; min-height: 44px;
}
.ep:hover { border-color: var(--gold-dim); }
.ep[aria-current="true"] { border-color: var(--gold); }
.ep img { width: 5.5rem; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; flex: none; }
.ep__title { font-family: var(--serif); font-weight: 700; }
.ep__sub { color: var(--ink-dim); font-size: .85rem; }

/* ── End card ──────────────────────────────────────────── */
.endcard {
  margin-top: 1.5rem; padding: 1.75rem; text-align: center;
  border: 1px solid var(--gold-dim); border-radius: var(--radius);
  background: rgba(232, 170, 78, .07);
}
.endcard p { color: var(--ink-dim); margin-top: 0; }
.endcard .endcard__book { margin: 1rem 0 0; font-size: .92rem; }
.link-btn {
  background: none; border: 0; padding: .25rem 0; color: var(--gold);
  text-decoration: underline; text-underline-offset: 3px; font-weight: 600; min-height: 44px;
}
.link-btn:hover { color: var(--ink); }

/* ── CTA dialog ────────────────────────────────────────── */
.cta {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2); color: var(--ink);
  padding: 0; max-width: 30rem; width: calc(100% - 2rem);
}
.cta::backdrop { background: rgba(20, 4, 6, .8); }
.cta__form { padding: 1.75rem; display: grid; gap: .9rem; }
.cta__sub { margin: -0.6rem 0 .4rem; color: var(--ink-dim); }
.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.check input { margin-top: .35rem; accent-color: var(--gold); width: 1.1rem; height: 1.1rem; }
/* The three books: one line of what they are, then a box per book under it. */
.check-group { border: 0; margin: 0; padding: 0; display: grid; gap: .5rem; min-width: 0; }
.check-group legend { padding: 0; margin-bottom: .55rem; }
.check-group .check { padding-left: 1.8rem; }
.check-group em { color: var(--ink-dim); }
.field { display: grid; gap: .35rem; }
.field span { color: var(--ink-dim); font-size: .9rem; }
.field input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); padding: .7rem .8rem; min-height: 44px; font: inherit;
}
.cta__price {
  font-size: .9rem; color: var(--ink-dim); background: rgba(232, 170, 78, .07);
  border-radius: 10px; padding: .85rem; margin: .2rem 0 0;
}
.cta__price strong { color: var(--ink); display: block; margin-bottom: .25rem; }
.cta__price code { color: var(--gold); white-space: nowrap; }
.cta__fine { font-size: .8rem; color: var(--ink-dim); margin: .5rem 0 0; }
.cta__form > .cta__fine { margin: 0; }
.cta__actions { display: flex; gap: .6rem; margin-top: .4rem; }
.cta__thanks { color: var(--gold); margin: 0; }
.cta__thanks p { margin: 0 0 .4rem; }
.cta__code {
  font-family: ui-monospace, Menlo, monospace; font-size: 1.15rem; letter-spacing: .08em;
  color: var(--ink); background: rgba(232, 170, 78, .12); padding: .1rem .45rem; border-radius: 6px;
}

.foot { color: var(--ink-dim); text-align: center; padding: 2rem 1rem 3rem; font-size: .85rem; }

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

/* Reduced motion: the scene still changes, the camera does not. The player
   also zeroes the transform at the source — this is belt and braces. */
@media (prefers-reduced-motion: reduce) {
  .stage__layer { transform: none !important; }
  .shelf__card, .shop__cover img { transition: none; }
}

/* ── Phone held upright: the story fills the screen, like the ads ──────
   app.js sets body.immersive while the player is open on a portrait phone.
   The picture is fixed full-screen; the caption and the three voices sit at
   the bottom, play and the scrubber at the top. When an episode ends, the end
   card and the story list scroll up over the last picture. */
body.immersive { overflow: hidden; }
body.immersive .player {
  position: fixed; inset: 0; z-index: 20; max-width: none; margin: 0; padding: 0;
  background: #1c0609; overflow-y: auto; overscroll-behavior: contain;
}
body.immersive .stage { position: fixed; inset: 0; aspect-ratio: auto; border-radius: 0; }
body.immersive .stage::before,
body.immersive .stage::after {
  content: ''; position: absolute; left: 0; right: 0; z-index: 3; pointer-events: none;
}
body.immersive .stage::before { top: 0; height: 8rem; background: linear-gradient(rgba(28, 6, 9, .6), transparent); }
body.immersive .stage::after {
  bottom: 0; height: 48%;
  background: linear-gradient(transparent, rgba(28, 6, 9, .55) 45%, rgba(28, 6, 9, .88));
}
body.immersive .stage__caption {
  bottom: calc(env(safe-area-inset-bottom) + 12.5rem); max-width: 92%;
  width: max-content; font-size: 1.3rem; padding: .55em .9em; border-radius: 14px;
  background: rgba(28, 6, 9, .62);
}

body.immersive .controls {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2; flex-wrap: nowrap; border: 0;
  padding: calc(env(safe-area-inset-top) + .6rem) 1rem .6rem;
}
body.immersive .controls :is([data-back], [data-fwd], [data-elapsed], [data-captions], [data-fullscreen]) { display: none; }
body.immersive .controls .btn { background: rgba(58, 20, 24, .7); border-color: rgba(255, 255, 255, .14); }
body.immersive .controls .btn--primary { background: var(--gold); border-color: var(--gold); }
body.immersive .btn--close { display: inline-block; font-size: 1.1rem; }
body.immersive .btn--stories { display: inline-block; flex: none; white-space: nowrap; font-size: .95rem; padding-inline: .8rem; }
body.immersive .scrub { min-width: 0; }
body.immersive .player[data-picking] .btn--stories { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }

body.immersive .voices {
  position: fixed; left: 1rem; right: 1rem; z-index: 2; padding: 0; text-align: center;
  bottom: calc(env(safe-area-inset-bottom) + 1.25rem);
}
body.immersive .voices__label { color: #ead6bc; margin-bottom: .6rem; }
body.immersive .voices__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .6rem; }
body.immersive .voice {
  align-items: center; justify-content: center; border-radius: 18px; padding: .8rem .3rem;
  min-height: 4.5rem; font-size: 1.15rem; font-weight: 600;
  background: rgba(58, 20, 24, .78); border-color: rgba(255, 255, 255, .14);
}
body.immersive .voice small { font-weight: 400; font-size: .8rem; color: #e2b8a4; }
body.immersive .voice[aria-pressed="true"] { background: rgba(232, 170, 78, .26); border: 2px solid var(--gold); }
body.immersive .voices__hint { display: none; }

/* The story list and the end card wait for the end of an episode, or for the
   Stories button, which raises the list alone over the picture mid-story. */
body.immersive .episodes,
body.immersive .endcard { display: none; }
body.immersive .player[data-ended] {
  display: flex; flex-direction: column; padding-top: 38dvh;
}
body.immersive .player[data-ended] :is(.stage__caption, .voices) { display: none; }
body.immersive .player[data-ended] :is(.endcard, .episodes) {
  display: block; position: relative; z-index: 1; margin: 0; border-radius: 0; border: 0;
  background: rgba(43, 10, 13, .96); padding: 1.25rem 1rem;
}
body.immersive .player[data-ended] .endcard { order: 1; border-radius: 22px 22px 0 0; padding-top: 1.75rem; }
body.immersive .player[data-ended] .episodes {
  order: 2; padding-bottom: calc(env(safe-area-inset-bottom) + 2rem); border-top: 1px solid var(--line);
}
body.immersive .player[data-picking] {
  display: flex; flex-direction: column; justify-content: flex-end;
}
body.immersive .player[data-picking] :is(.stage__caption, .voices, .endcard) { display: none; }
body.immersive .player[data-picking] .episodes {
  display: block; position: relative; z-index: 1; margin: 0; border: 0;
  border-radius: 22px 22px 0 0; background: rgba(43, 10, 13, .97);
  padding: 1.5rem 1rem calc(env(safe-area-inset-bottom) + 1.5rem);
}


@media (max-width: 30rem) {
  .controls { gap: .35rem; }
  .time { min-width: 2.9rem; font-size: .82rem; }
  .ep img { width: 4.25rem; }
}
