/* =========================================================================
   Animations. Only active when JavaScript adds .motion to <html>, and never
   for visitors who ask their device to reduce motion.
   ========================================================================= */

/* --- Scroll reveal ------------------------------------------------------ */
.motion [data-reveal],
.motion [data-stagger] > * {
  opacity: 0;
  transform: translateY(34px);
  transition:
    opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--delay, 0s);
}
.motion [data-reveal="left"] {
  transform: translateX(-46px);
}
.motion [data-reveal="right"] {
  transform: translateX(46px);
}
.motion [data-reveal="zoom"] {
  transform: scale(0.88) rotate(-2deg);
}
.motion [data-reveal].in,
.motion [data-stagger].in > * {
  opacity: 1;
  transform: none;
}
/* Hover lifts still work after the reveal has finished. */
.motion [data-stagger].done > * {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, opacity 0.3s ease;
  transition-delay: 0s;
}

/* --- Hero entrance on page load ---------------------------------------- */
.motion .hero > .badge,
.motion .hero > h1,
.motion .hero > p,
.motion .hero > .actions {
  animation: hsh-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.motion .hero > h1 { animation-delay: 0.12s; }
.motion .hero > p { animation-delay: 0.26s; }
.motion .hero > .actions { animation-delay: 0.4s; }
.motion .hero-film {
  animation: hsh-rise 1.1s 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes hsh-rise {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
}

/* Photo cut-outs pop in, then float gently. */
.motion .hero-cutout {
  animation:
    hsh-pop 0.9s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    hsh-float 6s 1.4s ease-in-out infinite;
}
.motion .hero-cutout.right {
  animation-delay: 0.65s, 2s;
  animation-duration: 0.9s, 7s;
}
@keyframes hsh-pop {
  from {
    opacity: 0;
    scale: 0.4;
  }
}
@keyframes hsh-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -14px; }
}

/* Smiley doodle wiggles, scribble sways, star spins. */
.motion .hero-doodle {
  animation: hsh-wiggle 4s ease-in-out infinite;
  transform-origin: 50% 80%;
}
@keyframes hsh-wiggle {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -10deg; }
  75% { rotate: 8deg; }
}
.motion .hero-scribble {
  animation: hsh-sway 5s ease-in-out infinite;
}
@keyframes hsh-sway {
  0%, 100% { translate: 0 0; }
  50% { translate: 8px -6px; }
}
.motion .benefit-star,
.motion .cta-shape {
  animation: hsh-spin 14s linear infinite;
}
@keyframes hsh-spin {
  to { rotate: 360deg; }
}
.motion .badge img {
  animation: hsh-twinkle 2.6s ease-in-out infinite;
}
@keyframes hsh-twinkle {
  0%, 100% { scale: 1; rotate: 0deg; }
  50% { scale: 1.25; rotate: 15deg; }
}
.motion .sticker {
  animation: hsh-bob 3.4s ease-in-out infinite;
}
@keyframes hsh-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

/* --- Buttons: lift, squish on press, shine ------------------------------ */
.button {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, box-shadow 0.25s;
}
.button:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px #2a1c101f;
}
.button:active {
  transform: translateY(0) scale(0.96);
}
.button::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, #ffffff55, transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.button:hover::after {
  left: 130%;
}

