/* ============================================================
   DASE EP — SITIO OFICIAL
   animations.css | Animaciones, transiciones y efectos
   Versión: 1.0.0 | 2025
   ============================================================ */

/* ─── SCROLL REVEAL ───────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Delays */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* ─── HOVER GLOW ────────────────────────────────────────── */
.hover-glow {
  transition: var(--transicion);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(0, 183, 201, 0.3),
              0 0 40px rgba(0, 183, 201, 0.1);
}

/* ─── FLOAT ANIMATION ─────────────────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.float-anim {
  animation: float 3s ease-in-out infinite;
}

/* ─── PULSE SOFT ──────────────────────────────────────────── */
@keyframes pulseSoft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.pulse-soft {
  animation: pulseSoft 2s ease-in-out infinite;
}

/* ─── SHIMMER ─────────────────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 3s ease-in-out infinite;
}

/* ─── SPIN ────────────────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fa-spinner, .fa-spin {
  animation: spin 1s linear infinite;
}

/* ─── COUNTER STYLE ─────────────────────────────────────── */
.counter-anim {
  display: inline-block;
}

/* ─── GLASSMORPHISM ─────────────────────────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ─── GRADIENT ANIMATION ─────────────────────────────────── */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.gradient-anim {
  background-size: 200% 200%;
  animation: gradientShift 6s ease infinite;
}

/* ─── ENTRANCE CARD STAGGER ─────────────────────────────── */
.card-stagger > * {
  opacity: 0;
  transform: translateY(12px);
  will-change: transform, opacity;
}

.card-stagger.visible > *:nth-child(1) { transition: all 0.5s ease 0.05s; }
.card-stagger.visible > *:nth-child(2) { transition: all 0.5s ease 0.1s; }
.card-stagger.visible > *:nth-child(3) { transition: all 0.5s ease 0.15s; }
.card-stagger.visible > *:nth-child(4) { transition: all 0.5s ease 0.2s; }
.card-stagger.visible > *:nth-child(5) { transition: all 0.5s ease 0.25s; }
.card-stagger.visible > *:nth-child(6) { transition: all 0.5s ease 0.3s; }
.card-stagger.visible > *:nth-child(7) { transition: all 0.5s ease 0.35s; }
.card-stagger.visible > *:nth-child(8) { transition: all 0.5s ease 0.4s; }
.card-stagger.visible > *:nth-child(9) { transition: all 0.5s ease 0.45s; }
.card-stagger.visible > *:nth-child(10) { transition: all 0.5s ease 0.5s; }
.card-stagger.visible > *:nth-child(11) { transition: all 0.5s ease 0.55s; }
.card-stagger.visible > *:nth-child(12) { transition: all 0.5s ease 0.6s; }
.card-stagger.visible > *:nth-child(13) { transition: all 0.5s ease 0.65s; }
.card-stagger.visible > *:nth-child(14) { transition: all 0.5s ease 0.7s; }
.card-stagger.visible > *:nth-child(15) { transition: all 0.5s ease 0.75s; }
.card-stagger.visible > *:nth-child(16) { transition: all 0.5s ease 0.8s; }
.card-stagger.visible > *:nth-child(17) { transition: all 0.5s ease 0.85s; }
.card-stagger.visible > *:nth-child(18) { transition: all 0.5s ease 0.9s; }
.card-stagger.visible > *:nth-child(19) { transition: all 0.5s ease 0.95s; }
.card-stagger.visible > *:nth-child(20) { transition: all 0.5s ease 1s; }

.card-stagger.visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ─── PARALLAX SUAVE ───────────────────────────────────────── */
.parallax-slow {
  will-change: transform;
}

/* ─── BORDER GLOW ─────────────────────────────────────────── */
@keyframes borderGlow {
  0%, 100% { border-color: rgba(0, 183, 201, 0.2); }
  50% { border-color: rgba(0, 183, 201, 0.6); }
}

.border-glow {
  animation: borderGlow 2s ease-in-out infinite;
}

/* ─── RIPPLE EFFECT ───────────────────────────────────────── */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  width: 100px;
  height: 100px;
  margin-top: -50px;
  margin-left: -50px;
  top: 50%;
  left: 50%;
  transform: scale(0);
  opacity: 0;
}

