/* ==========================================================================
   The scrollytelling layer: sticky device scenes, reveal-on-scroll, and the
   CSS devices themselves (an iPhone lock screen, an Apple Watch). Loaded
   only by the showpiece pages (nudges, watch). Everything degrades to a
   readable static page under prefers-reduced-motion.
   ========================================================================== */

/* ── reveals ────────────────────────────────────────────────────────────── */
.io { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.io.in { opacity: 1; transform: none; }
.io-d1 { transition-delay: .08s; } .io-d2 { transition-delay: .16s; } .io-d3 { transition-delay: .24s; }

/* ── floating CTA ───────────────────────────────────────────────────────── */
.float-cta {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  opacity: 0; transform: translateY(16px); pointer-events: none;
  transition: opacity .35s ease, transform .35s ease;
}
body.scrolled .float-cta { opacity: 1; transform: none; pointer-events: auto; }
.float-cta .btn { box-shadow: 0 14px 40px rgba(212,160,57,.45); border-radius: 999px; padding: 14px 24px; }

/* ── scene scaffolding ──────────────────────────────────────────────────── */
.scene { position: relative; }
.scene .scene-grid {
  display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: 70px;
  align-items: start;
}
.scene .device-pin { position: sticky; top: 90px; display: flex; justify-content: center; padding: 20px 0 40px; }
.scene .steps { padding: 10vh 0 20vh; display: grid; gap: 42vh; }
.scene .stepb {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 26px 28px; box-shadow: 0 18px 50px rgba(26,31,60,.08);
  opacity: .35; transform: translateY(10px) scale(.985);
  transition: opacity .4s ease, transform .4s ease;
}
.scene .stepb.active { opacity: 1; transform: none; box-shadow: 0 24px 60px rgba(26,31,60,.13); }
.scene .stepb .k { font: 700 11px var(--font-body); letter-spacing: .14em; color: var(--secondary); text-transform: uppercase; }
.scene .stepb h3 { margin: 8px 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 24px; color: var(--primary); letter-spacing: -.01em; }
.scene .stepb p { margin: 0; color: var(--muted); font-size: 15px; }
.scene .stepb .mini-cta { display: inline-block; margin-top: 14px; font: 600 13.5px var(--font-body); color: var(--primary); text-decoration: none; border-bottom: 2px solid var(--accent); }
@media (max-width: 900px) {
  .scene .scene-grid { grid-template-columns: 1fr; gap: 0; }
  .scene .device-pin { position: sticky; top: 66px; z-index: 5; background: linear-gradient(180deg, #fff 78%, rgba(255,255,255,0)); padding: 12px 0 18px; transform: scale(.82); transform-origin: top center; }
  .scene .steps { gap: 34vh; padding-top: 4vh; }
}

/* ══════════════════════════ THE PHONE ══════════════════════════ */
.phone {
  width: 300px; height: 610px; border-radius: 46px; position: relative;
  background: #0b0d16; border: 10px solid #10131f;
  box-shadow: 0 40px 90px rgba(15,18,41,.45), inset 0 0 0 2px #1c2033;
  overflow: hidden; color: #eef0f7; font-family: var(--font-body);
}
.phone .notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 106px; height: 26px; background: #10131f; border-radius: 999px; z-index: 6; }
.phone .wall {
  position: absolute; inset: 0;
  background: radial-gradient(80% 50% at 50% 0%, #1d2440 0%, #0b0d16 70%);
  transition: filter .6s ease;
}
.phone .ptime { position: absolute; top: 84px; left: 0; right: 0; text-align: center; z-index: 2; transition: opacity .5s ease, transform .5s ease; }
.phone .ptime b { display: block; font-size: 58px; font-weight: 300; letter-spacing: -.02em; }
.phone .ptime span { font-size: 14.5px; color: #aab0cc; }

/* the nudge card */
.ncard {
  position: absolute; left: 14px; right: 14px; top: 210px; z-index: 4;
  background: rgba(28,32,54,.92); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 14px;
  opacity: 0; transform: translateY(-26px) scale(.96);
  transition: opacity .5s cubic-bezier(.2,1.2,.3,1), transform .5s cubic-bezier(.2,1.2,.3,1);
}
.ncard .nh { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.ncard .face {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--secondary), #a2762a);
  display: flex; align-items: center; justify-content: center;
  font: 700 13px var(--font-body); color: #10131f;
  box-shadow: 0 0 0 2px rgba(212,160,57,.4);
}
.ncard .who b { display: block; font-size: 13.5px; }
.ncard .who span { font-size: 11px; color: #9aa1bd; }
.ncard .msg { font-size: 14.5px; line-height: 1.45; color: #e6e9f5; margin: 0 0 12px; }
.ncard .act {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--secondary); color: #10131f; border-radius: 12px;
  padding: 11px 0; font-weight: 700; font-size: 14px;
  transition: transform .2s ease, background .3s ease;
}
.ncard .later { text-align: center; font-size: 12px; color: #8f96b5; margin-top: 9px; }

/* logged state */
.plog {
  position: absolute; left: 14px; right: 14px; top: 250px; z-index: 5; text-align: center;
  opacity: 0; transform: scale(.9); transition: opacity .45s ease .1s, transform .45s cubic-bezier(.2,1.4,.4,1) .1s;
}
.plog .ring { width: 108px; height: 108px; margin: 0 auto 14px; position: relative; }
.plog .ring svg { transform: rotate(-90deg); overflow: visible; }
.plog .ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.plog .ring .bg { stroke: rgba(255,255,255,.12); }
.plog .ring .fg { stroke: var(--secondary); stroke-dasharray: 289; stroke-dashoffset: 289; transition: stroke-dashoffset 1s cubic-bezier(.3,.8,.3,1) .2s; filter: drop-shadow(0 0 8px rgba(212,160,57,.7)); }
.plog .ring .day { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.plog .ring .day b { font-size: 30px; }
.plog .ring .day span { font-size: 10px; letter-spacing: .1em; color: #9aa1bd; }
.plog h4 { margin: 0 0 4px; font-size: 17px; } .plog p { margin: 0; font-size: 13px; color: #9aa1bd; }

/* coach dashboard sliver */
.pdash {
  position: absolute; inset: 0; z-index: 5; background: #f6f4ef; color: var(--text);
  padding: 56px 16px 16px; opacity: 0; transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
.pdash .dh { font: 700 11px var(--font-body); letter-spacing: .12em; color: var(--faint); margin-bottom: 10px; }
.pdash .drow { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 13px; }
.pdash .drow .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.pdash .drow b { color: var(--primary); }
.pdash .drow small { display: block; color: var(--muted); }

/* phone step states */
[data-step="0"] .phone .wall { filter: brightness(.75); }
[data-step="1"] .ncard, [data-step="2"] .ncard { opacity: 1; transform: none; }
[data-step="2"] .ncard { transform: translateY(-12px) scale(.98); }
[data-step="2"] .ncard .act { background: #2f9e63; color: #fff; }
[data-step="2"] .plog { opacity: 1; transform: none; }
[data-step="2"] .plog .ring .fg { stroke-dashoffset: 46; }
[data-step="2"] .phone .ptime, [data-step="3"] .phone .ptime { opacity: 0; transform: translateY(-12px); }
[data-step="3"] .ncard, [data-step="3"] .plog { opacity: 0; }
[data-step="3"] .pdash { opacity: 1; transform: none; }

/* ══════════════════════════ THE WATCH ══════════════════════════ */
.wwrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
.wband { width: 96px; height: 74px; background: linear-gradient(180deg, #d8d3c8, #b9b3a6); }
.wband.top { border-radius: 18px 18px 0 0; }
.wband.bot { border-radius: 0 0 18px 18px; }
.watchcase {
  width: 252px; height: 300px; border-radius: 64px; position: relative;
  background: #05060a; border: 9px solid #23262f;
  box-shadow: 0 34px 80px rgba(5,6,10,.55), inset 0 0 0 2px #0c0e15;
  overflow: hidden; color: #eef0f7; font-family: var(--font-body); z-index: 2;
}
.watchcase::after { /* crown */
  content: ""; position: absolute; right: -15px; top: 86px; width: 7px; height: 40px;
  background: #2b2e39; border-radius: 4px;
}
.wscreen { position: absolute; inset: 0; opacity: 0; transform: scale(.97); transition: opacity .5s ease, transform .5s ease; padding: 26px 18px 16px; }
.wscreen.on { opacity: 1; transform: none; }
.wtitle { text-align: center; font: 700 10px var(--font-body); letter-spacing: .2em; color: rgba(238,240,247,.5); margin-bottom: 10px; }

/* watch: today list */
.wrow { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 9px 10px; margin-bottom: 7px; font-size: 12.5px; }
.wrow .wm { width: 22px; height: 22px; border-radius: 7px; flex: none; background: linear-gradient(135deg, #2e3a4a, #161c24); }
.wrow .tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #6b7089; flex: none; position: relative; transition: all .35s ease; }
.wrow.done .tick { border-color: var(--secondary); background: var(--secondary); }
.wrow.done .tick::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #10131f; }
.wrow.done span { text-decoration: line-through; color: #8f96b5; }
.wrow .streak { margin-left: auto; font: 700 10px var(--font-body); color: var(--accent); }

/* watch: reading steppers */
.wread { text-align: center; padding-top: 8px; }
.wread .big { font-size: 40px; font-weight: 300; letter-spacing: -.02em; transition: .2s; }
.wread .unit { font-size: 11px; color: #8f96b5; letter-spacing: .1em; }
.wread .stbtns { display: flex; justify-content: center; gap: 14px; margin: 14px 0; }
.wread .stb { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.1); display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 600; }
.wread .stb.gold { background: var(--secondary); color: #10131f; }
.wread .done { font-size: 11px; color: #7fd6a4; opacity: 0; transition: .4s; }

/* watch: comet */
.comet-face {
  position: absolute; width: 44px; height: 44px; border-radius: 50%;
  left: 50%; top: 34%; margin: -22px;
  background: linear-gradient(135deg, var(--secondary), #a2762a);
  display: flex; align-items: center; justify-content: center;
  font: 700 16px var(--font-body); color: #10131f;
  box-shadow: 0 0 24px 6px rgba(232,200,122,.65);
  transform: translate(-130px, -150px) scale(.4); opacity: 0;
  transition: transform .8s cubic-bezier(.2,.8,.3,1), opacity .3s ease;
}
.comet-trail { position: absolute; left: 50%; top: 34%; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); opacity: 0; }
.wask { position: absolute; inset: 0; padding: 66px 18px 14px; text-align: center; opacity: 0; transition: opacity .5s ease .35s; }
.wask .from { font: 700 9.5px var(--font-body); letter-spacing: .18em; color: var(--accent); margin-bottom: 6px; }
.wask .words { font-size: 14px; line-height: 1.4; margin: 0 0 12px; }
.wask .wbtn { background: var(--secondary); color: #10131f; border-radius: 999px; padding: 9px 0; font-weight: 700; font-size: 13px; margin-bottom: 7px; }
.wask .wlater { font-size: 11px; color: #8f96b5; }
[data-wstep="2"] .comet-face, .wscreen.on .comet-face { transform: translate(0,0) scale(1); opacity: 1; }
[data-wstep="2"] .wask, .wscreen.on .wask { opacity: 1; }

/* watch: the sky */
.sky2 { position: absolute; inset: 0; }
.sky2 .dust { position: absolute; border-radius: 50%; background: #e8e4f0; }
.sky2 .arcpath { position: absolute; inset: 0; width: 100%; height: 100%; }
.star { position: absolute; transform: translate(-50%, -50%); }
.star svg { overflow: visible; display: block; }
.star.brea { animation: sbrea 2.4s ease-in-out infinite; }
.star.brea2 { animation: sbrea 3.1s ease-in-out .6s infinite; }
@keyframes sbrea { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.15); } }
.star .fold { opacity: 0; transition: opacity .4s ease; }
.skyguide { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 9.5px; color: rgba(238,240,247,.55); }
.skyguide b { color: var(--accent); }

/* watch: ledger */
.wledge { position: absolute; inset: 0; padding: 60px 20px; text-align: center; }
.wledge .line { font-family: var(--font-display); font-size: 16.5px; line-height: 1.45; color: #f4ecd9; }
.wledge .spk { margin-top: 16px; font-size: 11px; color: var(--accent); }
.wledge .spk .bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-left: 6px; }
.wledge .spk .bars i { width: 3px; background: var(--accent); border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.wledge .spk .bars i:nth-child(2) { animation-delay: .2s; } .wledge .spk .bars i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 12px; } }

/* ── the composer widget (nudges page) ─────────────────────────────────── */
.composer { background: var(--primary); border-radius: 22px; padding: 30px; color: #e8eaf2; box-shadow: 0 30px 70px rgba(26,31,60,.3); }
.composer .clabel { font: 700 11px var(--font-body); letter-spacing: .14em; color: #8f96b5; text-transform: uppercase; margin-bottom: 12px; }
.composer .scen { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.composer .scen button {
  font: 600 13px var(--font-body); color: #d7dbea; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16); border-radius: 999px; padding: 9px 16px; cursor: pointer;
  transition: .2s;
}
.composer .scen button:hover { border-color: var(--accent); }
.composer .scen button.sel { background: var(--secondary); color: #10131f; border-color: var(--secondary); font-weight: 700; }
.composer .draft {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; padding: 18px; min-height: 96px; position: relative;
}
.composer .draft .dwho { display: flex; gap: 9px; align-items: center; margin-bottom: 10px; }
.composer .draft .dtext { font-size: 15.5px; line-height: 1.5; color: #f0f2fa; min-height: 46px; }
.composer .draft .dtext .caret { display: inline-block; width: 2px; height: 18px; background: var(--accent); vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer .approve { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.composer .approve .note { font-size: 12.5px; color: #8f96b5; }

/* ── big-number scene ──────────────────────────────────────────────────── */
.bignum { text-align: center; padding: 40px 0 10px; }
.bignum b { font-family: var(--font-display); font-weight: 600; font-size: clamp(90px, 16vw, 180px); color: var(--primary); letter-spacing: -.04em; line-height: 1; display: inline-block; transform: scale(calc(.75 + var(--p, 0) * .25)); opacity: calc(.25 + var(--p, 0) * .75); }
.bignum .cap { font-size: 17px; color: var(--muted); max-width: 46ch; margin: 18px auto 0; }

@media (prefers-reduced-motion: reduce) {
  .io { opacity: 1; transform: none; transition: none; }
  .scene .stepb { opacity: 1; transform: none; }
  .star.brea, .star.brea2, .wledge .spk .bars i { animation: none; }
  .ncard, .plog, .pdash, .wscreen, .comet-face, .wask { transition: none; }
  .bignum b { transform: none; opacity: 1; }
}

/* watch screen visibility per step (scene with data-var="wstep") */
[data-wstep="0"] .ws-0, [data-wstep="1"] .ws-1, [data-wstep="2"] .ws-2,
[data-wstep="3"] .ws-3, [data-wstep="4"] .ws-3, [data-wstep="5"] .ws-4 {
  opacity: 1; transform: none;
}
[data-wstep="4"] .star.hero { animation: none; }
[data-wstep="4"] .star.hero .burst { opacity: 0; transition: opacity .4s ease; }
[data-wstep="4"] .star.hero .fold { opacity: 1; }
[data-wstep="4"] .skyguide .open3 { display: none; }
[data-wstep="4"] .skyguide .open2 { display: inline; }
.skyguide .open2 { display: none; }

/* today rows tick as the reading step nears */
[data-wstep="1"] .wrow.r2 { }
.milestone-arc svg { display: block; margin: 0 auto; overflow: visible; }
.milestone-arc .draw { stroke-dasharray: 640; stroke-dashoffset: calc(640 - var(--p, 0) * 610); }
.milestone-arc .m { opacity: calc((var(--p, 0) - .18) * 4); }
.milestone-arc .m2 { opacity: calc((var(--p, 0) - .45) * 4); }
.milestone-arc .m3 { opacity: calc((var(--p, 0) - .72) * 4); }

/* ── the section bar ──────────────────────────────────────────────────────
   Hovers at the foot of the screen on phones: one pill per aspect of the
   page and the CTA. Appears with body.scrolled, like the floating CTA it
   replaces there; scenes.js marks the pill for the section in view. */
.sbar { display: none; }
@media (max-width: 900px) {
  .sbar {
    position: fixed; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 61;
    display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 14px 40px rgba(26,31,60,.18);
    opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .35s ease, transform .35s ease;
  }
  body.scrolled .sbar { opacity: 1; transform: none; pointer-events: auto; }
  .sbar-pills { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; -webkit-overflow-scrolling: touch; }
  .sbar-pills::-webkit-scrollbar { display: none; }
  .sbar-pills a { flex: none; padding: 8px 12px; border-radius: 999px; font: 600 12.5px/1 var(--font-body); color: var(--muted); text-decoration: none; white-space: nowrap; }
  .sbar-pills a.cur { background: var(--primary); color: #fff; }
  .sbar .btn { flex: none; padding: 9px 14px; border-radius: 999px; font-size: 13px; }
  body:has(.sbar) .float-cta { display: none; }
  body:has(.sbar) footer.site { padding-bottom: 84px; }
  [id] { scroll-margin-top: 76px; }
}
