/* ---------- Which version shows ---------- */
.story-flat-only { display: block; }
.story-live-only { display: none; }
.story-live .story-flat-only { display: none; }
.story-live .story-live-only { display: block; height: 100%; }

/* ---------- Live story: a tall section with a pinned stage ---------- */
.story-live .story { height: calc(var(--chapters) * 112vh); position: relative; }
.story-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background: var(--paper);
  --stage-x: 66%; --stage-y: 54%;
}

.stage-photos { position: absolute; top: 0; right: 0; bottom: 0; width: 66%; }
.story-photo { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; }
.stage-photos .story-photo { -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 38%); mask-image: linear-gradient(to right, transparent 0%, #000 38%); }
.stage-photos .story-photo::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(245,244,255,.35), rgba(245,244,255,0) 40%); }
.story-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-missing {
  width: 100%; height: 100%;
  background: radial-gradient(120% 90% at 80% 20%, #DCEFFF 0%, transparent 60%), radial-gradient(90% 80% at 70% 90%, #DDFBEF 0%, transparent 55%), linear-gradient(135deg, #EAE6FF, #E4F4FF);
  display: flex; align-items: flex-end; justify-content: flex-end; padding: 18px 22px;
}
.photo-missing span { font-size: 12px; color: var(--muted); background: rgba(255,255,255,.7); padding: 4px 10px; border-radius: 999px; }

.stage-dark { position: absolute; inset: 0; background: var(--night); opacity: 0; visibility: hidden; }
.stage-dark .story-photo { -webkit-mask-image: none; mask-image: none; }
.stage-dark .photo-missing { background: radial-gradient(70% 60% at 75% 70%, rgba(53,194,255,.22), transparent 70%), radial-gradient(60% 50% at 90% 95%, rgba(91,240,181,.18), transparent 70%), radial-gradient(60% 60% at 60% 40%, rgba(123,97,255,.25), transparent 70%); }
.stage-dark .photo-missing span { background: rgba(255,255,255,.08); color: var(--night-muted); }

.story-rings {
  position: absolute; left: var(--stage-x); top: var(--stage-y);
  width: min(96vh, 88vw); height: min(96vh, 88vw);
  transform: translate(-50%, -50%); overflow: visible; pointer-events: none;
}
.sr { stroke-dasharray: 100 100; stroke-dashoffset: 100; stroke-linecap: round; }
.sr-label { font-family: 'Figtree', sans-serif; font-size: 2.6px; font-weight: 700; fill: var(--ink); opacity: 0; letter-spacing: -0.02em; }
.sr-label { paint-order: stroke; stroke: rgba(245,244,255,.92); stroke-width: .9px; stroke-linejoin: round; }
.is-dark .sr-label { fill: #fff; stroke: rgba(20,18,43,.9); }

/* Floating health data */
.frags { position: absolute; inset: 0; pointer-events: none; }
.frag { position: absolute; will-change: transform, opacity; }
.frag-in {
  display: grid; grid-template-columns: auto auto; column-gap: 10px; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  padding: 10px 14px 10px 12px; box-shadow: 0 14px 34px -18px rgba(20,18,43,.35);
  font-size: 13px; line-height: 1.25; white-space: nowrap;
}
.frag-in .ic { grid-row: span 2; width: 26px; height: 26px; padding: 5px; border-radius: 9px; background: var(--paper-2); stroke: var(--violet-deep); }
.frag-in span { color: var(--muted); }
.frag-in b { font-weight: 700; font-size: 15px; color: var(--ink); }
.f-a { left: 44%; top: 17%; } .f-b { left: 79%; top: 13%; } .f-c { left: 86%; top: 43%; }
.f-d { left: 80%; top: 76%; } .f-e { left: 47%; top: 80%; } .f-f { left: 40%; top: 48%; } .f-g { left: 63%; top: 8%; }
@media (prefers-reduced-motion: no-preference) {
  .frag-in { animation: bob 6s ease-in-out infinite; }
  .f-b .frag-in { animation-delay: -1.2s; } .f-c .frag-in { animation-delay: -2.4s; } .f-d .frag-in { animation-delay: -3.1s; }
  .f-e .frag-in { animation-delay: -4s; } .f-f .frag-in { animation-delay: -5s; } .f-g .frag-in { animation-delay: -.6s; }
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1deg); } }

