/* UPLIFE FITNESS — motion layer.
   Signature idea: the hexagonal LED ceiling of the Nova UpLife "switching on".
   Everything here is opt-in: only with JS (.js) and no reduced-motion preference. */

@media (prefers-reduced-motion: no-preference) {

  /* ---------- Hero: lights on ---------- */
  .js .hero-media img {
    transform-origin: 50% 30%;
    animation: lights-on 2.4s cubic-bezier(.2, .7, .2, 1) both;
  }
  @keyframes lights-on {
    0%   { filter: brightness(.12) saturate(.5); transform: scale(1.08); }
    16%  { filter: brightness(.12) saturate(.5); }
    19%  { filter: brightness(.9)  saturate(.8); }
    22%  { filter: brightness(.22) saturate(.6); }
    27%  { filter: brightness(1.05) saturate(.9); }
    30%  { filter: brightness(.4)  saturate(.7); }
    36%  { filter: brightness(1.12) saturate(1); }
    100% { filter: brightness(1)   saturate(1); transform: scale(1); }
  }

  .js .hero-title .line > span {
    transform: translateY(108%);
    animation: line-rise 1s var(--ease-out) forwards;
  }
  .js .hero-title .line:nth-child(1) > span { animation-delay: .55s; }
  .js .hero-title .line:nth-child(2) > span { animation-delay: .68s; }
  @keyframes line-rise { to { transform: translateY(0); } }

  .js .hero-anim {
    opacity: 0;
    translate: 0 18px;
    animation: fade-up .9s var(--ease-out) forwards;
    animation-delay: calc(.35s + var(--d, 0) * .1s);
  }
  @keyframes fade-up { to { opacity: 1; translate: 0 0; } }

  /* ---------- Scroll reveals ---------- */
  .js [data-reveal] {
    opacity: 0;
    translate: 0 28px;
    transition: opacity .8s var(--ease-out), translate .9s var(--ease-out);
  }
  .js [data-reveal].is-in { opacity: 1; translate: 0 0; }

  /* Clip the image, not the observed wrapper: a fully clipped target never intersects. */
  .js [data-reveal="clip"] { opacity: 1; translate: none; }
  .js [data-reveal="clip"] img {
    clip-path: inset(0 0 100% 0);
    scale: 1.15;
    transition: clip-path 1.2s var(--ease-out), scale 1.6s var(--ease-out);
  }
  .js [data-reveal="clip"].is-in img { clip-path: inset(0 0 0 0); scale: 1; }

  /* Staggered groups. Reveal uses `opacity` + `translate` so hover can keep using `transform`
     without inheriting the stagger delay. */
  .js [data-reveal-stagger] > * {
    --stagger: calc(var(--i, 0) * 70ms);
    opacity: 0;
    translate: 0 24px;
    transition:
      opacity .7s var(--ease-out) var(--stagger),
      translate .8s var(--ease-out) var(--stagger),
      transform .35s var(--ease-out),
      box-shadow .35s var(--ease-out),
      border-color .3s;
  }
  .js [data-reveal-stagger].is-in > * { opacity: 1; translate: 0 0; }

  /* Gallery: curtain reveal, like the panels lighting up one by one */
  .js .gallery > * {
    opacity: 1;
    translate: none;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1.1s var(--ease-out) calc(var(--i, 0) * 110ms);
  }
  .js .gallery > * img { scale: 1.18; transition: scale 1.6s var(--ease-out) calc(var(--i, 0) * 110ms), transform .8s var(--ease-out); }
  .js .gallery.is-in > * { clip-path: inset(0 0 0 0); }
  .js .gallery.is-in > * img { scale: 1; }

  /* Chips pop */
  .js .chips > * { translate: 0 0; scale: .85; transition: opacity .5s var(--ease-out) calc(var(--i, 0) * 45ms), scale .6s var(--ease-out) calc(var(--i, 0) * 45ms), border-color .3s; }
  .js .chips.is-in > * { scale: 1; }
  @media (hover: hover) { .chips li:hover { border-color: var(--c-lime); } }

  /* Step numbers count in */
  .js .steps .step-num { display: inline-block; translate: -12px 0; opacity: 0; transition: opacity .6s var(--ease-out) calc(var(--i, 0) * 120ms + 200ms), translate .7s var(--ease-out) calc(var(--i, 0) * 120ms + 200ms); }
  .js .steps.is-in .step-num { translate: 0 0; opacity: 1; }

  /* ---------- Hexagons drawing themselves (Wellhub/TotalPass section) ---------- */
  .js [data-draw] path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.6s var(--ease-out);
  }
  .js [data-draw] path:nth-child(2) { transition-delay: .18s; }
  .js [data-draw] path:nth-child(3) { transition-delay: .36s; }
  .js [data-draw] path:nth-child(4) { transition-delay: .54s; }
  .js [data-draw].is-in path { stroke-dashoffset: 0; }
  .js [data-draw].is-in path { animation: led-breathe 5s ease-in-out 2.4s infinite; }
  .js [data-draw].is-in path:nth-child(2) { animation-delay: 3.1s; }
  .js [data-draw].is-in path:nth-child(3) { animation-delay: 3.8s; }
  .js [data-draw].is-in path:nth-child(4) { animation-delay: 4.5s; }
  @keyframes led-breathe {
    0%, 100% { stroke-opacity: .12; }
    50% { stroke-opacity: .3; }
  }
  @media (min-width: 768px) {
    @keyframes led-breathe {
      0%, 100% { stroke-opacity: .16; }
      50% { stroke-opacity: .4; }
    }
  }

  /* ---------- Featured plan: subtle lime aura (opacity-only, compositor friendly) ---------- */
  .plan--featured::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    box-shadow: 0 0 38px -4px rgba(198, 231, 27, .38);
    opacity: 0;
    pointer-events: none;
    animation: aura 4s ease-in-out 1s infinite;
  }
  @keyframes aura { 50% { opacity: 1; } }

  /* ---------- Header ---------- */
  .site-header { transition: box-shadow .35s var(--ease-out); }
  .site-header.is-scrolled { box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .6); }

  /* ---------- Mobile menu: links slide in ---------- */
  @media (max-width: 1199px) {
    .js .nav-links > a, .js .nav-menu-footer {
      opacity: 0;
      translate: 0 22px;
      transition: opacity .35s var(--ease-out), translate .5s var(--ease-out), color .2s;
    }
    .menu-open .nav-links > a, .menu-open .nav-menu-footer { opacity: 1; translate: 0 0; }
    .menu-open .nav-links > a:nth-child(1) { transition-delay: .06s; }
    .menu-open .nav-links > a:nth-child(2) { transition-delay: .11s; }
    .menu-open .nav-links > a:nth-child(3) { transition-delay: .16s; }
    .menu-open .nav-links > a:nth-child(4) { transition-delay: .21s; }
    .menu-open .nav-links > a:nth-child(5) { transition-delay: .26s; }
    .menu-open .nav-links > a:nth-child(6) { transition-delay: .31s; }
    .menu-open .nav-menu-footer { transition-delay: .38s; }
  }

  /* ---------- Top bar marquee (small screens only) ---------- */
  @media (max-width: 1023px) {
    .topbar-track { justify-content: flex-start; width: max-content; animation: marquee 38s linear infinite; }
    .topbar:hover .topbar-track, .topbar:focus-within .topbar-track { animation-play-state: paused; }
    .topbar-items { flex-wrap: nowrap; white-space: nowrap; gap: 32px; padding: 9px 32px 9px 0; }
    .topbar-clone { display: flex; }
    @keyframes marquee { to { transform: translateX(-50%); } }
  }

  /* ---------- WhatsApp FAB: a few attention pulses, then rest ---------- */
  .wa-fab::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--c-lime);
    opacity: 0;
    animation: ring 2.4s ease-out 3s 3;
  }
  @keyframes ring {
    0% { transform: scale(1); opacity: .8; }
    80%, 100% { transform: scale(1.7); opacity: 0; }
  }
}
