/* ==========================================================================
   1. VARIABLES Y RESETEO
   ========================================================================== */
:root {
    /* Paleta de Colores de la Marca Jahir Yusef */
    --bg-dark: #000000;         /* Negro puro */
    --bg-dark-gray: #111111;    /* Gris muy oscuro para contraste sutil */
    --bg-light: #ffffff;        /* Blanco puro */
    --text-light: #e0e0e0;      /* Texto claro (no 100% blanco para no cansar la vista) */
    --text-dark: #1a1a1a;       /* Texto oscuro */
    --accent-red: #cc0000;      /* Tu rojo característico */
    
    /* Tipografías */
    --font-main: 'Montserrat', sans-serif;
    --font-heading: 'Cinzel', serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Blindaje para evitar que nada sobresalga lateralmente */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: var(--font-main);
    line-height: 1.6;
    background-color: var(--bg-dark);
    color: var(--text-light);
    -webkit-font-smoothing: antialiased;
}

/* Regla de oro corregida: bloqueamos desbordamientos por escalado */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   2. CLASES UTILITARIAS Y GLOBALES
   ========================================================================== */
.container {
    width: 85%;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    padding: 6rem 0; /* Buen "aire" o respiro entre secciones */
}

.bg-dark { background-color: var(--bg-dark); color: var(--text-light); }
.bg-light { background-color: var(--bg-light); color: var(--text-dark); }
.bg-dark-gray { background-color: var(--bg-dark-gray); color: var(--text-light); }

/* Estilo de los Títulos del Inicio (Caja Roja + Texto) */
.section-title {
    display: flex;
    align-items: center;
    margin-bottom: 3.5rem;
    font-weight: 600;
    letter-spacing: 2px;
    font-family: var(--font-main);
}

.highlight-box {
    background-color: var(--accent-red);
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.title-text {
    color: #ffffff;
    padding-left: 1rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 4px;
}

/* ==========================================================================
   3. CABECERA Y NAVEGACIÓN (HEADER)
   ========================================================================== */
.main-header {
    background-color: var(--bg-dark);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    color: #ffffff;
    font-family: var(--font-heading);
    text-decoration: none;
    font-size: 1.8rem;
    letter-spacing: 3px;
    z-index: 1001; /* Asegura que el logo esté sobre el menú móvil */
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--accent-red);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.8rem;
    cursor: pointer;
    z-index: 1001; /* Asegura que el botón esté siempre visible */
}

/* ==========================================================================
   4. PÁGINA DE INICIO: SECCIONES
   ========================================================================== */

/* Hero (Fondo de muro texturizado - Franja anclada a la izquierda) */
.hero-section {
    height: 40vh; /* Franja más estrecha */
    background-image: url('../img/fondo-muro.jpg');
    background-repeat: no-repeat;
    background-size: cover; 
    background-position: left center; /* Anclado a la izquierda */
    border-bottom: 4px solid var(--accent-red);
}

/* Biografía (Fondo Negro) */
.bio-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 4rem;
    align-items: start;
}

.bio-text p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    text-align: justify;
    font-size: 0.95rem;
    color: #cccccc;
}

.bio-image-quote {
    display: flex;
    flex-direction: column;
}

.main-portrait {
    width: 100%;
    display: block;
    filter: grayscale(100%) contrast(1.1); /* Toque dramático en B/N */
    border-bottom: 2px solid var(--accent-red);
}

.quote {
    margin-top: 2rem;
    font-style: italic;
    font-size: 1rem;
    line-height: 1.7;
    color: #dddddd;
    padding-left: 1rem;
    border-left: 3px solid var(--accent-red);
}

.quote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 1px;
}

