/* Estilos generales (reutilizados del style.css principal) */
:root {
    --primary-color: #CE7940;    /* Naranja/Marrón (Principal) */
    --secondary-color: #243465; /* Azul Marino (Secundario) */
    --tertiary-color: #803B31;  /* Marrón Rojizo (Terciario/Acento) */

    --text-color: #333;
    --light-bg: #f4f4f4;
    --dark-bg: #222;
    --white-text: #fff;

    --font-family-header: 'Cinzel', serif;
    --font-family-body: 'Roboto', sans-serif;
}

/* Importar fuentes de Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&family=Cinzel:wght@400;700&display=swap');

body {
    font-family: var(--font-family-body);
    line-height: 1.8; /* Aumenta el interlineado para mejor legibilidad */
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--light-bg); /* Fondo más claro para la página wiki */
}

.container {
    width: 85%; /* Ancho un poco mayor para el contenido wiki */
    max-width: 900px; /* Ancho máximo más ajustado para lectura tipo columna */
    margin: auto;
    overflow: hidden;
    padding: 20px 0;
}

/* Encabezado */
header {
    background: var(--secondary-color);
    color: var(--white-text);
    padding: 1rem 0;
    text-align: center;
    border-bottom: 5px solid var(--primary-color);
    position: relative; /* Needed for absolute positioning of language selector */
}

header h1 {
    margin: 0;
    font-family: var(--font-family-header);
    font-size: 2.2rem; /* Tamaño de título ajustado para wiki */
    color: var(--primary-color);
    margin-bottom: 15px;
}

header nav ul {
    padding: 0;
    list-style: none;
    margin: 0;
}

header nav ul li {
    display: inline;
    margin-right: 20px;
}

header nav a {
    color: var(--white-text);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

header nav a:hover {
    color: var(--primary-color);
}

/* Language Selector */
.language-selector {
    position: absolute;
    top: 10px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.language-selector img {
    width: 30px;
    height: auto;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.language-selector img:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.language-selector img.active-lang {
    border: 2px solid var(--primary-color);
    transform: scale(1.05);
}

/* Contenido de la Wiki */
.wiki-content {
    background-color: var(--white-text);
    padding: 40px;
    margin-top: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.wiki-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    font-size: 1.05rem;
}

.wiki-content h2,
.wiki-content h3,
.wiki-content h4 {
    font-family: var(--font-family-header);
    color: var(--secondary-color);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

.wiki-content h2 {
    font-size: 1.8rem;
    color: var(--tertiary-color);
}

.wiki-content h3 {
    font-size: 1.5rem;
}

.wiki-content h4 {
    font-size: 1.2rem;
    border-bottom: none; /* Elimina el borde inferior para los h4 */
    padding-bottom: 0;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
}

.wiki-content ul {
    list-style: disc;
    margin-left: 25px;
    margin-bottom: 1.5rem;
}

.wiki-content ul ul { /* Para listas anidadas */
    list-style: circle;
    margin-left: 20px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.wiki-content ul li {
    margin-bottom: 0.8rem;
}

.wiki-content strong {
    color: var(--tertiary-color);
}

/* Styles for wiki images (General for existing figures) */
.wiki-content figure {
    margin: 20px auto; /* Centra la figura */
    padding: 10px;
    border: 1px solid var(--light-bg);
    border-radius: 5px;
    background-color: #fcfcfc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    max-width: 600px; /* Ancho máximo para las imágenes */
    text-align: center;
}

.wiki-content figure img {
    max-width: 100%;
    height: auto;
    display: block; /* Elimina espacio extra debajo de la imagen */
    margin: 0 auto 10px auto; /* Centra la imagen y añade espacio abajo */
    border-radius: 3px;
}

.wiki-content figure figcaption {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

/* Image Gallery Styles */
.image-gallery {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.image-gallery h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--secondary-color);
    font-size: 2rem;
    font-family: var(--font-family-header);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.image-gallery figure {
    margin: 0; /* Override previous figure margin */
    padding: 10px;
    border: 1px solid var(--light-bg);
    border-radius: 5px;
    background-color: #fcfcfc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    cursor: pointer; /* Indicate clickable */
}

.image-gallery figure:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.image-gallery figure img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px auto;
    border-radius: 3px;
}

.image-gallery figure figcaption {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    line-height: 1.4;
}

/* --- Lightbox Styles --- */
.lightbox {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 2000; /* Sit on top, ensuring it's above everything */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.9); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px; /* Padding around the content */
    box-sizing: border-box; /* Include padding in width/height */
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%; /* Max width of the image in the lightbox */
    max-height: 90vh; /* Max height to fit viewport */
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    animation-name: zoom;
    animation-duration: 0.6s;
}

/* Add Animation */
@keyframes zoom {
    from {transform: scale(0)}
    to {transform: scale(1)}
}

.lightbox-caption {
    margin-top: 20px;
    color: #f8f8f8;
    font-size: 1.1rem;
    text-align: center;
    max-width: 80%;
}

/* The Close Button */
.close-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.close-btn:hover,
.close-btn:focus {
    color: #bbb;
    text-decoration: none;
}

/* Pie de página */
footer {
    background: var(--secondary-color);
    color: var(--white-text);
    text-align: center;
    padding: 1rem 0;
    margin-top: 40px; /* Ensure there's enough space above the footer */
    border-top: 5px solid var(--primary-color);
    position: relative; /* Sometimes position:relative can help with stacking context */
    z-index: 1; /* Ensure footer is not underneath the lightbox container itself when not active */
}

footer p {
    margin: 5px 0;
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--white-text);
}


/* Media Queries para Responsividad */
@media (max-width: 992px) {
    .container {
        width: 90%;
        padding: 10px 0;
    }

    header h1 {
        font-size: 2rem;
    }

    header nav ul li {
        display: block;
        margin: 10px 0;
    }

    .language-selector {
        position: static;
        margin-top: 15px;
        justify-content: center;
    }

    .wiki-content {
        padding: 20px;
    }

    .wiki-content h2 {
        font-size: 1.6rem;
    }

    .wiki-content h3 {
        font-size: 1.3rem;
    }

    .wiki-content h4 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    .lightbox-content {
        max-width: 95%;
        max-height: 85vh;
    }
    .lightbox-caption {
        font-size: 1rem;
    }
    .close-btn {
        font-size: 30px;
        top: 10px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.5rem;
    }

    .wiki-content {
        padding: 15px;
    }

    .wiki-content p {
        font-size: 1rem;
    }

    .wiki-content h2 {
        font-size: 1.4rem;
    }

    .wiki-content h3 {
        font-size: 1.2rem;
    }

    .wiki-content h4 {
        font-size: 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .image-gallery h2 {
        font-size: 1.5rem;
    }
    .lightbox-content {
        max-width: 98%;
        max-height: 80vh;
    }
    .lightbox-caption {
        font-size: 0.9rem;
    }
    .close-btn {
        font-size: 25px;
        top: 5px;
        right: 15px;
    }
}
