/* hellobae.in motion, on every page (home, Join, Partners, Partner rules):
   the same gentle animations wherever a page has the element. All of them
   stop for people who ask their device for reduced motion. */

@media (prefers-reduced-motion: no-preference) {
  /* 1. The first screen comes in, one line after another. */
  .hero .pills,
  .hero h1,
  .hero .lede,
  .hero .lead,
  .hero .gift,
  .hero .join-cta,
  .hero .actions,
  .hero .cities,
  .hero .ticks,
  .rules-doc > .back,
  .rules-doc > .kicker,
  .rules-doc > h1,
  .rules-doc > .updated,
  .side,
  .card-area .card {
    /* Backwards only: once in, the element's own transform (the 3D tilt) works. */
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  }
  .hero h1,
  .rules-doc > .kicker {
    animation-delay: 0.08s;
  }
  .hero .lede,
  .hero .lead,
  .rules-doc > h1,
  .card-area .card {
    animation-delay: 0.16s;
  }
  .hero .gift,
  .hero .actions,
  .rules-doc > .updated {
    animation-delay: 0.24s;
  }
  .hero .join-cta,
  .hero .ticks {
    animation-delay: 0.32s;
  }
  .hero .cities {
    animation-delay: 0.4s;
  }

  /* 2. The photos float, the match card pops in, live dots pulse. */
  .collage .photo.coffee {
    animation:
      rise 0.9s 0.1s cubic-bezier(0.2, 0.7, 0.2, 1) both,
      float 4.2s 1s ease-in-out infinite;
  }
  .collage .photo.video {
    animation:
      rise 0.9s 0.25s cubic-bezier(0.2, 0.7, 0.2, 1) both,
      float 3.6s 1.4s ease-in-out infinite reverse;
  }
  .float.match {
    animation:
      pop 0.6s 0.9s cubic-bezier(0.3, 1.4, 0.5, 1) both,
      bob 3.2s 1.6s ease-in-out infinite;
  }
  .float.match .heart {
    animation: beat 1.6s 1.6s ease-in-out infinite;
  }
  .float.live-card {
    animation:
      pop 0.6s 1.1s cubic-bezier(0.3, 1.4, 0.5, 1) both,
      bob 3.6s 1.8s ease-in-out infinite reverse;
  }
  .dot {
    animation: ping 1.8s ease-out infinite;
  }
  /* Partners: the "How you earn" card pops in, then floats. */
  .earncard {
    animation:
      pop 0.7s 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) both,
      bob 4.2s 1.2s ease-in-out infinite;
  }

  /* 3. Sections and their cards fade up as they come into view (motion.js). */
  .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition:
      opacity 0.7s ease,
      transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--delay, 0s);
  }
  .reveal.in {
    opacity: 1;
    transform: none;
  }

  /* 4. The main buttons glow. */
  .join-btn,
  .top nav a.cta,
  .btn.main,
  .card .btn.round:not(:disabled):not(.wa) {
    animation: glow 2.8s 1.5s ease-in-out infinite;
  }

  /* 5. Strips that run along, left to right: the home page's safety promises
     and the Partners card's platforms (motion.js repeats them so the loop
     never shows a gap). */
  .ticker {
    margin-top: 64px;
    background: #211520;
    border: 1px solid #3a2731;
    border-radius: 24px;
    padding: 24px 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  }
  .ticker .safety {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    display: flex;
    gap: 0;
    width: max-content;
    animation: run 26s linear infinite;
  }
  .ticker .safety li {
    padding: 0 30px;
    white-space: nowrap;
  }
  .ticker:hover .safety,
  .ticker:hover .plats {
    animation-play-state: paused;
  }
  .ticker.plain {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
  }
  .ticker .plats {
    flex-wrap: nowrap;
    gap: 0;
    width: max-content;
    animation: run 18s linear infinite;
  }
  .ticker .plats li {
    margin-right: 8px;
    white-space: nowrap;
  }
}

/* 6. Cards tilt toward the mouse in 3D, with a soft shine where it points
   (motion.js sets --rx, --ry, --gx and --gy). Mouse and trackpad only. */
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .tilt {
    transform-style: preserve-3d;
  }
  .tilt.settled,
  .tilt:not(.reveal) {
    transition:
      transform 0.18s ease-out,
      box-shadow 0.3s ease;
  }
  .tilt.settled:hover,
  .tilt:not(.reveal):hover {
    transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-6px)
      scale(1.02);
    box-shadow: 0 26px 50px rgba(0, 0, 0, 0.45);
  }
  .tilt .shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(
      circle at var(--gx, 50%) var(--gy, 50%),
      rgba(255, 255, 255, 0.14),
      transparent 55%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .tilt:hover .shine {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-14px);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes run {
  from {
    transform: translateX(-50%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes beat {
  0%,
  100% {
    transform: scale(1);
  }
  15% {
    transform: scale(1.18);
  }
  30% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
  }
}

@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(229, 56, 79, 0.6);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(229, 56, 79, 0);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 10px 24px rgba(232, 65, 138, 0.25);
  }
  50% {
    box-shadow: 0 12px 34px rgba(232, 65, 138, 0.55);
  }
}
