/* =========================================
   ESTILO: GALERÍA ATEMPORAL (Versión Final - Alma Compacta)
   ========================================= */

/* ✨ IMPORTACIÓN DE FUENTES LOCALES */
@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/cinzel-v26-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Cinzel';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/cinzel-v26-latin-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/playfair-display-v40-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/playfair-display-v40-latin-700.woff2') format('woff2');
}

:root {
    --color-fondo: #ffffff;
    --color-texto: #333333;
    --color-acento: #000000;
    --color-gris-claro: #f4f4f4;
    --color-borde: #e0e0e0;
    --color-idioma: #888888; /* Gris neutro y sobrio */
    
    /* Colores del Sistema Documental */
    --color-doc-bg: #fdfbf7;
    --color-doc-borde: #d4af37;
    
    /* Paleta de Identidad (Museo) */
    --oro-principal: #d4af37;
    --marron-oscuro: #5a4a30;
    --crema-fondo: #fffbf5;

    /* Tipografías */
    --fuente-principal: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --fuente-serif: 'Georgia', 'Times New Roman', serif;
}

/* 1. Configuración Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--fuente-principal);
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
    font-size: 16px;
}

a { text-decoration: none; color: var(--color-texto); transition: color 0.3s ease; }
ul { list-style: none; }

/* 2. Encabezado (CENTRADO) */
header {
    background-color: var(--color-fondo);
    padding: 20px 0;
    border-bottom: 1px solid var(--color-borde);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 100;
}

