/* ========================================================
   STAFF & EVENTOS AP - Estilos Creativos, Personalidad & Animaciones Constantes
   - Transiciones de Entrada, Salida y de Vista (View Transitions & Page Transitions)
   - Luces Ambientales Persistentes (Persistent Ambient Glow Mesh)
   - Shimmer Text & Brillos Metálicos Continuos (Continuous Text Sheen)
   - Ticker Marquee Infinito con Máscara de Desvanecimiento (Continuous Marquee)
   - Insignias con Haz de Luz Persistente (Continuous Badge Sweep)
   - Balizas de Radar y Pulsos en Vivo (Live Status Radar Rings)
   - Levitación Orgánica & Card Tilt 3D (Organic Harmonic Floating & 3D Tilt)
   - Escáner Láser QR Activo (Live Scanner Beam)
   - Spotlight Interactivo que sigue al Cursor (Mouse Glow Tracking)
   - Border Beam Giratorio en Tarjetas VIP (Conic Rotating Border)
   ======================================================== */

:root {
    --apple-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --apple-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --apple-blue: #0071e3;
    --apple-blue-hover: #0077ed;
    --apple-glow: rgba(0, 113, 227, 0.25);
    --card-spotlight-color: rgba(0, 113, 227, 0.14);
}

/* ========================================================
   1. TRANSICIONES DE PÁGINA Y VISTA (VIEW TRANSITIONS API)
   ======================================================== */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: viewFadeOut 0.25s var(--apple-ease) both;
}

::view-transition-new(root) {
    animation: viewFadeIn 0.32s var(--apple-ease) both;
}

@keyframes viewFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.992) translateY(-4px);
    }
}

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

/* Transición suave de entrada y salida para toda la página */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: opacity 0.45s var(--apple-ease), transform 0.45s var(--apple-ease);
}

/* Solo se oculta si JavaScript esta activo; sin JS la pagina se ve completa */
.js body:not(.page-loaded):not(.page-exiting) {
    opacity: 0;
    transform: translateY(6px);
}

body.page-loaded {
    opacity: 1;
    transform: translateY(0);
}

body.page-exiting {
    opacity: 0;
    transform: translateY(-6px) scale(0.996);
    pointer-events: none;
}

/* ========================================================
   2. ANIMACIONES PERSISTENTES Y CONSTANTES (SIEMPRE ACTIVAS)
   ======================================================== */

/* A. Shimmer de Texto Continuo (Brillo Metálico que se desplaza siempre) */
@keyframes continuousShimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.shimmer-text {
    background: linear-gradient(
        90deg,
        #09090b 0%,
        #0071e3 25%,
        #38bdf8 50%,
        #0071e3 75%,
        #09090b 100%
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: continuousShimmer 5.5s linear infinite;
    display: inline-block;
}

.shimmer-text-dark {
    background: linear-gradient(
        90deg,
        #ffffff 0%,
        #38bdf8 25%,
        #818cf8 50%,
        #38bdf8 75%,
        #ffffff 100%
    );
    background-size: 200% auto;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: continuousShimmer 5s linear infinite;
    display: inline-block;
}

/* B. Haz de luz continuo en badges e insignias (Badge Sheen Sweep) */
.badge-shimmer {
    position: relative;
    overflow: hidden;
}

.badge-shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -120%;
    width: 65%;
    height: 200%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.45),
        transparent
    );
    transform: rotate(25deg);
    animation: badgeSweep 3.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes badgeSweep {
    0%, 35% {
        left: -120%;
    }
    70%, 100% {
        left: 220%;
    }
}

/* C. Baliza de Radar y Anillos de Pulso en Vivo (Live Status Radar Wave) */
@keyframes radarPulse {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(2.8);
        opacity: 0;
    }
}

.radar-beacon {
    position: relative;
    color: #10b981; /* el pulso hereda este color (verde disponible) */
}

.radar-beacon::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 9999px;
    background-color: currentColor;
    animation: radarPulse 2.2s cubic-bezier(0, 0.2, 0.8, 1) infinite;
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

.radar-beacon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 9999px;
    background-color: currentColor;
    animation: radarPulse 2.2s cubic-bezier(0, 0.2, 0.8, 1) infinite 0.75s;
    z-index: 0;
    pointer-events: none;
}

/* D. Respiración de Luz y Pulso en Botones Principales (Glow Pulse) */
@keyframes btnAuraPulse {
    0%, 100% {
        box-shadow: 0 8px 20px -4px rgba(0, 113, 227, 0.35);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 14px 30px 2px rgba(0, 113, 227, 0.55);
        transform: translateY(-1.5px);
    }
}

