/* ===================================================
   SECCIÓN DE EQUIPOS - MOBILE FIRST (FINAL y OPTIMIZADA)
   =================================================== */

/* Variables CSS LOCALS (Basadas en style.css) */
:root {
    /* Sombra de elevación para la card (limpia y definida) */
    --equipo-card-base-shadow: 0 5px 20px rgba(0, 0, 0, 0.15); 
    /* Brillo de marca Landetxa al hacer hover */
    /*--equipo-card-hover-glow: 0 0 10px var(--primary-green-light), 0 10px 40px rgba(0, 0, 0, 0.3); */
}


/* 1. SECCIÓN PRINCIPAL Y FONDO (Se mantiene) */
.section-title {
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body:not(.content-ready) .equipos-section { opacity: 0; visibility: hidden; }

/* 1. SECCIÓN PRINCIPAL: Ahora es solo un contenedor vacío de fondo */
.equipos-section {
    position: relative;
    padding: var(--spacing-3xl) var(--spacing-md);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-black); /* Color de respaldo para que no haya blanco */
}

/* 2. EL NUEVO FONDO: Separado para evitar el error de 'fixed' */
.equipos-section::before {
    content: "";
    position: fixed; /* Cambiado de absolute a fixed */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh; /* Altura de la pantalla, no de la sección */
    background-image: url('Fondos/ImagenFondoActualidad.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
    /* Esto evita que el fondo se mueva o haga zoom al filtrar */
    pointer-events: none; 
}

/* 3. EL OVERLAY: Encima del fondo pero debajo del contenido */
.equipos-section .background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Gradual oscuro para que el texto sea legible */
    background: radial-gradient(circle at center, rgba(17, 17, 17, 0.8) 0%, var(--secondary-black) 100%);
    z-index: 1;
    opacity: 0.95;
    /* Tu textura de ruido */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' opacity='.05'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.5' numOctaves='1'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 100px;
}

/* 4. AJUSTE PARA DESKTOP: Aquí sí podemos usar el efecto fixed */
@media (min-width: 1024px) {
    .equipos-section::before {
        background-attachment: fixed;
    }
}

/* Aseguramos que todo lo que hay dentro de la sección esté por encima del fondo */
.equipos-section > * {
    position: relative;
    z-index: 2;
}

@keyframes breathe {
    0%, 100% { opacity: 0.95; }
    50% { opacity: 0.92; }
}

.equipos-section>* {
    position: relative;
    z-index: 2;
}


.equipo-card {
    background-color: var(--neutral-white);
    border-radius: var(--radius-lg); 
    overflow: hidden;
    box-shadow: var(--equipo-card-base-shadow); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease-out; 
    display: flex;
    flex-direction: column;
    will-change: transform, box-shadow; 
    opacity: 0;
}
.equipo-card:hover {
    transform: translateY(-8px); /* Eliminado el scale(1.01) que suele causar desenfoque en fotos */
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3); /* Sombra estándar más profunda */
    background-color: var(--neutral-white); /* Mantenemos el blanco limpio */
}


/* ===================================================
   2. SUBTÍTULO Y CONTROLES
=================================================== */
.equipos-subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    margin-bottom: var(--spacing-xl);
    text-align: center;
    max-width: 600px;
    line-height: 1.6;
    /* Sin delay para aparecer inmediatamente */
    animation: fadeIn 0.6s var(--ease-out-expo) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.equipos-controls {
    margin: var(--spacing-xl) 0;
    width: 100%;
    max-width: 400px;
    /* Sin delay para aparecer inmediatamente */
    animation: fadeIn 0.6s var(--ease-out-expo) forwards;
}