.logo { text-align: center; margin-bottom: 5px; }
.logo h1 { font-size: 1.6rem; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; color: #000; margin: 0; }
.logo p { font-size: 0.8rem; color: #666; letter-spacing: 1px; margin: 5px 0 0 0; }

/* 3. Navegación (CENTRADA) */
.navegacion-principal { width: 100%; display: flex; justify-content: center; }
.navegacion-principal ul { 
    display: flex; 
    gap: 20px; 
    align-items: center; 
    justify-content: center;
    flex-wrap: wrap;
}
.navegacion-principal a { font-size: 0.85rem; text-transform: uppercase; font-weight: 600; padding: 5px 0; color: #444; }
.navegacion-principal a:hover, .navegacion-principal a.activo { border-bottom: 2px solid var(--color-acento); color: var(--color-acento); }

/* Idiomas y Buscador */
.idiomas { margin-left: 20px; font-size: 0.8rem; color: #bbb; border-left: 1px solid #ddd; padding-left: 20px; display: flex; gap: 5px; }
.idiomas a { padding: 0 2px; color: var(--color-idioma); font-weight: 600; border-bottom: none !important; opacity: 0.7; }
.idiomas a:hover { color: var(--color-acento); opacity: 1; }
.idioma-activo { font-weight: 800; color: var(--color-acento); cursor: default; opacity: 1; }

.boton-busqueda { cursor: pointer; font-size: 1.1rem; margin-left: 10px; border: none; background: none; color: #555; transition: transform 0.2s; }
.boton-busqueda:hover { transform: scale(1.1); color: var(--color-acento); }

/* 4. Hero (LIMPIO Y BLANCO) */
.hero { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 40px 20px; /* Reducido un poco el padding vertical */
    background-color: #ffffff; 
    gap: 50px; 
    flex-wrap: wrap; 
}

.hero-imagen img { 
    max-width: 100%; 
    height: auto; 
    border: none; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
    max-height: 400px; 
    border-radius: 4px; 
}

.bienvenida-texto { max-width: 800px; }
.bienvenida-texto h2 { font-size: 2rem; margin-bottom: 20px; font-weight: 300; color: #000; }
.bienvenida-texto p { margin-bottom: 20px; font-size: 1.1rem; color: #555; }

/* Botón de Acción Principal (Dorado) */
.boton-entrar, .boton-accion-principal { 
    display: inline-block; 
    background-color: var(--oro-principal); 
    color: white !important; 
    padding: 15px 30px; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    margin-top: 20px; 
    border-radius: 4px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.boton-entrar:hover, .boton-accion-principal:hover { 
    background-color: var(--marron-oscuro); 
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* 5. Grillas y Tarjetas */
.destacados, .tarjetas-grid { padding: 40px 0; text-align: center; }

/* TÍTULO DE SECCIÓN ELEGANTE */
.destacados h3 { 
    margin-bottom: 30px; 
    font-family: var(--fuente-serif); 
    font-size: 1.8rem; 
    font-weight: normal; 
    font-style: italic; 
    color: var(--marron-oscuro); 
    text-transform: none; 
    letter-spacing: 0; 
}

.tarjetas-grid {
    display: grid;
    /* Ajuste para que se mantengan centradas */
    grid-template-columns: repeat(auto-fit, minmax(220px, 320px)); 
    /* CAMBIO: Aumentamos a 40px para que no estén pegadas */
    gap: 40px; 
    margin-top: 10px;
    padding-top: 0;
    justify-content: center; 
}

/* =========================================
   ESTILO FINAL: TARJETAS "ALMA" (Compacta, Fantasma visible y Justificada)
   ========================================= */

/* Título de la sección */
.destacados h3 {
    font-family: var(--fuente-serif);
    font-size: 1.8rem;
    color: var(--marron-oscuro);
    font-style: italic;
    margin-bottom: 30px;
    font-weight: normal;
}

/* LA TARJETA (El contenedor principal) - VERSIÓN INTEGRADA */
.tarjeta-alma {
    position: relative;
    display: block;
    height: 220px;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 6px;
    
    /* CAMBIO CLAVE 1: Sin borde ni sombra inicial. Se integra al fondo. */
    border: none;
    box-shadow: none;
    
    text-decoration: none;
    background-color: transparent; 
    overflow: hidden;
    transition: all 0.4s ease; /* Un poco más lento para suavidad */

    /* Elimina el destello azul en móviles */
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

/* Efecto al pasar el mouse (hover) O al seleccionarlo (focus) */
.tarjeta-alma:hover, .tarjeta-alma:focus {
    transform: translateY(-5px);
    
    /* CAMBIO CLAVE 2: El borde y la sombra SOLO aparecen al interactuar */
    border: 1px solid var(--oro-principal); 
    box-shadow: 0 15px 30px rgba(90, 74, 48, 0.15); /* Sombra cálida */
    
    outline: none;
}

/* LA IMAGEN FANTASMA (Versión "Marca de Agua" muy suave) */
.imagen-fondo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    
    /* CAMBIO RADICAL: Opacidad muy baja para que sea un "fantasma" real */
    opacity: 0.15; /* Antes era 0.8. Ahora es casi transparente. */
    
    /* Filtro sepia total para que se tiña del color del fondo */
    filter: sepia(100%) saturate(50%); 
    
    z-index: 0;
    transition: all 0.6s ease;
}

/* Al pasar el mouse, la imagen cobra vida casi total */
.tarjeta-alma:hover .imagen-fondo {
    opacity: 0.6; /* Se hace bastante visible */
    filter: sepia(0%); /* Recupera sus colores originales */
    transform: scale(1.05);
}

/* EL CONTENIDO (Versión Transparente para el efecto fantasma) */
.contenido-alma {
    position: relative;
    z-index: 10;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    
    /* PRUEBA: Fondo transparente para que solo se vea la "marca de agua" */
    background: rgba(253, 251, 247, 0.6);
    
    transition: background 0.4s ease;
}

/* Al pasar el mouse, la imagen cobra vida y color (ESTO SE QUEDA) */
.tarjeta-alma:hover .imagen-fondo, .tarjeta-alma:focus .imagen-fondo {
    opacity: 1; /* Se vuelve totalmente visible */
    filter: sepia(0%); /* Recupera sus colores originales */
    transform: scale(1.05);
}

/* Estilo del título (ESTO TAMBIÉN SE QUEDA) */
.contenido-alma h4 {
    font-family: var(--fuente-serif);
    font-size: 1.3rem;
    color: #2c1b18;
    margin-bottom: 8px;
    font-weight: normal;
}
/* CAMBIO 3: Texto justificado */
.contenido-alma p {
    font-family: var(--fuente-principal);
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
    margin-bottom: 15px;
    width: 100%; /* Asegura que use todo el ancho disponible */
    text-align: justify; /* Justifica el texto */
    /* Un truco visual: la última línea queda centrada para que no se vea rara si es corta */
    text-align-last: center; 
}

/* EL BOTÓN */
.boton-ver-alma {
    display: inline-block;
    padding: 6px 15px;
    border: 1px solid var(--marron-oscuro);
    color: var(--marron-oscuro);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s;
}

.tarjeta-alma:hover .boton-ver-alma {
    background-color: var(--marron-oscuro);
    color: #fff;
    border-color: var(--marron-oscuro);
}

/* --- TARJETA ESTÁNDAR (Para otras secciones) --- */
.tarjeta:not(.tarjeta-alma) { 
    background: white; 
    border: 1px solid var(--color-borde); 
    padding: 25px 20px; 
    transition: transform 0.3s ease; 
    text-align: center; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    height: 100%; 
    justify-content: space-between; 
}

.tarjeta:not(.tarjeta-alma):hover { 
    transform: translateY(-3px); 
    border-color: var(--color-acento); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); 
}
.tarjeta h4 { font-size: 1.1rem; margin: 10px 0 5px 0; color: #000; }
.tarjeta img { max-width: 100%; height: auto; max-height: 200px; object-fit: contain; margin-bottom: 10px; cursor: pointer; }

/* 7. Páginas Interiores */
.pagina-interior { max-width: 1000px; margin: 0 auto; padding: 40px 20px; padding-bottom: 20px; background-color: #ffffff; }
.titulo-seccion { text-align: center; margin-bottom: 40px; }
.titulo-seccion h2 { font-size: 2.2rem; font-weight: 300; margin-bottom: 10px; color: #000; }
.titulo-seccion .bajada { font-size: 1.1rem; color: #777; font-style: italic; }
.contenido-texto p { text-align: justify; margin-bottom: 15px; line-height: 1.5; font-size: 0.95rem; }
blockquote { border-left: 4px solid var(--color-acento); padding-left: 20px; margin: 30px 0; font-style: italic; color: #666; font-size: 1.1rem; }
.firma-autor { margin-top: 30px; padding-top: 10px; text-align: center; }
.divisor { margin: 30px 0; border: 0; border-top: 1px solid #ddd; }
.foto-destacada { margin: 40px 0; text-align: center; }
.foto-destacada img { max-width: 100%; height: auto; max-height: 75vh; width: auto; display: block; margin: 0 auto; border: 10px solid white; box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.foto-destacada figcaption { margin-top: 10px; font-size: 0.9rem; color: #777; font-style: italic; }
.agradecimientos { padding: 15px 30px; background-color: #f9f9f9; border-radius: 8px; margin-top: 20px; }
.agradecimientos h3 { margin-bottom: 10px; font-size: 1.3rem; color: #000; }
.lista-agradecimientos { padding-left: 20px; margin-top: 10px; }
.lista-agradecimientos li { margin-bottom: 4px; list-style-type: square; color: #555; }
.agradecimiento-final { margin-top: 15px; font-weight: bold; color: #000; }
.conclusion-destacada { margin-top: 40px; padding: 30px; background-color: var(--color-doc-bg); border: 1px solid var(--color-doc-borde); text-align: center; border-radius: 5px; }
.conclusion-destacada p { text-align: center; font-size: 1.1rem; font-weight: 500; color: #333; margin: 0; }
.seccion-enlaces, .seccion-investigacion { margin: 30px auto; padding: 0 20px; }

/* Documentación y Estilos Generales */
details.seccion-documental { background-color: #fff; border: 1px solid #ccc; margin-bottom: 20px; border-radius: 5px; overflow: hidden; }
details.seccion-documental summary { background-color: #fffdf0; padding: 20px; cursor: pointer; color: #5a4a30; font-size: 1.3rem; font-weight: bold; list-style: none; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid transparent; transition: background 0.3s; }
details.seccion-documental summary:hover { background-color: #fcefc2; }
details.seccion-documental[open] summary { border-bottom: 1px solid #d4af37; background-color: #fff8e1; }
details.seccion-documental summary::after { content: '+'; font-size: 1.5rem; }
details.seccion-documental[open] summary::after { content: '-'; }

.galeria-documentos { padding: 30px; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 30px; background-color: #fff; }
.ficha-doc { background: #fff; display: flex; flex-direction: column; gap: 10px; }
.marco-foto { position: relative; background: #fff; padding: 8px; box-shadow: 0 3px 8px rgba(0,0,0,0.2); border: 1px solid #ddd; transition: transform 0.2s; cursor: zoom-in; }
.marco-foto:hover { transform: scale(1.02); box-shadow: 0 5px 15px rgba(0,0,0,0.3); z-index: 10; }
.marco-foto img { display: block; width: 100%; height: 200px; object-fit: cover; border: 1px solid #eee; }
.datos-doc { font-size: 0.85rem; color: #555; line-height: 1.5; border-top: 3px solid #f4f4f4; padding-top: 10px; }
.datos-doc strong { display: block; color: #000; font-size: 0.95rem; margin-bottom: 2px; }

.documento-antiguo { padding: 15px; margin-bottom: 15px; border-radius: 4px; font-size: 0.9rem; }
.documento-antiguo h4 { margin-top: 0; font-size: 1rem; font-weight: normal; color: #5a4a30; }

.cerrar-seccion-container { width: 100%; text-align: center; padding: 20px; border-top: 1px solid #f0f0f0; background-color: #fafafa; margin-top: 20px; }
.btn-cerrar-seccion { background: none; border: 1px solid #ccc; padding: 10px 20px; cursor: pointer; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: #666; border-radius: 30px; transition: all 0.3s; }
.btn-cerrar-seccion:hover { background-color: #333; color: #fff; border-color: #333; }

.bio-contenedor { display: flex; gap: 40px; align-items: flex-start; margin-bottom: 40px; }
.bio-texto { flex: 1; }
.bio-ficha { flex: 0 0 300px; max-width: 300px; }
.ficha-tecnica { background-color: #fdfbf7; border: 1px solid #d4af37; padding: 25px; margin: 30px 0; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.ficha-tecnica h4 { background: none; color: #5a4a30; padding: 0; border-bottom: 2px solid #d4af37; box-shadow: none; margin-top: 0; }
.ficha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; font-size: 0.9rem; }
.ficha-dato strong { color: #333; display: block; margin-bottom: 4px; }
.galeria-compacta { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 15px; margin-top: 20px; }
.galeria-compacta .tarjeta { padding: 8px; width: 220px; flex-grow: 0; border: none; background: none; }
.galeria-compacta .tarjeta img { height: 160px; width: 100%; object-fit: cover; border: 1px solid #ddd; border-radius: 3px; }

details.documento-historico { background-color: var(--color-doc-bg); border-left: 5px solid var(--color-doc-borde); border-top: 1px solid #e0d8c0; border-right: 1px solid #e0d8c0; border-bottom: 1px solid #e0d8c0; margin-bottom: 20px; border-radius: 4px; overflow: hidden; }
details.documento-historico summary { background-color: #f4f0e6; padding: 8px 15px; cursor: pointer; color: #5a4a30; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.documento-historico summary::after { content: '+'; font-size: 1.2rem; font-weight: bold; }
details.documento-historico[open] summary::after { content: '-'; }
details.documento-historico .contenido-bilingue { padding: 30px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; border-top: 1px solid #e0d8c0; }
.glosario { margin-top: 60px; padding-top: 40px; border-top: 4px solid var(--color-doc-borde); background-color: #fff; }
.glosario h3 { font-size: 1.4rem; margin-bottom: 20px; color: #5a4a30; font-family: var(--fuente-serif); }
.glosario dl { display: grid; grid-template-columns: auto 1fr; gap: 15px 30px; align-items: baseline; }
.glosario dt { grid-column: 1; font-weight: bold; color: #000; font-size: 1rem; text-align: right; min-width: 100px; }
.glosario dd { grid-column: 2; margin: 0; color: #555; font-size: 0.95rem; }

.contenedor-tema { background: #fff; border-radius: 8px; padding: 30px; margin-bottom: 40px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border-top: 5px solid var(--oro-principal); }
.titulo-tema { color: var(--marron-oscuro); border-bottom: 2px solid var(--oro-principal); padding-bottom: 5px; margin-bottom: 15px; text-transform: none; letter-spacing: 1px; font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
.cita-destacada { font-size: 1.1rem; line-height: 1.7; font-style: italic; color: #2c3e50; border-left: 4px solid var(--oro-principal); padding-left: 20px; background: var(--crema-fondo); padding: 20px; margin: 20px 0; }

.bibliografia-chicago { list-style-type: none; padding-left: 0; margin: 20px 0; }
.bibliografia-chicago li { margin-bottom: 15px; padding-left: 30px; text-indent: -30px; line-height: 1.5; color: #444; }
.bibliografia-chicago .autor { font-weight: bold; color: #5a4a30; }

/* 8. Footer */
footer { background-color: #222; color: #ddd; padding: 40px 0; margin-top: 40px; font-size: 0.9rem; }
.footer-contenedor { max-width: 1000px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
.footer-columna h3 { color: #fff; font-size: 1.1rem; margin-bottom: 10px; }
.footer-columna h4 { color: #fff; font-size: 0.9rem; margin-bottom: 10px; font-weight: 600; }
.footer-links li { margin-bottom: 5px; }
.footer-links a { color: #ffffff; text-decoration: none; transition: color 0.3s; opacity: 0.9; }
.footer-links a:hover { color: #fff; opacity: 1; text-decoration: underline; }
.copyright { margin-top: 20px; font-size: 0.8rem; color: #888; }
.copyright a { color: #bbbbbb; text-decoration: underline; transition: color 0.3s ease; }
.copyright a:hover { color: var(--oro-principal); }
.clearfix { clear: both; }

/* Lightbox */
.lightbox-modal { display: none; position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.95); flex-direction: column; align-items: center; justify-content: flex-start; overflow-y: auto; padding: 40px 0; }
.lightbox-contenido { margin: auto; display: block; width: auto; max-width: 95vw; height: auto; max-height: none; border: 4px solid #fff; margin-top: 40px; margin-bottom: 20px; animation: zoom 0.3s; }
.lightbox-caption { margin: 0 auto 40px auto; width: 90%; text-align: center; color: #e0e0e0; font-family: var(--fuente-serif); font-size: 1.1rem; text-shadow: 1px 1px 2px black; flex-shrink: 0; }
.lightbox-cerrar { position: fixed; top: 20px; right: 30px; color: #fff; font-size: 50px; cursor: pointer; z-index: 10000; background: rgba(0,0,0,0.5); padding: 0 15px; border-radius: 5px; }
.lightbox-prev, .lightbox-next { position: fixed; top: 50%; transform: translateY(-50%); color: white; font-size: 40px; cursor: pointer; z-index: 10000; padding: 20px; background: rgba(0,0,0,0.3); border-radius: 5px; }
.lightbox-prev { left: 20px; } .lightbox-next { right: 20px; }

/* Árbol Genealógico Interactivo */
.tabs-arbol { display: flex; justify-content: center; gap: 10px; margin-bottom: 30px; border-bottom: 1px solid #ccc; padding-bottom: 10px; }
.tab-btn { background: none; border: none; padding: 10px 20px; font-family: var(--fuente-principal); font-size: 1rem; cursor: pointer; color: #666; border-bottom: 3px solid transparent; transition: all 0.3s; }
.tab-btn:hover { color: var(--color-acento); }
.tab-btn.activo { color: #000; border-bottom-color: #d4af37; font-weight: bold; }
.vista-arbol { display: none; animation: fadeIn 0.5s; }
.vista-arbol.activa { display: block; }

.tree { width: 100%; overflow-x: auto; padding: 20px; text-align: center; }
.tree ul { padding-top: 20px; position: relative; transition: all 0.5s; display: flex; justify-content: center; }
.tree li { float: left; text-align: center; list-style-type: none; position: relative; padding: 20px 5px 0 5px; transition: all 0.5s; }
.tree li::before, .tree li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 1px solid #ccc; width: 50%; height: 20px; }
.tree li::after { right: auto; left: 50%; border-left: 1px solid #ccc; }
.tree li:only-child::after, .tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 1px solid #ccc; border-radius: 0 5px 0 0; }
.tree li:first-child::after { border-radius: 5px 0 0 0; }
.tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 1px solid #ccc; width: 0; height: 20px; }
.tree .persona { border: 1px solid #ccc; padding: 10px; text-decoration: none; color: #666; font-family: var(--fuente-serif); font-size: 0.85rem; display: inline-block; border-radius: 5px; transition: all 0.5s; background: #fff; min-width: 120px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.tree .persona:hover { background: #fffdf0; border-color: #d4af37; color: #000; transform: scale(1.05); z-index: 10; }
.tree .persona strong { display: block; font-size: 0.95rem; margin-bottom: 3px; }
.tree .persona span { font-size: 0.75rem; color: #999; display: block; }

.tabla-sosa { width: 100%; border-collapse: collapse; margin-top: 20px; background: #fff; }
.tabla-sosa th, .tabla-sosa td { border: 1px solid #eee; padding: 12px; text-align: left; font-size: 0.9rem; }
.tabla-sosa th { background-color: #f9f9f9; color: #5a4a30; font-weight: bold; width: 80px; text-align: center; }
.tabla-sosa tr:hover { background-color: #fffdf0; }
.lista-descendente ul { padding-left: 20px; border-left: 1px dashed #ccc; }
.lista-descendente li { margin-bottom: 10px; position: relative; }
.lista-descendente li::before { content: "—"; position: absolute; left: -15px; color: #ccc; }
.gen-tag { font-size: 0.7rem; background: #eee; padding: 2px 6px; border-radius: 4px; margin-right: 5px; color: #555; }

/* Árbol Lienzo Wrapper */
#arbol-lienzo-wrapper { width: 100%; height: 900px; background-color: #fdfbf7; background-image: linear-gradient(to bottom, #fdfbf7 0%, #f4e4bc 100%); border: 8px solid #fff; outline: 1px solid #8d6e63; box-shadow: inset 0 0 60px rgba(139, 69, 19, 0.1), 0 10px 20px rgba(0,0,0,0.15); overflow: hidden !important; position: relative; border-radius: 4px; cursor: grab; display: flex; justify-content: center; align-items: flex-start; }
#arbol-lienzo-wrapper:active { cursor: grabbing; }
.tree-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform-origin: 50% 50px; z-index: 1; display: flex; justify-content: center; }
#overlay-arbol { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(253, 251, 247, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; transition: opacity 0.3s; backdrop-filter: blur(1px); }
#overlay-arbol.oculto { opacity: 0; pointer-events: none; }
.btn-activar { background-color: #5a4a30; color: #fff; border: 1px solid #3e2723; padding: 12px 30px; font-size: 1.1rem; border-radius: 4px; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.2); font-family: 'Georgia', serif; }
.controles-flotantes { position: absolute; bottom: 20px; right: 20px; display: flex; gap: 5px; z-index: 200; }
.btn-float { width: 35px; height: 35px; border: 1px solid #bcaaa4; background: #fff; color: #5d4037; border-radius: 3px; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 1px 1px 3px rgba(0,0,0,0.2); }

/* =========================================
   MEDIA QUERY: AJUSTES PARA MÓVIL
   ========================================= */
@media (max-width: 768px) {
    header { text-align: center; gap: 10px; }
    .navegacion-principal ul { flex-direction: column; gap: 5px; }
    .footer-contenedor { grid-template-columns: 1fr; text-align: center; }
    
    /* AJUSTE: Unimos el espacio entre foto y texto en móvil */
    .bio-contenedor { 
        flex-direction: column-reverse; 
        gap: 10px !important; /* Reducimos el hueco a solo 10px */
    }
    
    /* Eliminamos el margen inferior de la foto y su leyenda */
    .bio-ficha, .foto-destacada { 
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    /* ELIMINAMOS EL MARGEN SUPERIOR DEL PRIMER PÁRRAFO */
    /* Esto es clave: borra el espacio "invisible" arriba del texto */
    .bio-texto .contenido-texto p:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    
    /* Corrección del espacio gigante */
    .bio-ficha { 
        max-width: 100%; 
        margin: 0 auto; 
        /* CLAVE: Esto le dice que la altura sea automática, anulando el tamaño fijo de escritorio */
        flex: auto !important; 
        height: auto !important; 
    }
    .galeria-documentos { grid-template-columns: 1fr; padding: 15px; }
    
    .contenido-bilingue, details .contenido-bilingue, .documento-historico div[style*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    .documento-historico { margin: 10px 0 !important; width: 100% !important; max-width: 100% !important; }
    .contenido-bilingue p, .contenido-bilingue div { word-wrap: break-word; overflow-wrap: break-word; font-size: 0.95rem !important; }
    .documento-historico div[style*="padding: 30px"] { padding: 20px 15px !important; }
    .contenedor-tema { padding: 20px 15px; }

    .titulo-seccion {
        margin-bottom: 15px !important; 
    }
} /* <--- ¡ESTA ES LA LLAVE QUE FALTABA! Cierra la sección móvil aquí. */


/* =========================================
   SOLUCIÓN VISUAL: FILAS CENTRADAS (PC Y MÓVIL)
   ========================================= */
.fila-centrada { display: flex !important; flex-wrap: wrap !important; justify-content: center !important; gap: 20px !important; }
.fila-centrada .tarjeta { width: 250px; max-width: 100%; flex-grow: 0; height: 100%; }

/* --- TARJETAS SIMPLES PARA NAVEGACIÓN SECUNDARIA --- */
.contenedor-navegacion-simple {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.tarjeta-simple {
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    padding: 20px;
    text-align: center;
    border: 1px solid #d6d3c9; /* Tono piedra cálida */
    border-radius: 4px;
    background-color: #fdfbf7; /* Crema muy suave */
    transition: all 0.3s ease;
    text-decoration: none;
}

.tarjeta-simple:hover {
    border-color: var(--oro-principal);
    background-color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.tarjeta-simple h4 {
    font-family: var(--fuente-serif);
    color: var(--marron-oscuro);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.tarjeta-simple p {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
    margin-bottom: 0;
}

/* --- DISEÑO LADO A LADO PARA AGRADECIMIENTOS Y FOTO --- */
.contenedor-agradecimientos-foto {
    display: flex;
    /* CAMBIO 1: 'center' baja la foto para que quede a la mitad verticalmente */
    align-items: center; 
    /* CAMBIO 2: Reducimos el hueco para que la foto se "acerque" más al texto */
    gap: 30px;               
    margin: 40px 0;
}

/* ACTUALIZACIÓN DE PROPORCIONES: Ahora es 3 a 2 (La foto es más grande) */
.contenedor-agradecimientos-foto .agradecimientos {
    flex: 3;         /* El texto toma el 60% del espacio */
    margin-top: 0;
}

.contenedor-agradecimientos-foto .foto-destacada {
    flex: 4;         /* La foto ahora toma el 40% (antes era el 33%) */
    margin: 0;
}

/* Ajuste específico: En móviles volvemos a poner uno debajo del otro */
@media (max-width: 768px) {
    .contenedor-agradecimientos-foto {
        flex-direction: column;
    }
}
/* =========================================
   CORRECCIÓN GLOBAL DE ANCHO EN MÓVILES
   ========================================= */
@media (max-width: 768px) {
    
    /* 1. Reducimos el margen general de la página al mínimo cómodo */
    .pagina-interior {
        padding-left: 15px !important;
        padding-right: 15px !important;
        max-width: 100% !important;
    }

    /* 2. Quitamos el relleno de los contenedores de texto internos */
    .contenido-texto, 
    .bio-texto, 
    .texto-narrativo,
    .seccion-investigacion {
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    /* 3. Ajuste para lectura */
    p, li {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }
}
/* === NUEVO: Estilos del Buscador Profesional === */
.busqueda-modal {
    display: none;
    position: fixed;
    z-index: 2000; /* Lo ponemos bien alto para que tape todo */
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
}

.busqueda-contenido {
    background-color: #fdfbf7;
    margin: 10% auto;
    padding: 40px;
    border: 2px solid #d4af37;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    position: relative;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.cerrar-x {
    position: absolute;
    right: 20px; top: 10px;
    font-size: 35px;
    cursor: pointer;
    color: #5a4a30;
    font-weight: bold;
}

.busqueda-contenido input {
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    border: 1px solid #d4af37;
    border-radius: 4px;
    font-size: 1.1rem;
    font-family: 'Georgia', serif;
}

.btn-buscar-modal {
    background-color: #5a4a30;
    color: white;
    padding: 15px 40px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: background 0.3s;
}

.btn-buscar-modal:hover {
    background-color: #d4af37;
}
/* === ESTILOS PARA FORMULARIOS Y ACCESO (ESTÉTICA MUSEO) === */
.cuadro-museo {
    max-width: 500px;
    margin: 60px auto;
    padding: 40px;
    background: #fdfaf6; /* Crema fondo */
    border: 1px solid #d4af37; /* Oro principal */
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.boton-museo {
    display: inline-block;
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    background: #1a1a1a; /* Marrón oscuro / Negro */
    color: #d4af37 !important; /* Texto dorado */
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.3s;
}

.boton-museo:hover {
    background: #333;
}

/* === MENÚ DE IDENTIDAD FAMILIAR (DROPDOWN) === */
.usuario-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.usuario-nombre {
    font-family: var(--fuente-serif);
    color: var(--marron-oscuro);
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.dropdown-contenido {
    display: none;
    position: absolute;
    right: 0;
    background-color: #fdfaf6; /* Crema institucional */
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border: 1px solid var(--oro-principal);
    z-index: 1000;
    margin-top: 10px;
}

/* Mostrar el menú al pasar el mouse */
.usuario-dropdown:hover .dropdown-contenido {
    display: block;
}

/* === MENÚ DE IDENTIDAD (DROPDOWN DISCRETO) === */
.contenedor-perfil-galeria {
    display: flex;
    justify-content: flex-end; /* Lo pega a la derecha */
    margin-bottom: 10px;
}

.usuario-dropdown {
    position: relative;
    display: inline-block;
}

.usuario-nombre-discreto {
    font-family: var(--fuente-principal);
    font-size: 0.75rem; /* Tamaño muy pequeño */
    color: #888; /* Gris suave */
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usuario-nombre-discreto:hover {
    color: var(--oro-principal);
}

.dropdown-contenido-discreto {
    display: none;
    position: absolute;
    right: 0;
    background-color: #fdfaf6;
    min-width: 140px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 1px solid var(--oro-principal);
    z-index: 1000;
}

/* Mostrar al pasar el mouse */
.usuario-dropdown:hover .dropdown-contenido-discreto {
    display: block;
}

/* Enlaces y botones internos */
.dropdown-contenido-discreto a, 
.dropdown-contenido-discreto button {
    color: #555;
    padding: 10px 12px;
    text-decoration: none;
    display: block;
    font-size: 0.75rem;
    text-align: left;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--fuente-principal);
}

.dropdown-contenido-discreto a:hover, 
.dropdown-contenido-discreto button:hover {
    background-color: #fff;
    color: var(--oro-principal);
}

/* Estilo para resaltar el idioma que el usuario está viendo */
.idioma-activo {
    font-weight: bold !important; /* Lo pone en negrita ✍️ */
    color: #000000 !important;    /* Lo pone en color negro ⬛ */
    text-decoration: underline;    /* Opcional: le agrega un subrayado para que resalte más */
}
