/* =============================================================
   animations.css — Fede Saimur Tattoo
   Estados iniciales de los elementos animados por GSAP/ScrollTrigger.
   GSAP anima desde estos estados (hidden) hacia los estados finales.
   También contiene animaciones CSS puras que no dependen de JS.
   ============================================================= */


/* ── ESTADO OCULTO BASE PARA REVEAL ──────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  will-change: opacity, transform;
  animation: fallback-reveal 0.6s ease 2s forwards;
}

[data-reveal="left"] {
  opacity: 0;
  transform: translateX(-32px);
  animation: fallback-reveal 0.6s ease 2s forwards;
}

[data-reveal="right"] {
  opacity: 0;
  transform: translateX(32px);
  animation: fallback-reveal 0.6s ease 2s forwards;
}

[data-reveal="scale"] {
  opacity: 0;
  transform: scale(0.94);
  animation: fallback-reveal 0.6s ease 2s forwards;
}

.no-js [data-reveal] {
  opacity: 1;
  transform: none;
  animation: none;
}


/* ── HÉROE: CORTINA DE TEXTO ─────────────────────────────────── */
/* Cada línea del título tiene overflow:hidden (definido en layout.css).
   GSAP anima el span interior desde translateY(105%) → 0.
   Este es el estado inicial. */
.hero__title-line > span {
  display: inline-block;
  transform: translateY(105%);
  will-change: transform;
}


/* ── PARALLAX: FONDO DEL HERO ────────────────────────────────── */
/* GSAP mueve .hero__bg vía ScrollTrigger.
   will-change para GPU compositing. */
[data-parallax] {
  will-change: transform;
}


/* ── PORTFOLIO: CARRUSEL 3D ──────────────────────────────────── */
/* Los items empiezan todos centrados (transform: translate(-50%,-50%))
   y JS los posiciona en el primer render sin transición.
   No hay estado oculto inicial: el carrusel gestiona opacidad/transform. */


/* ── KEYFRAME FALLBACK GLOBAL ────────────────────────────────── */
/*
   Fallback para cuando GSAP no llega a ejecutarse (CDN lento, error de red).
   Todos los elementos ocultos usan este keyframe con delay de 2s.
   Cuando GSAP SÍ funciona, sobreescribe opacity/transform via inline style
   y este keyframe no tiene efecto visual perceptible.
*/
@keyframes fallback-reveal {
  to {
    opacity: 1;
    transform: none;
  }
}


/* ── TARJETAS DE ESTILOS: APARICIÓN EN CASCADA ───────────────── */
.style-card {
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
  animation: fallback-reveal 0.6s ease 2s forwards;
}

.no-js .style-card {
  opacity: 1;
  transform: none;
  animation: none;
}


/* ── PROCESO: ITEMS ──────────────────────────────────────────── */
.process__item {
  opacity: 0;
  transform: translateX(-16px);
  will-change: opacity, transform;
  animation: fallback-reveal 0.6s ease 2s forwards;
}

.no-js .process__item {
  opacity: 1;
  transform: none;
  animation: none;
}


/* ── TESTIMONIOS: CARRUSEL CONTINUO ─────────────────────────── */
/* Las cards fluyen sin interrupción — siempre visibles, sin estado oculto. */
.testimonial {
  opacity: 1;
  transform: none;
}

/* Keyframe: desplaza el track el -50% de su ancho total.
   Funciona porque el HTML duplica los items: originales + copias aria-hidden.
   El contenido vuelve al inicio cuando el primer set sale por la izquierda. */
@keyframes testimonials-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.testimonials__list {
  animation: testimonials-scroll 32s linear infinite;
  will-change: transform;
}

/* Pausa al hacer hover sobre el carrusel */
.testimonials__carousel:hover .testimonials__list {
  animation-play-state: paused;
}


/* ── ESTADÍSTICAS DEL ABOUT: CONTADOR ───────────────────────── */
/* GSAP animará el número con un contador.
   Estado inicial: contenido invisible hasta que entra en viewport. */
.about__stats strong {
  opacity: 0;
  transition: opacity var(--transition-base);
}


/* ── LÍNEA DE TINTA: REVEAL ──────────────────────────────────── */
/* El path SVG usa stroke-dasharray + stroke-dashoffset animado por JS.
   Estado inicial: totalmente oculto (se establece vía JS al medir el path). */
.ink-line__path {
  stroke-dasharray: 0;
  stroke-dashoffset: 0;
}


/* ── HEADER: FADE IN AL CARGAR ───────────────────────────────── */
.site-header {
  opacity: 0;
  animation: header-in 0.8s var(--ease-out-expo) 0.3s forwards;
}

@keyframes header-in {
  to { opacity: 1; }
}


/* ── WHATSAPP FLOAT: ENTRADA ─────────────────────────────────── */
.whatsapp-float {
  opacity: 0;
  transform: scale(0.8) translateY(8px);
  animation: whatsapp-in 0.6s var(--ease-spring) 1.2s forwards;
}

@keyframes whatsapp-in {
  from { opacity: 0; transform: scale(0.8) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}


/* ── GRAIN / TEXTURA (overlay sobre toda la página) ──────────── */
/* Pseudo-elemento en body para un sutil grano cinematográfico.
   Recrea la textura de la tinta sobre papel. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: var(--z-top);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.06'/%3E%3C/svg%3E");
  opacity: 0.4;
}


/* ── REDUCED MOTION: DESACTIVAR ANIMACIONES ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal="left"],
  [data-reveal="right"],
  [data-reveal="scale"],
  .style-card,
  .process__item,
  .hero__title-line > span {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }

  .testimonials__list {
    animation: none;
  }

  .hero__scroll-cue-line {
    animation: none;
    opacity: 0.4;
  }

  .whatsapp-float::before {
    animation: none;
  }
}