.btn-glow-pulse {
    animation: btnAuraPulse 3.6s ease-in-out infinite;
    will-change: box-shadow, transform;
}

/* E. Levitación Orgánica Continua para Tarjetas e Insignias */
@keyframes floatHarmonic {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-6px) rotate(0.4deg);
    }
    66% {
        transform: translateY(4px) rotate(-0.3deg);
    }
}

@keyframes floatHarmonicDelayed {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(5px) rotate(-0.4deg);
    }
    66% {
        transform: translateY(-5px) rotate(0.3deg);
    }
}

.float-persistent {
    animation: floatHarmonic 5.5s ease-in-out infinite;
    will-change: transform;
}

.float-persistent-delayed {
    animation: floatHarmonicDelayed 6.5s ease-in-out infinite;
    will-change: transform;
}

/* F. Pulso de Luz Ambiental en el Fondo */
@keyframes ambientDrift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.45;
    }
    33% {
        transform: translate(35px, -25px) scale(1.1);
        opacity: 0.65;
    }
    66% {
        transform: translate(-30px, 30px) scale(0.92);
        opacity: 0.4;
    }
}

.ambient-orb {
    animation: ambientDrift 11s ease-in-out infinite;
    will-change: transform, opacity;
}

.ambient-orb-delayed {
    animation: ambientDrift 13s ease-in-out infinite reverse;
    will-change: transform, opacity;
}

/* G. Ticker Marquee Infinito con Máscara de Borde Suave */
@keyframes marqueeScroll {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

.marquee-container {
    mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marqueeScroll 34s linear infinite;
    will-change: transform;
}

.marquee-track:hover {
    animation-play-state: paused;
}

/* H. Barras de Telemetría Dinámicas / Ecualizador en Vivo */
@keyframes barBounce1 { 0%, 100% { height: 4px; } 50% { height: 16px; } }
@keyframes barBounce2 { 0%, 100% { height: 14px; } 50% { height: 6px; } }
@keyframes barBounce3 { 0%, 100% { height: 8px; } 50% { height: 18px; } }
@keyframes barBounce4 { 0%, 100% { height: 16px; } 50% { height: 5px; } }

.telemetry-bar-1 { animation: barBounce1 1.2s ease-in-out infinite; }
.telemetry-bar-2 { animation: barBounce2 1.4s ease-in-out infinite; }
.telemetry-bar-3 { animation: barBounce3 1.1s ease-in-out infinite; }
.telemetry-bar-4 { animation: barBounce4 1.5s ease-in-out infinite; }

/* I. Haz de Luz Láser para Escáner QR */
@keyframes laserScan {
    0% {
        top: 2%;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        top: 94%;
        opacity: 0;
    }
}

.scanner-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #0071e3, #38bdf8, #0071e3, transparent);
    box-shadow: 0 0 16px 3px rgba(56, 189, 248, 0.85);
    animation: laserScan 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* J. Border Beam Giratorio en Tarjetas VIP */
@keyframes rotateBorder {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.border-beam-container {
    position: relative;
    overflow: hidden;
}

.border-beam-container::before {
    content: '';
    position: absolute;
    inset: -200%;
    background: conic-gradient(from 0deg, transparent 0deg 280deg, #0071e3 330deg, #38bdf8 360deg);
    animation: rotateBorder 6.5s linear infinite;
    z-index: 0;
}

.border-beam-inner {
    position: relative;
    z-index: 1;
    background: inherit;
    border-radius: inherit;
}

/* K. Iconos con respiración constante */
@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.07);
    }
}

.icon-breathe {
    animation: iconPulse 3.8s ease-in-out infinite;
    will-change: transform;
}

/* ========================================================
   3. CURSOR SPOTLIGHT & PERSPECTIVE TILT
   ======================================================== */
.spotlight-card {
    position: relative;
    background-color: #ffffff;
    transition: transform 0.4s var(--apple-ease), box-shadow 0.4s var(--apple-ease);
}

.spotlight-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: radial-gradient(
        420px circle at var(--mouse-x, -500px) var(--mouse-y, -500px),
        rgba(0, 113, 227, 0.16),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.spotlight-card:hover::before {
    opacity: 1;
}

.spotlight-card-dark {
    position: relative;
    background-color: #0d0d12;
}

.spotlight-card-dark::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: radial-gradient(
        450px circle at var(--mouse-x, -500px) var(--mouse-y, -500px),
        rgba(56, 189, 248, 0.28),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 2;
}

.spotlight-card-dark:hover::before {
    opacity: 1;
}

/* ========================================================
   4. TRANSICIONES DE ENTRADA, SALIDA Y VISTA (SCROLL & HOVER)
   ======================================================== */

/* Reveal en Scroll Bidireccional (Entrada y Salida) */
.js .reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.85s var(--apple-ease), transform 0.85s var(--apple-ease);
    will-change: opacity, transform;
}

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

