/* Avec Maya site. Colours come from the app (src/theme/tokens.ts). */
:root {
  --ink: #2B2350;
  --ink-soft: #5E5689;
  --paper: #FFF6E9;
  --moon: #FFE08A;
  --lamp: #FFD27A;
  --coral: #FF7A59;
  --lilac: #8C6CF0;
  --night: #15133A;
  --night-2: #221E57;
  --night-3: #2E2A6B;
  --starlight: #EDE9FF;
  --starlight-soft: #B9B3E6;

  --dusk-1: #FFE9D6;
  --dusk-2: #FFD3CF;
  --twilight: #D8C8F5;
  --lavender: #B9A5EF;

  --display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  --gutter: clamp(16px, 5vw, 48px);
  --measure: 1120px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 500 18px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }

.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.site-header { position: relative; z-index: 2; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; }
.brand { display: flex; white-space: nowrap; flex-shrink: 0; align-items: center; gap: 10px; text-decoration: none; font: 700 22px/1 var(--display); letter-spacing: -0.01em; }
.brand img { width: 40px; height: 40px; }
.brand .avec { font-weight: 500; opacity: 0.72; }
.nav { display: flex; gap: clamp(12px, 3vw, 28px); font-weight: 700; font-size: 16px; }
.nav a { text-decoration: none; opacity: 0.8; }
.nav a:hover { opacity: 1; text-decoration: underline; }
.nav .nav-cta { opacity: 1; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: var(--paper); white-space: nowrap; }
.nav .nav-cta:hover { text-decoration: none; background: #3B3380; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- the sunset: every band starts where the last one ended ---------- */
.band { position: relative; overflow: hidden; }
.band > .wrap { position: relative; z-index: 1; }
.dusk     { background: linear-gradient(var(--dusk-1), var(--dusk-2)); }
.evening  { background: linear-gradient(var(--dusk-2), var(--twilight)); }
.lavender { background: linear-gradient(var(--twilight), var(--lavender)); }
.twilight { background: linear-gradient(var(--lavender) 0%, #7A66D6 55%, var(--night-3) 100%); }
.nightfall{ background: linear-gradient(var(--night-3), var(--night-2)); color: var(--starlight); }
.midnight { background: linear-gradient(var(--night-2), var(--night)); color: var(--starlight); }

.stars { position: absolute; inset: 0; pointer-events: none; }
.stars svg { position: absolute; fill: #FFF1C4; animation: twinkle 4s ease-in-out infinite; }
.stars svg:nth-child(2n) { animation-delay: -1.3s; }
.stars svg:nth-child(3n) { animation-delay: -2.6s; }
@keyframes twinkle { 50% { opacity: 0.35; } }

/* ---------- hero ---------- */
.hero > .wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: clamp(24px, 5vw, 64px); padding-top: clamp(24px, 6vw, 72px); padding-bottom: clamp(40px, 6vw, 72px); }
.kicker { font: 800 14px/1.2 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 18px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(44px, 7.4vw, 88px); line-height: 0.98; }
h1 em { font-style: normal; color: #D9472A; }
.lede { font-size: clamp(18px, 2vw, 21px); max-width: 32em; margin: 24px 0 32px; color: var(--ink-soft); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 14px 22px; border-radius: 999px; font: 600 18px/1 var(--display); text-decoration: none; }
.pill-solid { background: var(--ink); color: var(--paper); }
.pill-solid svg { width: 18px; height: 18px; fill: currentColor; }
.pill-ghost { box-shadow: inset 0 0 0 2px rgba(43, 35, 80, 0.25); }
.pill-ghost:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.hero-stage { position: relative; justify-self: center; width: min(100%, 500px); aspect-ratio: 1 / 1; }
/* a little fan of real pages from stories made in the app */
.leafy { position: absolute; margin: 0; padding: 10px; background: var(--paper); border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 30px 50px -28px rgba(43, 35, 80, 0.65); }
.leafy img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.leafy-back { width: 62%; }
.l1 { left: -12%; top: 6%; transform: rotate(-11deg); animation: sway 7s ease-in-out infinite; --r: -11deg; }
.l2 { right: -12%; top: -2%; transform: rotate(10deg); animation: sway 8s -2s ease-in-out infinite; --r: 10deg; }
.leafy-front { left: 5%; right: 5%; bottom: 2%; padding: 12px 12px 16px; transform: rotate(-1.5deg); }
@keyframes sway { 50% { transform: rotate(calc(var(--r) * 0.8)) translateY(-8px); } }
.readalong { margin: 12px 4px 0; font: 600 clamp(16px, 1.7vw, 19px)/1.4 var(--display); color: var(--ink); }
.readalong b { font-weight: 600; border-radius: 6px; padding: 0 2px; margin: 0 -2px; animation: say 7s infinite; animation-delay: calc(var(--i) * 0.4s + 0.8s); }
@keyframes say { 0%, 6% { background: var(--lamp); } 9%, 100% { background: transparent; } }
.peek { position: absolute; right: -2%; bottom: 30%; width: 26%; z-index: 2; animation: bob 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 14px rgba(43, 35, 80, 0.2)); }
.peek svg { width: 100%; height: auto; }

/* the name: a hand-drawn underline, rewritten whenever it changes */
.starring { white-space: nowrap; }
.name { position: relative; display: inline-block; color: #D9472A; }
.name::after { content: ""; position: absolute; left: 0; right: 0; bottom: -0.06em; height: 0.16em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 Q50 1 100 6 T198 5' fill='none' stroke='%23FFB23F' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; }
.write-on { animation: write 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.write-on::after { animation: underline 0.7s 0.15s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes write { from { clip-path: inset(0 100% 0 0); transform: translateY(6px); } to { clip-path: inset(0 0 -20% 0); transform: none; } }
@keyframes underline { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* page-load: everything in the hero rises in turn */
.rise { animation: rise 0.8s calc(var(--d, 0) * 110ms + 80ms) cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.beta-tag { display: inline-block; margin-right: 8px; padding: 4px 9px; border-radius: 999px; background: var(--ink); color: var(--lamp); letter-spacing: 0.1em; }
.places-hint { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; font: 800 14px/1.3 var(--body); color: var(--ink-soft); }
.places-hint .dot { width: 8px; height: 8px; border-radius: 50%; background: #3FC28D; box-shadow: 0 0 0 4px rgba(63, 194, 141, 0.2); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px rgba(63, 194, 141, 0.05); } }
.name-try { margin: 0 0 28px; max-width: 30em; }
.name-try label { display: block; font: 800 14px/1.2 var(--body); color: var(--ink-soft); margin-bottom: 10px; }
.name-row { display: flex; gap: 8px; padding: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.7); box-shadow: inset 0 0 0 2px rgba(43, 35, 80, 0.14), 0 12px 30px -18px rgba(43, 35, 80, 0.5); }
.name-row:focus-within { box-shadow: inset 0 0 0 2px var(--ink), 0 12px 30px -18px rgba(43, 35, 80, 0.5); }
.name-row input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; padding: 10px 14px; font: 600 19px/1.2 var(--display); color: var(--ink); outline: none; }
.name-row input::placeholder { color: #A9A3C9; }
.name-row button { border: 0; border-radius: 999px; padding: 12px 20px; background: var(--coral); color: #fff; font: 600 17px/1 var(--display); cursor: pointer; white-space: nowrap; }
.name-row button:hover { background: #F0613E; }
@keyframes bob { 50% { transform: translateY(-14px); } }

/* ---------- the reel: a screen between dusk and evening ---------- */
.watch { background: var(--dusk-2); overflow: visible; z-index: 1; }
.watch > .wrap { padding-top: 8px; padding-bottom: clamp(24px, 4vw, 48px); }
.reel { position: relative; margin: 0 auto; max-width: 1000px; width: min(100%, calc(80svh * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 28px; overflow: hidden; background: var(--night); border: 6px solid var(--ink); box-shadow: 0 40px 80px -40px rgba(43, 35, 80, 0.7); }
.reel[data-kind="portrait"] { aspect-ratio: 9 / 16; width: min(100%, calc(80svh * 9 / 16)); border-radius: 36px; }
.reel-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.reel-sound { position: absolute; right: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border: 0; border-radius: 999px; background: rgba(255, 246, 233, 0.92); color: var(--ink); font: 600 16px/1 var(--display); cursor: pointer; }
.reel-sound:hover { background: var(--paper); }
.reel-sound svg { width: 20px; height: 20px; fill: currentColor; }
.reel-sound[aria-pressed="false"] .on, .reel-sound[aria-pressed="true"] .off { display: none; }
.reel-video[controls] ~ .reel-sound { bottom: 64px; }

/* ---------- how it works ---------- */
/* Meet Maya: the brand's namesake, between the reel and the story maker. */
.meet { background: var(--dusk-2); }
.meet > .wrap { padding-top: clamp(8px, 2vw, 24px); padding-bottom: clamp(40px, 6vw, 72px); }
.meet-card {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: clamp(20px, 4vw, 48px);
  background: var(--paper); border-radius: 32px; padding: clamp(24px, 4vw, 48px);
  box-shadow: 0 24px 50px -30px rgba(43, 35, 80, 0.45);
}
.meet-card img { width: clamp(120px, 16vw, 180px); height: auto; }
.meet-card .kicker { margin-bottom: 0; }
.meet-card h2 { font-size: clamp(28px, 3.4vw, 40px); margin: 8px 0 0; }
.meet-card p:not(.kicker) { margin: 14px 0 0; font-size: 19px; color: var(--ink-soft); max-width: 36em; }
@media (max-width: 640px) {
  .meet-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.section-head { max-width: 40em; margin-bottom: clamp(32px, 5vw, 56px); }
h2 { font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04; }
.section-head p { margin: 16px 0 0; font-size: 19px; color: var(--ink-soft); }
.nightfall .section-head p, .midnight .section-head p { color: var(--starlight-soft); }
.evening .wrap, .lavender .wrap, .twilight .wrap, .nightfall .wrap { padding-top: clamp(56px, 9vw, 112px); padding-bottom: clamp(56px, 9vw, 112px); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2.4vw, 32px); counter-reset: step; }
.steps li { counter-increment: step; position: relative; }
.phone { position: relative; margin: 0 0 22px; aspect-ratio: 9 / 16; border-radius: 30px; overflow: hidden; border: 5px solid var(--ink); background: var(--night); box-shadow: 0 30px 50px -30px rgba(43, 35, 80, 0.8); transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1); }
.phone img { display: block; width: 100%; height: 100%; object-fit: cover; }
.phone::before {
  content: counter(step);
  position: absolute; z-index: 1; top: 12px; left: 12px;
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper); color: var(--ink);
  font: 700 19px/1 var(--display);
  box-shadow: 0 0 0 3px var(--ink);
}
.steps li:nth-child(odd) .phone { transform: rotate(-1.5deg); }
.steps li:nth-child(even) .phone { transform: rotate(1.5deg) translateY(18px); }
.steps li:hover .phone { transform: rotate(0) translateY(-6px); }
.steps li:nth-child(even) h3 { margin-top: 18px; }
h3 { font-size: 24px; line-height: 1.15; margin-bottom: 8px; }
.steps p { margin: 0; font-size: 17px; color: var(--ink-soft); }

/* ---------- story maker ---------- */
.evening .kicker, .lavender .kicker { margin-bottom: 12px; }
.maker { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.picks { display: grid; gap: 22px; }
.picks fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.picks legend { padding: 0; margin-bottom: 10px; font: 800 14px/1.2 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tiles[data-group="when"] { grid-template-columns: repeat(3, 1fr); }
.tiles button {
  position: relative; display: grid; justify-items: center; gap: 4px;
  padding: 12px 6px 10px; border-radius: 20px; cursor: pointer;
  background: rgba(255, 255, 255, 0.75); color: var(--ink);
  border: 3px solid rgba(43, 35, 80, 0.14);
  font: 600 15px/1.1 var(--display);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), background 0.2s, border-color 0.2s;
}
.tiles button:hover { transform: translateY(-3px); border-color: rgba(43, 35, 80, 0.35); }
.tiles button:active { transform: scale(0.96); }
.tiles button[aria-pressed="true"] { background: #FFF6E9; border-color: var(--ink); box-shadow: 0 10px 20px -12px rgba(43, 35, 80, 0.7); }
.tiles button[aria-pressed="true"]::after { content: "✓"; position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #3FC28D; color: #fff; font: 700 14px/1 var(--display); box-shadow: 0 0 0 3px var(--ink); }
.tile-art { width: 52px; height: 52px; }
.tile-art svg { width: 100%; height: 100%; }

.spread { position: sticky; top: 24px; }
.book { position: relative; display: grid; grid-template-columns: 1fr 1.25fr; padding: 14px 14px 22px; border-radius: 26px; background: var(--coral); border: 5px solid var(--ink); box-shadow: 0 40px 60px -36px rgba(43, 35, 80, 0.8); }
.leaf { background: var(--paper); border: 4px solid var(--ink); min-height: clamp(260px, 30vw, 340px); }
.leaf-left { position: relative; border-radius: 18px 6px 6px 18px; border-right-width: 2px; background: radial-gradient(circle at 50% 40%, #FFF1C9, var(--paper) 70%); }
.leaf-right { border-radius: 6px 18px 18px 6px; border-left-width: 2px; padding: clamp(16px, 2.4vw, 26px); }
.scene { position: absolute; display: block; }
.scene svg { width: 100%; height: 100%; }
.s-where { width: 62%; aspect-ratio: 1; left: 19%; top: 16%; }
.s-who { width: 44%; aspect-ratio: 1; left: 2%; bottom: 2%; }
.s-when { width: 30%; aspect-ratio: 1; right: 4%; top: 4%; }
.pop { animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes pop { from { transform: scale(0.4) rotate(-8deg); opacity: 0; } }
.story-text { margin: 0; font: 600 clamp(16px, 1.5vw, 18px)/1.6 var(--body); color: var(--ink); }
.story-text strong { display: block; font: 700 1.3em/1.1 var(--display); margin-bottom: 8px; }
.story-text em { font-style: normal; font-weight: 800; color: #D9472A; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -0.2em; background: var(--coral); animation: blink 0.8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.voice-chip { display: flex; width: fit-content; align-items: center; gap: 10px; margin: 18px auto 0; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--night-2); color: var(--starlight); font: 600 15px/1 var(--display); }
.mic { width: 26px; height: 26px; border-radius: 50%; background: var(--coral) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='9' y='4' width='6' height='11' rx='3'/%3E%3Cpath d='M6 11a6 6 0 0 0 12 0' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat center / 16px; }
.bars { display: inline-flex; gap: 3px; align-items: center; height: 16px; }
.bars i { width: 3px; height: 100%; border-radius: 2px; background: var(--lamp); animation: bar 0.9s ease-in-out infinite; }
.bars i:nth-child(2) { animation-delay: -0.2s; } .bars i:nth-child(3) { animation-delay: -0.5s; } .bars i:nth-child(4) { animation-delay: -0.1s; } .bars i:nth-child(5) { animation-delay: -0.7s; } .bars i:nth-child(6) { animation-delay: -0.35s; }
@keyframes bar { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
.maker-note { margin: 14px auto 0; max-width: 34em; text-align: center; font-size: 15px; color: var(--ink-soft); }

/* ---------- scroll reveals (only when the script is running) ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.steps .reveal:nth-child(2), .promises .reveal:nth-child(2n) { transition-delay: 0.1s; }
.steps .reveal:nth-child(3) { transition-delay: 0.2s; }
.steps .reveal:nth-child(4) { transition-delay: 0.3s; }

/* ---------- features: a bento of picture-book pages ---------- */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "pic pic help chap" "pic pic calm calm" "read read car car"; gap: 20px; }
.cell { position: relative; overflow: hidden; background: var(--paper); border-radius: 24px; padding: 26px; box-shadow: 0 18px 40px -24px rgba(21, 19, 58, 0.6); }
.cell h3 { font-size: 23px; margin-bottom: 8px; }
.cell p { margin: 0; font-size: 17px; color: var(--ink-soft); }
.cell .icon { width: 44px; height: 44px; margin-bottom: 16px; }
.cell-pictures { grid-area: pic; padding: 0; display: flex; flex-direction: column; }
.cell-pictures img { width: 100%; flex: 1; min-height: 0; object-fit: cover; }
.cell-pictures .cell-words { padding: 22px 26px 26px; }
.cell-help { grid-area: help; background: #FFE1D8; }
.cell-chapters { grid-area: chap; background: #E6DEFF; }
.cell-calm { grid-area: calm; padding: 0; display: grid; grid-template-columns: 1fr 1fr; align-items: center; background: var(--night-2); }
.cell-calm img { width: 100%; height: 100%; object-fit: cover; }
.cell-calm .cell-words { padding: 22px 24px; }
.cell-calm h3 { color: var(--paper); }
.cell-calm p { color: var(--starlight-soft); }
.cell-read { grid-area: read; }
.cell-read .demo { margin-top: 18px; padding: 16px 18px; border-radius: 16px; background: #FFFFFF; box-shadow: inset 0 0 0 2px rgba(43, 35, 80, 0.08); color: var(--ink); font-size: 20px; }
.cell-car { grid-area: car; background: #DDF6E8; display: flex; flex-direction: column; justify-content: center; }
.bento .reveal:nth-child(2), .bento .reveal:nth-child(5) { transition-delay: 0.08s; }
.bento .reveal:nth-child(3), .bento .reveal:nth-child(6) { transition-delay: 0.16s; }

/* ---------- grown-ups ---------- */
.promises { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px 48px; }
.promises li { padding-left: 36px; position: relative; }
.promises li::before { content: ""; position: absolute; left: 0; top: 6px; width: 20px; height: 20px; background: var(--lamp); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.promises h3 { color: #FFFFFF; font-size: 22px; }
.promises p { margin: 0; color: var(--starlight-soft); font-size: 17px; }
.nightfall .wrap { padding-bottom: clamp(32px, 5vw, 64px); }
.nightfall a { color: var(--lamp); }
.policy-link { margin-top: 40px; }

/* ---------- private beta: 50 stars, one per family ---------- */
.beta { background: var(--night-2); color: var(--starlight); }
.beta > .wrap { padding-top: clamp(24px, 4vw, 48px); padding-bottom: clamp(24px, 4vw, 48px); }
.beta-card { max-width: 760px; margin: 0 auto; text-align: center; padding: clamp(28px, 5vw, 56px); border-radius: 36px; background: radial-gradient(120% 90% at 50% 0%, #3A3486, var(--night-3) 60%); border: 1px solid rgba(237, 233, 255, 0.14); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.7); }
.store-link { margin-top: 24px; }
.store-link[hidden], .beta-form[hidden] { display: none; }
.beta-card .kicker { color: var(--lamp); margin-bottom: 12px; }
.beta-card h2 { color: #FFFFFF; }
.beta-lede { max-width: 34em; margin: 16px auto 0; color: var(--starlight-soft); font-size: 19px; }
.beta-form { max-width: 480px; margin: 0 auto; }
.beta-form .name-row { background: rgba(255, 255, 255, 0.95); }
.beta-form.done .name-row { display: none; }
.beta-form button:disabled { opacity: 0.6; cursor: progress; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { min-height: 1.6em; margin: 14px 0 0; font-size: 16px; }
.form-msg[data-kind="error"] { color: #FFB4A8; }
.form-msg[data-kind="ok"] { padding: 14px 18px; border-radius: 18px; background: rgba(63, 194, 141, 0.16); color: #FFFFFF; font-size: 18px; }
.form-msg a, .fine a { color: var(--lamp); }
.fine { max-width: 32em; margin: 14px auto 0; font-size: 14px; color: var(--muted, #8E87C4); }

/* ---------- goodnight ---------- */
.goodnight .wrap { padding-top: clamp(64px, 10vw, 128px); padding-bottom: 40px; text-align: center; }
.goodnight .sleepy { width: 160px; margin: 0 auto 24px; }
.goodnight h2 { color: #FFFFFF; }
.goodnight .support { margin: 16px auto 0; max-width: 34em; color: var(--starlight-soft); }
.goodnight .support a { color: var(--lamp); font-weight: 800; }
.site-footer { margin-top: clamp(56px, 8vw, 96px); padding-top: 24px; border-top: 1px solid rgba(237, 233, 255, 0.14); display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; font-size: 15px; color: var(--starlight-soft); }
.site-footer nav { display: flex; gap: 20px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #FFFFFF; }

/* ---------- legal pages: a cream book page on the night sky ---------- */
.legal { background: linear-gradient(var(--night-2), var(--night)); color: var(--starlight); min-height: 100vh; }
.legal .site-header .brand, .legal .nav { color: var(--starlight); }
.sheet {
  max-width: 780px; margin: 8px auto 0;
  background: var(--paper); color: var(--ink);
  border-radius: 8px 28px 28px 8px;
  padding: clamp(28px, 6vw, 64px);
  box-shadow: inset 14px 0 16px -14px rgba(43, 35, 80, 0.4), 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.sheet h1 { font-size: clamp(38px, 6vw, 56px); }
.sheet .updated { color: var(--ink-soft); font-size: 15px; margin: 12px 0 0; }
.sheet h2 { font-size: 26px; margin: 40px 0 10px; }
.sheet h3 { font-size: 19px; margin: 24px 0 6px; }
.sheet p, .sheet li { font-size: 17px; }
.sheet ul { padding-left: 22px; }
.sheet li { margin: 6px 0; }
.sheet .summary { background: #FFEBD1; border-radius: 16px; padding: 18px 22px; margin-top: 28px; }
.sheet .summary p { margin: 0; }
.sheet table { width: 100%; border-collapse: collapse; font-size: 16px; margin: 12px 0; }
.sheet th, .sheet td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid rgba(43, 35, 80, 0.14); }
.sheet th { font-family: var(--display); font-weight: 600; }
.legal .site-footer { max-width: 780px; margin: 40px auto 0; padding-bottom: 40px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .hero > .wrap { grid-template-columns: minmax(0, 1fr); }
  .hero-stage { width: min(84%, 400px); grid-row: 2; margin-top: 8px; }
  .maker { grid-template-columns: 1fr; }
  .spread { position: static; }
  /* steps become a swipeable row of phones */
  .steps { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: clamp(220px, 64vw, 280px); overflow-x: auto; scroll-snap-type: x mandatory; padding: 8px var(--gutter) 28px; margin: 0 calc(var(--gutter) * -1); scrollbar-width: none; }
  .steps::-webkit-scrollbar { display: none; }
  .steps li { scroll-snap-align: center; }
  .steps li:nth-child(even) .phone { transform: rotate(1.5deg); }
  .steps li:nth-child(even) h3 { margin-top: 0; }
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "pic pic" "help chap" "calm calm" "read read" "car car"; }
  .cell-pictures img { aspect-ratio: 4 / 3; flex: none; height: auto; }
}
@media (max-width: 600px) {
  body { font-size: 17px; }
  .nav { gap: 12px; font-size: 15px; }
  .brand { font-size: 19px; gap: 8px; }
  .brand img { width: 32px; height: 32px; }
  .hero-stage { width: min(92%, 340px); }
  .starring { white-space: normal; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .tiles[data-group="when"] { grid-template-columns: repeat(3, 1fr); }
  .book { grid-template-columns: 1fr; padding: 10px 10px 16px; }
  .leaf { min-height: 0; }
  .leaf-left { height: 190px; border-radius: 18px 18px 6px 6px; border-right-width: 4px; border-bottom-width: 2px; }
  .leaf-right { border-radius: 6px 6px 18px 18px; border-left-width: 4px; border-top-width: 2px; }
  /* The picture page is wide and short here, so the scenes are sized to its height, not its width. */
  .s-where { width: 148px; height: 148px; left: calc(50% - 74px); top: 10%; }
  .s-who { width: 100px; height: 100px; left: 6%; bottom: 4%; }
  .s-when { width: 66px; height: 66px; right: 6%; top: 6%; }
  .name-row button { padding: 12px 14px; font-size: 16px; }
  .nav .hide-sm { display: none; }
  .promises { grid-template-columns: 1fr; }
  .bento { grid-template-columns: minmax(0, 1fr); grid-template-areas: "pic" "help" "chap" "calm" "read" "car"; }
  .cell-calm { grid-template-columns: 1fr; }
  .cell-calm img { aspect-ratio: 4 / 3; height: auto; }
  .cell-help, .cell-chapters, .cell-read, .cell-car { padding: 22px; }
  .sheet table, .sheet thead, .sheet tbody, .sheet tr, .sheet th, .sheet td { display: block; }
  .sheet thead { display: none; }
  .sheet td { border: 0; padding: 2px 0; }
  .sheet tr { border-bottom: 1px solid rgba(43, 35, 80, 0.14); padding: 10px 0; }
  .sheet td:first-child { font-family: var(--display); font-weight: 600; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .phone, .tiles button { transition: none; }
}

/* ---------- shared stories shelf (filled from Convex; hidden until there's at least one) ---------- */
.bookshelf { background: linear-gradient(var(--night-3), var(--night-3)); color: var(--starlight); }
.bookshelf .section-head h2 { color: var(--paper); }
.bookshelf .section-head p { color: var(--starlight-soft); }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 270px); gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 18px; margin: 0 -4px; scrollbar-width: thin; scrollbar-color: #4A4494 transparent; }
.shelf-book { scroll-snap-align: start; display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--night-2); border: 1px solid #3B3680; border-radius: 22px; overflow: hidden; transition: transform .15s ease, border-color .15s ease; }
.shelf-book:hover, .shelf-book:focus-visible { transform: translateY(-3px); border-color: var(--lilac); }
.shelf-book .pic { aspect-ratio: 4 / 3; background: var(--night); }
.shelf-book .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf-book .words { padding: 14px 16px 18px; display: grid; gap: 4px; }
.shelf-book .t { font: 700 19px/1.2 var(--display); color: var(--paper); }
.shelf-book .s { font-size: 14px; font-weight: 700; color: var(--starlight-soft); }
.shelf-all { margin: 22px 0 0; text-align: center; }
.shelf-all .pill { background: var(--moon); color: var(--night); }
@media (prefers-reduced-motion: reduce) { .shelf-book { transition: none; } .shelf-book:hover { transform: none; } }

/* ---------- the beta button, at the end of every section ---------- */
.cta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 16px; margin-top: clamp(32px, 5vw, 48px); }
.cta-note { flex-basis: 100%; text-align: center; font: 800 14px/1.2 var(--body); color: var(--ink-soft); }
.nightfall .cta-note, .midnight .cta-note, .bookshelf .cta-note, .twilight .cta-note { color: var(--starlight-soft); }
.pill svg { width: 18px; height: 18px; fill: currentColor; }
.pill { transition: transform 0.15s ease, background-color 0.15s ease; }
.pill:active { transform: translateY(1px) scale(0.98); }
.pill-solid:hover { background: #3B3380; }
.pill-moon { background: var(--moon); color: var(--night); box-shadow: 0 14px 30px -16px rgba(255, 224, 138, 0.6); }
.pill-moon:hover { background: #FFEAA8; }
.pill-line { color: var(--starlight); box-shadow: inset 0 0 0 2px rgba(237, 233, 255, 0.35); }
.pill-line:hover { box-shadow: inset 0 0 0 2px var(--starlight); }
.goodnight .cta-row { margin-top: 28px; }

/* Follows you down the page; hidden over the hero and the sign-up section. */
.float-cta { position: fixed; z-index: 10; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); border: 2px solid var(--ink); box-shadow: 0 18px 40px -14px rgba(21, 19, 58, 0.7); opacity: 0; transform: translateY(20px); pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease; }
.float-cta.on { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 600px) {
  .float-cta { left: 16px; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .float-cta, .pill { transition: none; } }

/* ---------- hero badge: what this is, and how many places are left (live) ---------- */
.beta-badge { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; margin: 0 0 22px; padding: 5px 12px 5px 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.72); box-shadow: inset 0 0 0 1.5px rgba(43, 35, 80, 0.12), 0 10px 24px -16px rgba(43, 35, 80, 0.55); text-decoration: none; color: var(--ink); transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.beta-badge:hover { background: #FFFFFF; transform: translateY(-1px); box-shadow: inset 0 0 0 1.5px rgba(43, 35, 80, 0.2), 0 14px 28px -16px rgba(43, 35, 80, 0.6); }
.beta-badge:hover .bb-go { transform: translateX(2px); }
.bb-tag { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px 7px 10px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 600 15px/1 var(--display); white-space: nowrap; }
.bb-tag svg { width: 15px; height: 15px; fill: var(--lamp); margin-top: -2px; }
.bb-live { display: inline-flex; align-items: center; gap: 8px; font: 800 15px/1.2 var(--body); color: var(--ink); white-space: nowrap; }
.bb-dot { width: 8px; height: 8px; border-radius: 50%; background: #2FB37F; box-shadow: 0 0 0 4px rgba(47, 179, 127, 0.18); animation: breathe 2.4s ease-in-out infinite; flex-shrink: 0; }
.bb-go { width: 16px; height: 16px; color: var(--ink-soft); transition: transform 0.15s ease; flex-shrink: 0; }
@media (max-width: 380px) { .bb-tag, .bb-live { font-size: 14px; } .beta-badge { gap: 8px; } }
@media (prefers-reduced-motion: reduce) { .beta-badge, .bb-go { transition: none; } .beta-badge:hover { transform: none; } }
@media (max-width: 340px) { .bb-go { display: none; } .bb-tag svg { display: none; } }
@media (min-width: 901px) { .bb-tag, .bb-live { font-size: 16px; } .bb-tag { padding: 8px 14px 8px 12px; } }
