@font-face { font-family: "OpenDyslexic"; src: url("assets/fonts/OpenDyslexic-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OpenDyslexic"; src: url("assets/fonts/OpenDyslexic-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

/* Features version: light garden palette. */
:root {
  --ink: #23303d;
  --muted: rgba(35, 48, 61, 0.72);
  --unread: rgba(35, 48, 61, 0.42);
  --cream: #fffaf0;
  --panel: rgba(255, 250, 240, 0.94);
  --sky-top: #bfe0f7;
  --sky-low: #eef8ff;
  --hero-top: #a9d6f5;
  --accent: #237a5b;        /* read words, title */
  --orange: #f2793a;
  --mistake: #d43a3a;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "Nunito", system-ui, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; display: block; }
h1, h2 { font-family: "Love Ya Like A Sister", "Nunito", cursive; font-weight: 400; }

/* ---------- top bar ---------- */
.topbar { position: fixed; inset: 0 0 auto 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 40px); z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 250, 240, 0.9) 0%, rgba(255, 250, 240, 0.65) 50%, rgba(255, 250, 240, 0) 100%); }
.appstore-badge { display: inline-block; line-height: 0; border-radius: 9px; }
.appstore-badge img { height: 100%; width: auto; }
.appstore-badge-small { height: 30px; border-radius: 7px; }
.appstore-badge-large { height: 56px; }
.appstore-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn { display: inline-block; font-weight: 800; text-decoration: none; background: var(--orange); color: #fff; border: 0; border-radius: 999px; padding: 14px 24px; cursor: pointer; }
.btn-ghost { background: transparent; border: 2px solid var(--accent); color: var(--accent); font-family: inherit; }

/* ---------- title screen ---------- */
/* A transparent layer over the first pinned scene (#f-phone): it scrolls away with the page while the scene
   stays, so the devices lie right below the payoff on the first screen. */
main { position: relative; }
.hero { position: absolute; left: 0; right: 0; top: 0; z-index: 1; height: 100vh; height: 100svh; overflow: hidden; pointer-events: none;
  text-align: center; padding: max(70px, 9svh) 16px 0; }
.hero-content { position: relative; }
.hero-title-pin h1.is-placeholder { visibility: hidden; }
.floating-title { position: fixed; left: 50%; top: 0; z-index: 60; pointer-events: none; white-space: nowrap;
  font-family: "Love Ya Like A Sister", "Nunito", cursive; font-size: clamp(3.5rem, 15vw, 8rem); line-height: 1.15;
  color: var(--orange); text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7); transform-origin: 50% 50%; will-change: transform; }
.topbar-title { position: absolute; left: 50%; transform: translateX(-50%); color: var(--orange); font-family: "Love Ya Like A Sister", cursive; font-size: 1.6rem; }
.hero h1 { font-size: clamp(3.5rem, 15vw, 8rem); margin: 0; color: var(--orange); line-height: 1.15; }
.hero .tagline { margin: 10px auto 0; max-width: 34ch; text-wrap: balance; font-size: clamp(1.25rem, 4.4vw, 1.9rem); font-weight: 700; }
/* the first scene keeps the title screen's deeper sky at the top */
#f-phone .pin { background: linear-gradient(to bottom, var(--hero-top) 0%, var(--sky-top) 45%, var(--sky-low) 100%); }

/* scroll cue, right edge: a dot runs down a short track and fades, then a chevron nods */
.scroll-cue { position: absolute; right: max(14px, 3vw); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scroll-cue-track { position: relative; width: 3px; height: 72px; border-radius: 3px; background: rgba(35, 48, 61, 0.18); overflow: hidden; }
.scroll-cue-dot { position: absolute; left: 0; top: 0; width: 3px; height: 22px; border-radius: 3px; background: var(--orange); animation: cue-run 1.8s cubic-bezier(0.5, 0, 0.3, 1) infinite; }
.scroll-cue-chevron { width: 12px; height: 12px; border-right: 3px solid var(--orange); border-bottom: 3px solid var(--orange); border-radius: 0 0 3px 0;
  transform: rotate(45deg); animation: cue-nod 1.8s ease-in-out infinite; }
@keyframes cue-run { 0% { transform: translateY(-22px); opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { transform: translateY(72px); opacity: 0; } }
@keyframes cue-nod { 0%, 55% { transform: translateY(0) rotate(45deg); } 75% { transform: translateY(5px) rotate(45deg); } 100% { transform: translateY(0) rotate(45deg); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue-dot, .scroll-cue-chevron { animation: none; } .scroll-cue-dot { top: 25px; } }

.cloud { position: absolute; width: 140px; height: 44px; border-radius: 44px; background: rgba(255, 255, 255, 0.9); }
.cloud::before, .cloud::after { content: ""; position: absolute; background: inherit; border-radius: 50%; }
.cloud::before { width: 60px; height: 60px; left: 24px; top: -30px; }
.cloud::after { width: 46px; height: 46px; left: 72px; top: -20px; }
.cloud-1 { left: 6%; top: 15%; }
.cloud-2 { left: 74%; top: 34%; transform: scale(0.7); opacity: 0.8; }
@media (max-width: 520px) { .cloud-1 { left: -12%; top: 30%; } .cloud-2 { top: 9%; } }

/* ---------- feature sections: tall section, sticky full-screen .pin ---------- */
.feat { position: relative; height: var(--len, 220vh); }
.pin { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.sky-bg { background: linear-gradient(to bottom, var(--sky-top) 0%, var(--sky-low) 100%); }
.cream-bg { background: var(--cream); }
.f-copy { position: absolute; left: 50%; top: 78px; transform: translateX(-50%); width: min(calc(100vw - 32px), 820px); text-align: center; z-index: 5; }
.f-copy h2 { margin: 0; font-size: clamp(2rem, 7vw, 3.6rem); color: var(--accent); line-height: 1.1; text-wrap: balance; }
.f-copy p { margin: 10px auto 0; max-width: 46ch; font-size: clamp(1rem, 3.4vw, 1.3rem); color: var(--ink); text-wrap: balance; }
.f-copy-2 { opacity: 0; }

.tale-text { font-family: "OpenDyslexic", "Nunito", sans-serif; }
.w { color: var(--unread); }
.w.sound-word { cursor: pointer; text-decoration: underline wavy var(--orange); text-underline-offset: 6px; }

/* 1. the device family: iPad (landscape) with the iPhone in front of its lower-right corner.
   Sizes inside use cqw (% of the iPad's width), so both devices scale together. The iPad's proportions
   match the recording's screen (iPad A16, 2360 × 1640) inside a 2.2cqw bezel. */
/* the app's page colour fades in behind the dive, so the zoomed iPad screen becomes one seamless page */
.pin-cream { position: absolute; inset: 0; background: #fafafa; opacity: 0; }
.phone-stage { position: absolute; inset: 0; perspective: 1100px; perspective-origin: 50% 30%; }
.devices { position: absolute; left: 50%; top: 60%; width: min(70vw, 560px, calc((100dvh - 340px) * 1.41)); aspect-ratio: 1.412 / 1;
  container-type: inline-size; transform-style: preserve-3d; }
.ipad { position: absolute; inset: 0; border-radius: 4cqw; background: #1d232b; padding: 2.2cqw; box-shadow: 0 30px 60px rgba(35, 48, 61, 0.28); }
.screen { position: relative; height: 100%; background: #fafafa; overflow: hidden; }
.ipad-screen { border-radius: 2.2cqw; }
.app-video, .app-shot { display: block; width: 100%; height: 100%; object-fit: cover; }
/* where the page's text sits in the iPad recording (the camera dives into it) */
.ipad-zoom-target { position: absolute; left: 3%; top: 6%; width: 60%; height: 26%; pointer-events: none; }
.phone { position: absolute; right: -7%; bottom: -16%; width: 25%; aspect-ratio: 9 / 19.5; border-radius: 4.4cqw; background: #1d232b; padding: 1.2cqw;
  box-shadow: 0 24px 50px rgba(35, 48, 61, 0.35); }
.phone-screen { border-radius: 3.4cqw; }

/* a free-standing iPhone frame (syllables scene, parental-gate card) */
/* the screen is inset (not padded: % padding follows the parent's width), with the recording's proportions (iPhone 17) */
.device-phone { position: relative; aspect-ratio: 9 / 19.5; background: #1d232b; border-radius: 13% / 6%; box-shadow: 0 24px 50px rgba(35, 48, 61, 0.3); }
.device-phone .screen { position: absolute; left: 2.5%; right: 2.5%; top: 2.36%; bottom: 2.36%; height: auto; border-radius: 11% / 5%; }
.device-phone img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* 2. giant words */
.giant { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(calc(100vw - 40px), 1100px); margin: 0;
  font-size: clamp(2.2rem, 7.6vw, 5.4rem); line-height: 1.35; font-weight: 700; text-align: center; text-wrap: balance; }
.giant-source { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; color: var(--muted); font-style: italic; margin: 0; }

/* 3. the stumble: an iPhone playing recording B, between the copy and the bottom of the screen */
.stumble-stage { position: absolute; left: 0; right: 0; top: clamp(220px, 31dvh, 300px); bottom: 3dvh; display: flex; justify-content: center; perspective: 900px; }
.stumble-phone { height: 100%; max-width: calc(100vw - 32px); }

/* 4. characters that play */
.characters { position: absolute; inset: 0; }
.character { position: absolute; width: min(17vw, 130px); margin-left: calc(min(17vw, 130px) / -2); margin-top: calc(min(17vw, 130px) / -2);
  cursor: pointer; background: none; border: 0; padding: 0; }
.character img { width: 100%; transform-origin: 50% 50%; filter: drop-shadow(0 8px 14px rgba(35, 48, 61, 0.18)); }
.sounds-card { position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%); width: min(calc(100vw - 32px), 760px);
  background: #fff; border-radius: var(--radius); padding: 18px 22px; box-shadow: 0 10px 30px rgba(35, 48, 61, 0.12); }
.sounds-sentence { margin: 0; font-size: clamp(1.05rem, 3.6vw, 1.45rem); line-height: 1.7; text-align: center; }
.sounds-sentence .w { color: var(--ink); }

/* 5. covers corridor (vanishing point at 50% 52%) */
.corridor { position: absolute; inset: 0; }
.cover { position: absolute; left: 50%; top: 52%; width: 34vmin; margin-left: -17vmin; margin-top: -21vmin; border-radius: 20px; background: var(--c);
  padding: 2.2vmin; box-shadow: 0 14px 30px rgba(35, 48, 61, 0.22); transform-origin: 50% 50%; will-change: transform, opacity; }
.cover img { width: 78%; margin: 0 auto; }
.cover p { margin: 1.4vmin 0 0; text-align: center; font-weight: 800; font-size: 2.4vmin; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); line-height: 1.15; }
.cover.light p { color: var(--ink); text-shadow: none; }

/* 6. flip card */
.flip-stage { position: absolute; inset: 0; perspective: 1000px; }
.flip-card { position: absolute; left: 50%; top: 57%; width: min(calc(100vw - 40px), 760px); height: min(36vh, 260px); margin-left: calc(min(calc(100vw - 40px), 760px) / -2);
  transform: translateY(-50%); transform-style: preserve-3d; }
.flip-face { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 6%; border-radius: 24px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  font-size: clamp(1.2rem, 4.4vw, 2.3rem); line-height: 1.5; box-shadow: 0 14px 40px rgba(35, 48, 61, 0.15); }
.flip-a { background: #fff; color: var(--ink); }
.flip-b { background: var(--accent); color: #fff; transform: rotateX(180deg); }

/* 7. font morph */
.font-stage { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); width: min(calc(100vw - 40px), 900px); text-align: center; }
.font-sample { margin: 0; font-size: clamp(1.6rem, 6vw, 3.4rem); line-height: 1.4; }
.font-plain { font-family: Georgia, "Times New Roman", serif; }
.font-dys { position: absolute; inset: 0; font-family: "OpenDyslexic", sans-serif; color: var(--accent); opacity: 0; }

/* 8. safety cards */
.safe-cards { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); width: min(calc(100vw - 32px), 1000px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; perspective: 900px; }
.safe-card { background: #fff; border-radius: var(--radius); padding: 22px; box-shadow: 0 12px 30px rgba(35, 48, 61, 0.12); text-align: center; transform-origin: 50% 100%; }
.safe-card .icon { font-size: 2.2rem; }
.mini-phone { width: 74px; margin: 0 auto 4px; box-shadow: 0 8px 18px rgba(35, 48, 61, 0.22); }
@media (max-width: 600px) {
  /* stacked cards: the phone sits beside the text */
  .safe-card.has-shot { display: grid; grid-template-columns: 58px 1fr; column-gap: 14px; text-align: left; align-items: center; }
  .safe-card.has-shot .mini-phone { grid-row: span 2; width: 58px; margin: 0; }
  .safe-card.has-shot h3 { margin-top: 0; }
}
.safe-card h3 { margin: 8px 0 6px; font-size: 1.15rem; }
.safe-card p { margin: 0; color: var(--muted); }
@media (max-width: 600px) { .safe-cards { gap: 10px; } .safe-card { padding: 14px; } .safe-card p { font-size: 0.9rem; } }

/* 9. the author */
.author { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); width: min(calc(100vw - 32px), 760px); text-align: center; }
.portrait { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center;
  font-family: "Love Ya Like A Sister", cursive; font-size: 3.4rem; box-shadow: 0 10px 30px rgba(35, 48, 61, 0.2); }
.author h2 { margin: 0; font-size: clamp(1.9rem, 6.4vw, 3.2rem); color: var(--accent); line-height: 1.15; text-wrap: balance; }
.author p { margin: 12px auto 18px; color: var(--muted); }
.instruments { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.instrument { font: inherit; font-weight: 800; background: #fff; color: var(--ink); border: 2px solid var(--accent); border-radius: 999px; padding: 10px 20px; cursor: pointer; }
.instrument.playing { background: var(--accent); color: #fff; }

/* ---------- demo ---------- */
.finale { position: relative; z-index: 1; background: var(--cream); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 104px 0 32px; }
.demo { padding: 0 16px; width: 100%; max-width: 760px; margin: 0 auto; text-align: center; }
.demo h2 { font-size: clamp(2.2rem, 8vw, 3.5rem); color: var(--accent); margin: 0; }
.demo-intro { color: var(--muted); margin: 8px 0 88px; }
.demo-card { background: #fff; border: 1px solid rgba(35, 48, 61, 0.1); border-radius: var(--radius); padding: 24px 20px; position: relative; box-shadow: 0 10px 30px rgba(35, 48, 61, 0.08); }
.demo-hedgehog { width: 110px; margin: -84px auto 8px; }
.demo-sentence { font-size: clamp(1.15rem, 4.2vw, 1.6rem); }
.demo-sentence .w { cursor: pointer; transition: color 0.2s, transform 0.2s; display: inline-block; }
.demo-sentence .w.read { color: var(--accent); }
.demo-sentence .w.next { color: var(--ink); }
.demo-sentence .w.hint { color: var(--ink); transform: scale(1.25); }
.demo-sentence .w.wrong { color: var(--mistake); }
.demo-syllables[hidden] { display: none; }
.demo-syllables { margin: 18px auto 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.demo-syllables-word { font-family: "OpenDyslexic", sans-serif; font-weight: 700; font-size: clamp(1.8rem, 8vw, 3rem); background: var(--cream); border-radius: 16px; padding: 0.1em 0.5em; }
.demo-syllables-word span:nth-child(odd) { color: #1d6fd8; }
.demo-syllables-word span:nth-child(even) { color: #d8431d; }
.demo-controls { margin-top: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mic { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-weight: 800; font-size: 1.05rem; background: var(--orange); color: #fff; border: 0; border-radius: 999px; padding: 14px 26px; cursor: pointer; }
.mic svg { width: 24px; height: 24px; fill: currentColor; }
.mic[aria-pressed="true"] { background: var(--mistake); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(212, 58, 58, 0.2); } }
.demo-status { min-height: 1.5em; color: var(--muted); margin: 0; }
.demo-debug { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; color: var(--accent); margin: 0; word-break: break-word; }
.demo-privacy { color: var(--muted); font-size: 0.85rem; margin-top: 16px; }
.end { text-align: center; padding: 36px 16px 0; }

/* ---------- reduced motion: sections become plain blocks, everything visible ---------- */
body.reduced .hero { position: relative; height: auto; padding-bottom: 24px; background: linear-gradient(to bottom, var(--hero-top), var(--sky-top)); }
body.reduced .devices { transform: translate(-50%, -50%); }
body.reduced .scroll-cue { display: none; }
body.reduced .feat { height: auto; }
body.reduced .pin { position: relative; height: auto; min-height: 0; padding: 110px 0 40px; overflow: visible; }
body.reduced .f-copy, body.reduced .giant, body.reduced .font-stage, body.reduced .safe-cards, body.reduced .author { position: relative; left: auto; top: auto; transform: none; margin: 0 auto; }
body.reduced .f-copy-2, body.reduced .font-dys, body.reduced .flip-b, body.reduced .corridor { display: none; }
body.reduced .phone-stage, body.reduced .flip-stage, body.reduced .characters { position: relative; height: 70vh; }
body.reduced .stumble-stage { position: relative; top: auto; bottom: auto; height: 70vh; margin-top: 24px; }
body.reduced .sounds-card { position: relative; left: auto; bottom: auto; transform: none; margin: 20px auto 0; }
body.reduced .w { color: var(--ink); }
