html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: #333;
    background-color: #fff;
    margin: 0;
    line-height: 1.6;
}

.contenedor {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================= */
/* === HEADER & NAVEGACIÓN === */
/* ========================================= */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: linear-gradient(to bottom, #fff, #f9f9f9);
}

.logo-container { margin-bottom: 20px; }
.logo-container .logo-desktop { max-height: 100px; width: auto; display: block; }
.logo-container .logo-mobile { display: none; max-width: 300px; height: auto; margin: 0 auto; }

h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3.5em;
    margin: 0 0 20px 0;
    text-align: center;
    width: 100%;
}

/* Menú Hamburguesa */
.hamburger-menu { display: none; position: absolute; top: 20px; right: 20px; z-index: 1002; }
.close-nav { display: none; }

nav ul {
    list-style: none;
    padding: 0;
    margin: 30px 0 0;
    display: flex;
    justify-content: center;
    align-items: center; /* Alinea verticalmente el botón tienda */
    gap: 40px;
}

nav a {
    text-decoration: none;
    color: #555;
    font-size: 1.1em;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color 0.3s ease;
    position: relative;
}

nav a:hover { color: #000; }

/* Línea roja animada (solo para links normales) */
nav a:not(.btn-tienda)::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: #e63946;
    transition: width .3s;
    margin-top: 5px;
}

nav a:not(.btn-tienda)::hover::after { width: 100%; }

/* --- BOTÓN TIENDA (NUEVO) --- */
.btn-tienda {
    background-color: #e63946;
    color: white !important;
    padding: 6px 16px; /* Relleno ajustado */
    border-radius: 50px;
    font-size: 0.9em !important;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 5px rgba(230, 57, 70, 0.3);
    transition: all 0.3s ease;
    margin-left: 15px; /* Separación extra */
    vertical-align: middle;
    position: relative;
    top: -1px;
}

.btn-tienda:hover {
    background-color: #c12e3a;
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(230, 57, 70, 0.4);
    color: white !important;
}

.btn-tienda i { font-size: 0.85em; }


/* --- SUB-NAVEGACIÓN --- */
.sub-nav {
    text-align: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background-color: #fdfdfd;
}

.sub-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 30px;
}

.sub-nav a {
    text-decoration: none;
    color: #555;
    font-size: 0.9em;
    font-weight: 500;
    transition: color 0.3s ease;
}

