/* =============================================
   ANIMACIONES GLOBALES — San Lorenzo
   Archivo: css/animations.css
   ============================================= */

/* ── REVEAL VARIANTS (Etapa 2 — unificado) ──────
   Trigger class: .visible (alineado con variables.css
   y con los overrides de delay en hero.css).
   .fade-up vive en variables.css — acá las 4 variantes
   adicionales: fade-left, fade-right, scale-in (alias
   zoom-in), clip-reveal. */
.fade-left,
.fade-right,
.scale-in,
.zoom-in,
.clip-reveal {
  opacity: 0;
  will-change: opacity, transform;
  transition:
    opacity   var(--dur-slow) var(--ease-out-expo),
    transform var(--dur-slow) var(--ease-out-expo);
}

.fade-left  { transform: translateX(-40px); }
.fade-right { transform: translateX(40px); }
.scale-in,
.zoom-in    { transform: scale(0.92); }

.clip-reveal {
  clip-path: inset(0 100% 0 0);
  transition:
    clip-path var(--dur-xslow) var(--ease-out-expo),
    opacity   var(--dur-base)  ease;
}

.fade-left.visible,
.fade-right.visible,
.scale-in.visible,
.zoom-in.visible {
  opacity: 1;
  transform: none;
}

.clip-reveal.visible {
  clip-path: inset(0 0% 0 0);
  opacity: 1;
}

/* Delays escalonados — sin !important para permitir
   override por data-delay inline o por hero.css. */
.delay-1 { transition-delay: 0.10s; }
.delay-2 { transition-delay: 0.20s; }
.delay-3 { transition-delay: 0.32s; }
.delay-4 { transition-delay: 0.44s; }
.delay-5 { transition-delay: 0.56s; }

/* ── STAGGER ANIMATIONS (Etapa 2) ──────────────
   Hijos de [data-stagger] usan keyframe animations
   en lugar de transitions. Razón: muchos hijos (ej. .mc)
   ya declaran su propia `transition: transform 0.38s`
   para hover/3D — si usáramos transition para el reveal
   se pisarían. Con @keyframes + animation-fill-mode:
   backwards el reveal corre independiente, y la transition
   del hover queda libre para el comportamiento post-reveal. */
@keyframes staggerFadeUp     { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes staggerFadeLeft   { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes staggerFadeRight  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes staggerScaleIn    { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

[data-stagger] > .fade-up.visible    { animation: staggerFadeUp    var(--dur-slow) var(--ease-out-expo) backwards; }
[data-stagger] > .fade-left.visible  { animation: staggerFadeLeft  var(--dur-slow) var(--ease-out-expo) backwards; }
[data-stagger] > .fade-right.visible { animation: staggerFadeRight var(--dur-slow) var(--ease-out-expo) backwards; }
[data-stagger] > .scale-in.visible,
[data-stagger] > .zoom-in.visible    { animation: staggerScaleIn   var(--dur-slow) var(--ease-out-expo) backwards; }

/* ── HERO ANIMATIONS ────────────────────────── */

/* Collage hero: imagen con parallax + ken burns suave */
.hero__bg img {
  transform-origin: center center;
  will-change: transform;
  transition: none; /* JS controla el parallax */
}

/* El collage tiene fondo crema → hero overlay más suave */
.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right,  rgba(10,10,10,0.82) 0%, rgba(10,10,10,0.3) 65%, transparent 100%),
    linear-gradient(to bottom, transparent 50%, rgba(10,10,10,0.7) 100%);
  z-index: 1;
}

/* ── MUSEUM CARDS TILT ───────────────────────── */
.mc {
  will-change: transform;
  transform-style: preserve-3d;
}

/* ── SPLIT TEXT (word wrap containers) ─────── */
.split-word { display: inline-block; overflow: hidden; vertical-align: bottom; }
.split-word__inner { display: inline-block; will-change: transform; }

/* ── PROGRESS BAR ───────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, #04719a 0%, #f39204 50%, #e30b17 100%);
  z-index: 9999;
  pointer-events: none;
  transform-origin: left;
}

/* ── CUSTOM CURSOR ───────────────────────────── */
#custom-cursor,
#cursor-ring {
  pointer-events: none;
  position: fixed;
  border-radius: 50%;
  z-index: 99999;
}