.form-select {
    width: 100%;
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: var(--neutral-white);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all 0.3s var(--ease-out-smooth);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.form-select:hover,
.form-select:focus {
    border-color: var(--primary-green-light);
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 4px 20px rgba(0, 125, 76, 0.3),
        0 0 0 3px rgba(0, 125, 76, 0.1);
    outline: none;
}

.form-select option {
    background-color: var(--secondary-black);
    color: var(--neutral-white);
}

/* ===================================================
   6. CONTENIDO DE LA TARJETA
=================================================== */
.equipo-content {
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex-grow: 1;
    background: var(--neutral-white);
}

.equipo-title {
    font-family: var(--font-heading);
    font-size: clamp(1.3rem, 3vw, 1.6rem);
    color: var(--secondary-black);
    margin: 0;
    font-weight: 900;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.equipo-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
    margin: 0;
    flex-grow: 1;
}

/* Estadísticas mejoradas */
.equipo-stats {
    display: flex;
    /* 💥 SOLUCIÓN: Permite que los elementos salten a la siguiente línea */
    flex-wrap: wrap; 
    
    /* Permite algo de espacio entre las estadísticas si tienen un ancho menor */
    gap: var(--spacing-sm) var(--spacing-md); 

    /* Aseguramos que la columna funcione en desktop si la Card es horizontal */
    flex-direction: row; 
    
    /* Si tienes más estilos aquí, déjalos */
    margin-top: var(--spacing-md); 
    padding: 0 var(--spacing-md); /* Pequeño ajuste de padding si es necesario */
}

.equipo-stats .stat {
    /* Define un ancho base para forzar el salto si es necesario. 
       Aquí, si solo pones el 100% solo saldrá uno por línea. 
       Si pones 50% saldrán dos por línea. */
    flex-basis: 100%; /* 💥 Para que cada stat ocupe su propia línea completa */
    
    display: flex;
    align-items: center;
    /* Si necesitas que el texto del entrenador se envuelva dentro del stat */
    white-space: normal; 
    overflow-wrap: break-word;
}

.stat {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 0.85rem;
    color: #666;
    transition: color 0.3s ease;
}

.stat i {
    font-size: 1rem;
    transition: transform 0.3s var(--ease-out-back);
}

/* Esto asegura que el degradado de la foto NO cambie a verde en hover */
.equipo-card:hover .equipo-image::before {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.1) 70%);
}

/* 6. IMAGEN Y OVERLAY - SOLUCIÓN DEFINITIVA DEL HOVER (CONFIRMADO) */

.equipo-image {
    position: relative;
    height: 220px; /* Un poco más de aire para fotos panorámicas */
    overflow: hidden;
    background-color: #333; /* Fondo oscuro por si tarda en cargar */
    display: flex;
    align-items: flex-end;
    padding: var(--spacing-md);
    flex-shrink: 0;
    background-size: cover;
    background-position: center 25%;
}



.equipo-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.05) 60%);
    transition: background 0.3s ease-out; 
    z-index: 1; 
}


.equipo-badge {
    z-index: 2; 
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: var(--accent-gold);
    color: var(--secondary-black);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 0.8rem;
    box-shadow: var(--shadow-sm);
}

/* ===================================================
   8. MODAL - DISEÑO POLAROID PIZARRA DE CLASE
   =================================================== */

/* FONDO OSCURO */
#equipo-modal.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#equipo-modal.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* EL TABLÓN DE CORCHO (Volvemos a la anchura original) */
#equipo-modal .modal-content.cork-board {
    /* 1. Mantenemos tu corcho */
    background-image: url('https://www.toptal.com/designers/subtlepatterns/uploads/cork-board.png') !important;
    background-color: #6e4e2d !important;
    
    /* 2. BORDE: Olvida el border-image complejo. 
       Usamos un borde sólido con un outline para crear el efecto "Marco de Pizarra" */
    border: 12px solid #4a331d !important; /* Madera oscura */
    outline: 2px solid #2a1d15; /* Línea de definición final */
    border-radius: 4px;

    /* 3. ESPACIO: Aquí es donde ganamos la foto.
       Reducimos los paddings laterales a casi nada para que la foto estire */
    padding: 85px 6px 15px 6px !important; 
    
    width: 98%;
    max-width: 600px;
    position: relative;
    
    /* Sombra para que se separe de la pared */
    box-shadow: 0 25px 50px rgba(0,0,0,0.8);
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

