/* ============================================
   ANIMATIONS — Scroll reveals & micro-interactions
   Edutech Junior Hub
   ============================================ */

/* ── Scroll Reveal base ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for grid children */
.reveal-delay-1 { transition-delay: 100ms; }
.reveal-delay-2 { transition-delay: 200ms; }
.reveal-delay-3 { transition-delay: 300ms; }
.reveal-delay-4 { transition-delay: 400ms; }
.reveal-delay-5 { transition-delay: 500ms; }
.reveal-delay-6 { transition-delay: 600ms; }

/* ── Slide from left ── */
.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* ── Slide from right ── */
.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* ── Scale up ── */
.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ── Pulse animation for CTA ── */
@keyframes pulse-ring {
  0%   { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.btn-cta-pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--clr-accent);
  opacity: 0;
  z-index: -1;
  animation: pulse-ring 2s ease-out infinite;
}

/* ══════════════════════════════════════════════
   FLOATING HERO DOODLES
   ══════════════════════════════════════════════ */
.hero-doodles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.doodle {
  position: absolute;
  opacity: 0.12;
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-14px) rotate(3deg); }
  50%      { transform: translateY(-6px) rotate(-2deg); }
  75%      { transform: translateY(-18px) rotate(1deg); }
}

@keyframes float-sway {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(8px, -16px) rotate(5deg); }
  66%      { transform: translate(-6px, -10px) rotate(-3deg); }
}

@keyframes float-spin {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(180deg); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.12; transform: scale(1); }
  50%      { opacity: 0.25; transform: scale(1.15); }
}

.doodle-star {
  width: 32px;
  height: 32px;
  top: 15%;
  right: 8%;
  animation: twinkle 3s ease-in-out infinite, float-gentle 6s ease-in-out infinite;
}

.doodle-pencil {
  width: 28px;
  height: 28px;
  top: 30%;
  right: 18%;
  animation: float-sway 7s ease-in-out 0.5s infinite;
  opacity: 0.1;
}

.doodle-bulb {
  width: 30px;
  height: 30px;
  top: 55%;
  right: 5%;
  animation: twinkle 4s ease-in-out 1s infinite;
}

.doodle-rocket {
  width: 34px;
  height: 34px;
  bottom: 20%;
  right: 12%;
  animation: float-gentle 5s ease-in-out 0.3s infinite;
  opacity: 0.1;
}

.doodle-heart {
  width: 22px;
  height: 22px;
  top: 20%;
  left: 85%;
  animation: float-sway 6s ease-in-out 2s infinite;
  opacity: 0.1;
}

.doodle-abc {
  width: 60px;
  height: 20px;
  bottom: 30%;
  right: 22%;
  animation: float-gentle 8s ease-in-out 1.5s infinite;
  opacity: 0.08;
}

.doodle-plus {
  width: 24px;
  height: 24px;
  top: 70%;
  right: 25%;
  animation: float-spin 10s linear infinite;
  opacity: 0.08;
}

/* ══════════════════════════════════════════════
   WAVY SECTION DIVIDERS
   ══════════════════════════════════════════════ */
.wave-divider {
  line-height: 0;
  margin-top: -1px;
  overflow: hidden;
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: 40px;
}

.wave-hero {
  background: linear-gradient(135deg, var(--clr-bg) 0%, var(--clr-primary-bg) 100%);
}

.wave-courses {
  background: var(--clr-bg-alt);
}

.wave-advantages {
  background: var(--clr-bg-alt);
}

/* ══════════════════════════════════════════════
   SCROLL PROGRESS BAR
   ══════════════════════════════════════════════ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-accent));
  z-index: calc(var(--z-sticky) + 10);
  transition: width 50ms linear;
  border-radius: 0 2px 2px 0;
}

/* ══════════════════════════════════════════════
   TYPEWRITER EFFECT
   ══════════════════════════════════════════════ */
.typewriter-prefix {
  color: var(--clr-text-secondary);
}

