:root {
    --primary-color: #354099; /* Azul Profundo */
    --primary-light: #096CB2; /* Azul Claro */
    --accent-color: #F27D05; /* Naranja */
    --gold-color: #F5B500; /* Amarillo Oro */
    --bg-color: #f5f6fa;
    --text-color: #333333;
    --card-bg: #ffffff;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--primary-color);
    background-image: radial-gradient(circle at top center, var(--primary-light) 0%, var(--primary-color) 100vh);
    background-attachment: fixed;
    color: var(--text-color);
    scroll-behavior: smooth;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    min-height: 100vh;
    height: auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle, var(--primary-light) 0%, var(--primary-color) 100%);
    color: white;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.hero-content {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 600px;
    width: 90%;
    
    /* --- DISEÑO DE PORTADA DE LIBRO --- */
    background-color: var(--primary-color);
    background-image: 
        linear-gradient(to right, rgba(0,0,0,0.6) 0px, rgba(0,0,0,0.2) 20px, transparent 40px), /* Lomo del libro */
        linear-gradient(to left, rgba(255,255,255,0.2) 0px, rgba(255,255,255,0) 10px); /* Borde derecho brilloso */
    padding: 60px 40px;
    border-radius: 5px 25px 25px 5px; /* Bordes derechos redondeados, izquierdo recto */
    box-shadow: 
        inset 15px 0 30px rgba(0,0,0,0.4), /* Profundidad del lomo */
        25px 25px 50px rgba(0,0,0,0.6); /* Sombra proyectada pesada */
    position: relative;
    border: 1px solid var(--primary-color);
}

/* Marco dorado interior tipo libro antiguo */
.hero-content::before {
    content: '';
    position: absolute;
    top: 20px; 
    left: 45px; /* Espacio para el lomo */
    right: 20px; 
    bottom: 20px;
    border: 2px solid var(--gold-color);
    border-radius: 0 15px 15px 0;
    pointer-events: none;
    opacity: 0.8;
}

/* Textura del lomo */
.hero-content::after {
    content: '';
    position: absolute;
    top: 0; left: 15px; bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.1);
    box-shadow: 10px 0 0 rgba(255,255,255,0.05);
    pointer-events: none;
}

.school-logo {
    max-width: 150px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.main-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    margin: 0;
    color: var(--gold-color);
    text-shadow: 2px 4px 10px rgba(0,0,0,0.5);
}

.sub-title {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.2rem, 3vw, 2.5rem);
    font-weight: 300;
    margin: 10px 0 30px 0;
    opacity: 0.9;
}

.event-badge {
    background-color: var(--accent-color);
    padding: 8px 25px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 40px;
    box-shadow: 0 5px 15px rgba(192, 57, 43, 0.4);
}

.hero-actions {
    z-index: 2;
    margin-top: 40px;
}

.btn-scroll {
    display: inline-block;
    padding: 15px 40px;
    background: var(--gold-color);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.btn-scroll:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.4);
    background: #fff;
}

.mascot-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 100;
    pointer-events: none; /* Evita que bloquee clics en el texto detrás de él */
    transition: background 0.4s ease; /* Transición suave para el fondo modal */
}

.mascot-hero {
    width: 150px;
    filter: drop-shadow(0 10px 15px rgba(0,0,0,0.3));
    animation: float 4s ease-in-out infinite;
    pointer-events: auto; /* Permite que la mascota reciba clics si se desea */
    cursor: zoom-in;
    transition: all 0.4s ease;
}

/* --- Estado Expandido (Lightbox) --- */
.mascot-container.expanded {
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Atrapa clics en el fondo para cerrar */
    z-index: 9999;
}

.mascot-container.expanded .mascot-hero {
    width: auto !important;
    height: auto !important;
    max-width: 90vw !important;
    max-height: 70vh !important;
    object-fit: contain;
    border-radius: 10px;
    cursor: default;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* --- Botón Descarga de PDF --- */
.btn-download-pdf {
    display: none;
    position: absolute;
    bottom: 50px;
    background: var(--gold-color);
    color: var(--primary-color);
    padding: 15px 30px;
    border-radius: 50px;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    text-decoration: none;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    z-index: 10001; 
    transition: transform 0.3s ease;
}

.btn-download-pdf:hover {
    transform: scale(1.05);
    background: white;
}

.mascot-container.expanded .close-widget-text {
    display: none !important;
}

.mascot-container.expanded .btn-download-pdf {
    display: block;
    animation: slideUp 0.5s ease forwards;
}

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

/* --- Hub Container --- */
.hub-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px;
}

