/* ============================================
   CLANCY DOGGYMANN — Animations & Motion System
   ============================================ */

/* ── Scroll Reveal Base ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(4rem);
  filter: blur(6px);
  transition: opacity 800ms var(--ease-spring),
              transform 800ms var(--ease-spring),
              filter 800ms var(--ease-spring);
}

[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

[data-reveal="left"] {
  transform: translateX(-4rem) translateY(0);
}
[data-reveal="left"].revealed {
  transform: translateX(0) translateY(0);
}

[data-reveal="right"] {
  transform: translateX(4rem) translateY(0);
}
[data-reveal="right"].revealed {
  transform: translateX(0) translateY(0);
}

[data-reveal="scale"] {
  transform: scale(0.92);
}
[data-reveal="scale"].revealed {
  transform: scale(1);
}

/* ── Staggered Children ── */
[data-reveal-parent] [data-reveal-child] {
  opacity: 0;
  transform: translateY(3rem);
  filter: blur(4px);
  transition: opacity 700ms var(--ease-spring),
              transform 700ms var(--ease-spring),
              filter 700ms var(--ease-spring);
}

[data-reveal-parent].revealed [data-reveal-child] {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

[data-reveal-parent].revealed [data-reveal-child]:nth-child(1) { transition-delay: 0ms; }
[data-reveal-parent].revealed [data-reveal-child]:nth-child(2) { transition-delay: 120ms; }
[data-reveal-parent].revealed [data-reveal-child]:nth-child(3) { transition-delay: 240ms; }
[data-reveal-parent].revealed [data-reveal-child]:nth-child(4) { transition-delay: 360ms; }
[data-reveal-parent].revealed [data-reveal-child]:nth-child(5) { transition-delay: 480ms; }
[data-reveal-parent].revealed [data-reveal-child]:nth-child(6) { transition-delay: 600ms; }

/* ══════════════════════════════════════
   CLOUD PARALLAX DRIFT
   ══════════════════════════════════════ */
@keyframes cloud-drift-50 {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes cloud-drift-80 {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.cloud-layer-1 { animation: cloud-drift-50 50s linear infinite; }
.cloud-layer-2 { animation: cloud-drift-80 80s linear infinite; }
.cloud-layer-3 { animation: cloud-drift-80 120s linear infinite; }

/* ══════════════════════════════════════
   GLOBAL CLOUD LAYER — Full page sky feel
   ══════════════════════════════════════ */
.global-cloud-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url('../assets/decor/CLOUD-layer-1.png');
  background-repeat: repeat-x;
  background-size: auto 55%;
  background-position: center 20%;
  animation: cloud-drift-50 120s linear infinite;
}

/* ══════════════════════════════════════
   FLOATING HAY BALES
   ══════════════════════════════════════ */
@keyframes float-drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%      { transform: translateY(-18px) rotate(3deg); }
  66%      { transform: translateY(-8px) rotate(-2deg); }
}

.floating-haybale {
  position: fixed;
  width: 55px;
  opacity: 0.12;
  pointer-events: none;
  z-index: 1;
  animation: float-drift 8s ease-in-out infinite;
  filter: blur(0.5px);
}
.floating-haybale:nth-child(1) { left: 4%; top: 28%; animation-duration: 7s; }
.floating-haybale:nth-child(2) { right: 6%; top: 52%; animation-duration: 9.5s; animation-delay: 2.2s; }
.floating-haybale:nth-child(3) { left: 10%; top: 76%; animation-duration: 11s; animation-delay: 4.5s; }

/* ══════════════════════════════════════
   FLOATING PARTICLES — Golden dust / pollen
   ══════════════════════════════════════ */
.particle-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

@keyframes sparkle-float {
  0%   { opacity: 0; transform: translateY(100vh) translateX(0) scale(0.5); }
  8%   { opacity: 0.35; }
  50%  { opacity: 0.2; transform: translateY(40vh) translateX(20px) scale(0.8); }
  90%  { opacity: 0.1; }
  100% { opacity: 0; transform: translateY(-15vh) translateX(45px) scale(1); }
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--sun);
  opacity: 0;
  animation: sparkle-float 12s ease-in-out infinite;
}

