/*
  Round 2 (2026-10-20): layered over base.css. What changed after the owner saw round 1 on a phone:
  - Composed for a portrait screen first: the picture lives in the top half, large and close; the
    words in the bottom half, over a soft pool of dark; fewer words per beat.
  - Secondary text is near-white, not grey (the owner, on Digital Mycelium: "grey text is
    difficult to read on every browser"). Hierarchy comes from size, not from dimming.
  - The app itself is on the page: an iPhone built from the app's own screens (phone.js).
*/
:root {
  --muted: #ddd6c9;
  --dim: #b8ae9f;
  --t-hero: clamp(2.7rem, 11vw, 7rem);
  --t-head: clamp(2.2rem, 8.4vw, 4.8rem);
  --t-lede: clamp(1.25rem, 4.6vw, 1.55rem);
  --t-body: clamp(1.125rem, 4.2vw, 1.25rem);
  --ph-h: min(54svh, 640px);
}
@media (min-width: 700px) {
  :root {
    --t-hero: clamp(3.4rem, 6.6vw, 7rem);
    --t-head: clamp(2.6rem, 4.6vw, 4.6rem);
    --t-lede: clamp(1.3rem, 1.7vw, 1.6rem);
    --t-body: clamp(1.125rem, 1.3vw, 1.3rem);
    --ph-h: min(72vh, 720px);
  }
}

/* Nothing may widen the page: the pools and tags reach past the edges on purpose, so clip them.
   overflow: clip (not hidden) leaves position: sticky working inside each beat. */
html, body { overflow-x: clip; }
.story, .beat { overflow-x: clip; }

/* Beats: a tall section whose words stick to the bottom of the screen. */
.beat { min-height: 160vh; }
.beat.short { min-height: 120vh; }
.copy {
  justify-content: flex-end;
  gap: 0.8rem;
  padding-block: 8vh calc(9vh + env(safe-area-inset-bottom, 0px));
  max-width: 44rem;
}
.copy.center { text-align: center; align-items: center; }
/* The pool of dark under the words: a gradient up from the bottom, never a box, never over the picture. */
.copy.pool::before {
  content: "";
  position: absolute;
  left: -40vw;
  right: -40vw;
  bottom: -6vh;
  height: 72vh;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to top, var(--ink) 0%, color-mix(in srgb, var(--ink) 92%, transparent) 38%, transparent 100%);
}
h1, h2 { line-height: 1.0; }
.lede { max-width: 30ch; }
.body { max-width: 36ch; color: var(--muted); }
.quote { max-width: 24ch; }

@media (min-width: 900px) {
  /* Wide screens: words on the left third, the picture to the right. */
  .copy { max-width: 40rem; padding-left: max(var(--gutter-l), 6vw); justify-content: center; padding-block: 14vh; }
  .copy.center { max-width: 50rem; margin-inline: auto; padding-left: var(--gutter-l); }
  .copy.pool::before {
    left: -20vw; right: -10vw; top: -10vh; bottom: -10vh; height: auto;
    background: radial-gradient(62% 62% at 42% 50%, color-mix(in srgb, var(--ink) 96%, transparent), color-mix(in srgb, var(--ink) 70%, transparent) 45%, transparent 72%);
  }
}