/* Trayectoria (Fondo Blanco) */
.trajectory-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.trajectory-text h2 {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.trajectory-text .subtitle {
    color: #666666;
    letter-spacing: 3px;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.trajectory-text p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: #444444;
    font-size: 1rem;
}

/* Imagen de Trayectoria Corregida para evitar desborde lateral */
.trajectory-image {
    display: flex;
    justify-content: center; 
    align-items: flex-end; 
    overflow: hidden; /* CRUCIAL: impide que el scale(1.2) se salga del contenedor */
}

.trajectory-image img {
    width: 100%;
    max-width: 600px; 
    display: block;
    transform: scale(1.2); 
    transform-origin: center center; 
}

.btn-red {
    display: inline-block;
    background-color: var(--accent-red);
    color: #ffffff;
    padding: 1rem 2.5rem;
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    margin-top: 1.5rem;
    transition: background 0.3s ease, transform 0.3s ease;
}

.btn-red:hover {
    background-color: #990000;
    transform: translateY(-2px);
}

/* ==========================================================================
   5. GALERÍA EN BANNER INFINITO (CARRUSEL)
   ========================================================================== */
.gallery-slider-container {
    width: 100%;
    overflow: hidden; 
    position: relative;
    padding: 1rem 0;
}

.gallery-slider-track {
    display: flex;
    animation: scrollBanner 30s linear infinite;
    width: max-content; 
}

/* Pausa la animación al pasar el ratón */
.gallery-slider-track:hover {
    animation-play-state: paused;
}

.slider-item {
    width: 350px; 
    height: 350px;
    margin-right: 2rem; 
    overflow: hidden;
    flex-shrink: 0; 
}

.slider-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.5s ease, transform 0.5s ease;
}

.slider-item:hover img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

@keyframes scrollBanner {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-50% - 1rem)); }
}

/* ==========================================================================
   6. SUBPÁGINAS (Obra Original, Archivos, etc.)
   ========================================================================== */
.page-header {
    padding: 5rem 0 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 3rem;
    text-align: center;
}

.page-header h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: #ffffff;
    margin-bottom: 1rem;
}

.page-header p {
    color: #aaaaaa;
    letter-spacing: 1px;
}

/* Grid de Obras completas */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding-bottom: 5rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    background-color: #111;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.9s ease;
}

.gallery-item:hover img {
    transform: scale(1.03);
}

.item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    padding: 1.5rem;
    text-align: center;
    border-top: 2px solid var(--accent-red);
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.gallery-item:hover .item-info {
    transform: translateY(0);
}

.item-info h3 {
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.item-info p {
    font-size: 0.85rem;
    color: #aaaaaa;
}

/* ==========================================================================
   7. PIE DE PÁGINA (FOOTER)
   ========================================================================== */
.main-footer {
    background-color: var(--bg-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4rem 0 2rem;
    text-align: center;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: #ffffff;
    letter-spacing: 3px;
    margin-bottom: 1rem;
}

.main-footer p {
    color: #666666;
    font-size: 0.85rem;
}

.social-links { margin-top: 1.5rem; }

.social-links a {
    color: #aaaaaa;
    margin: 0 15px;
    text-decoration: none;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-red);
}

/* ==========================================================================
   ESTILOS DE LA PÁGINA "OBRAS PUBLICADAS" (CON LECTOR PDF)
   ========================================================================== */

.obras-hero {
    background: url('../img/fondo-muro.jpg') center center / cover no-repeat;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 4px solid var(--bg-dark);
}

.obras-title-box {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.5);
    border-bottom: 1px solid rgba(255,255,255,0.5);
    padding: 2rem 0;
    width: 80%;
    max-width: 500px;
}

.obras-title-box h1 {
    font-family: var(--font-main);
    font-size: 2.8rem;
    font-weight: 400;
    color: #ffffff;
    letter-spacing: 4px;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.obras-title-box p {
    font-size: 0.8rem;
    color: #cccccc;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.obras-title-box span {
    color: #ffffff;
    font-weight: bold;
}

.reconocimientos-section {
    padding: 4rem 0;
}

.acknowledgments-container {
    max-width: 900px; 
    margin: 0 auto;
}

.acknowledgments-container h2 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 2rem;
    color: #ffffff;
}

.acknowledgments-container p {
    font-size: 0.9rem;
    line-height: 1.8;
    color: #ffffff;
    margin-bottom: 1.2rem;
    text-align: center;
}

.book-viewer-section {
    padding: 6rem 0;
}

.book-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.pdf-reader-container {
    width: 100%;
    background-color: #f9f9f9;
    border-radius: 4px;
    overflow: hidden;
}

.book-title {
    font-size: 2.2rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-family: var(--font-main);
    font-weight: 700;
}