/* The phone */
.phone-wrap { position: absolute; left: var(--stage-x); top: var(--stage-y); width: 300px; height: 620px; transform: translate(-50%, -50%) scale(.9); transform-origin: center; will-change: transform, opacity; }
.phone { width: 300px; height: 620px; border-radius: 46px; background: var(--ink); padding: 10px; position: relative; box-shadow: 0 40px 90px -30px rgba(20,18,43,.55), inset 0 0 0 1.5px #2C2950; }
.phone-island { position: absolute; top: 20px; left: 50%; width: 88px; height: 25px; background: var(--ink); border-radius: 20px; transform: translateX(-50%); z-index: 6; }
.phone-screen { width: 100%; height: 100%; border-radius: 37px; overflow: hidden; background: var(--paper); position: relative; }
.scr-layer { position: absolute; inset: 0; }
.story-live .story-stage .scr-layer { opacity: 0; visibility: hidden; }

.cheers { position: absolute; left: calc(var(--stage-x) + 150px); top: 26%; display: grid; gap: 10px; justify-items: start; pointer-events: none; }
.cheer { background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px -16px rgba(20,18,43,.35); opacity: 0; visibility: hidden; white-space: nowrap; }
.cheer::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--grad); margin-right: 8px; vertical-align: 1px; }

/* Captions */
.story-captions {
  position: absolute; inset: 0; display: grid; align-items: center;
  padding: 68px max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))) 0;
  pointer-events: none;
}
.story-caption { grid-area: 1 / 1; max-width: 410px; opacity: 0; visibility: hidden; }
.story-caption h1 { font-size: clamp(2.4rem, 3.4vw + 1rem, 4.25rem); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; }
.story-caption h2 { font-size: clamp(1.9rem, 2vw + 1rem, 2.8rem); font-weight: 790; letter-spacing: -0.03em; line-height: 1.06; }
.story-caption p { font-size: var(--step-1); color: var(--ink-2); line-height: 1.5; margin-top: 18px; }
.story-caption .lede { margin-bottom: 28px; }
.story-caption .actions { margin-top: 24px; }
.story-caption.is-dark h2 { color: var(--white); }
.story-caption.is-dark p { color: var(--night-text); }
.btn-ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,.5); }
.btn-ghost:hover { background: rgba(255,255,255,.1); border-color: var(--white); }
.story-caption.is-dark .btn:not(.btn-ghost) { background: var(--white); color: var(--ink); border-color: var(--white); }
.story-caption.is-dark .btn:not(.btn-ghost):hover { background: var(--mint); border-color: var(--mint); }
.story-promises { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 14px; }
.story-promises li { color: var(--white); font-size: var(--step-1); font-weight: 600; display: grid; grid-template-columns: 22px 1fr; align-items: center; }
.story-promises li::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--grad); }
.scroll-cue { font-size: var(--step--1) !important; color: var(--muted) !important; margin-top: 34px !important; display: flex; align-items: center; gap: 10px; }
.scroll-cue::after { content: ''; width: 1.5px; height: 28px; background: linear-gradient(var(--violet), transparent); }
@media (prefers-reduced-motion: no-preference) { .scroll-cue::after { animation: cue 1.8s ease-in-out infinite; transform-origin: top; } }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.story-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: transparent; }
.story-progress i { display: block; height: 100%; background: var(--grad); transform-origin: left; transform: scaleX(0); }