.hub-header {
    text-align: center;
    margin-bottom: 60px;
}

.hub-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold-color);
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hub-header p {
    font-size: 1.2rem;
    color: #e0e0e0;
}

/* --- Grid & Accordion --- */
.chapters-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chapter-card {
    background: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: all 0.3s ease;
    border-left: 5px solid var(--accent-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    cursor: pointer;
    background: #ffffff;
    transition: background 0.3s ease;
}

.card-header:hover {
    background: #f8f9fa;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.chapter-icon-left {
    width: 60px;
    height: 60px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 50%;
    padding: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 2px solid var(--primary-color);
}

@keyframes wobble-icon {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-3px) rotate(-5deg); }
    50% { transform: translateY(-6px) rotate(0deg); }
    75% { transform: translateY(-3px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.hub-container .chapter-icon-left {
    animation: wobble-icon 4s ease-in-out infinite;
}

.chapter-name {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toggle-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

/* Accordion Logic */
.card-content-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: #fafafa;
}

.card-content-wrapper.open {
    max-height: 5000px; /* Suficiente espacio para que se expanda el contenido */
}

.card-header.active .toggle-icon {
    transform: rotate(-180deg);
}

.card-body {
    padding: 40px;
    border-top: 1px solid #eee;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Estilos de Contenido Interno (Compatibilidad con el HTML viejo) */
.chapter-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.chapter-name {
    font-size: 1.5rem;
    font-family: 'Cinzel', serif;
    margin: 0;
    color: var(--primary-color);
}

.chapter-grade {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 3px;
    font-weight: bold;
}
.page-header {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--gold-color);
    padding-bottom: 10px;
    margin-top: 0;
    margin-bottom: 20px;
}

.sticker-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.historic-quote {
    font-style: italic;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    border-left: 5px solid var(--accent-color);
    margin: 30px 0;
    padding: 20px;
    background: #fff;
    border-radius: 0 10px 10px 0;
    color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* --- Patrocinantes Footer --- */
.sponsor-footer {
    background: white;
    padding: 45px 0 20px 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.05);
    position: relative;
    z-index: 10;
}

.sponsor-footer::before {
    content: "NUESTROS PATROCINANTES";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.85rem;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: white;
    letter-spacing: 3px;
    background-color: var(--accent-color);
    padding: 5px 0;
    z-index: 15;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.sponsor-track {
    display: flex;
    align-items: center;
    gap: 50px;
    width: max-content;
    animation: scrollBanner 30s linear infinite;
    padding-left: 50px;
}

.sponsor-logo {
    height: 60px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: none !important;
    background: transparent !important;
    border: none !important;
}

.sponsor-logo:hover {
    transform: scale(1.15);
}

@keyframes scrollBanner {
    0% { transform: translateX(0); }
    100% { transform: translateX(calc(-33.33% - 16px)); }
}

/* --- Botón Volver Arriba --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-color);
    transform: translateY(-5px);
}

/* --- Estilos Proyecto Individual --- */
.project-header {
    background: transparent;
    color: white;
    padding: 40px 20px;
    text-align: center;
    position: relative;
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-back {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    color: var(--gold-color);
    border: 1px solid var(--gold-color);
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 5;
}

.btn-back:hover {
    background: var(--gold-color);
    color: var(--primary-color);
}

.project-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--gold-color);
    margin: 0;
}

.project-subtitle {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-top: 5px;
}

.project-container {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
    min-height: 50vh;
}

.project-body {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    padding: 50px;
}

/* Mascota superior derecha para proyecto */
.mascot-container-topright {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: auto;
    left: auto;
    z-index: 100;
}

.mascot-container-topleft {
    position: fixed;
    top: 160px;
    left: 20px;
    right: auto;
    bottom: auto;
    z-index: 100;
}

.mascot-container-topright .mascot-hero-small {
    width: 100px;
}

/* --- Mini Portada (En Línea) --- */
.mini-book-link {
    display: inline-block;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.mini-book-link:hover {
    transform: scale(1.05);
}

.hero-content.mini-book {
    padding: 15px 10px 15px 25px; /* Espacio para el lomo */
    border-radius: 2px 10px 10px 2px;
    box-shadow: 
        inset 5px 0 10px rgba(0,0,0,0.4),
        10px 10px 20px rgba(0,0,0,0.5);
    width: auto;
    min-width: 100px;
    text-align: center;
}

.hero-content.mini-book::before {
    top: 5px; left: 15px; right: 5px; bottom: 5px;
    border-width: 1px;
    border-radius: 0 5px 5px 0;
}

.hero-content.mini-book::after {
    left: 8px;
    width: 1px;
}

.mini-title {
    font-size: 1.2rem;
    line-height: 1.2;
    margin-bottom: 5px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.mini-logo {
    width: 35px;
    background: white;
    padding: 3px;
    border-radius: 5px;
    margin-bottom: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.mini-school {
    font-size: 0.5rem;
    font-family: 'Cinzel', serif;
    color: #e0e0e0;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.mini-subtitle {
    font-size: 0.65rem;
    color: var(--gold-color);
    margin-bottom: 10px;
    opacity: 0.9;
}

.mini-badge {
    font-size: 0.6rem;
    padding: 3px 8px;
    margin-bottom: 0;
    letter-spacing: 0;
}

/* --- Copyright --- */
.copyright-bar {
    background-color: var(--primary-color);
    color: #e0e0e0;
    text-align: center;
    padding: 15px 10px;
    font-size: 0.9rem;
    font-family: 'Nunito', sans-serif;
    letter-spacing: 1px;
    border-top: 2px solid var(--gold-color);
}

/* --- Botón Entrar a la Feria (Landing Page) --- */
.enter-badge {
    background-color: var(--accent-color);
    color: white;
    padding: 12px 25px;
    font-size: 1.2rem;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    border-radius: 8px;
    margin-top: 30px;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    transition: transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
    animation: pulse-orange 2s infinite;
}

.hero-book-link {
    transition: transform 0.3s ease;
}

.hero-book-link:hover {
    transform: translateY(-5px);
}

.hero-book-link:hover .enter-badge {
    transform: scale(1.05);
    background-color: var(--gold-color);
    color: var(--primary-color);
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(242, 125, 5, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(242, 125, 5, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(242, 125, 5, 0);
    }
}

/* Responsive */
@media (min-width: 769px) {
    .mobile-only {
        display: none;
    }
}

@media (max-width: 1024px) {
    .mascot-container {
        left: 20px;
        top: 20px;
        bottom: auto;
        right: auto;
        transform: none;
    }
    .mascot-hero {
        width: 120px;
    }
    
    /* Bajar la mascota en tablets para que no solape el botón volver */
    .mascot-container-topright {
        top: 120px;
    }
}

@media (max-width: 768px) {
    .hero-content {
        padding: 40px 25px 40px 35px;
    }
    .hero-content::before {
        top: 15px; 
        left: 25px; 
        right: 15px; 
        bottom: 15px;
    }
    .hero-content::after {
        left: 10px;
    }
    
    .card-header {
        padding: 15px 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .header-right {
        align-self: flex-end;
    }
    .card-body {
        padding: 20px;
    }
    .mascot-container {
        left: 10px;
        top: 10px;
    }
    .mascot-hero {
        width: 90px;
    }
    
    .project-container {
        padding: 0 10px;
        margin-top: 30px;
    }
    .project-body {
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .mascot-container-topright {
        top: 160px; /* Más abajo en móvil debido a que la cabecera ocupa más líneas */
        right: 10px;
    }
    
    .mascot-container-topleft {
        top: 220px;
        left: 10px;
    }
    .mascot-container-topright .mascot-hero-small {
        width: 80px;
    }
    
    /* Responsive Mini Book */
    .mini-book-link {
        display: inline-block;
    }
    .hero-content.mini-book {
        padding: 10px 5px 10px 15px;
        min-width: 80px;
    }
    .mini-title {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }
    .mini-logo {
        width: 25px;
    }
    .mini-school {
        font-size: 0.4rem;
        margin-bottom: 3px;
    }
    .mini-subtitle {
        font-size: 0.5rem;
        margin-bottom: 5px;
    }
    .mini-badge {
        font-size: 0.5rem;
        padding: 2px 5px;
    }
}
