body,
html {
    margin: 0;
    padding: 0;
    height: 100vh;
    /* Altura del 100% de la ventana */
    overflow: hidden;
    /* Evita que aparezcan barras de desplazamiento */
    font-family: 'IM Fell English SC', serif;
}

/* Base Grid Layout */
.grid-container {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    height: 100vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(9, 1fr);
    align-items: center;
    /* Centra el contenido verticalmente en la cuadrícula */
    gap: 0;
    z-index: 10;
}

/* Developer Visual Grid Overlay (hidden by default) */
.grid-guide {
    display: none;
    position: absolute;
    top: 0;
    left: 40px;
    /* Igual que el padding de grid-container */
    right: 40px;
    bottom: 0;
    pointer-events: none;
    /* Permite hacer clic a través de la guía */
    z-index: -1;
    /* Detrás del contenido pero sobre el fondo */
}

body.show-grid .grid-guide {
    display: block;
}

.grid-guide .grid-cols {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
}

.grid-guide .grid-rows {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-rows: repeat(9, 1fr);
}

.grid-guide .grid-col {
    border-right: 2px solid #000;
}

.grid-guide .grid-col:last-child {
    border-right: none;
}

.grid-guide .grid-row {
    border-bottom: 2px solid #000;
}

.grid-guide .grid-row:last-child {
    border-bottom: none;
}

/* Dev Toggle Button */
.dev-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #2a2a2a;
    color: #00ffff;
    border: 1px solid #444;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    z-index: 10000;
    transition: all 0.3s ease;
}

.dev-toggle:hover {
    background: #3a3a3a;
    border-color: #00ffff;
}

body {
    background-image: url('Resources/Images/background.png');
    background-repeat: repeat;
    /* Repite la imagen para que no haya huecos mientras se mueve */
    background-position: 0% 0%;

    /* Configura el tamaño del fondo. 
       auto para el ancho, y 100vh para el alto para asegurar que una repetición de la imagen cubra exactamente la altura de la pantalla,
       logrando así un bucle ("loop") perfecto sin saltos visuales. */
    background-size: auto 200vh;

    /* Aplica la animación: 
       - "scroll-background": el nombre de la animación (definida abajo)
       - "15s": la duración de la animación (puedes subir o bajar este número para cambiar la velocidad)
       - "linear": hace que la velocidad sea constante (sin acelerar o desacelerar)
       - "infinite": hace que se repita infinitamente
    */
    animation: scroll-background 60s linear infinite;
}

/* Card Container Styling */
.card {
    grid-column: 2 / span 3;
    /* Posiciona la tarjeta a la izquierda ocupando 3 columnas, dejando 1 de margen */
    grid-row: 2 / 9;
    align-self: center;
    /* Ocupa desde el inicio de la fila 2 hasta el final de la fila 6 (línea 7) */
    background-color: #171717;
    /* Dark charcoal background */
    border-radius: 50px;
    padding: 25px 30px;
    /* Reducido de 70px para dar más espacio horizontal al contenido */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    /* Opcional: balancea el contenido verticalmente ahora que tiene altura estática predefinida por las celdas */
    color: #f0f0f0;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    /* Shadow blending with the dark theme */
}

/* Base style for new cards */
.comunication-card {
    background-color: black;
    border: 6px solid transparent;
    border-radius: 40px;
    width: 100%;
    height: 140px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    text-decoration: none;
    color: #f0f0f0;
    cursor: pointer;
}

/* Card content layout */
.comunication-card-header {
    display: flex;
    align-items: left;
    gap: 15px;
    margin-bottom: 5px;
}

.comunication-card-logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.comunication-card-title {
    font-size: 2.5rem;
    margin: 0;
    letter-spacing: 1px;
}

.comunication-card-text {
    font-family: inherit;
    font-size: 1.2rem;
    text-align: center;
    margin: 5px 0 0 0;
    letter-spacing: 0.5px;
}

.comunication-card-1 {
    grid-column: 7 / 12;
    grid-row: 2 / 5;
    align-self: center;
}

.comunication-card-2 {
    grid-column: 7 / 12;
    grid-row: 4 / 7;
    align-self: center;
}

.comunication-card-3 {
    grid-column: 7 / 12;
    grid-row: 6 / 9;
    align-self: center;
}

/* Title Typography */
.card h1 {
    font-size: 3.5rem;
    margin: 0 0 35px 0;
    letter-spacing: 2px;
    font-weight: normal;
}

/* Logo Circular Container */
.logo-container {
    background-color: #e8e8e8;
    border-radius: 50%;
    width: 220px;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 35px;
    overflow: hidden;
}

.logo-container img {
    width: 90%;
    /* Keep a small margin from the pure circle edge */
    height: 90%;
    object-fit: contain;
}

/* Subtitles Typography */
.card h2 {
    font-family: 'Merriweather', serif;
    font-size: 1.3rem;
    margin: 6px 0;
    font-weight: normal;
    letter-spacing: 1px;
    white-space: nowrap;
    /* Fuerza a que el texto ocupe 1 sola linea */
}

/* Social Links Array */
.social-links {
    display: flex;
    gap: 17px;
    margin-top: 30px;
}

.social-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-icon img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.social-icon .icon-highlight {
    opacity: 0;
}

.social-icon:hover {
    transform: scale(1.2);
}

.comunication-card:hover {
    transform: scale(1.05);
    border-color: #EA9D14;
}

.comunication-card-3 {
    cursor: default;
}

