/* =========================================================
   tamo junto — motion layer
   - Native CSS scroll-driven animations: animation-timeline scroll() / view() / named view timeline
   - Variable-font kinetic type (Archivo wdth 62–100)
   - Container query units for a compositor-only ball roll
   - View Transitions for the form → thanks swap (see main.js)
   Motion runs regardless of the OS reduced-motion setting (owner's decision).
   ========================================================= */

@media (max-width: 420px) {
  .motion .site-header__cta { padding: 8px 9px; font-size: 11px; letter-spacing: 0.02em; }
  }

/* ---------- scroll progress (native scroll timeline) ---------- */
.sd-progress { display: none; }

/* ---------- hero: the goal frame opens into the photo ---------- */
.goalframe { display: none; }

/* ---------- kinetic wordmark band ---------- */
.kinetic {
  background: var(--ink);
  overflow: hidden;
  padding: 28px 0 32px;
  border-top: 1px solid var(--line-d);
  border-bottom: 1px solid var(--line-d);
}
.kinetic__row {
  display: flex; gap: 0.28em; white-space: nowrap;
  font-family: var(--f-lat); font-weight: 900; font-stretch: 62%;
  font-size: clamp(3.4rem, 17vw, 11rem); line-height: 0.92; letter-spacing: -0.005em;
  color: var(--paper);
  will-change: transform;
}
.kinetic__row span:nth-child(even) { color: var(--grey-d); }
.kinetic__row--rev { color: transparent; -webkit-text-stroke: 1px rgba(238, 235, 228, 0.45); font-size: clamp(2.2rem, 11vw, 7rem); margin-top: 6px; }
.kinetic__row--rev span:nth-child(even) { color: transparent; -webkit-text-stroke-color: var(--accent); }

/* ---------- 1-month: ball rolls down the timeline ---------- */
.steps-wrap { position: relative; view-timeline-name: --steps; }
.ball { display: none; }
.ball svg { width: 100%; height: 100%; display: block; }
.ball circle { fill: var(--paper-3); stroke: var(--ink); stroke-width: 2; }
.ball path:first-of-type { fill: var(--ink); }
.ball path { fill: none; stroke: var(--ink); stroke-width: 1.6; }
@media (min-width: 900px) {
  .month .steps-wrap { grid-column: 2; grid-row: 1 / span 4; }
  .month .steps-wrap .steps { margin-top: 0; }
}

/* ---------- CTA: pointer-follow light (desktop) ---------- */
.motion .cta { position: relative; overflow: hidden; isolation: isolate; transition: background-color 0.25s, transform 0.35s var(--ease-out); }
.motion .cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.4), transparent 65%);
  transition: opacity 0.3s;
}
@media (hover: hover) { .motion .cta:hover::before { opacity: 1; } }