/* ── SECTION STACKING ────────────────────────── */
.stack-section {
  position: sticky;
  top: 0;
  z-index: 1;
  will-change: transform, filter;
}
.stack-section:nth-child(2) { z-index: 2; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(3) { z-index: 3; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(4) { z-index: 4; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(5) { z-index: 5; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(6) { z-index: 6; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(7) { z-index: 7; border-radius: 20px 20px 0 0; }
.stack-section:nth-child(8) { z-index: 8; border-radius: 20px 20px 0 0; }

/* ── HOVER GLOW EN PINS DEL MAPA ────────────── */
.mi-pin circle:first-of-type {
  filter: drop-shadow(0 0 0px currentColor);
  transition: filter 0.25s ease, r 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.mi-pin:hover circle:first-of-type {
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.3));
}

/* ── LÍNEA TIMELINE ANIMADA ─────────────────── */
.timeline {
  position: relative;
}
.timeline__dot {
  position: relative;
  z-index: 2;
  animation: dotPulse 2.5s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(227,11,23,0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(227,11,23,0); }
}

/* ── SMOOTH HOVER TRANSITIONS GLOBALES ──────── */
a, button { transition: color 0.18s ease, background 0.18s ease, transform 0.22s ease; }
img       { transition: transform 0.55s cubic-bezier(0.16,1,0.3,1); }

/* ── HERO COLLAGE SPECIFIC ───────────────────── */
/* El collage tiene fondo claro — necesita ajuste de object-position */
.hero--collage .hero__bg img {
  object-position: center 30%;
  object-fit: cover;
}
/* Text legibility over light collage image */
.hero--collage .hero__title,
.hero--collage .hero__subtitle,
.hero--collage .hero__eyebrow {
  text-shadow: 0 2px 20px rgba(0,0,0,0.6), 0 0 40px rgba(0,0,0,0.4);
}

/* ── ENTRANCE PULSE para stats ───────────────── */
@keyframes statPop {
  0%   { transform: scale(0.8); opacity: 0; }
  70%  { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
.hero__stat.animated {
  animation: statPop 0.55s cubic-bezier(0.34,1.56,0.64,1) both;
}

/* ── NAV hide/show on scroll ─────────────────── */
.nav.hidden {
  transform: translateY(-100%);
}
.nav {
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1),
              background 0.3s ease, box-shadow 0.3s ease;
}

/* ── BUTTON PRESS EFFECT ─────────────────────── */
.btn:active {
  transform: scale(0.96) !important;
}

/* ── IMAGE HOVER ZOOM ────────────────────────── */
.about__img-wrap:hover img,
.contacto__photo:hover img {
  transform: scale(1.04);
}
.about__img-wrap img,
.contacto__photo img {
  transition: transform 0.65s cubic-bezier(0.16,1,0.3,1);
}

/* ── FOOTER LINKS UNDERLINE DRAW ────────────── */
.footer__nav-link {
  position: relative;
}
.footer__nav-link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  height: 1px;
  width: 0;
  background: #04719a;
  transition: width 0.28s cubic-bezier(0.16,1,0.3,1);
}
.footer__nav-link:hover::after { width: 100%; }

/* ── PREFERS REDUCED MOTION ─────────────────── */
@media (prefers-reduced-motion: reduce) {
  .fade-up, .fade-left, .fade-right, .scale-in, .zoom-in,
  .clip-reveal, .split-word__inner {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
    animation: none !important;
  }
  #custom-cursor, #cursor-ring { display: none; }
}