/* Animación opcional del cursor (como la punta del rotulador) */
@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #1a1a1a; }
}

/* BOTÓN CERRAR */
#equipo-modal .modal-close {
    position: absolute;
    top: 15px; 
    right: 15px;
    background-color: #5d3a24;
    color: #fdfdfd;
    border: 2px solid #bc8f61;
    border-radius: 50%;
    width: 40px; height: 40px;
    z-index: 1100;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#equipo-modal .modal-close::before { content: '×'; font-size: 1.8rem; font-weight: bold; }

/* LA FOTO POLAROID */
#equipo-modal .modal-body {
    background: #ffffff !important;
    box-shadow: 15px 20px 45px rgba(0,0,0,0.5);
    position: relative;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    width: 100% !important; /* Ocupa todo el ancho del corcho */
    padding: 8px 8px 50px 8px !important; /* Marco blanco de la Polaroid más fino */
    transform: rotate(0deg);
    height: auto;
    aspect-ratio: auto; /* IMPORTANTE: Deja que la foto mande sobre la altura */
    object-fit: contain; /* GARANTIZA que se vea el 100% de la foto panorámica */
    border: 1px solid #ddd;
}


/* 1. EL CLAVO: Con efecto de profundidad (se estrecha al entrar) */
#equipo-modal .modal-body::before {
    content: '' !important;
    position: absolute;
    top: -22px; /* Ajustado para conectar con la cabeza */
    left: 50%;
    width: 4px; 
    height: 28px; 
    z-index: 101;
    background: linear-gradient(to right, #333, #fff 40%, #ddd 60%, #222);
    /* Inclinación tipo flecha hacia el usuario */
    transform: translateX(-50%) rotate(8deg);
    transform-origin: bottom center;
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 0% 100%);
}

/* 2. LA CABEZA: Con efecto "tapa" y cuello de unión */
#equipo-modal .modal-body::after {
    content: '' !important;
    position: absolute;
    top: -72px; /* Bajada un poco para que no se salga de la tabla */
    left: 54%;  /* Alineada con la inclinación del clavo */
    width: 46px; 
    height: 52px;
    z-index: 105;
    
    /* Transformación 3D para ver la parte de arriba */
    transform: translateX(-50%) rotateX(20deg) rotateZ(4deg);
    
    background: 
        /* TAPA SUPERIOR: Elipse brillante que da el volumen 3D */
        radial-gradient(ellipse at 40% 25%, rgba(255,255,255,0.95) 0%, transparent 40%),
        /* UNIÓN/CUELLO: Sombra que simula donde entra el clavo en el plástico */
        radial-gradient(circle at 50% 95%, rgba(0,0,0,0.6) 0%, transparent 50%),
        /* CUERPO ROJO */
        radial-gradient(circle at 50% 45%, #ff2a2a 0%, #800 95%);

    border-radius: 50% 50% 45% 45% / 40% 40% 60% 60%;
    
    /* SOMBRA PROYECTADA: Muy importante para que "salte" del fondo */
    filter: drop-shadow(18px 35px 10px rgba(0,0,0,0.45));
}

/* 3. EL AGUJERO DE IMPACTO (Sombra en el papel) */
#equipo-modal .modal-image-container::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    width: 10px;
    height: 5px;
    background: #000;
    border-radius: 50%;
    z-index: 100;
    transform: translateX(-50%);
    opacity: 0.7;
    filter: blur(1px); /* Suaviza la entrada */
}

/* 4. AJUSTE DE LA FOTO (Para que la sombra no se corte) */


/* AJUSTE DE IMAGEN PARA QUE SE VEA COMPLETA */
#equipo-modal .modal-image {
    width: 100%;
    height: auto; /* Permite que la altura dependa del formato de la foto */
    aspect-ratio: auto; /* 🚩 ELIMINA el 1/1 que tenías antes */
    object-fit: contain; /* Asegura que se vea el 100% de la foto sin recortes */
    border: 1px solid #eee;
    display: block;
}

