/* Main-page motion only. Loaded by PageMotion.astro, never on blog articles.
   Uses transform and opacity so layout (CLS) does not shift. */

/* --------------------------------------------------------------------------
   Hero motif: milk bubbles and a gentle wave, English home and language homes
   -------------------------------------------------------------------------- */

.hero-section {
  position: relative;
}

.hero-motif {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.hero-container,
.hero-wave {
  position: relative;
  z-index: 1;
}

.hero-bubble {
  position: absolute;
  display: block;
  border-radius: 50%;
  background: rgba(215, 20, 28, 0.1);
  border: 1px solid rgba(215, 20, 28, 0.16);
  bottom: -2.5rem;
  animation: bmm-bubble-rise 14s ease-in infinite;
}

.hero-section-red .hero-bubble {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.hero-bubble-1 { width: 0.7rem; height: 0.7rem; left: 8%; animation-duration: 11s; animation-delay: 0s; }
.hero-bubble-2 { width: 1.15rem; height: 1.15rem; left: 22%; animation-duration: 15s; animation-delay: 2.2s; }
.hero-bubble-3 { width: 0.55rem; height: 0.55rem; left: 48%; animation-duration: 10s; animation-delay: 4s; }
.hero-bubble-4 { width: 1.4rem; height: 1.4rem; left: 68%; animation-duration: 17s; animation-delay: 1s; }
.hero-bubble-5 { width: 0.85rem; height: 0.85rem; left: 84%; animation-duration: 13s; animation-delay: 5.5s; }
.hero-bubble-6 { width: 0.5rem; height: 0.5rem; left: 92%; animation-duration: 12s; animation-delay: 3.4s; }

@keyframes bmm-bubble-rise {
  0% { transform: translate3d(0, 0, 0); opacity: 0; }
  12% { opacity: 0.7; }
  80% { opacity: 0.45; }
  100% { transform: translate3d(12px, -110vh, 0); opacity: 0; }
}

.page-main .hero-wave {
  width: 140%;
  left: -20%;
  right: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .page-main .hero-wave {
    animation: bmm-wave-shift 16s ease-in-out infinite alternate;
  }

  .hero-section-red .hero-visual {
    animation: bmm-hero-visual 0.8s ease both;
  }

  .hero-section-red .hero-badge {
    animation: bmm-hero-nudge 0.55s ease both;
  }
}

@keyframes bmm-wave-shift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-2.5%, 0, 0); }
}

@keyframes bmm-hero-visual {
  from { transform: translate3d(0, 14px, 0); opacity: 0.65; }
  to { transform: translate3d(0, 0, 0); opacity: 1; }
}

/* Short, transform-only nudge. Does not start the heading at opacity 0, so LCP is safe. */
@keyframes bmm-hero-nudge {
  from { transform: translate3d(0, 6px, 0); }
  to { transform: translate3d(0, 0, 0); }
}

/* --------------------------------------------------------------------------
   Scroll reveal: off-screen elements only (js-reveal is added by motion.js)
   -------------------------------------------------------------------------- */

html.js-motion .js-reveal {
  transition: opacity 0.55s ease, transform 0.55s ease;
}

html.js-motion .js-reveal:not(.is-in) {
  opacity: 0;
  transform: translate3d(0, 1.1rem, 0);
}

html.js-motion .js-reveal.is-in {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* --------------------------------------------------------------------------
   Hover micro-interactions, scoped to main pages
   -------------------------------------------------------------------------- */

.page-main .blog-card-thumb img,
.page-main .hub-card,
.page-main .tools-home-card {
  transition: transform var(--transition-normal, 250ms ease), box-shadow var(--transition-normal, 250ms ease);
}

.page-main .blog-card-thumb img {
  transform: translate3d(0, 0, 0);
}

.page-main .blog-card:hover .blog-card-thumb img {
  transform: scale(1.04);
}

.page-main .place-chip {
  transition: transform var(--transition-fast, 150ms ease), background-color var(--transition-fast, 150ms ease), border-color var(--transition-fast, 150ms ease), color var(--transition-fast, 150ms ease);
}

.page-main .place-chip:hover,
.page-main .place-chip[aria-pressed="true"] {
  transform: translate3d(0, -1px, 0);
}


/* Never hide the footer, header, or a tall tool wrapper, even if a class is added by mistake. */
footer,
.site-footer,
header,
.tool-card,
[data-no-reveal] {
  opacity: 1 !important;
  transform: none !important;
}

/* --------------------------------------------------------------------------
   Reduced motion: freeze every motion rule on this stylesheet
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .hero-bubble,
  .page-main .hero-wave,
  .hero-section-red .hero-visual,
  .hero-section-red .hero-badge {
    animation: none !important;
  }

  html.js-motion .js-reveal,
  html.js-motion .js-reveal:not(.is-in),
  html.js-motion .js-reveal.is-in,
  .page-main .blog-card-thumb img,
  .page-main .blog-card:hover .blog-card-thumb img,
  .page-main .place-chip,
  .page-main .place-chip:hover,
  .page-main .place-chip[aria-pressed="true"] {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