.sub-nav a:hover { color: #e63946; }
.sub-nav a.active { color: #e63946; font-weight: 700; pointer-events: none; }


/* ========================================= */
/* === GALERÍAS (RETRATOS, PIXELART...) === */
/* ========================================= */
.galeria, .galeria-principal {
    column-count: 3;
    column-gap: 20px;
}

.galeria img, .galeria-principal a {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: aparecerSuave 1s ease-out forwards;
    break-inside: avoid;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.galeria-principal > a > img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.4s ease;
}

.galeria img:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    cursor: pointer;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.galeria-principal > a:hover > img { transform: scale(1.05); }

/* Overlay Títulos */
.galeria-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.4s ease;
}
.galeria-titulo { color: white; font-family: 'Poppins', sans-serif; font-size: 1.8em; text-align: center; padding: 10px; }
.galeria-principal a:hover .galeria-overlay { opacity: 1; }


/* ========================================= */
/* === SECCIONES Y FOOTER === */
/* ========================================= */
.seccion { padding: 50px 20px; text-align: center; }
.seccion h2 {
    font-family: 'Poppins', sans-serif; font-size: 2em; font-weight: 350;
    margin-bottom: 20px; border-bottom: 2px solid #333; display: inline-block; padding-bottom: 5px;
}
footer { text-align: center; padding: 20px; border-top: 1px solid #eee; color: #666; font-size: 0.9em; }


/* ========================================= */
/* === VISOR DE IMÁGENES (MODAL) === */
/* ========================================= */
/* --- VISOR (MODAL) --- */
.visor-oculto {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    position: fixed;

    /* CAMBIO AQUÍ: Subimos de 1000 a 10000 para tapar el menú */
    z-index: 10000 !important;

    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9); /* Fondo oscuro */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Y aseguramos que el botón de cerrar esté AÚN MÁS arriba */
.cerrar-visor {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;

    /* CAMBIO AQUÍ: 10001 para ganarle al visor */
    z-index: 10001 !important;
}
.visor-visible { opacity: 1; visibility: visible; }

.cerrar-visor {
    position: absolute; top: 20px; right: 35px; color: #f1f1f1;
    font-size: 40px; font-weight: bold; transition: 0.3s; cursor: pointer; z-index: 1001;
}
.cerrar-visor:hover { color: #bbb; text-decoration: none; }

.visor-contenido { position: relative; max-width: 90%; max-height: 90%; display: flex; align-items: center; justify-content: center; }

/* Imagen del visor (PC: Deja espacio a los costados para flechas) */
.visor-contenido img {
    max-width: 80vw;
    max-height: 90vh;
    display: block; object-fit: contain; box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

/* Info del visor */
#visor-info {
    position: absolute; bottom: 0; left: 0; color: #f1f1f1; text-align: center; width: 100%;
    padding: 80px 20px 20px; box-sizing: border-box;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%); pointer-events: none;
}
#visor-titulo { margin: 0; font-size: 1.3em; font-weight: 500; }
#visor-contador { margin: 5px 0 0; font-size: 0.9em; color: #ccc; }


/* ========================================= */
/* === ELEMENTOS INTERACTIVOS === */
/* ========================================= */

/* LUPA */
.lupa-oculta { display: none; }
.lupa-activa { display: block !important; }
#lupa {
    position: fixed; transform: translate(-50%, -50%);
    border: 2px solid #fff; box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 50%; cursor: none; z-index: 2000;
    background-repeat: no-repeat; background-color: #fff;
    pointer-events: none; width: 150px; height: 150px; opacity: 1; display: none;
}

/* FLECHAS DE NAVEGACIÓN */
.navegacion-btn {
    position: fixed; top: 50%; transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5); color: white;
    border: none; cursor: pointer;

    font-size: 30px; padding: 5px; width: 50px; height: 50px; /* Tamaño ajustado */

    border-radius: 50%; z-index: 1500; transition: all 0.3s ease;
    user-select: none; display: flex; align-items: center; justify-content: center;
}

.navegacion-btn:hover {
    background-color: rgba(0, 0, 0, 0.8); /* Gris Oscuro */
    transform: translateY(-50%) scale(1.1);
}

/* Posición PC */
#prevButton { left: 30px; }
#nextButton { right: 30px; }