/* ---------- Phones and small screens ---------- */
@media (max-width: 760px) {
  .story-stage { --stage-x: 50%; --stage-y: 36%; }
  .stage-photos { width: 100%; -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 72%); mask-image: linear-gradient(to bottom, #000 0%, #000 40%, transparent 72%); }
  .stage-photos .story-photo { -webkit-mask-image: none; mask-image: none; }
  .story-rings { width: min(64vh, 140vw); height: min(64vh, 140vw); }
  .story-captions { align-items: end; padding: 0 12px 14px; }
  .story-caption { max-width: none; background: color-mix(in srgb, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 20px; padding: 18px 18px 20px; }
  .story-caption.is-dark { background: rgba(20,18,43,.82); border-color: rgba(255,255,255,.12); }
  .story-caption h1 { font-size: 2.05rem; }
  .story-caption h2 { font-size: 1.6rem; }
  .story-caption p { font-size: 1rem; margin-top: 10px; }
  .story-caption .lede { margin-bottom: 16px; }
  .story-caption .actions { margin-top: 14px; }
  .story-caption .btn { padding: 11px 18px; font-size: .95rem; }
  .story-promises { gap: 8px; margin-top: 12px; }
  .story-promises li { font-size: 1rem; }
  .scroll-cue { display: none !important; }
  .frag-in { font-size: 11px; padding: 7px 10px 7px 8px; column-gap: 7px; border-radius: 13px; }
  .frag-in b { font-size: 12.5px; }
  .frag-in .ic { width: 22px; height: 22px; padding: 4px; }
  .f-a { left: 2%; top: 17%; } .f-b { left: 73%; top: 18%; } .f-c { left: 73%; top: 33%; }
  .f-d { left: 73%; top: 48%; } .f-e { left: 2%; top: 47%; } .f-f { left: 2%; top: 32%; } .f-g { left: 37%; top: 9.5%; }
  .cheers { left: auto; right: 12px; top: 9%; justify-items: end; }
  .cheer { font-size: 12px; padding: 6px 12px; }
  .sr-label { font-size: 4.4px; stroke-width: 1.2px; }
}
@media (max-height: 640px) and (min-width: 761px) {
  .story-caption h1 { font-size: 2.6rem; }
}

/* ---------- Phone screen contents ---------- */
.scr { position: absolute; inset: 0; padding: 56px 18px 74px; font-size: 12px; line-height: 1.35; color: var(--ink); display: flex; flex-direction: column; gap: 10px; text-align: left; }
.scr-splash { align-items: center; justify-content: center; gap: 12px; background: linear-gradient(160deg, #F5F4FF 0%, #ECEAFE 100%); }
.scr-splash .badge { border-radius: 15px; }
.scr-splash p { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.ph-sub { font-size: 12px; color: var(--muted); }
.ph-eyebrow { font-size: 11px; color: var(--muted); margin: 0; }
.ph-title { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; margin: -6px 0 2px; line-height: 1.15; }
.ph-ready { position: relative; width: 132px; height: 132px; margin: 4px auto 0; }
.ph-ready svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ph-ready .trk { fill: none; stroke: var(--paper-2); stroke-width: 11; }
.ph-ready .arc { fill: none; stroke: var(--violet); stroke-width: 11; stroke-linecap: round; stroke-dasharray: 100 100; stroke-dashoffset: 18; }
.ph-ready-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ph-ready-num b { font-size: 36px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.ph-ready-num span { font-size: 11px; color: var(--muted); margin-top: 3px; }
.ph-note { font-size: 11.5px; color: var(--ink-2); margin: 0; text-align: center; padding: 0 6px; }
.ph-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 4px 12px; }
.ph-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--paper-2); }
.ph-row:last-child { border-bottom: 0; }
.ph-row span { color: var(--ink-2); }
.ph-row b { font-weight: 700; }
.ic { width: 18px; height: 18px; fill: none; stroke: var(--violet-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ph-stories { display: flex; gap: 6px; overflow: hidden; }
.ph-stories span { flex: 0 0 auto; font-size: 10.5px; font-weight: 600; padding: 7px 10px; border-radius: 999px; background: var(--white); border: 1.5px solid transparent; background-image: linear-gradient(var(--white), var(--white)), var(--grad); background-origin: border-box; background-clip: padding-box, border-box; }
.ph-tabs { position: absolute; left: 0; right: 0; bottom: 0; height: 62px; padding: 10px 18px 18px; display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,.92); border-top: 1px solid var(--line); }
.ph-tabs span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.ph-tabs span.on { color: var(--violet-deep); }
.ph-person { display: grid; grid-template-columns: 38px 1fr auto; gap: 10px; align-items: center; background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.ph-person b { display: block; font-size: 13px; }
.ph-person span { color: var(--ink-2); font-size: 11.5px; }
.ph-person .ok { stroke: #19A974; }
.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 700; color: var(--white); font-size: 14px; }
.av1 { background: #7B61FF; } .av2 { background: #2BA3E0; } .av3 { background: #2FC795; } .av4 { background: #5B3FE0; width: 32px; height: 32px; font-size: 12px; }
.ph-share { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; padding: 4px 4px 0; }
.ph-share .ic { width: 15px; height: 15px; }
.ph-post { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 12px; }
.ph-post-head { display: grid; grid-template-columns: 32px 1fr; gap: 9px; align-items: center; }
.ph-post-head b { display: block; font-size: 13px; }
.ph-post-head span { color: var(--muted); font-size: 11px; }
.ph-route { width: 100%; height: 62px; margin: 8px 0 6px; background: #EEF6FF; border-radius: 10px; }
.ph-route path { fill: none; stroke: var(--violet); stroke-width: 3.5; stroke-linecap: round; }
.ph-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.ph-stats span { color: var(--muted); font-size: 10.5px; display: grid; }
.ph-stats b { color: var(--ink); font-size: 15px; font-weight: 750; }
.ph-board { padding: 10px 12px 8px; }
.ph-board-title { font-weight: 700; font-size: 12px; margin: 0 0 6px; }
.ph-bar { display: grid; grid-template-columns: 42px 1fr 30px; gap: 8px; align-items: center; padding: 4px 0; font-size: 11px; }
.ph-bar span { color: var(--ink-2); }
.ph-bar i { height: 8px; background: var(--paper-2); border-radius: 99px; overflow: hidden; display: block; }
.ph-bar em { display: block; height: 100%; width: 100%; background: var(--grad); border-radius: 99px; transform-origin: left; }
.ph-bar b { text-align: right; font-weight: 700; }
.ph-toggles { padding: 2px 12px; }
.ph-tog { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--paper-2); font-size: 12.5px; }
.ph-tog:last-child { border-bottom: 0; }
.ph-tog i { width: 34px; height: 20px; border-radius: 99px; background: #D9D6EE; position: relative; }
.ph-tog i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.ph-tog i.on { background: #2FC795; }
.ph-tog i.on::after { left: 16px; }
.ph-toast { position: absolute; top: 50px; left: 10px; right: 10px; z-index: 5; display: grid; grid-template-columns: 22px 1fr; gap: 9px; align-items: start; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; box-shadow: 0 16px 34px -14px rgba(20,18,43,.45); font-size: 11.5px; opacity: 0; visibility: hidden; }
.ph-toast b { display: block; font-size: 12px; line-height: 1.3; }
.ph-toast span { color: var(--muted); font-size: 10.5px; }
.ph-toast .ic { width: 20px; height: 20px; stroke: #E0732B; }

/* ---------- Calm version (reduced motion or no JavaScript) ---------- */
.flat-chapter { padding: clamp(48px, 7vw, 96px) 0; border-bottom: 1px solid var(--line); }
.flat-chapter:first-child { padding-top: clamp(32px, 6vw, 80px); }
.flat-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(24px, 6vw, 80px); align-items: center; }
.flat-text h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; max-width: 12ch; }
.flat-text h2 { font-size: var(--step-3); font-weight: 780; }
.flat-text p { font-size: var(--step-1); color: var(--ink-2); margin-top: 16px; max-width: 46ch; }
.flat-text .actions { margin-top: 24px; }
.flat-text .scroll-cue { display: none; }
.flat-chapter.night { border-bottom: 0; }
.flat-chapter.night p { color: var(--night-text); }
.flat-chapter.night .story-promises li { color: var(--white); }
.flat-chapter.night .btn:not(.btn-ghost) { background: var(--white); color: var(--ink); border-color: var(--white); }
.flat-visual { display: flex; justify-content: center; }
@media (max-width: 760px) { .flat-grid { grid-template-columns: 1fr; } .flat-visual .phone { transform: scale(.85); transform-origin: top center; margin-bottom: -90px; } }