.js .reveal-left {
    opacity: 0;
    transform: translateX(-35px);
    transition: opacity 0.85s var(--apple-ease), transform 0.85s var(--apple-ease);
    will-change: opacity, transform;
}

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

.js .reveal-right {
    opacity: 0;
    transform: translateX(35px);
    transition: opacity 0.85s var(--apple-ease), transform 0.85s var(--apple-ease);
    will-change: opacity, transform;
}

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

.js .reveal-scale {
    opacity: 0;
    transform: scale(0.94);
    transition: opacity 0.85s var(--apple-ease), transform 0.85s var(--apple-ease);
    will-change: opacity, transform;
}

.reveal-scale.is-visible {
    opacity: 1;
    transform: scale(1);
}

.delay-75 { transition-delay: 75ms; }
.delay-100 { transition-delay: 100ms; }
.delay-150 { transition-delay: 150ms; }
.delay-200 { transition-delay: 200ms; }
.delay-250 { transition-delay: 250ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Botones Apple con respuesta elástica */
.apple-btn {
    transition: transform 0.28s var(--apple-spring), background-color 0.2s ease, box-shadow 0.25s ease;
}

.apple-btn:hover {
    transform: scale(1.035) translateY(-1px);
}

.apple-btn:active {
    transform: scale(0.97) translateY(1px);
}

/* Tarjetas de Imagen Bento */
.bento-image-card {
    transition: transform 0.5s var(--apple-ease), box-shadow 0.5s var(--apple-ease);
}

.bento-image-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.14);
}

.bento-img {
    transition: transform 0.9s var(--apple-ease);
}

.bento-image-card:hover .bento-img {
    transform: scale(1.07);
}

/* Efectos de Cristal Apple */
.apple-glass {
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.apple-glass-dark {
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.apple-glass-badge {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.apple-glass-dark-badge {
    background: rgba(15, 15, 20, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Mini-Menús Desplegables con Transición Elástica */
.group:hover .group-hover\:opacity-100 {
    animation: dropdownPop 0.28s var(--apple-ease) forwards;
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Transición de filtrado en galería */
.gallery-card {
    transition: opacity 0.35s var(--apple-ease), transform 0.35s var(--apple-ease);
}

/* Botón flotante WhatsApp */
.wa-apple-float {
    transition: transform 0.35s var(--apple-spring), box-shadow 0.35s ease;
}

.wa-apple-float:hover {
    transform: scale(1.12) translateY(-2px);
    box-shadow: 0 16px 40px -4px rgba(16, 185, 129, 0.5);
}

/* Inputs con foco Apple */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.14);
}

/* ========================================================
   5. CONTROLES SEGMENTADOS SÍ / NO PARA FORMULARIOS ESPECÍFICOS
   ======================================================== */
.toggle-group {
    display: inline-flex;
    align-items: center;
    background: #f4f4f5;
    padding: 3px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-btn {
    border: none;
    outline: none;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #71717a;
    background: transparent;
    transition: all 0.22s var(--apple-spring);
}

.toggle-btn:hover {
    color: #18181b;
}

.toggle-btn.is-active-si {
    background: #0071e3;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 113, 227, 0.35);
    transform: scale(1.03);
}

.toggle-btn.is-active-si-emerald {
    background: #10b981;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: scale(1.03);
}

.toggle-btn.is-active-no {
    background: #e4e4e7;
    color: #52525b;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.toggle-row {
    transition: all 0.25s var(--apple-ease);
}

.toggle-row.row-selected {
    border-color: rgba(0, 113, 227, 0.45);
    background-color: #f8fafc;
    box-shadow: 0 4px 20px -2px rgba(0, 113, 227, 0.06);
}

.toggle-row.row-selected-emerald {
    border-color: rgba(16, 185, 129, 0.45);
    background-color: #f0fdf4;
    box-shadow: 0 4px 20px -2px rgba(16, 185, 129, 0.06);
}


/* ========================================================
   ACCESIBILIDAD: respetar la preferencia de menos movimiento
   ======================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }
    .js .reveal, .js .reveal-left, .js .reveal-right, .js .reveal-scale {
        opacity: 1 !important;
        transform: none !important;
    }
    .js body:not(.page-loaded) { opacity: 1 !important; transform: none !important; }
    .ambient-orb, .ambient-orb-delayed { display: none !important; }
}

/* Foco visible para navegacion con teclado */
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid #0071e3;
    outline-offset: 2px;
}