/* The iPhone, built from the app's own screens. Sized by height so it fits a portrait screen's top half. */
.ph-layer { position: fixed; inset: 0; z-index: 1; pointer-events: none; perspective: 1400px; perspective-origin: 50% 40%; }
.ph {
  position: absolute;
  left: 0;
  top: 0;
  height: var(--ph-h);
  width: calc(var(--ph-h) * 0.4615);
  margin-left: calc(var(--ph-h) * -0.23075);
  transform-style: preserve-3d;
  will-change: transform, opacity;
  container-type: size;
}
.ph .body {
  position: absolute; inset: 0;
  border-radius: calc(var(--ph-h) * 0.085);
  background: linear-gradient(160deg, #2b2621, #0c0b0a 45%, #1c1916);
  box-shadow:
    0 0 0 calc(var(--ph-h) * 0.004) #0a0908,
    0 calc(var(--ph-h) * 0.06) calc(var(--ph-h) * 0.12) rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: inherit; max-width: none; margin: 0;
}
.ph .edge {
  position: absolute; inset: calc(var(--ph-h) * 0.004);
  border-radius: calc(var(--ph-h) * 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02) 30%, rgba(0,0,0,0.3));
  pointer-events: none;
}
.ph .screen {
  position: absolute; inset: calc(var(--ph-h) * 0.017);
  border-radius: calc(var(--ph-h) * 0.07);
  overflow: hidden;
  background: var(--ink);
  color: var(--ivory);
  font-family: var(--text);
  font-size: calc(var(--ph-h) * 0.0235);
  line-height: 1.4;
}
.ph .island {
  position: absolute; left: 50%; top: calc(var(--ph-h) * 0.017);
  width: calc(var(--ph-h) * 0.17); height: calc(var(--ph-h) * 0.05);
  transform: translateX(-50%);
  border-radius: 999px; background: #000; z-index: 3;
}
.ph .glare {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, rgba(255,255,255,0.09) 0%, rgba(255,255,255,0.02) 28%, transparent 46%);
}
.ph .scr {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: calc(var(--ph-h) * 0.085) calc(var(--ph-h) * 0.034) calc(var(--ph-h) * 0.04);
  opacity: 0; transition: opacity 0.7s var(--ease);
}
.ph .scr.on { opacity: 1; }
.ph .ey { font-size: 0.72em; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); font-weight: 500; }
.ph .ser { font-family: var(--display); font-weight: 300; line-height: 1.08; letter-spacing: -0.01em; }
.ph .q { font-size: 1.95em; margin-top: 0.35em; }
.ph .q.sm { font-size: 1.55em; }
.ph .mu { color: var(--muted); }
.ph .pill { margin-top: auto; background: var(--ivory); color: var(--ink); border-radius: 999px; text-align: center; padding: 0.8em; font-weight: 500; font-size: 1em; }
.ph .quiet-row { text-align: center; color: var(--muted); padding: 0.7em 0 0; }
.ph .rule { height: 1px; background: var(--hairline); margin: 0.9em 0; }
.ph .row { display: flex; align-items: center; gap: 0.7em; padding: 0.6em 0; }
.ph .row.sep { border-top: 1px solid var(--hairline); }
.ph .row .t { flex: 1; min-width: 0; }
.ph .row .t b { display: block; font-weight: 500; font-family: var(--display); font-size: 1.25em; font-weight: 300; }
.ph .row .t span { color: var(--muted); font-size: 0.86em; }
.ph .tick { width: 1.1em; height: 1.1em; border-radius: 50%; border: 1px solid var(--hairline); display: grid; place-items: center; color: var(--gold); font-size: 0.9em; }
.ph .tick.on { border-color: var(--gold); background: var(--gold-soft); }
.ph .cover { position: relative; border-radius: 0.9em; overflow: hidden; aspect-ratio: 4 / 5; background: radial-gradient(80% 70% at 50% 35%, #4a3828, #1a1512 70%); margin-top: 0.8em; }
.ph .cover.wide { aspect-ratio: 16 / 10; }
.ph .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(11,10,9,0.55), transparent 55%); }
.ph .cover .fig { position: absolute; left: 50%; bottom: -6%; width: 62%; aspect-ratio: 1 / 1.1; transform: translateX(-50%); border-radius: 45% 45% 10% 10% / 50% 50% 8% 8%; background: radial-gradient(60% 50% at 50% 30%, #6b5340, #2c2119 70%); filter: blur(2px); opacity: 0.9; }
.ph .cover .fig::before { content: ""; position: absolute; left: 50%; top: -28%; width: 42%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 40% 35%, #7d6450, #3a2d24 70%); }
.ph .cover .rings { position: absolute; right: 0.7em; top: 0.7em; width: 1.6em; color: var(--gold); opacity: 0.9; }
.ph .bar { display: flex; align-items: center; gap: 0.7em; margin-top: 0.9em; font-variant-numeric: tabular-nums; font-size: 0.9em; color: var(--muted); }
.ph .bar .play { width: 2.4em; height: 2.4em; border-radius: 50%; background: var(--ivory); color: var(--ink); display: grid; place-items: center; flex: none; }
.ph .bar .play::before { content: ""; border-left: 0.75em solid var(--ink); border-top: 0.5em solid transparent; border-bottom: 0.5em solid transparent; margin-left: 0.2em; }
.ph .bar .track { flex: 1; height: 3px; background: var(--hairline); border-radius: 2px; position: relative; }
.ph .bar .track i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 35%); background: var(--gold); border-radius: 2px; }
.ph .bar .track i::after { content: ""; position: absolute; right: -0.35em; top: 50%; width: 0.7em; height: 0.7em; border-radius: 50%; background: var(--gold); transform: translateY(-50%); }
.ph .words { margin-top: 1em; font-family: var(--display); font-size: 1.2em; line-height: 1.35; color: var(--muted); }
.ph .words b { font-weight: 400; color: var(--ivory); background: linear-gradient(transparent 60%, var(--gold-soft) 60%); }
.ph .words .tc { font-family: var(--text); font-size: 0.7em; color: var(--gold); letter-spacing: 0.08em; margin-right: 0.5em; font-variant-numeric: tabular-nums; }
.ph .ask { margin-top: auto; display: flex; align-items: center; gap: 0.6em; border: 1px solid var(--hairline); border-radius: 999px; padding: 0.55em 0.5em 0.55em 1em; font-size: 0.95em; color: var(--ivory); }
.ph .ask .mic { margin-left: auto; width: 2.1em; height: 2.1em; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; flex: none; }
.ph .ask .mic i { width: 0.5em; height: 0.9em; border-radius: 0.3em; background: var(--ink); display: block; }
.ph .ans { margin-top: 1em; border: 1px solid var(--hairline); border-radius: 1em; padding: 0.9em 1em; background: var(--surface); }
.ph .ans .who { display: flex; justify-content: space-between; font-size: 0.82em; color: var(--muted); font-variant-numeric: tabular-nums; }
.ph .ans .who b { color: var(--ivory); font-weight: 500; }
.ph .ans .who em { color: var(--gold); font-style: normal; }
.ph .ans p { margin: 0.4em 0 0; font-family: var(--display); font-size: 1.2em; line-height: 1.3; }
.ph .cam { position: absolute; inset: 0; background: radial-gradient(90% 60% at 50% 40%, #3d3027, #0b0a09 75%); }
.ph .cam .fig { position: absolute; left: 50%; bottom: 0; width: 72%; height: 48%; transform: translateX(-50%); border-radius: 45% 45% 0 0 / 60% 60% 0 0; background: radial-gradient(60% 60% at 50% 30%, #5d4a3b, #241c16 75%); filter: blur(3px); }
.ph .cam .fig::before { content: ""; position: absolute; left: 50%; top: -40%; width: 40%; aspect-ratio: 1 / 1.15; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(circle at 45% 35%, #7a6150, #35291f 70%); }
.ph .cam .top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--ph-h) * 0.085) calc(var(--ph-h) * 0.034) 0; background: linear-gradient(var(--ink), transparent); }
.ph .cam .bot { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.2em calc(var(--ph-h) * 0.034) calc(var(--ph-h) * 0.04); background: linear-gradient(transparent, var(--ink) 70%); display: flex; flex-direction: column; gap: 0.7em; }
.ph .cam .rec { display: flex; align-items: center; gap: 0.5em; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.9em; }
.ph .cam .rec i { width: 0.6em; height: 0.6em; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.ph .cam .finish { background: var(--ivory); color: var(--ink); border-radius: 999px; text-align: center; padding: 0.85em; font-weight: 500; }
.ph .cam .coach { font-family: var(--display); font-size: 1.25em; color: var(--ivory); }
.ph .avatar { width: 2.4em; height: 2.4em; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #6b5340, #2c2119 75%); flex: none; }
.ph .avatar.you { background: radial-gradient(circle at 40% 35%, #8f7a60, #3b3126 75%); }
.ph .tree { position: relative; flex: 1; margin-top: 1em; }
.ph .tree svg { width: 100%; height: 100%; }
.ph .tabs { margin-top: auto; display: flex; justify-content: space-around; padding-top: 0.8em; border-top: 1px solid var(--hairline); font-size: 0.78em; color: var(--muted); }
.ph .tabs b { color: var(--ivory); font-weight: 500; }
.ph .list .row { padding: 0.75em 0; }
.ph .list .thumb { width: 3.6em; height: 2.7em; border-radius: 0.5em; background: radial-gradient(70% 70% at 50% 40%, #4a3828, #1a1512 80%); flex: none; }
.ph .now { margin-top: 0.4em; font-size: 0.86em; color: var(--muted); }
.ph .grow { display: flex; gap: 0.35em; margin-top: 0.8em; }
.ph .grow i { flex: 1; height: 0.45em; border-radius: 2px; background: var(--hairline); }
.ph .grow i.on { background: var(--gold); }

/* Words that sit in the scene (names, time codes), placed by the script. */
.tags { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.tags span { position: absolute; left: 0; top: 0; white-space: nowrap; opacity: 0; will-change: transform, opacity; text-shadow: 0 1px 14px rgba(0,0,0,0.9); }
.tags .nm { font: 400 italic clamp(1.1rem, 4vw, 1.5rem)/1 var(--display); color: var(--ivory); }
.tags .cap { font: 500 0.72rem/1.3 var(--text); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }

/* The who-can-see rows, as in the app. */
.who-can { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 0; padding: 0; }
.who-can li { min-height: 46px; display: inline-flex; align-items: center; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--hairline); color: var(--muted); font-size: 1rem; }
.who-can li.on { border-color: var(--gold); color: var(--ivory); background: var(--gold-soft); }

/* The way into the web app, top right. */
.site-top .signin {
  pointer-events: auto;
  display: inline-flex; align-items: center;
  min-height: 42px; padding: 0 1.1rem;
  border-radius: 999px; border: 1px solid var(--gold-soft);
  color: var(--ivory); text-decoration: none;
  font: 500 0.95rem/1 var(--text); letter-spacing: 0.02em;
  background: rgba(11, 10, 9, 0.5);
  transition: border-color 0.5s var(--ease), background 0.5s var(--ease);
}
.site-top .signin:hover { border-color: var(--gold); background: var(--gold-soft); }

/* The last beat. */
.final { display: flex; flex-direction: column; gap: 1.2rem; align-items: flex-start; }
.copy.center .final { align-items: center; }
.final .cta { font-size: 1.15rem; min-height: 64px; padding: 0 2.3rem; white-space: nowrap; }

/* The proverb, large. */
.proverb { font-family: var(--display); font-weight: 300; font-size: clamp(2rem, 7.6vw, 4.2rem); line-height: 1.08; margin: 0; max-width: 16ch; text-wrap: balance; }
.proverb em { color: var(--gold); font-style: italic; }
.proverb small { display: block; font-family: var(--text); font-size: 0.95rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) { .ph .scr { transition: none; } }