.comunication-card-3:hover {
    transform: none;
    border-color: transparent;
}

.social-icon:hover .icon-normal {
    opacity: 0;
}

.social-icon:hover .icon-highlight {
    opacity: 1;
}

/* Definición de la animación */
@keyframes scroll-background {
    from {
        /* Empieza en la posición normal */
        background-position: 0 0;
    }

    to {
        /* Se mueve exactamente 100vh de arriba hacia abajo, 
           lo cual encaja perfecto con el tamaño del fondo (auto 100vh),
           haciendo que el bucle sea indetectable. */
        background-position: 0 200vh;
    }
}

/* Game Card Styles */
.game-card {
    background-color: black;
    border-radius: 20px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 10px 10px 10px;
    box-sizing: border-box;
    color: #f0f0f0;
}

.game-card-title {
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    letter-spacing: 1px;
    text-align: center;
    font-family: 'Merriweather', serif;
}

.game-card-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #1a1a1a;
    border-radius: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    color: #666;
}

.game-card-video img,
.game-card-video iframe,
.game-card-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
}

.game-card-footer {
    display: flex;
    gap: 30px;
    margin-bottom: 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.video-wrapper {
    position: relative;
    /* Para videos verticales (9:16), usa 177.77%. 
       Para el tuyo que es algo intermedio, prueba con 160% */
    padding-bottom: 160%;
    height: 0;
    overflow: hidden;
    background-color: #000;
    /* Fondo negro por si el video no llena todo */
    border-radius: 8px;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    /* Esto ayuda a que el navegador entienda mejor el espacio */
    display: block;
}

.gameVideo {
    width: 460px;
    height: 264px;
}

/* ==========================================
   Estilos específicos de games.html
   ========================================== */

html.games-html,
body.games-body {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body.games-body {
    background-image: url('Resources/Images/background.png');
    background-repeat: repeat;
    background-position: 0% 0%;
    background-size: auto 200vh;
    animation: scroll-background 60s linear infinite;
}

.games-grid-container {
    height: auto;
    grid-template-rows: auto;
    grid-auto-rows: auto;
    row-gap: 20px;
    padding-top: 50px;
    padding-bottom: 50px;
    align-items: start;
}

.games-header-card {
    grid-column: 3 / span 8;
    grid-row: 1;
    margin-bottom: 40px;
    text-align: center;
    padding: 10px 30px;
    border-radius: 30px;
    justify-content: center;
    gap: 12px;
}

.games-header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.games-header-logo-container {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.card .games-header-title,
.games-header-card .games-header-title {
    margin: 0;
    font-size: 2.8rem;
    line-height: 1;
}

.games-header-home-btn {
    width: 45px;
    height: 45px;
    margin-top: 5px;
}

.game-card-left {
    grid-column: 3 / span 4;
    width: auto;
    margin-right: 25px;
}

.game-card-right {
    grid-column: 7 / span 4;
    width: auto;
    margin-left: 25px;
}

/* ==========================================
   Estilos específicos de index.html (Card 3D)
   ========================================== */

.comunication-card-header-3d {
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 0;
}

.comunication-card-title-3d-span {
    font-family: 'Merriweather', serif;
    font-size: 2rem;
}

.comunication-card-3d-social {
    margin-top: 0 !important;
}

/* ==========================================
   Media Queries para diseño responsivo
   ========================================== */

@media (max-width: 900px) {
    body,
    html {
        height: auto;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .grid-container,
    .games-grid-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        height: auto;
        min-height: 100vh;
        padding: 40px 20px;
        gap: 24px;
        box-sizing: border-box;
    }

    /* Ocultar la guía de desarrollo en pantallas pequeñas */
    .grid-guide {
        display: none !important;
    }

    /* Perfil (Index Card) */
    .card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        max-width: 480px;
        border-radius: 30px;
        padding: 30px 20px;
        margin: 0 auto;
    }

    .card h1 {
        font-size: 2.5rem;
        margin-bottom: 20px;
    }

    .logo-container {
        width: 160px;
        height: 160px;
        margin-bottom: 20px;
    }

    .card h2 {
        font-size: 1.1rem;
        white-space: normal;
        text-align: center;
    }

    .social-links {
        margin-top: 20px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    /* Tarjetas de comunicación */
    .comunication-card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        max-width: 480px;
        height: auto;
        min-height: 110px;
        padding: 20px;
        border-radius: 25px;
        margin: 0 auto;
    }

    .comunication-card-title {
        font-size: 2rem;
    }

    .comunication-card-text {
        font-size: 1rem;
    }

    /* Cabecera de la tarjeta 3D en responsive */
    .comunication-card-header-3d {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .comunication-card-header-3d .social-links {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* Página de Juegos */
    .games-header-card {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        max-width: 480px;
        margin-bottom: 10px;
        padding: 20px 15px;
        border-radius: 25px;
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }

    .games-header-content {
        flex-direction: column;
        gap: 10px;
    }

    .card .games-header-title,
    .games-header-card .games-header-title {
        font-size: 2rem;
        margin: 0;
    }

    .game-card-left,
    .game-card-right {
        grid-column: auto;
        width: 100%;
        max-width: 480px;
        margin: 0 auto !important;
    }

    .game-card {
        padding: 15px;
        border-radius: 20px;
    }

    .game-card-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }

    .game-card-video {
        margin-bottom: 15px;
    }

    .gameVideo {
        width: 100%;
        height: auto;
        max-width: 100%;
    }
}