/* OTROS */
.redes-sociales { margin-top: 20px; display: flex; justify-content: center; gap: 20px; }
.redes-sociales a { color: #333; transition: transform 0.2s ease-in-out; }
.redes-sociales a:hover { transform: scale(1.2); color: #e63946; }
.redes-sociales a:active { transform: scale(0.9); }

@keyframes aparecerSuave {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

#scrollTopBtn {
    display: none; position: fixed; bottom: 20px; right: 30px; z-index: 99;
    border: none; outline: none; background-color: #e63946; color: white; cursor: pointer;
    padding: 15px; border-radius: 50%; font-size: 18px; line-height: 1;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2); transition: background-color 0.3s, transform 0.3s;
}
#scrollTopBtn:hover { background-color: #c12e3a; transform: translateY(-3px); }


/* ========================================= */
/* === ESTILOS CÓMICS (MAZO REAL) === */
/* ========================================= */
.comic-gallery {
    display: grid; grid-template-areas: "pila"; width: 220px;
    margin-right: auto; margin-left: 20px; padding-right: 200px; box-sizing: content-box;
}
.comic-gallery img {
    grid-area: pila; width: 100%; height: auto; border-radius: 8px;
    border: 1px solid #ccc; box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background-color: white; cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* Orden capas */
.comic-gallery img:nth-child(1) { z-index: 10; }
.comic-gallery img:nth-child(2) { z-index: 9; }
.comic-gallery img:nth-child(3) { z-index: 8; }
.comic-gallery img:nth-child(4) { z-index: 7; }
.comic-gallery img:nth-child(5) { z-index: 6; }

/* Animación Despliegue Recto */
.comic-gallery:hover img:nth-child(1) { transform: translateX(-5px); }
.comic-gallery:hover img:nth-child(2) { transform: translateX(50px); }
.comic-gallery:hover img:nth-child(3) { transform: translateX(100px); }
.comic-gallery:hover img:nth-child(4) { transform: translateX(150px); }
.comic-gallery:hover img:nth-child(5) { transform: translateX(200px); }


/* ========================================= */
/* === RESPONSIVE (MÓVIL Y TABLET) === */
/* ========================================= */

@media (max-width: 768px) {
    /* Layout */
    .galeria, .galeria-principal { column-count: 2; }
    .logo-container .logo-desktop { display: none; }
    .logo-container .logo-mobile { display: block; }

    /* Menú Hamburguesa */
    .hamburger-menu { display: block; background: none; border: none; color: #333; font-size: 30px; cursor: pointer; }
    nav:not(.sub-nav) {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background-color: rgba(0, 0, 0, 0.95); display: flex; align-items: center; justify-content: center;
        transform: translateX(-100%); transition: transform 0.3s ease-in-out; z-index: 1003;
    }
    nav:not(.sub-nav).nav-active { transform: translateX(0); }
    .close-nav { display: block; position: absolute; top: 20px; right: 20px; background: none; border: none; color: white; font-size: 35px; cursor: pointer; }

    /* Links Menú */
    nav:not(.sub-nav) a { color: white; font-size: 1.5em; }
    nav:not(.sub-nav) ul { flex-direction: column; gap: 25px; }

    /* Ajuste Botón Tienda Móvil */
    .btn-tienda { margin-top: 15px; margin-left: 0; width: auto; font-size: 1em !important; }

    /* Sub-nav Scrollable */
    .sub-nav { overflow-x: auto; padding: 10px 0; -ms-overflow-style: none; scrollbar-width: none; }
    .sub-nav::-webkit-scrollbar { display: none; }
    .sub-nav ul { justify-content: flex-start; flex-wrap: nowrap; white-space: nowrap; padding: 0 20px; }

    /* VISOR MÓVIL (IMAGEN ARRIBA, FLECHAS ABAJO) */
    .visor-contenido img {
        max-width: 95vw !important;
        max-height: 60vh !important;
        margin-bottom: 120px !important;
    }
    .navegacion-btn {
        top: auto !important;
        bottom: 40px !important;
        transform: none !important;
        background-color: rgba(255, 255, 255, 0.15);
        border: 1px solid rgba(255,255,255,0.3);
    }
    #prevButton { left: 20px !important; }
    #nextButton { right: 20px !important; }
}

@media (max-width: 480px) {
    .galeria, .galeria-principal { column-count: 1; }
    /* Desactivar efecto comics en móvil */
    .comic-gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-template-areas: none; width: 100%; padding-right: 0; margin: 0; gap: 15px; display: grid; }
    .comic-gallery img { grid-area: auto; transform: none !important; }
}

/* ============================================== */
/* === CORRECCIÓN DE EMERGENCIA (Z-INDEX) === */
/* ============================================== */

/* 1. El menú negro (Hamburguesa) debe ser el REY supremo */
nav:not(.sub-nav) {
    z-index: 9999 !important; /* Número altísimo para que tape todo */
}

/* 2. La barra de galerías debe quedarse atrás, tranquila */
.sub-nav {
    position: relative;
    z-index: 1 !important; /* Número bajo */
    background-color: #fdfdfd; /* Su color original */
}

/* 3. Aseguramos que el texto de la barra de galerías sea GRIS, no blanco */
.sub-nav a {
    color: #555 !important;
}

/* 4. Pero si pasamos el mouse/dedo, se pone rojo */
.sub-nav a:hover,
.sub-nav a.active {
    color: #e63946 !important;
}