/* ---------- view transition for the form → thanks swap ---------- */
::view-transition-old(root) { animation: vt-out 0.35s ease-in both; }
::view-transition-new(root) { animation: vt-in 0.5s var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

/* =========================================================
   Motion
   ========================================================= */


  /* hero intro: look through the goal (3:2), then it opens full-bleed */
  .motion .photo--hero { --gf-t: 16%; --gf-b: 64%; --gf-l: 12%; --gf-r: 12%; }
  .motion .photo--hero picture { animation: gf-open 2s cubic-bezier(0.76, 0, 0.18, 1) 0.1s both; }
  .motion .photo--hero img { animation: gf-zoom 2.6s var(--ease-out) 0.1s both; }
  .motion .goalframe {
    display: block; position: absolute; z-index: 1; pointer-events: none;
    animation: gf-frame 2s cubic-bezier(0.76, 0, 0.18, 1) 0.1s both;
  }
  .motion .goalframe i {
    position: absolute; inset: 0;
    border: 3px solid var(--paper); border-bottom: 0;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  }
  @media (min-width: 900px) {
    .motion .photo--hero { --gf-t: 20%; --gf-b: 38%; --gf-l: 44%; --gf-r: 18%; }
  }

  /* hero title: characters kick up one by one after the goal opens */
  .motion .hero__title .line > span { animation: none; transform: none; }
  .motion .hero__title .ch {
    display: inline-block;
    transform: translateY(115%) rotate(6deg);
    animation: ch-in 0.9s var(--ease-out) forwards;
    animation-delay: calc(0.95s + var(--i) * 26ms);
  }
  .motion .hero__tag { animation-delay: 0.8s; }
  .motion .hero__h1 { animation-delay: 1.3s; }
  .motion .hero__lead, .motion .hero__coach { animation-delay: 1.5s; }
  .motion .hero .cta-block { animation-delay: 1.65s; }


@keyframes gf-open {
  0%, 28% { clip-path: inset(var(--gf-t) var(--gf-r) var(--gf-b) var(--gf-l)); }
  100% { clip-path: inset(0 0 0 0); }
}
@keyframes gf-frame {
  0%, 28% { inset: var(--gf-t) var(--gf-r) var(--gf-b) var(--gf-l); opacity: 1; }
  80% { opacity: 0.9; }
  100% { inset: 0; opacity: 0; }
}
@keyframes gf-zoom { from { transform: scale(1.22); } to { transform: scale(1); } }
@keyframes ch-in { to { transform: none; } }

/* ---------- native scroll-driven animations ---------- */
@supports (animation-timeline: view()) {
  

    .sd-progress {
      display: block; position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
      background: var(--accent); transform-origin: 0 50%;
      animation: sd-grow linear both; animation-timeline: scroll(root);
    }

    /* hero recedes as you scroll away */
    .motion .hero__inner { animation: hero-out linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
    .motion .photo--hero { animation: hero-photo linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }

    /* kinetic type: rows slide in opposite directions while the width axis stretches */
    .motion .kinetic__row { animation: kin linear both; animation-timeline: view(); animation-range: cover; }
    .motion .kinetic__row--rev { animation-name: kin-rev; }

    /* headings wipe in top → bottom as they enter */
    .motion .h2, .motion .apply__title {
      animation: wipe linear both; animation-timeline: view(); animation-range: entry 5% entry 95%;
    }
    .motion .night__list li,
    .motion .step,
    .motion .terms > div,
    .motion .faq details {
      animation: slide-in linear both; animation-timeline: view(); animation-range: entry 0% entry 80%;
    }
    .motion .gap__big { animation: big-in linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
    .motion .gap__x { animation: x-spin linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }
    .motion .loop li { animation: pop linear both; animation-timeline: view(); animation-range: entry 10% entry 90%; }
    .motion .note { animation: note-in linear both; animation-timeline: view(); animation-range: entry 0% cover 40%; }
    .motion .photo--coach img { animation: coach-zoom linear both; animation-timeline: view(); animation-range: cover; }

    /* the ball rolls with the reader through the month (named view timeline + container units) */
    .motion .ball {
      display: block; position: absolute; z-index: 2;
      left: -4px; width: 18px; top: calc(var(--steps-top, 64px) + 4px); bottom: 4px;
      container-type: size;
    }
    .motion .ball svg {
      width: 18px; height: 18px;
      animation: roll linear both; animation-timeline: --steps; animation-range: cover 18% cover 82%;
    }
    @media (min-width: 900px) { .motion .ball { --steps-top: 0px; } }
  
}

@keyframes sd-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes hero-out { to { transform: translateY(-14vh); opacity: 0; } }
@keyframes hero-photo { to { transform: scale(1.06); opacity: 0.3; } }
@keyframes kin { from { transform: translateX(4%); font-stretch: 62%; } to { transform: translateX(-38%); font-stretch: 100%; } }
@keyframes kin-rev { from { transform: translateX(-42%); font-stretch: 100%; } to { transform: translateX(2%); font-stretch: 62%; } }
@keyframes wipe {
  from { clip-path: inset(0 0 100% 0); transform: translateY(28px); }
  to { clip-path: inset(0 0 -10% 0); transform: none; }
}
@keyframes slide-in { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes big-in { from { opacity: 0; letter-spacing: 0.5em; filter: blur(6px); } to { opacity: 1; letter-spacing: -0.02em; filter: none; } }
@keyframes x-spin { from { transform: rotate(-270deg) scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pop { from { opacity: 0.1; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes note-in { from { opacity: 0; transform: translateY(90px) rotate(-9deg); } to { opacity: 1; transform: rotate(-1.2deg); } }
@keyframes coach-zoom { from { transform: scale(1.2); } to { transform: scale(1); } }
@keyframes roll { from { transform: translateY(0) rotate(0turn); } to { transform: translateY(calc(100cqh - 18px)) rotate(3turn); } }