/* --- Cards lift on hover ------------------------------------------------ */
.approach-card,
.program-card,
.benefit,
.feature,
.faq-list article,
.blog-grid article,
.post-card,
.note-card,
.meal-grid article,
.schedule article {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.approach-card:hover,
.benefit:hover,
.blog-grid article:hover,
.post-card:hover,
.note-card:hover,
.meal-grid article:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 40px #2a1c1012;
}
.approach-card:hover .approach-icon {
  transform: rotate(-8deg) scale(1.08);
}
.approach-icon,
.feature > img,
.icon-circle {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.feature:hover > img {
  transform: rotate(10deg) scale(1.12);
}
.benefit:hover .icon-circle,
.safety-grid article:hover .icon-circle,
.schedule article:hover .icon-circle {
  transform: rotate(-12deg) scale(1.15);
}
.schedule article:hover {
  transform: translateX(6px);
}

/* --- Programs: cards slide in when the slider moves --------------------- */
.motion .program-pair.slide-in {
  animation: hsh-slide 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes hsh-slide {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}
.motion .program-pair.slide-in.from-left {
  animation-name: hsh-slide-left;
}
@keyframes hsh-slide-left {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
}

/* Explorer and form tab panels fade up when switched */
.motion .explorer-panel.switch,
.motion .form-pane.switch {
  animation: hsh-panel 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes hsh-panel {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.99);
  }
}
.motion .explorer-panel.switch .explorer-photo img {
  animation: hsh-photo 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes hsh-photo {
  from {
    opacity: 0;
    transform: scale(0.85) rotate(-3deg);
  }
}

/* FAQ answers open smoothly */
.motion .faq-list p:not([hidden]) {
  animation: hsh-panel 0.4s ease;
}

/* Gallery filter + lightbox */
.motion .gallery-item.show {
  animation: hsh-pop-photo 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes hsh-pop-photo {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}
.motion .lightbox:not([hidden]) {
  animation: hsh-fade 0.3s ease;
}
.motion .lightbox:not([hidden]) img {
  animation: hsh-zoom 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes hsh-fade {
  from { opacity: 0; }
}
@keyframes hsh-zoom {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}

/* Modal */
.motion .modal-overlay:not([hidden]) {
  animation: hsh-fade 0.3s ease;
}
.motion .modal-overlay:not([hidden]) .modal {
  animation: hsh-modal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes hsh-modal {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
}

/* Floating call button gently pulses */
.motion .mobile-call::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--hsh-orange);
  z-index: -1;
  animation: hsh-ping 2.4s ease-out infinite;
}
@keyframes hsh-ping {
  from {
    opacity: 0.6;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* --- Inner page banners (Joyloo style) ---------------------------------- */
.motion .banner-inner > * {
  animation: hsh-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.motion .banner-inner > :nth-child(2) { animation-delay: 0.12s; }
.motion .banner-inner > :nth-child(3) { animation-delay: 0.26s; }
.motion .banner-icon {
  animation: hsh-pop 0.8s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.motion .banner-icon.left {
  animation: hsh-pop 0.8s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both, hsh-wiggle 4s 1.4s ease-in-out infinite;
}
.motion .banner-icon.right {
  animation: hsh-pop 0.8s 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) both, hsh-sway 5s 1.5s ease-in-out infinite;
}
.motion .about-ticker,
.motion .parents-banner {
  animation: hsh-rise 1s 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.motion .mission-sun svg,
.motion .story-star {
  animation: hsh-spin 16s linear infinite;
}
.motion .shape-wave svg {
  animation: hsh-sway 5s ease-in-out infinite;
}
.motion .shape-sparkle svg,
.motion .shape-sparkle-green svg {
  animation: hsh-twinkle 2.6s ease-in-out infinite;
}
.motion .story-badge {
  animation: hsh-bob 3.4s ease-in-out infinite;
}
.motion .doc-card.show {
  animation: hsh-pop-photo 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Approach cards: gentle ease-in, one after another ------------------ */
.motion .approach-cards[data-stagger] > * {
  opacity: 0;
  transform: translateY(90px) scale(0.92);
  transition:
    opacity 1s cubic-bezier(0.42, 0, 0.58, 1),
    transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--delay, 0s);
}
.motion .approach-cards[data-stagger] > :nth-child(1) {
  --delay: 0s !important;
  transform: translate(-50px, 90px) rotate(-5deg) scale(0.92);
}
.motion .approach-cards[data-stagger] > :nth-child(2) {
  --delay: 0.2s !important;
}
.motion .approach-cards[data-stagger] > :nth-child(3) {
  --delay: 0.4s !important;
  transform: translate(50px, 90px) rotate(5deg) scale(0.92);
}
.motion .approach-cards[data-stagger].in > * {
  opacity: 1;
  transform: none;
}
/* After the entrance, hover lifts are quick again. */
.motion .approach-cards[data-stagger].done > * {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  transition-delay: 0s;
}
/* The photo pops in, then the heading and text ease up. */
.motion .approach-cards[data-stagger] .approach-icon {
  opacity: 0;
  transform: scale(0.3) rotate(-25deg);
  transition:
    opacity 0.6s ease-in-out calc(var(--delay, 0s) + 0.45s),
    transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--delay, 0s) + 0.45s);
}
.motion .approach-cards[data-stagger] .approach-card h3,
.motion .approach-cards[data-stagger] .approach-card p {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.7s ease-in-out calc(var(--delay, 0s) + 0.65s),
    transform 0.7s ease-in-out calc(var(--delay, 0s) + 0.65s);
}
.motion .approach-cards[data-stagger] .approach-card p {
  transition-delay: calc(var(--delay, 0s) + 0.8s);
}
.motion .approach-cards[data-stagger].in .approach-icon,
.motion .approach-cards[data-stagger].in .approach-card h3,
.motion .approach-cards[data-stagger].in .approach-card p {
  opacity: 1;
  transform: none;
}
.motion .approach-cards[data-stagger].done .approach-card:hover .approach-icon {
  transform: rotate(-8deg) scale(1.08);
  transition-delay: 0s;
}
/* The decorative line inside each card draws in slowly. */
.motion .approach-cards[data-stagger] .card-line {
  opacity: 0;
  transition: opacity 1.4s ease-in calc(var(--delay, 0s) + 0.5s);
}
.motion .approach-cards[data-stagger].in .card-line {
  opacity: 1;
}

/* --- Respect "reduce motion" ------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .motion [data-reveal],
  .motion [data-stagger] > * {
    opacity: 1 !important;
    transform: none !important;
  }
  .scroll-progress {
    display: none;
  }
}