/* ══════════════════════════════════════
   PAW TRAIL DIVIDER — Walking between sections
   ══════════════════════════════════════ */
@keyframes paw-walk {
  0%   { background-position-x: 0; }
  100% { background-position-x: -1920px; }
}

.paw-trail-divider {
  width: 100%;
  height: 36px;
  pointer-events: none;
  opacity: 0.055;
  background-image: url('../assets/decor/DECOR-pawprints.png');
  background-repeat: repeat-x;
  background-size: auto 100%;
  animation: paw-walk 22s linear infinite;
  position: relative;
  z-index: 2;
}

/* ══════════════════════════════════════
   CORNER SUNFLOWER DECORATION
   ══════════════════════════════════════ */
@keyframes gentle-sway {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

.corner-sunflower {
  position: absolute;
  width: 72px;
  opacity: 0.09;
  pointer-events: none;
  z-index: 1;
  animation: gentle-sway 6s ease-in-out infinite;
}
.corner-sunflower.top-right { top: 2rem; right: 2rem; }
.corner-sunflower.bottom-left { bottom: 2rem; left: 2rem; transform-origin: bottom center; }

/* ══════════════════════════════════════
   VIDEO EDGE MASKING — SEAMLESS BLENDING
   ══════════════════════════════════════ */
.video-blend {
  position: relative;
  overflow: hidden;
  border-radius: 2rem;
}
.video-blend video {
  width: 100%;
  height: auto;
  display: block;
}
.video-blend::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(
    ellipse 80% 80% at center,
    transparent 45%,
    var(--section-bg, #FAFAFA) 100%
  );
}

/* Per-context section background overrides */
.video-blend--sky    { --section-bg: #E3F2FD; }
.video-blend--cream  { --section-bg: #FFF8E1; }
.video-blend--white  { --section-bg: #FAFAFA; }
.video-blend--dark   { --section-bg: #1A237E; }
.video-blend--cloud  { --section-bg: #F5F5F5; }

/* Hero video: directional fade-in mask */
.hero-video-blend::after {
  background:
    linear-gradient(to right,  #C8E6F8 0%, transparent 22%, transparent 72%, #C8E6F8 100%),
    linear-gradient(to bottom, #C8E6F8 0%, transparent 12%, transparent 82%, #E8D5B7 100%);
}

/* Trailer: strong cinematic vignette */
.video-blend--cinematic::after {
  background: radial-gradient(
    ellipse 75% 75% at center,
    transparent 40%,
    rgba(26, 35, 126, 0.25) 75%,
    var(--section-bg, #FAFAFA) 100%
  );
}

/* Bond/Porch: warm edge tint */
.video-blend--warm::after {
  background: radial-gradient(
    ellipse 80% 80% at center,
    transparent 45%,
    rgba(255, 248, 225, 0.6) 80%,
    var(--section-bg, #FFF8E1) 100%
  );
}

/* ══════════════════════════════════════
   FLOAT BOOK OSCILLATION
   ══════════════════════════════════════ */
@keyframes float-book {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-10px) rotate(0.5deg); }
}

.float-book {
  animation: float-book 4s ease-in-out infinite;
}

/* ══════════════════════════════════════
   STAR RATING POP ANIMATION
   ══════════════════════════════════════ */
@keyframes star-pop {
  0%   { opacity: 0; transform: scale(0) rotate(-30deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.star-animated {
  opacity: 0;
  transform: scale(0) rotate(-30deg);
}
.star-animated.animate {
  animation: star-pop 0.4s var(--ease-spring) forwards;
}
.star-animated:nth-child(1) { animation-delay: 0.1s; }
.star-animated:nth-child(2) { animation-delay: 0.2s; }
.star-animated:nth-child(3) { animation-delay: 0.3s; }
.star-animated:nth-child(4) { animation-delay: 0.4s; }
.star-animated:nth-child(5) { animation-delay: 0.5s; }

/* ══════════════════════════════════════
   BUY BUTTON PULSE
   ══════════════════════════════════════ */
@keyframes buy-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 111, 165, 0); }
  50%      { box-shadow: 0 0 0 8px rgba(74, 111, 165, 0.08); }
}

.btn-amazon {
  animation: buy-pulse 3s ease-in-out infinite;
}

/* ══════════════════════════════════════
   CONFETTI BURST (Email success)
   ══════════════════════════════════════ */
@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(200px) rotate(720deg) scale(0.3);
    opacity: 0;
  }
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
}

.email-success.show ~ .email-confetti .confetti-piece {
  animation: confetti-fall 1.5s var(--ease-spring) forwards;
}

.confetti-piece:nth-child(1)  { left: 10%; background: var(--bandana); animation-delay: 0.0s; }
.confetti-piece:nth-child(2)  { left: 20%; background: var(--sun); animation-delay: 0.1s; }
.confetti-piece:nth-child(3)  { left: 30%; background: var(--grass); animation-delay: 0.05s; }
.confetti-piece:nth-child(4)  { left: 40%; background: var(--barn); animation-delay: 0.15s; }
.confetti-piece:nth-child(5)  { left: 50%; background: var(--sky); animation-delay: 0.08s; }
.confetti-piece:nth-child(6)  { left: 60%; background: var(--bandana); animation-delay: 0.12s; }
.confetti-piece:nth-child(7)  { left: 70%; background: var(--sun); animation-delay: 0.03s; }
.confetti-piece:nth-child(8)  { left: 80%; background: var(--grass); animation-delay: 0.18s; }
.confetti-piece:nth-child(9)  { left: 90%; background: var(--barn); animation-delay: 0.07s; }
.confetti-piece:nth-child(10) { left: 15%; background: var(--sky); animation-delay: 0.13s; }
.confetti-piece:nth-child(11) { left: 45%; background: var(--sun); animation-delay: 0.09s; }
.confetti-piece:nth-child(12) { left: 75%; background: var(--bandana); animation-delay: 0.16s; }

/* ══════════════════════════════════════
   SECTION WAVE DIVIDERS
   ══════════════════════════════════════ */
.section-wave {
  display: block;
  width: 100%;
  height: 60px;
  position: relative;
  margin-top: -1px;
  z-index: 5;
}

/* ══════════════════════════════════════
   AMBIENT GLOW (behind video containers)
   ══════════════════════════════════════ */
.ambient-glow {
  position: absolute;
  width: 150%;
  height: 150%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

/* ══════════════════════════════════════
   HERO TEXT ENTRANCE
   ══════════════════════════════════════ */
@keyframes hero-text-in {
  0% {
    opacity: 0;
    transform: translateY(2rem);
    filter: blur(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.hero-text-animate {
  opacity: 0;
  animation: hero-text-in 900ms var(--ease-spring) forwards;
}
.hero-text-animate:nth-child(1) { animation-delay: 200ms; }
.hero-text-animate:nth-child(2) { animation-delay: 350ms; }
.hero-text-animate:nth-child(3) { animation-delay: 500ms; }
.hero-text-animate:nth-child(4) { animation-delay: 650ms; }
.hero-text-animate:nth-child(5) { animation-delay: 800ms; }

@keyframes hero-image-in {
  0% {
    opacity: 0;
    transform: scale(0.9) translateX(2rem);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateX(0);
    filter: blur(0);
  }
}

.hero-image-animate {
  opacity: 0;
  animation: hero-image-in 1000ms var(--ease-spring) 400ms forwards;
}

/* ══════════════════════════════════════
   SUNBEAM ROTATE
   ══════════════════════════════════════ */
@keyframes sunbeam-rotate {
  0%   { transform: rotate(-15deg); }
  100% { transform: rotate(-12deg); }
}

.sunbeam {
  animation: sunbeam-rotate 12s ease-in-out infinite alternate;
}