.ripple:active::after {
  animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
  0% { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

/* ─── LOADING SKELETON ────────────────────────────────────── */
@keyframes skeleton {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radio-sm);
}

/* ═══════════════════════════════════════════════════════════════
   BOTÓN FLOTANTE — HISTORIAS DE VIDA
   Componente interactivo con morphing foto → formas → esfera → texto
   ═══════════════════════════════════════════════════════════════ */

/* ─── Contenedor principal ─── */
.story-btn {
  position: fixed;
  bottom: 120px;
  right: 30px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform;
}

.story-btn:hover {
  transform: scale(1.15);
}

.story-btn:active {
  transform: scale(0.9);
}

/* ─── Inner container (morphing layer) ─── */
.story-btn-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* clip-path se aplica dinámicamente por estado */
  clip-path: circle(50%);
  background: linear-gradient(135deg, var(--turquesa), var(--azul-institucional));
  box-shadow: 0 8px 32px rgba(0, 183, 201, 0.35),
              0 0 80px rgba(0, 183, 201, 0.12);
  overflow: visible;
  transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Avatar / Foto (alta calidad, sin blur) ─── */
.story-btn-avatar {
  position: absolute;
  inset: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transform: scale(1) rotate(0deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 2;
  border-radius: inherit;
  overflow: hidden;
}

.story-btn-avatar-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.15);
  border: 3px solid rgba(255, 255, 255, 0.4);
  transition: border-radius 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.5s ease;
}

.story-btn-avatar-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
  image-rendering: auto;
  -ms-interpolation-mode: nearest-neighbor;
}

/* ─── Formas geométricas dinámicas ─── */
.story-btn-shape {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.3) rotate(-30deg);
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 1;
}

.story-btn-shape-bg {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle at 40% 35%, rgba(0, 183, 201, 0.9), rgba(10, 77, 155, 0.7));
  transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.8s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s ease;
  animation: shapeMorph 4s ease-in-out infinite;
  box-shadow: 0 0 30px rgba(0, 183, 201, 0.2);
}

.story-btn-shape-glow {
  position: absolute;
  inset: -16px;
  background: radial-gradient(circle, rgba(0, 183, 201, 0.12), transparent 70%);
  animation: shapeGlow 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shapeMorph {
  0%, 100% {
    clip-path: polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%);  /* pentágono */
    border-radius: 40% 60% 30% 70% / 50% 40% 60% 50%;
  }
  25% {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);  /* hexágono */
    border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%;
  }
  50% {
    clip-path: polygon(50% 0%, 80% 10%, 100% 35%, 100% 65%, 80% 90%, 50% 100%, 20% 90%, 0% 65%, 0% 35%, 20% 10%);  /* decágono */
    border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%;
  }
  75% {
    clip-path: polygon(25% 0%, 75% 0%, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0% 75%, 0% 25%);  /* octágono */
    border-radius: 60% 30% 60% 30% / 40% 60% 40% 60%;
  }
}

@keyframes shapeGlow {
  0%, 100% { transform: scale(0.85); opacity: 0.25; }
  50% { transform: scale(1.25); opacity: 0.5; }
}

/* ─── Esfera de color ─── */
.story-btn-sphere {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.6s ease, transform 0.6s ease;
  z-index: 1;
}

.story-btn-sphere-core {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 199, 44, 0.95), rgba(0, 183, 201, 0.7), rgba(10, 77, 155, 0.4));
  animation: spherePulse 2.5s ease-in-out infinite;
  box-shadow: 0 0 40px rgba(255, 199, 44, 0.3);
}

.story-btn-sphere-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 199, 44, 0.15), transparent 70%);
  animation: sphereGlow 2.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes spherePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes sphereGlow {
  0%, 100% { transform: scale(0.85); opacity: 0.25; }
  50% { transform: scale(1.3); opacity: 0.5; }
}

/* ─── Texto animado ─── */
.story-btn-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-titulo);
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1.15;
  color: var(--blanco);
  text-align: center;
  padding: 6px;
  opacity: 0;
  transform: scale(0.25) rotate(-15deg);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 4;
  text-shadow:
    0 2px 12px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.03em;
  word-break: break-word;
  max-width: 80%;
  margin: 0 auto;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ─── Estados del morphing ─── */
/* Cada estado define qué capas se ven y cómo se transforman */

