/* Readyo · motion.
 * Only transforms and opacity (plus a short blur on text reveals). Hidden start states exist only
 * under html.js (set by a tiny inline script), so without JS or with reduced motion nothing is lost.
 * Ease: cubic-bezier(.22, 1, .36, 1), 500-900 ms. Scroll reveals: IntersectionObserver adds .is-in
 * (assets/js/site.js); cards also use animation-timeline: view() where the browser supports it. */

/* ---------- Reduced motion: everything visible and still, ticker stopped ---------- */
@media (prefers-reduced-motion: reduce) {
  .ticker { contain: none; }
  .ticker__track { width: 100%; }
  .ticker__list { flex-wrap: wrap; justify-content: center; }
  .ticker__list[aria-hidden="true"] { display: none; }
  .ticker__list li { padding-block: 0.7rem; }
  .js .dock { transition: none; }
  .play::after { display: none; }
}

/* ---------- Motion allowed ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  /* Featured plan: a lime ring breathes out of the card every few seconds (opacity and transform only) */
  .plan--pass::after {
    content: ""; position: absolute; inset: -4px; border-radius: calc(var(--radius-lg) + 4px);
    border: 2px solid var(--color-lime); pointer-events: none; opacity: 0;
    animation: plan-ring 2.8s var(--ease) 1.2s infinite;
  }
  @keyframes plan-ring { 0% { opacity: 0.9; transform: scale(1); } 65%, 100% { opacity: 0; transform: scale(1.035); } }

  /* Hero intro: nav fades, headline rises line by line out of a mask (blur to sharp) */
  .js .nav { animation: fade-in 700ms var(--ease) both; }
  .js .line__in { animation: line-up 900ms var(--ease) both; animation-delay: var(--d, 0ms); }
  .js .intro { animation: fade-up 800ms var(--ease) both; animation-delay: var(--d, 0ms); }

  /* Lavender panel slides in from the edge, the phone rises, starbursts pop then turn slowly */
  .js .lav--hero { animation: panel-in 1100ms var(--ease) 100ms both; }
  .js .phone--hero { animation: phone-in 1100ms var(--ease) 380ms both; }
  .js .burst--hero { animation: pop 900ms var(--ease) 560ms both, spin 90s linear 1.5s infinite; }
  .js .burst--hero-sm { animation: pop 900ms var(--ease) 760ms both, spin 60s linear 1.7s infinite reverse; }

  /* Floating UI chips drift in, then float gently */
  .js .floater { animation: drift-in 800ms var(--ease) both, bob 6s ease-in-out infinite; animation-delay: var(--d, 900ms), calc(var(--d, 900ms) + 800ms); }
  .js .floater--who { animation-duration: 800ms, 7s; }
  .js .floater--lime { animation-duration: 800ms, 5.5s; }

  /* Stat + avatar pill: faces pop in one after the other */
  .js .people__faces img { animation: pop-in 600ms var(--ease) both; }
  .js .people__faces img:nth-child(1) { animation-delay: 900ms; }
  .js .people__faces img:nth-child(2) { animation-delay: 1000ms; }
  .js .people__faces img:nth-child(3) { animation-delay: 1100ms; }
  .js .people__go { animation: pop-in 600ms var(--ease) 1200ms both; }

  /* Marquee runs continuously */
  .ticker__track { animation: marquee 38s linear infinite; }
  .ticker:hover .ticker__track { animation-play-state: paused; }

  /* Scroll reveals with stagger (delay comes from the inline --d) */
  .js .reveal {
    opacity: 0; transform: translateY(1.75rem);
    transition: opacity 800ms var(--ease), transform 800ms var(--ease);
    transition-delay: var(--d, 0ms);
  }
  .js .reveal--tilt {
    transform: translateY(2.25rem); filter: blur(6px);
    transition-property: opacity, transform, filter;
  }
  .js .reveal.is-in { opacity: 1; transform: none; filter: none; }

  /* About: phones slide in from the sides, play button pops then pulses */
  .js .about__media .phone--about-a { opacity: 0; transform: translateX(-45%); transition: opacity 900ms var(--ease) 150ms, transform 900ms var(--ease) 150ms; }
  .js .about__media .phone--about-b { opacity: 0; transform: translateX(55%); transition: opacity 900ms var(--ease) 300ms, transform 900ms var(--ease) 300ms; }
  .js .about__media.is-in .phone--about-a, .js .about__media.is-in .phone--about-b { opacity: 1; transform: none; }
  .js .about__media .play { scale: 0.4; opacity: 0; transition: scale 700ms var(--ease) 450ms, opacity 500ms var(--ease) 450ms, transform var(--dur-fast) var(--ease); }
  .js .about__media.is-in .play { scale: 1; opacity: 1; }
  .play::after { animation: pulse 2.4s var(--ease) 1.2s infinite; }

  /* Features: the starburst turns, rail cards stagger in, arrows glide */
  .burst--purple { animation: spin 40s linear infinite; }
  .js .rail .feat { opacity: 0; transform: translateX(3rem); transition: opacity 700ms var(--ease), transform 800ms var(--ease); transition-delay: var(--d, 0ms); }
  .js .rail.is-in .feat { opacity: 1; transform: none; }
  .arrow { transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast); }
  .arrow:active:not(:disabled) { transform: scale(0.92); }

  /* CTA: phones rise in sequence, the starburst pops beside the left phone */
  .js .rise { opacity: 0; transform: translateY(35%); transition: opacity 800ms var(--ease), transform 1000ms var(--ease); transition-delay: calc(var(--d, 0ms) + 150ms); }
  .js .cta__phones.is-in .rise { opacity: 1; transform: none; }
  .js .burst--cta { scale: 0; rotate: -60deg; transition: scale 800ms var(--ease) 500ms, rotate 1200ms var(--ease) 500ms; }
  .js .cta__phones.is-in .burst--cta { scale: 1; rotate: 0deg; }
  .burst--cta { animation: spin 50s linear 2.5s infinite; }

  /* Sections: each card slides up and settles over the previous one; the white card expands,
     the CTA card grows inside its lavender frame. Scroll-driven where supported. */
  @supports (animation-timeline: view()) {
    .js .card:not(.card--top) { animation: card-in linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; transform-origin: 50% 0; }
    .js .card--light#features { animation-name: card-expand; animation-range: entry 0% entry 70%; }
    .js .cta { animation: card-in linear both; animation-timeline: view(); animation-range: entry 0% entry 50%; }
    .js .cta__inner { transform-origin: 50% 100%; animation: cta-in linear both; animation-timeline: view(); animation-range: entry 5% entry 90%; }
    .js .phone--about-a { animation: drift-a linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    .js .phone--about-b { animation: drift-b linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
  }
  @supports not (animation-timeline: view()) {
    .js .card:not(.card--top), .js .cta { transform: translateY(3rem) scale(0.95); transition: transform 1000ms var(--ease); }
    .js .card.is-in, .js .cta.is-in { transform: none; }
    .js .cta__inner { transform: scale(0.88); transition: transform 1000ms var(--ease) 100ms; transform-origin: 50% 100%; }
    .js .cta.is-in .cta__inner { transform: none; }
  }

  @keyframes line-up { from { transform: translateY(105%); opacity: 0; filter: blur(10px); } to { transform: none; opacity: 1; filter: blur(0); } }
  @keyframes fade-up { from { transform: translateY(1.5rem); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes panel-in { from { transform: translateX(14%); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes phone-in { from { transform: translateY(32%); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes pop { from { scale: 0; opacity: 0; } 60% { opacity: 1; } to { scale: 1; opacity: 1; } }
  @keyframes pop-in { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes spin { to { rotate: 360deg; } }
  @keyframes drift-in { from { translate: -2.5rem 1.5rem; opacity: 0; } to { translate: 0 0; opacity: 1; } }
  @keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.5rem); } }
  @keyframes marquee { to { transform: translateX(-50%); } }
  @keyframes pulse { 0% { opacity: 0.8; transform: scale(1); } 100% { opacity: 0; transform: scale(1.45); } }
  @keyframes card-in { from { transform: translateY(4rem) scale(0.94); } to { transform: none; } }
  @keyframes card-expand { from { transform: translateY(5rem) scale(0.88); } to { transform: none; } }
  @keyframes cta-in { from { transform: scale(0.84); } to { transform: none; } }
  @keyframes drift-a { from { translate: 0 2.5rem; } to { translate: 0 -2.5rem; } }
  @keyframes drift-b { from { translate: 0 -1.5rem; } to { translate: 0 3rem; } }
}
