/* ============================================================
   ANIMATIONS v3 -- Light Theme
   Scroll Reveals, Parallax, Micro-interactions
   ============================================================ */

/* --- Reveal Base States --- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.reveal-scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* --- Stagger --- */
.delay-1 { transition-delay: 0.1s !important; }
.delay-2 { transition-delay: 0.2s !important; }
.delay-3 { transition-delay: 0.3s !important; }
.delay-4 { transition-delay: 0.4s !important; }
.delay-5 { transition-delay: 0.5s !important; }
.delay-6 { transition-delay: 0.6s !important; }

/* Stagger container auto-delays children */
.stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 0.07s);
}

.stagger.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* --- Hero Intro Animation Keyframes --- */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes heroLine {
  from { width: 0; }
  to   { width: 60px; }
}

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

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.05); }
}

@keyframes gradient-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes rotate-slow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* --- Hero Intro Classes --- */
.animate-hero > * {
  opacity: 0;
  animation: heroFadeUp 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-hero > *:nth-child(1) { animation-delay: 0.1s; }
.animate-hero > *:nth-child(2) { animation-delay: 0.3s; }
.animate-hero > *:nth-child(3) { animation-delay: 0.5s; }
.animate-hero > *:nth-child(4) { animation-delay: 0.7s; }
.animate-hero > *:nth-child(5) { animation-delay: 0.9s; }

/* Utilities for previously unused keyframes */
.animate-hero-line {
  animation: heroLine 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.rotate-slow {
  animation: rotate-slow 10s linear infinite;
}

/* --- Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, var(--gold-600), var(--gold-400), var(--gold-500));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* --- Glow Ring Decorations --- */
.glow-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(158, 123, 52, 0.10);
  pointer-events: none;
  animation: pulse-glow 6s ease-in-out infinite;
}

/* --- Floating Decoration --- */
.float-element {
  animation: float 6s ease-in-out infinite;
}

/* --- Smooth underline hover --- */
.hover-underline {
  position: relative;
  display: inline-block;
}

.hover-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-underline:hover::after {
  transform: scaleX(1);
}

/* --- Counter --- */
.counter-value {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   PAGE TRANSITIONS (Smooth fade between pages)
   ============================================================ */

body {
  opacity: 0;
  animation: pageFadeIn 0.34s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}

body.page-transitioning {
  animation: pageFadeOut 0.24s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pageFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* View Transitions API -- progressive enhancement */
@supports (view-transition-name: none) {
  body {
    opacity: 1;
    animation: none;
  }

  body.page-transitioning {
    animation: none;
  }

  ::view-transition-old(root) {
    animation: pageViewOut 240ms cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  ::view-transition-new(root) {
    animation: pageViewIn 340ms cubic-bezier(0.22, 0.9, 0.3, 1) both;
  }
}

@keyframes pageViewIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pageViewOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0.08;
    transform: translateY(-2px) scale(0.998);
  }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  body {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
  }
}