/* 1) AVATAR — foto nítida */
.story-btn.state-avatar .story-btn-avatar {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.story-btn.state-avatar .story-btn-shape {
  opacity: 0;
  transform: scale(0.3) rotate(-30deg);
  transition-delay: 0s;
}
.story-btn.state-avatar .story-btn-sphere {
  opacity: 0;
  transform: scale(0.3);
}
.story-btn.state-avatar .story-btn-text {
  opacity: 0;
  transform: scale(0.25) rotate(-15deg);
}

/* 2) SHAPE — formas geométricas animadas */
.story-btn.state-shape .story-btn-avatar {
  opacity: 0;
  transform: scale(0.3) rotate(10deg);
}
.story-btn.state-shape .story-btn-shape {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
.story-btn.state-shape .story-btn-sphere {
  opacity: 0;
  transform: scale(0.3);
}
.story-btn.state-shape .story-btn-text {
  opacity: 0;
  transform: scale(0.25) rotate(-15deg);
}

/* 3) SPHERE — esfera pulsante */
.story-btn.state-sphere .story-btn-avatar {
  opacity: 0;
  transform: scale(0.3);
}
.story-btn.state-sphere .story-btn-shape {
  opacity: 0;
  transform: scale(0.3) rotate(30deg);
}
.story-btn.state-sphere .story-btn-sphere {
  opacity: 1;
  transform: scale(1);
}
.story-btn.state-sphere .story-btn-text {
  opacity: 0;
  transform: scale(0.25) rotate(-15deg);
}

/* 4) TEXT — texto legible con fondo semitransparente */
.story-btn.state-text .story-btn-avatar {
  opacity: 0;
  transform: scale(0.3);
}
.story-btn.state-text .story-btn-shape {
  opacity: 0;
  transform: scale(0.3) rotate(-30deg);
}
.story-btn.state-text .story-btn-sphere {
  opacity: 0;
  transform: scale(0.3);
}
.story-btn.state-text .story-btn-text {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* ─── Transición del fondo y forma del inner ─── */
.story-btn.state-avatar .story-btn-inner {
  background: linear-gradient(135deg, var(--turquesa), var(--azul-institucional));
  clip-path: circle(50%);
}

.story-btn.state-shape .story-btn-inner {
  background: linear-gradient(135deg, #0A4D9B, #009688);
  /* Forma orgánica fluida */
  clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
  border-radius: 30% 70% 50% 50% / 50% 40% 60% 50%;
}

.story-btn.state-sphere .story-btn-inner {
  background: radial-gradient(circle at 30% 30%, var(--amarillo), var(--turquesa));
  clip-path: circle(50%);
}

.story-btn.state-text .story-btn-inner {
  background: linear-gradient(135deg, var(--azul-institucional), #1a1a4e);
  clip-path: circle(50%);
}

/* ─── Clip-path dinámico extra para morphing de formas ─── */
.story-btn-inner {
  animation: innerShapeMorph 12s ease-in-out infinite;
}

@keyframes innerShapeMorph {
  0%, 25% {
    clip-path: circle(50%);
    border-radius: 50%;
  }
  25.1%, 50% {
    clip-path: polygon(20% 0%, 80% 0%, 100% 20%, 100% 80%, 80% 100%, 20% 100%, 0% 80%, 0% 20%);
    border-radius: 20% 50% 30% 60% / 40% 30% 60% 50%;
  }
  50.1%, 75% {
    clip-path: circle(50%);
    border-radius: 50%;
  }
  75.1%, 100% {
    clip-path: polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%);
    border-radius: 40% 60% 30% 70% / 50% 40% 60% 50%;
  }
}

/* ─── Ondas expansivas (rings) ─── */
.story-btn-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2.5px solid rgba(0, 183, 201, 0.2);
  animation: ringExpand 4s ease-out infinite;
  pointer-events: none;
}

.story-btn-ring-2 {
  animation-delay: 1.3s;
  inset: -5px;
  border-width: 1.5px;
}

.story-btn-ring-3 {
  animation-delay: 2.6s;
  inset: -15px;
  border-width: 1px;
}

@keyframes ringExpand {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* ─── Efecto glow continuo ─── */
.story-btn::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--turquesa), var(--amarillo));
  z-index: -1;
  opacity: 0;
  animation: storyGlow 3s ease-in-out infinite;
  filter: blur(18px);
}

@keyframes storyGlow {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.1); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .story-btn {
    width: 76px;
    height: 76px;
    bottom: 100px;
    right: 20px;
  }

  .story-btn-shape-bg {
    width: 52px;
    height: 52px;
  }

  .story-btn-sphere-core {
    width: 42px;
    height: 42px;
  }

  .story-btn-text {
    font-size: 0.6rem;
    padding: 6px 8px;
    max-width: 85%;
  }

  .story-btn-ring {
    inset: -6px;
  }
  .story-btn-ring-2 {
    inset: -3px;
  }
  .story-btn-ring-3 {
    inset: -10px;
  }
}

@media (max-width: 480px) {
  .story-btn {
    width: 64px;
    height: 64px;
    bottom: 90px;
    right: 14px;
  }

  .story-btn-avatar-img {
    border-width: 2px;
  }

  .story-btn-shape-bg {
    width: 44px;
    height: 44px;
  }

  .story-btn-sphere-core {
    width: 36px;
    height: 36px;
  }

  .story-btn-text {
    font-size: 0.52rem;
    padding: 5px 6px;
    max-width: 90%;
  }

  .story-btn-ring {
    inset: -4px;
    border-width: 2px;
  }
  .story-btn-ring-2 {
    inset: -2px;
    border-width: 1px;
  }
  .story-btn-ring-3 {
    inset: -8px;
    border-width: 1px;
  }
}
