/* ==========================================================================
   ANIMATIONS — Keyframes, scroll reveals, micro-interactions
   ========================================================================== */

/* ── Keyframes ────────────────────────────────────────────────────────────── */

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-32px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(32px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 var(--c-gold-glow); }
  60%       { box-shadow: 0 0 0 6px rgba(200, 168, 75, 0); }
}

@keyframes terminalLine {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

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

@keyframes drawLine {
  from { stroke-dashoffset: 600; }
  to   { stroke-dashoffset: 0; }
}

@keyframes svgBuild {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes goldPulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Hero entrance ────────────────────────────────────────────────────────── */
.hero__tag      { animation: fadeInDown 0.5s 0.1s both; }
.hero__title    { animation: fadeInUp   0.65s 0.2s both; }
.hero__subtitle { animation: fadeInUp   0.65s 0.32s both; }
.hero__ctas     { animation: fadeInUp   0.65s 0.44s both; }
.hero__visual   { animation: fadeInUp   0.75s 0.5s both; }

/* Terminal lines appear in sequence */
.terminal__line:nth-child(1)  { animation-delay: 1.0s; }
.terminal__line:nth-child(2)  { animation-delay: 1.7s; }
.terminal__line:nth-child(3)  { animation-delay: 2.3s; }
.terminal__line:nth-child(4)  { animation-delay: 2.9s; }
.terminal__line:nth-child(5)  { animation-delay: 3.4s; }
.terminal__line:nth-child(6)  { animation-delay: 3.9s; }
.terminal__line:nth-child(7)  { animation-delay: 4.3s; }
.terminal__line:nth-child(8)  { animation-delay: 4.7s; }

/* ── Browser SVG build animation ─────────────────────────────────────────── */
.build-el {
  opacity: 0;
  animation: svgBuild 0.45s forwards;
}
.build-el:nth-child(1) { animation-delay: 0.2s; }
.build-el:nth-child(2) { animation-delay: 0.6s; }
.build-el:nth-child(3) { animation-delay: 0.9s; }
.build-el:nth-child(4) { animation-delay: 1.3s; }
.build-el:nth-child(5) { animation-delay: 1.6s; }
.build-el:nth-child(6) { animation-delay: 1.9s; }
.build-el:nth-child(7) { animation-delay: 2.2s; }

/* ── Scroll reveal ────────────────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--t-xslow), transform var(--t-xslow);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-28px);
  transition: opacity var(--t-xslow), transform var(--t-xslow);
}

.reveal-right {
  opacity: 0;
  transform: translateX(28px);
  transition: opacity var(--t-xslow), transform var(--t-xslow);
}

.reveal.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible {
  opacity: 1;
  transform: translate(0);
}

/* Stagger children */
.stagger > .reveal:nth-child(1),
.stagger > .reveal-left:nth-child(1),
.stagger > .reveal-right:nth-child(1) { transition-delay: 0.05s; }

.stagger > .reveal:nth-child(2),
.stagger > .reveal-left:nth-child(2),
.stagger > .reveal-right:nth-child(2) { transition-delay: 0.12s; }

.stagger > .reveal:nth-child(3),
.stagger > .reveal-left:nth-child(3),
.stagger > .reveal-right:nth-child(3) { transition-delay: 0.19s; }

.stagger > .reveal:nth-child(4),
.stagger > .reveal-left:nth-child(4),
.stagger > .reveal-right:nth-child(4) { transition-delay: 0.26s; }

.stagger > .reveal:nth-child(5),
.stagger > .reveal-left:nth-child(5),
.stagger > .reveal-right:nth-child(5) { transition-delay: 0.33s; }

.stagger > .reveal:nth-child(6),
.stagger > .reveal-left:nth-child(6),
.stagger > .reveal-right:nth-child(6) { transition-delay: 0.40s; }

/* ── SVG utilities ────────────────────────────────────────────────────────── */
.svg-float  { animation: float 5s ease-in-out infinite; }
.svg-rotate { animation: rotateSlow 24s linear infinite; }

.svg-draw line,
.svg-draw path,
.svg-draw polyline {
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: drawLine 2s ease forwards;
}

/* ── Shimmer (skeleton) ───────────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--c-surface)   0%,
    var(--c-surface-2) 50%,
    var(--c-surface)   100%
  );
  background-size: 200% auto;
  animation: shimmer 1.6s infinite;
}

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