.typewriter {
  color: var(--clr-primary);
  font-weight: var(--fw-bold);
  border-right: none;
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.typewriter-cursor {
  color: var(--clr-accent);
  font-weight: var(--fw-regular);
  animation: blink-cursor 0.8s step-end infinite;
  margin-left: 1px;
}

/* ══════════════════════════════════════════════
   ANIMATED GRADIENT ON HERO TITLE
   ══════════════════════════════════════════════ */
@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.hero-title .text-gradient {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent), #8b5cf6, var(--clr-primary));
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* ══════════════════════════════════════════════
   SECTION STICKER BADGES
   ══════════════════════════════════════════════ */
@keyframes sticker-pop {
  0%   { transform: rotate(var(--sticker-rot)) scale(0); }
  60%  { transform: rotate(var(--sticker-rot)) scale(1.15); }
  100% { transform: rotate(var(--sticker-rot)) scale(1); }
}

.section-sticker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-md);
  z-index: 2;
  pointer-events: none;
  --sticker-rot: -6deg;
  animation: sticker-pop 0.5s var(--ease-out) forwards, float-gentle 4s ease-in-out 1s infinite;
}

.section-sticker-popular {
  top: -12px;
  right: -10px;
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #78350f;
  --sticker-rot: 4deg;
}

.section-sticker-free {
  top: -12px;
  right: -10px;
  background: linear-gradient(135deg, var(--clr-accent), #ff5a9d);
  color: white;
  --sticker-rot: -5deg;
}

/* ══════════════════════════════════════════════
   FLOATING "GRATIS" STICKER (side of page)
   ══════════════════════════════════════════════ */
.floating-sticker {
  position: fixed;
  z-index: var(--z-dropdown);
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
  pointer-events: none;
}

.floating-sticker.visible {
  opacity: 1;
  pointer-events: auto;
}

.sticker-free {
  top: 40%;
  right: -2px;
  transform: translateX(100%);
}

.sticker-free.visible {
  transform: translateX(0);
}

.sticker-free span {
  display: block;
  background: var(--clr-accent);
  color: white;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  padding: 10px 14px 10px 16px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  box-shadow: var(--shadow-lg);
  writing-mode: vertical-lr;
  text-orientation: mixed;
  letter-spacing: 0.15em;
  animation: float-gentle 3s ease-in-out infinite;
}

/* ══════════════════════════════════════════════
   HAND-DRAWN UNDERLINE ON HEADINGS
   ══════════════════════════════════════════════ */
@keyframes draw-underline {
  from { stroke-dashoffset: 300; }
  to   { stroke-dashoffset: 0; }
}

.section-title {
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 10%;
  width: 80%;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='8' fill='none'%3E%3Cpath d='M2 5 Q50 1 100 5 T198 4' stroke='%23f92374' stroke-width='2.5' stroke-linecap='round' opacity='.3'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ══════════════════════════════════════════════
   MOUSE TRAIL STARS (canvas via JS, CSS base)
   ══════════════════════════════════════════════ */
.cursor-sparkle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: cursor-sparkle-fade 0.6s ease forwards;
}

@keyframes cursor-sparkle-fade {
  0%   { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(0) translateY(-15px); opacity: 0; }
}

/* ══════════════════════════════════════════════
   SPARKLE EFFECT ON CTA BUTTONS
   ══════════════════════════════════════════════ */
@keyframes sparkle-float {
  0%   { transform: translate(0, 0) scale(0); opacity: 1; }
  50%  { opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(1); opacity: 0; }
}

.btn-accent:hover .sparkle,
.btn-accent:focus .sparkle {
  animation: sparkle-float 0.6s ease forwards;
}

/* ══════════════════════════════════════════════
   COURSE CARD TILT ON HOVER (3D)
   ══════════════════════════════════════════════ */
.course-card {
  perspective: 800px;
}

.course-card:hover {
  transform: translateY(-6px) rotateX(2deg) rotateY(-1deg);
}

/* ══════════════════════════════════════════════
   ADVANTAGE ICONS BOUNCE ON REVEAL
   ══════════════════════════════════════════════ */
@keyframes bounce-in {
  0%   { transform: scale(0); opacity: 0; }
  50%  { transform: scale(1.2); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); opacity: 1; }
}

.advantage-card.revealed .advantage-icon {
  animation: bounce-in 0.6s var(--ease-out) forwards;
}