.book-info-column p {
    color: #333333;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.testimonial-box {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
}

.testimonial-text {
    font-style: italic;
    color: #666666 !important;
    font-size: 0.95rem !important;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.testimonial-author img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.author-details h4 {
    color: var(--accent-red);
    font-size: 1rem;
    margin-bottom: 0;
}

.author-details span {
    color: #1a1a1a;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ==========================================================================
   PÁGINA DE OBRAS (GALERÍA)
   ========================================================================== */

.obras-page {
    padding: 4rem 0 8rem;
    min-height: 100vh;
}

.breadcrumbs {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.breadcrumbs a {
    color: #888;
    text-decoration: none;
}

.main-title {
    font-size: 5rem;
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: #fff;
    margin-bottom: 4rem;
}

.obras-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 5rem;
}

.obra-item {
    text-align: center;
}

.obra-img-container {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid #333;
}

.obra-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.obra-item:hover img {
    transform: scale(1.05);
}

.obra-item h3 {
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    margin-top: 10px;
}

.pagination {
    display: flex;
    gap: 10px;
    margin-top: 3rem;
}

.page-num, .page-nav {
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fff;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    transition: 0.3s;
}

.page-num.active {
    background-color: #fff;
    color: #000;
}

.page-num:hover:not(.active), .page-nav:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Botones de Administración en el Nav */
.nav-links li a i {
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.nav-admin-link {
    color: #ff4d4d !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
}

.nav-login i {
    color: rgba(255, 255, 255, 0.4);
}

.nav-login:hover i {
    color: #ffffff;
}

.nav-logout i {
    color: #ffaaaa;
}

.nav-logout:hover i {
    color: #ff4d4d;
}

/* ==========================================================================
   8. DISEÑO TOTALMENTE RESPONSIVO (TABLETS Y MÓVILES) - CORREGIDO
   ========================================================================== */

@media (max-width: 992px) {
    .container {
        width: 90%; 
    }
    
    .bio-grid, .trajectory-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .trajectory-text h2 {
        font-size: 2.2rem;
    }

    .obras-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-title {
        font-size: 3.5rem;
    }
    .book-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .obras-title-box h1 {
        font-size: 2rem;
    }
    .pdf-reader-container iframe {
        height: 450px;
    }
}

@media (max-width: 768px) {
    section {
        padding: 3.5rem 0;
    }

    .hero-section {
        height: 25vh; 
        min-height: 200px;
    }

    .section-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 2rem;
    }
    
    .title-text {
        padding-left: 0;
        font-size: 1rem;
    }
    
    .slider-item {
        width: 250px;
        height: 250px;
        margin-right: 1rem;
    }

    /* --- CORRECCIÓN DEL MENÚ MÓVIL (FULL SCREEN Y VISIBILIDAD) --- */
    .menu-toggle {
        display: block; 
    }

    .nav-links {
        display: none; 
        flex-direction: column;
        position: fixed; /* Cambiado a fixed para que no se pierda al hacer scroll */
        top: 0; 
        left: 0;
        width: 100%;
        height: 100vh; /* Ocupa toda la pantalla del móvil */
        background-color: var(--bg-dark); /* Color sólido para que no transparente contenido inferior */
        padding: 6rem 0 2rem; /* Espacio arriba para no tapar el logo */
        text-align: center;
        border-top: none;
        border-bottom: 3px solid var(--accent-red);
        box-shadow: 0 10px 20px rgba(0,0,0,0.5);
        overflow-y: auto; /* Permite scroll si hay muchos enlaces */
    }

    .nav-links li {
        margin-bottom: 2rem;
    }

    .nav-links a {
        font-size: 1.2rem; /* Enlaces más grandes para fácil clic táctil */
    }

    .nav-links.active {
        display: flex;
    }

    /* Evitar que la imagen escalada genere scroll horizontal en móvil */
    .trajectory-image img {
        transform: scale(1.1); /* Reducimos un poco el aumento en móvil */
    }
}

@media (max-width: 600px) {
    .obras-grid {
        grid-template-columns: 1fr;
    }
    .main-title {
        font-size: 2.5rem;
        margin-bottom: 2rem;
    }
}