#equipo-modal #modal-season {
    font-family: 'Gochi Hand', cursive !important;
    font-size: 28px !important;
    color: #1a1a1a !important;
    margin: 0 !important;
    display: inline-block;
    transform: rotate(1deg);
    font-weight: 900;

    /* Configuración para que no haya saltos */
    white-space: nowrap;
    overflow: hidden;
    width: 0; /* Empieza vacío */
}

/* Se dispara rápido al abrir el modal */
#equipo-modal.active #modal-season {
    animation: fastWrite 0.8s steps(15, end) forwards;
    animation-delay: 0.5s; /* Pequeña pausa para que el ojo se centre */
}

@keyframes fastWrite {
    from { width: 0; }
    to { width: 100%; }
}
/* ELIMINAR CUALQUIER OTRA LÍNEA O RESIDUO */
#equipo-modal .modal-header,
#equipo-modal .modal-info-grid,
#equipo-modal .modal-content::before,
#equipo-modal .modal-content::after {
    display: none !important;
}


/* TEXTO GOCHI HAND (Estilo rotulador) */
#equipo-modal #modal-description {
    display: block !important;
    font-family: 'Gochi Hand', cursive !important;
    font-size: 28px !important;
    color: #222;
    text-align: center;
    position: absolute;
    bottom: 25px;
    left: 0;
    width: 100%;
    transform: rotate(1deg);
}

.polaroid-wrapper {
    transform-style: preserve-3d;
}


/* 1. Desde que el navegador abre el archivo, el fondo ya es negro */
html {
    background-color: #111 !important; /* El color de tu club */
}

/* 2. Bloqueo preventivo: invisible pero con fondo oscuro */
body:not(.content-ready) {
    opacity: 0 !important;
    background-color: #111 !important;
}

/* 3. Aparición rápida */
body.content-ready {
    opacity: 1 !important;
    transition: opacity 0.2s ease-in;
    background-color: #111 !important;
}

@media (min-width: 1024px) {
    .equipo-image {
        height: 450px; /* Foto bien grande en PC */
        background-position: center center;
    }
    
    #equipo-modal .modal-content.cork-board {
        max-width: 800px; /* Más espacio para ver al equipo en grande */
    }
}

/* ===================================================
   9. AJUSTE DESKTOP: CARD ANCHA Y BOTÓN DEBAJO
   =================================================== */

/* ===================================================
   DESKTOP – CARD COMPLETA, SIN CORTES
   =================================================== */

/* ===================================================
   DESKTOP – CARD CENTRADA, ENTERA, MÁS GRANDE
   =================================================== */

@media (min-width: 1024px) {

    /* Sección: centra todo y da aire lateral */
    .equipos-section {
        padding-left: var(--spacing-2xl);
        padding-right: var(--spacing-2xl);
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* Contenedor de la card: más ancho */
    .equipos-grid {
        width: 100%;
        max-width: 1300px;   /* 🔑 MÁS ANCHA */
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    /* CARD: misma estructura que móvil, sin límites */
    .equipo-card {
        width: 100%;
        max-width: none;
        height: auto;
        max-height: none;
        overflow: visible;
        flex-direction: column;
    }

    /* IMAGEN: más grande para desktop */
    .equipo-image {
        width: 100%;
        height: 400px;       /* 🔑 IMAGEN MÁS ALTA */
        max-height: none;
        flex-shrink: 0;
    }

    /* CONTENIDO: más aire */
    .equipo-content {
        width: 100%;
        height: auto;
        padding: var(--spacing-2xl);
    }

    /* BOTÓN VOLVER AL INICIO: debajo y centrado */
    .volver-inicio,
    .equipo-volver,
    .btn-volver {
        margin-top: var(--spacing-2xl);
        align-self: center;
    }

    /* Fondo fijo solo en desktop */
    .equipos-section::before {
        background-attachment: fixed;
    }
}
