/* ==========================================================================
   LENTE BINARIA v4 — Animations & Keyframes
   ========================================================================== */

/* --------------------------------------------------------------------------
   SCROLL REVEAL — Initial hidden states
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  will-change: transform, opacity;
}

[data-reveal="up"] {
  transform: translateY(60px);
}

[data-reveal="down"] {
  transform: translateY(-60px);
}

[data-reveal="left"] {
  transform: translateX(-60px);
}

[data-reveal="right"] {
  transform: translateX(60px);
}

[data-reveal="scale"] {
  transform: scale(0.9);
}

[data-reveal="fade"] {
  /* Only opacity change — no transform needed */
  transform: none;
}

/* Revealed state  — applied by JS or GSAP */
[data-reveal].is-visible {
  opacity: 1;
  transform: translate(0) scale(1);
  transition: opacity var(--duration-reveal) var(--ease-out-expo),
              transform var(--duration-reveal) var(--ease-out-expo);
}

/* Stagger children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(40px);
}

[data-stagger].is-visible > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

[data-stagger].is-visible > *:nth-child(1) { transition-delay: 0s; }
[data-stagger].is-visible > *:nth-child(2) { transition-delay: 0.1s; }
[data-stagger].is-visible > *:nth-child(3) { transition-delay: 0.2s; }
[data-stagger].is-visible > *:nth-child(4) { transition-delay: 0.3s; }
[data-stagger].is-visible > *:nth-child(5) { transition-delay: 0.4s; }
[data-stagger].is-visible > *:nth-child(6) { transition-delay: 0.5s; }

/* --------------------------------------------------------------------------
   TEXT REVEAL — Split character animations
   -------------------------------------------------------------------------- */
/* Splitting.js adds .char class to each character */
[data-text-reveal] .char {
  opacity: 0;
  transform: translateY(100%);
  display: inline-block;
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}

[data-text-reveal].is-visible .char {
  opacity: 1;
  transform: translateY(0);
}

/* Fallback: if no .char children exist (Splitting.js not loaded),
   treat the element like a regular reveal */
[data-text-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--duration-reveal) var(--ease-out-expo),
              transform var(--duration-reveal) var(--ease-out-expo);
}

[data-text-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Word-by-word reveal */
[data-text-reveal="word"] .word {
  opacity: 0;
  transform: translateY(30px);
  display: inline-block;
  margin-right: 0.3em;
  transition: opacity var(--duration-normal) var(--ease-out-expo),
              transform var(--duration-normal) var(--ease-out-expo);
}

[data-text-reveal="word"].is-visible .word {
  opacity: 1;
  transform: translateY(0);
}

/* Line reveal with clip */
[data-line-reveal] {
  overflow: hidden;
}

[data-line-reveal] > span {
  display: block;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out-expo);
}

[data-line-reveal].is-visible > span {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   KEYFRAMES LIBRARY
   -------------------------------------------------------------------------- */

/* Fade animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

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

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Glow effects */
@keyframes glow-pulse {
  0%, 100% {
    box-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 40px var(--accent-glow-strong);
  }
}

@keyframes glow-text {
  0%, 100% {
    text-shadow: 0 0 20px var(--accent-glow);
  }
  50% {
    text-shadow: 0 0 40px var(--accent-glow-strong);
  }
}

/* Shimmer / Gradient slide */
@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.shimmer {
  background: linear-gradient(
    120deg,
    transparent 25%,
    rgba(212, 160, 60, 0.1) 50%,
    transparent 75%
  );
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}

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

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

/* Scale breathe */
@keyframes breathe {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

/* Draw line (SVG stroke) */
@keyframes draw-line {
  from {
    stroke-dashoffset: var(--line-length, 1000);
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* Iris open (preloader) */
@keyframes iris-open {
  from {
    clip-path: circle(0% at 50% 50%);
  }
  to {
    clip-path: circle(100% at 50% 50%);
  }
}

@keyframes iris-close {
  from {
    clip-path: circle(100% at 50% 50%);
  }
  to {
    clip-path: circle(0% at 50% 50%);
  }
}

/* Counter tick */
@keyframes counter-tick {
  0% { transform: translateY(-10px); opacity: 0; }
  50% { opacity: 1; }
  100% { transform: translateY(0); opacity: 1; }
}

/* Particle drift */
@keyframes drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translate(var(--drift-x, 100px), var(--drift-y, -200px)) rotate(180deg);
    opacity: 0;
  }
}

/* Grain noise */
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  20% { transform: translate(-15%, 5%); }
  30% { transform: translate(7%, -25%); }
  40% { transform: translate(-5%, 25%); }
  50% { transform: translate(-15%, 10%); }
  60% { transform: translate(15%, 0%); }
  70% { transform: translate(0%, 15%); }
  80% { transform: translate(3%, 35%); }
  90% { transform: translate(-10%, 10%); }
}

/* --------------------------------------------------------------------------
   HERO-SPECIFIC ANIMATIONS
   -------------------------------------------------------------------------- */
.hero__decoration {
  position: absolute;
  right: -10%;
  top: 50%;
  transform: translateY(-50%);
  width: 60%;
  max-width: 600px;
  opacity: 0.06;
  animation: rotate-slow 120s linear infinite;
  pointer-events: none;
}

.hero__grain {
  position: absolute;
  inset: -200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
  pointer-events: none;
  z-index: 0;
}

/* Hero stats - glass counter cards */
.hero__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-top: var(--space-3xl);
}

.hero__stat {
  text-align: center;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-sm);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.hero__stat:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.hero__stat-number {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-2xs);
}

.hero__stat-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

@media (max-width: 640px) {
  .hero__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   COMPARISON TABLE — Animated
   -------------------------------------------------------------------------- */
.comparison {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--glass-bg);
}

.comparison__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-light);
}

.comparison__row:last-child {
  border-bottom: none;
}

.comparison__row--header {
  background: var(--bg-secondary);
}

.comparison__cell {
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.comparison__cell--header {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.comparison__cell--highlight {
  color: var(--text-primary);
  background: var(--accent-muted);
}