.advantage-card:nth-child(1).revealed .advantage-icon { animation-delay: 100ms; }
.advantage-card:nth-child(2).revealed .advantage-icon { animation-delay: 200ms; }
.advantage-card:nth-child(3).revealed .advantage-icon { animation-delay: 300ms; }
.advantage-card:nth-child(4).revealed .advantage-icon { animation-delay: 400ms; }

/* ══════════════════════════════════════════════
   TRUST BAR ICON HOVER WIGGLE
   ══════════════════════════════════════════════ */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-8deg); }
  75%      { transform: rotate(8deg); }
}

.trust-item:hover .trust-icon {
  animation: wiggle 0.4s ease;
}

/* ══════════════════════════════════════════════
   FORM SUCCESS CONFETTI
   ══════════════════════════════════════════════ */
@keyframes confetti-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(120px) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.5s ease forwards;
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   SECTION BADGE SHIMMER
   ══════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.section-badge {
  background-image: linear-gradient(
    110deg,
    transparent 0%,
    transparent 40%,
    rgba(255,255,255,0.5) 50%,
    transparent 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

/* ══════════════════════════════════════════════
   NAV LINK HOVER DOT
   ══════════════════════════════════════════════ */
.nav-link:hover::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  width: 4px;
  height: 4px;
  background: var(--clr-accent);
  border-radius: 50%;
  animation: bounce-in 0.3s ease;
}

/* ══════════════════════════════════════════════
   HERO IMAGE GENTLE ROTATE
   ══════════════════════════════════════════════ */
@keyframes gentle-rotate {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%      { transform: rotate(1.5deg) scale(1.01); }
  75%      { transform: rotate(-1.5deg) scale(1.01); }
}

.hero-image img {
  animation: gentle-rotate 8s ease-in-out infinite;
}

/* ══════════════════════════════════════════════
   FOOTER LINK HOVER SLIDE
   ══════════════════════════════════════════════ */
.footer-links a {
  position: relative;
  display: inline-block;
}

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--clr-primary-light);
  transition: width 0.3s ease;
}

.footer-links a:hover::after {
  width: 100%;
}

/* ── Counter number roll ── */
@keyframes count-up {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-number.animated {
  animation: count-up 0.6s var(--ease-out) forwards;
}

/* ── Card hover lift ── */
.card-hover {
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}

/* ── Spin for loading states ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--clr-border);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ══════════════════════════════════════════════
   ABOUT IMAGE — HAND-DRAWN BORDER
   ══════════════════════════════════════════════ */
.about-image::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: calc(var(--radius-2xl) + 4px);
  border: 3px dashed var(--clr-primary);
  opacity: 0.12;
  z-index: -1;
  animation: spin 40s linear infinite;
}

/* ══════════════════════════════════════════════
   FORM INPUT FOCUS GLOW
   ══════════════════════════════════════════════ */
@keyframes input-glow {
  0%   { box-shadow: 0 0 0 3px rgba(5, 58, 251, 0.1); }
  50%  { box-shadow: 0 0 0 5px rgba(5, 58, 251, 0.15); }
  100% { box-shadow: 0 0 0 3px rgba(5, 58, 251, 0.1); }
}

.form-input:focus,
.form-textarea:focus {
  animation: input-glow 2s ease infinite;
}

/* ── Prefers reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal, .reveal-left, .reveal-right, .reveal-scale {
    opacity: 1;
    transform: none;
  }

  .hero-doodles,
  .scroll-progress,
  .floating-sticker,
  .cursor-sparkle {
    display: none !important;
  }

  .typewriter-cursor {
    animation: none;
    display: none;
  }
}

/* ── Mobile: simplify animations ── */
@media (max-width: 768px) {
  .hero-doodles {
    display: none;
  }

  .wave-divider svg {
    height: 24px;
  }

  .floating-sticker {
    display: none;
  }

  .section-sticker {
    font-size: 0.6rem;
    padding: 4px 10px;
  }

  .section-title::after {
    display: none;
  }

  .cursor-sparkle {
    display: none;
  }

  .about-image::before {
    display: none;
  }
}
