/* ===================================================
   RESET Y ESTILOS BASE
   =================================================== */
body {
    background-color: #fdfcf8;
    margin: 0;
    overflow: hidden; 
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    color: #1a1a1a;
    height: 100vh;
    width: 100vw;
    position: fixed; 
    overscroll-behavior: none; 
    
    background-image: repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(192,57,43,0.05) 30px, rgba(192,57,43,0.05) 32px),
                      repeating-linear-gradient(90deg, transparent, transparent 30px, rgba(46,125,50,0.05) 30px, rgba(46,125,50,0.05) 32px);
}

/* --- EFECTO DE LIBRO ABIERTO --- */
.book-spine {
    position: absolute; top: 0; left: 50%; width: 120px; height: 100%; transform: translateX(-50%);
    background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.03) 30%, rgba(0,0,0,0.12) 48%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.12) 52%, rgba(0,0,0,0.03) 70%, rgba(0,0,0,0) 100%);
    z-index: 1; pointer-events: none;
}
.book-stitches {
    position: absolute; top: 0; left: 50%; width: 2px; height: 100%; transform: translateX(-50%);
    background-image: linear-gradient(to bottom, transparent 60%, rgba(200,200,200,0.8) 60%); background-size: 100% 45px; z-index: 2; pointer-events: none;
}

/* --- FONDOS PARALLAX Y BRILLO --- */
.parallax-layer {
    position: absolute; top: -5%; left: -5%; width: 110%; height: 110%;
    z-index: 0; pointer-events: none; opacity: 0.5; transition: transform 0.1s linear; 
}
#bg-canvas-layer2 { opacity: 0.3; } 

.red-glow {
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    
    /* Usamos vw y vh para que sea una elipse que se adapte a cualquier monitor */
    width: 110vw; 
    height: 110vh; 
    
    /* Cambiamos a 'ellipse at center' y bajamos la opacidad inicial de 0.7 a 0.45 para suavizarlo */
    background: radial-gradient(circle at center, rgba(216, 27, 27, 0.683) 0%, rgba(210, 30, 30, 0.15) 40%, rgba(253, 252, 248, 0) 75%);
    
    mix-blend-mode: multiply; 
    z-index: 3; 
    pointer-events: none;
}

/* ===================================================
   HEADER, MENÚ Y LEYENDA (FILTROS)
   =================================================== */
.main-header {
    position: absolute; top: 0; left: 0; width: 100%; padding: 30px 40px; box-sizing: border-box;
    display: flex; justify-content: space-between; align-items: flex-start; z-index: 100; pointer-events: none;
}
.menu-container, .social-icons { pointer-events: auto; position: relative; }
.hamburger { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 0; }
.hamburger .line { display: block; width: 35px; }
.red-solid { height: 1.5px; background-color: #c0392b; }
.green-dotted { height: 0px; border-top: 2px dotted #2e7d32; }

.simple-dropdown {
    position: absolute; top: 40px; left: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    opacity: 0; pointer-events: none; transform: translateY(-10px); transition: all 0.3s ease; min-width: 180px; padding-top: 15px;
}
.simple-dropdown.active { opacity: 1; pointer-events: auto; transform: translateY(0); }
.simple-dropdown a { text-decoration: none; }
.simple-dropdown span {
    background-color: #ffff00; color: #0000ff; font-family: 'Space Mono', monospace; padding: 2px 8px; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s ease; display: inline-block;
}
.simple-dropdown span:hover { background-color: #0000ff; color: #ffff00; }

.project-legend {
    display: flex; flex-direction: column; align-items: flex-end; gap: 0;
    pointer-events: auto; position: relative; z-index: 200;
}
.legend-group {
    display: flex; flex-direction: column; align-items: flex-end; margin-bottom: 8px;
}
.legend-item {
    display: flex; align-items: center; gap: 10px; cursor: pointer; 
    color: #5c2c2c; transition: all 0.3s ease; opacity: 0.6; 
}
.legend-item:hover { color: #c0392b; opacity: 1; }
.legend-item.active { color: #c0392b; opacity: 1; font-weight: bold; transform: translateX(-5px); }
.legend-text { font-family: 'Space Mono', monospace; font-size: 0.8rem; text-transform: uppercase; transition: opacity 0.3s; }
.node-icon { font-size: 0.8em; margin-right: 4px; opacity: 0.7; color: #f15e0f; }

.legend-desc {
    max-height: 0; overflow: hidden; opacity: 0; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
    font-family: 'Roboto', sans-serif; font-size: 0.7rem; color: #555;
    text-align: right; width: 220px; margin-top: 0; line-height: 1.3;
}
.legend-item.active + .legend-desc {
    max-height: 400px; opacity: 1; margin-top: 4px; padding-bottom: 5px;
}

/* --- INTERRUPTORES (VISTAS E IDIOMAS) --- */
.lang-toggle, .view-toggle {
    font-family: 'Space Mono', monospace; font-size: 0.85rem; margin-bottom: 8px;
    display: flex; gap: 8px; color: #5c2c2c; justify-content: flex-end; width: 100%;
    align-items: center; /* <--- 1. Esto clava todos los botones en la misma línea central */
}
.view-toggle { margin-bottom: 15px; gap: 15px; }

/* 2. Le ponemos un borde transparente a los inactivos para que no salten de tamaño */
.lang-toggle span, .view-toggle span { 
    cursor: pointer; opacity: 0.4; transition: all 0.3s ease; 
    border-bottom: 1px dashed transparent; 
}
.lang-toggle span:hover, .view-toggle span:hover { opacity: 0.8; color: #c0392b; }
.lang-toggle span.active, .view-toggle span.active { opacity: 1; font-weight: bold; color: #c0392b; }
.view-toggle span.active { border-bottom: 1px dashed #c0392b; }
/* ===================================================
   VISTAS (MAPA Y MOSAICO)
   =================================================== */
.center-title {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    text-align: center; z-index: 50; pointer-events: auto; cursor: pointer; background: transparent; padding: 0;
    transition: transform 0.4s ease, opacity 0.3s ease;
}
.center-title:hover { transform: translate(-50%, -50%) scale(1.05); opacity: 0.8; }
.main-title { font-size: 2rem; font-weight: 600; letter-spacing: 5px; margin: 0 0 5px 0; color: #1a1a1a; text-transform: uppercase; }
.subtitle { font-family: 'Roboto', sans-serif; font-weight: 100; font-style: italic; font-size: 1.1rem; margin: 0; color: #333; }

.data-vis-container { 
    position: fixed; top: 50%; left: 50%; width: 0; height: 0; 
    z-index: 10; pointer-events: none; transition: opacity 0.4s ease;
}
.data-vis-lines, .data-vis-nodes { position: absolute; top: 0; left: 0; overflow: visible; }
.dv-node { position: absolute; pointer-events: auto; cursor: pointer; z-index: 15; }
.dv-text {
    display: inline-block; font-family: 'Roboto', sans-serif; 
    font-weight: 300; /* Lo subimos de 100 a 300 para que tenga más cuerpo */
    color: #1a1a1a; /* Lo cambiamos de gris oscuro a casi negro para máximo contraste */
    background: transparent; padding: 2px 5px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s;
}
.dv-node:hover { z-index: 30; }
.dv-node:hover .dv-text { transform: scale(2.8); color: #c0392b; font-weight: 300; font-style: italic; }

/* Control de qué vista está activa */
body.viewing-mosaic .red-glow, body.viewing-mosaic .data-vis-container { 
    opacity: 0; 
    pointer-events: none; 
}

/* Modificación del Título Central en Vista Mosaico */
body.viewing-mosaic .center-title {
    opacity: 0.2; /* Lo hacemos translúcido como una marca de agua en el fondo */
    pointer-events: none; /* Desactivamos los clics para poder mover las fotos por encima */
    z-index: 10; /* Lo empujamos hacia el fondo, detrás del contenedor del mosaico (que tiene z-index 60) */
    position: fixed; /* Lo mantenemos fijo en el centro de la pantalla */
}

/* Cambiar los colores del título central en Mosaico para que contraste con el fondo oscuro */
body.viewing-mosaic .center-title .main-title {
    color: #fdfcf8;
    text-shadow: 0 0 20px rgba(0,0,0,0.8); /* Una sombra para que resalte sobre las fotos */
}

.mosaic-container {
    position: absolute; top: 0; left: 0; width: 100vw; height: 100vh;
    overflow-y: auto; overflow-x: hidden;
    z-index: 60; background-color: #161616;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
    opacity: 1; transition: opacity 0.4s ease; pointer-events: auto;
}
/* Asegura que las fotos en el mosaico NO estén inclinadas */
.mosaic-container img {
    /* Quitamos cualquier rotación que tuvieran antes */
    transform: rotate(0deg) !important; 
    
    /* Mantenemos el resto de estilos para que se vean bien */
    width: 100%;
    height: 100%;
    object-fit: cover; /* Para que la foto llene el cuadrado sin deformarse */
    border-radius: 5px; /* Unos bordes suaves elegantes */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* Para que el efecto de hover sea suave */
}

/* Efecto opcional: Un pequeño zoom al pasar el mouse, pero manteniéndolas rectas */
.mosaic-container img:hover {
    transform: scale(1.05) rotate(0deg) !important; /* Agranda un poquito, 0 rotación */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); /* Una sombrita sutil */
    z-index: 2; /* Para que se ponga por encima de las otras al agrandarse */
}
.mosaic-item {
    position: absolute; cursor: grab; background: #e9e9e5; 
    padding: 6px 6px 35px 6px; box-shadow: 2px 5px 15px rgba(0,0,0,0.6); 
    user-select: none; transition: filter 0.3s, box-shadow 0.3s; touch-action: none;
}
.mosaic-item:active { cursor: grabbing; box-shadow: 10px 15px 30px rgba(0,0,0,0.9); }
.mosaic-item img {
    width: 100%; display: block; object-fit: cover; filter: grayscale(100%) contrast(1.2); pointer-events: none;
}

.mosaic-item:hover img { filter: grayscale(10%) contrast(1.1); }
.mosaic-item.format-horizontal img { aspect-ratio: 4 / 3; }
.mosaic-item.format-vertical img { aspect-ratio: 3 / 4; }
.mosaic-item.format-square img { aspect-ratio: 1 / 1; }
.mosaic-item.format-panoramic img { aspect-ratio: 16 / 9; }
.mosaic-overlay { position: absolute; bottom: 5px; left: 5px; right: 5px; text-align: center; }
.mosaic-title { 
    font-weight: bold; color: #c0392b; font-family: 'Montserrat', sans-serif; 
    font-size: 0.6rem; line-height: 1.1; margin-top: 2px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; 
}

/* ===================================================
   VENTANAS MODALES Y COMPONENTES
   =================================================== */
.project-modal {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(253, 252, 248, 0.85); 
    background-image: repeating-linear-gradient(45deg, transparent, transparent 50px, rgba(192,57,43,0.03) 50px, rgba(192,57,43,0.03) 52px);
    z-index: 200; display: flex; justify-content: center; align-items: flex-start;
    overflow-y: auto; opacity: 0; pointer-events: none; transition: opacity 0.4s ease; backdrop-filter: blur(8px);
}
.project-modal.active { opacity: 1; pointer-events: auto; }

.modal-content {
    position: relative; width: 90%; max-width: 800px; margin: 60px 0; padding: 50px; background-color: #fdfcf8; 
    background-image: repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(192,57,43,0.05) 40px, rgba(192,57,43,0.05) 42px),
                      repeating-linear-gradient(-45deg, transparent, transparent 40px, rgba(46,125,50,0.05) 40px, rgba(46,125,50,0.05) 42px);
    border: 1px solid rgba(192, 57, 43, 0.3); box-shadow: 0 15px 50px rgba(0,0,0,0.15);
}

.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #1a1a1a; transition: color 0.3s; font-family: 'Space Mono', monospace; }
.modal-close:hover { color: #c0392b; }

.modal-title {
    font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 2.2rem; color: #1a1a1a; margin-top: 0;
    border-bottom: 1px dashed rgba(46, 125, 50, 0.4); padding-bottom: 15px; margin-bottom: 20px; text-transform: uppercase;
    display: flex; align-items: center; gap: 15px;
}
.title-icon { font-size: 1.5rem; color: #c0392b; cursor: default; }
.modal-category { font-family: 'Space Mono', monospace; font-size: 0.95rem; color: #f15e0f; margin-bottom: 20px; text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; font-weight: 600; }

.modal-roles { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 25px; }
.role-tag {
    font-family: 'Space Mono', monospace; font-size: 0.65rem; font-weight: bold; background-color: #1a1a1a; color: #fdfcf8; padding: 4px 10px; text-transform: uppercase; letter-spacing: 1px;
}

.modal-video-container { position: relative; width: 100%; padding-bottom: 56.25%; background: #e0e0e0; margin-bottom: 30px; border: 1px solid rgba(0,0,0,0.1); }
.modal-video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; background-color: #1a1a1a; }.modal-description { font-family: 'Roboto', sans-serif; font-weight: 300; font-size: 1.15rem; line-height: 1.8; color: #333; margin-bottom: 40px; background: rgba(253, 252, 248, 0.7); padding: 15px; border-radius: 4px;}
.modal-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.modal-gallery img { width: 100%; height: 220px; object-fit: cover; border: 1px solid rgba(0,0,0,0.1); transition: transform 0.3s ease; filter: grayscale(20%); cursor: zoom-in;}
.modal-gallery img:hover { transform: scale(1.02); filter: grayscale(0%); border-color: #c0392b; }

.modal-miro-container { position: relative; width: 100%; height: 500px; background: #e0e0e0; margin-bottom: 30px; border: 1px solid rgba(0,0,0,0.1); }
.modal-miro-container iframe { width: 100%; height: 100%; }

.custom-layout-container { display: none; width: 100%; }
.custom-layout-container.active { display: block; }
.custom-subtitle { font-family: 'Space Mono', monospace; font-weight: bold; color: #c0392b; font-size: 1rem; margin: 30px 0 15px 0; border-bottom: 1px dashed rgba(192, 57, 43, 0.3); padding-bottom: 5px; }
.custom-image-full { width: 100%; height: auto; border: 1px solid rgba(0,0,0,0.1); margin-bottom: 20px; }
.project-link-btn {
    display: inline-block; background-color: #fdfcf8; border: 2px solid #2e7d32; color: #2e7d32; font-family: 'Space Mono', monospace; font-size: 0.8rem; font-weight: bold;
    padding: 10px 15px; text-decoration: none; margin: 10px 10px 10px 0; transition: all 0.3s ease; text-transform: uppercase;
}
.project-link-btn:hover { background-color: #2e7d32; color: #fdfcf8; transform: translateY(-3px); }

/* --- LIGHTBOX --- */
.lightbox {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(253, 252, 248, 0.95); 
    z-index: 300; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; backdrop-filter: blur(10px); 
}
.lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox-img { max-width: 90vw; max-height: 90vh; box-shadow: 0 15px 50px rgba(0,0,0,0.3); border: 2px solid #c0392b; object-fit: contain; background: #fff; padding: 10px; }
.lightbox-close { position: absolute; top: 30px; right: 40px; font-size: 2rem; color: #1a1a1a; cursor: pointer; transition: color 0.3s; font-family: 'Space Mono', monospace;}

/* --- SEMILLAS Y ONBOARDING --- */
.seed-node { position: absolute; transform: translate(-50%, -50%); color: #f15e0f; font-size: 1.2rem; z-index: 12; pointer-events: none; animation: pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes pop-in { 0% { transform: translate(-50%, -50%) scale(0) rotate(-45deg); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; } }

.onboarding-toast {
    position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
    background-color: #1a1a1a; color: #fdfcf8; font-family: 'Space Mono', monospace; font-size: 0.75rem; line-height: 1.4;
    padding: 12px 24px; border: 1px solid #f15e0f; opacity: 0; pointer-events: none; transition: opacity 0.8s ease;
    z-index: 1000; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.onboarding-toast.show { opacity: 1; }

/* --- FORMULARIO DE CONTACTO --- */
.brutalist-form { display: flex; flex-direction: column; gap: 15px; margin-top: 25px; font-family: 'Space Mono', monospace; }
.brutalist-form label { font-size: 0.85rem; color: #5c2c2c; font-weight: bold; text-transform: uppercase; }
.brutalist-form input, .brutalist-form textarea {
    background: #fdfcf8; border: 1px solid rgba(192, 57, 43, 0.4); padding: 12px; font-family: 'Roboto', sans-serif; font-size: 1rem; color: #1a1a1a; outline: none; transition: all 0.3s ease; border-radius: 0;
}
.brutalist-form input:focus, .brutalist-form textarea:focus { border-color: #f15e0f; box-shadow: 4px 4px 0px rgba(241, 94, 15, 0.2); }
.brutalist-form textarea { resize: vertical; min-height: 120px; }
.brutalist-form input:not(:placeholder-shown):valid, .brutalist-form textarea:not(:placeholder-shown):valid { border-bottom: 2px solid #2e7d32; }
.submit-btn { background-color: #c6c6b2; color: #f15e0f; border: none; padding: 15px; font-family: 'Space Mono', monospace; font-weight: bold; font-size: 1rem; cursor: pointer; transition: all 0.3s ease; text-transform: uppercase; align-self: flex-start; margin-top: 10px; }
.submit-btn:hover:not(:disabled) { background-color: #f15e0f; color: #c6c6b2; transform: translateX(5px); }
/* --- BUSCADOR Y SPINNER DE CARGA --- */
#project-search {
    background: transparent; border: 1px solid rgba(192,57,43,0.3); font-family: 'Space Mono', monospace; 
    font-size: 0.75rem; padding: 6px 10px; width: 170px; color: #5c2c2c; outline: none; transition: border 0.3s;
}
#project-search:focus { border-color: #c0392b; box-shadow: 2px 2px 0 rgba(192,57,43,0.1); }
#project-search::placeholder { color: rgba(92, 44, 44, 0.4); text-transform: uppercase; }

.modal-video-container { position: relative; background: #e9e9e5; }
.modal-video-container::before {
    content: "CARGANDO... / LOADING..."; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-family: 'Space Mono', monospace; font-size: 0.8rem; color: rgba(0,0,0,0.3); animation: blink 1.5s infinite; z-index: 0;
}

/* --- ACCESIBILIDAD Y LECTURA --- */
/* 1. Títulos del centro un poquito más grandes */
.main-title { font-size: 2.2rem; } /* Antes era 2rem */
.subtitle { font-size: 1.2rem; } /* Antes era 1.1rem */

/* 2. Anillo de Foco: Muestra visualmente dónde estás al presionar la tecla TAB */
*:focus-visible {
    outline: 2px dashed #f15e0f;
    outline-offset: 4px;
    transition: outline 0.1s;
}

/* 3. Contraste Inteligente: El menú se vuelve claro/brillante cuando el fondo es el Mosaico oscuro */
body.viewing-mosaic .legend-item { color: #fdfcf8; opacity: 0.7; }
body.viewing-mosaic .legend-item:hover, body.viewing-mosaic .legend-item.active { color: #f15e0f; opacity: 1; }
body.viewing-mosaic .lang-toggle span, body.viewing-mosaic .view-toggle span { color: #fdfcf8; }
body.viewing-mosaic .lang-toggle span:hover, body.viewing-mosaic .view-toggle span:hover,
body.viewing-mosaic .lang-toggle span.active, body.viewing-mosaic .view-toggle span.active { color: #0ff12d; border-color: #f15e0f;}
body.viewing-mosaic #project-search { border-color: rgba(61, 215, 14, 0.4); color: #fdfcf8; }
body.viewing-mosaic #project-search:focus { border-color: #f15e0f; }
body.viewing-mosaic #project-search::placeholder { color: rgba(253, 252, 248, 0.5); }
/* Pone en blanco las descripciones, los textos y el botón de ayuda en el mosaico */
body.viewing-mosaic .legend-desc, 
body.viewing-mosaic .legend-text { color: #fdfcf8 !important; opacity: 0.9; }
body.viewing-mosaic #btn-help { color: #fdfcf8 !important; opacity: 1 !important; }
/* ===================================================
   BOTÓN CENTRAR MAPA FLOTANTE (REVISADO: SOLO TEXTO)
   =================================================== */
.floating-reset-btn {
    position: fixed !important;
    bottom: 40px;
    right: 40px;
    z-index: 100;
    
    /* REMOVEMOS: Fondo, borde, curvas y sombra para dejar solo el texto */
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    
    /* Mantenemos el resto para que flote bien */
    padding: 10px !important; /* Un poco de padding transparente para facilitar el clic */
    opacity: 0.7; /* Se mantiene sutil y translúcido */
    margin-bottom: 0 !important;
    transition: all 0.3s ease;
}

/* Efecto hover: Solo cambia opacidad y sube un poquito, sin marcos */
.floating-reset-btn:hover {
    opacity: 1;
    transform: translateY(-3px) !important;
    background: none !important; /* Asegura que no reaparezca el fondo */
}

/* Ocultar el botón si estamos en la vista de mosaico */
body.viewing-mosaic .floating-reset-btn {
    display: none !important;
}

/* Ajuste para que en celulares no quede tan pegado al centro */
@media (max-width: 768px) {
    .floating-reset-btn {
        bottom: 20px;
        right: 20px;
        padding: 5px !important;
    }
}
/* ===================================================
   TÍTULO DE PAULINA EN EL MENÚ (SOLO VISTA MOSAICO)
   =================================================== */
.mosaic-title-legend {
    display: none; /* Oculto por defecto en el mapa */
    position: fixed; /* Lo liberamos de la caja de la derecha */
    top: 20px; /* Distancia desde el techo */
    left: 42%; /* Lo mandamos al centro */
    transform: translateX(-50%); /* Centrado matemático exacto */
    text-align: center; /* Centramos el texto interno */
    z-index: 100; /* Por encima de las fotos */
    pointer-events: none; /* Para que no estorbe al hacer clic o arrastrar fotos */
    
    /* Tipografía */
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.8rem; /* Un poco más grande para que destaque */
    color: #fdfcf8;
    letter-spacing: 5px; /* Elegancia */
    line-height: 1.2;
}

.mosaic-title-legend span {
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    letter-spacing: 2px;
    color: #f15e0f; /* Naranja/Rojo sutil */
    font-weight: 300;
    text-transform: uppercase;
}

/* Solo se muestra cuando el body tiene la clase del mosaico */
body.viewing-mosaic .mosaic-title-legend {
    display: block;
}
/* ===================================================
   CORRECCIÓN DE CAPAS (Z-INDEX) Y TARJETA PARA LAPTOPS
   =================================================== */

/* 1. Asegurar que las palabras pasen POR DEBAJO de todo lo demás */
.data-vis-container {
    z-index: 10 !important; 
}
.dv-node {
    z-index: 15 !important; 
}

/* 2. Asegurar que el panel derecho (Filtros y Búsqueda) esté POR ENCIMA de las palabras */
.project-legend {
    z-index: 200 !important;
}

/* 3. El Menú Amarillo (Hamburguesa) debe estar POR ENCIMA de la tarjeta del panel derecho */
.menu-container {
    position: relative;
    z-index: 300 !important; 
}
.simple-dropdown {
    z-index: 300 !important;
}

/* 4. Aplicar la tarjeta translúcida a Laptops (pantallas hasta 1366px) */
@media (max-width: 1366px) {
    .project-legend {
        background: transparent !important; /* Antes era rgba(253, 252, 248, 0.85) */
        padding: 20px 25px;
        border-radius: 15px;
        box-shadow: none !important; /* Antes tenía sombra */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    
    body.viewing-mosaic .project-legend {
        background: transparent !important; 
        box-shadow: none !important;
    }
}
/* ===================================================
   BOTÓN DESPLEGABLE Y MENÚ DE FILTROS
   =================================================== */

.filter-btn {
    background: transparent;
    border: 1px dashed rgba(192, 57, 43, 0.4);
    color: #5c2c2c;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 8px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    outline: none;
    border-radius: 4px;
}

.filter-btn:hover, .filter-btn.active {
    border-style: solid;
    border-color: #c0392b;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.05);
}

.filter-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(253, 252, 248, 0.95);
    backdrop-filter: blur(8px);
    padding: 0 15px;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: 0 10px 30px rgba(0,0,0,0);
}

.filter-content.show {
    max-height: 800px; /* Altura suficiente para que quepan todos los textos */
    opacity: 1;
    visibility: visible;
    padding: 15px;
    border-color: rgba(192, 57, 43, 0.15);
    box-shadow: -5px 10px 30px rgba(0,0,0,0.08);
}

/* Ajuste del botón en la vista del Mosaico (modo oscuro) */
body.viewing-mosaic .filter-btn {
    color: #fdfcf8;
    border-color: rgba(253, 252, 248, 0.4);
}
body.viewing-mosaic .filter-btn:hover, body.viewing-mosaic .filter-btn.active {
    color: #f15e0f;
    border-color: #f15e0f;
    background: rgba(241, 94, 15, 0.1);
}
body.viewing-mosaic .filter-content {
    background: rgba(22, 22, 22, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}
/* ===================================================
   NUEVO MENÚ HAMBURGUESA Y DESPLEGABLE
   =================================================== */

.hamburger-menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    outline: none;
    transition: transform 0.3s ease;
}

.hamburger-menu-btn .burger-line {
    width: 30px;
    height: 2px;
    background-color: #c0392b;
    transition: all 0.3s ease;
}

.hamburger-menu-btn:hover .burger-line {
    background-color: #f15e0f;
}

.filter-content {
    max-height: 0;
    overflow: visible; /* Cambiado a visible para que los tooltips salgan */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(253, 252, 248, 0.95);
    backdrop-filter: blur(8px);
    padding: 0 15px;
    margin-top: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: 0 10px 30px rgba(0,0,0,0);
}

.filter-content.show {
    max-height: 800px;
    opacity: 1;
    visibility: visible;
    padding: 15px;
    border-color: rgba(192, 57, 43, 0.15);
    box-shadow: -5px 10px 30px rgba(0,0,0,0.08);
}

/* Ocultar las descripciones originales que estaban anidadas */
.legend-desc {
    display: none !important;
}

/* ===================================================
   EFECTO HOVER (TOOLTIP) PARA LAS DESCRIPCIONES
   =================================================== */

.tooltip-container {
    position: relative; /* Clave para posicionar el tooltip */
}

.tooltip-desc {
    position: absolute;
    right: 110%; /* Aparece a la izquierda de la categoría */
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    width: 250px;
    background: rgba(253, 252, 248, 0.98);
    border: 1px solid rgba(192, 57, 43, 0.2);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 0.75rem;
    color: #555;
    line-height: 1.4;
    text-align: right;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

/* La flechita del tooltip */
.tooltip-desc::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px; /* Flecha apuntando a la derecha */
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(253, 252, 248, 0.98);
    filter: drop-shadow(2px 0 1px rgba(192, 57, 43, 0.2));
}

/* Mostrar el tooltip al pasar el ratón */
.tooltip-container:hover .tooltip-desc {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Ajustes para el Mosaico (Modo Oscuro) */
body.viewing-mosaic .hamburger-menu-btn .burger-line {
    background-color: #fdfcf8;
}
body.viewing-mosaic .hamburger-menu-btn:hover .burger-line {
    background-color: #f15e0f;
}
body.viewing-mosaic .filter-content {
    background: rgba(22, 22, 22, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}
body.viewing-mosaic .tooltip-desc {
    background: rgba(22, 22, 22, 0.98);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.1);
}
body.viewing-mosaic .tooltip-desc::after {
    border-color: transparent transparent transparent rgba(22, 22, 22, 0.98);
}
/* ===================================================
   ADAPTACIÓN PARA MÓVILES
   =================================================== */
@media (max-width: 768px) {
    /* 1. CONTROLES SUPERIORES (Idiomas y Vistas centrados al tope) */
    .top-right-controls {
        position: absolute !important;
        top: 15px !important;
        left: 50% !important; /* Centrado absoluto */
        right: auto !important;
        transform: translateX(-50%) !important; /* Ajuste para centrado perfecto */
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 20;
    }

    /* 2. BUSCADOR (Centrado justo debajo de los botones superiores) */
    .search-container {
        position: absolute !important;
        top: 85px !important; /* Espacio para que quepan los botones de arriba */
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 80%; /* Ancho cómodo para escribir */
        z-index: 20;
    }
    #search-input {
        text-align: center;
        background: rgba(244, 241, 234, 0.9); /* Fondito sutil para que resalte sobre las líneas */
        padding: 8px !important; 
        font-size: 0.8rem; 
        border-radius: 20px; /* Bordes redondeados elegantes */
    }

    /* 3. CATEGORÍAS (Ancladas al borde derecho como una pestaña) */
    .project-legend {
        position: absolute !important;
        top: 0px !important; 
        right: 0 !important; 
        left: auto !important;
        transform: none !important;
        min-width: 220px;
        max-width: 85%; 
        padding: 15px 15px 15px 20px !important;
        align-items: flex-end !important; 
        
        /* 👇 AQUÍ ESTÁ EL CAMBIO CLAVE 👇 */
        background: transparent !important; /* Antes era rgba(244, 241, 234, 0.639) */
        box-shadow: none !important; /* Antes tenía sombra negra */
        border-radius: 0 !important; 
        z-index: 10;
    }
    /* Alinear textos e iconos de categorías a la derecha */
    .legend-item {
        justify-content: flex-end !important; 
        margin-bottom: 8px !important; 
        font-size: 0.75rem !important;
        width: 100%;
    }

    .legend-desc {
        text-align: right !important; /* Textos justificados a la derecha */
        margin-right: 0 !important;
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }

    /* 4. BAJAR EL CENTRO DE GRAVEDAD EN MÓVILES */
    .center-title {
        top: 62% !important; /* Lo bajamos del 50% al 62% para hacerle espacio a la tarjeta */
        transform: translate(-50%, -50%) scale(0.9) !important; 
    }
    
    /* También bajamos el mapa de palabras y el fondo rojo para que todo coincida */
    .data-vis-container,
    .red-glow {
        top: 62% !important;
    }
 
  /* 5. EL MOSAICO (Fondo negro a pantalla completa) */
    .mosaic-container { 
        left: 0 !important; 
        width: 100vw !important; 
        top: 0 !important; /* Inicia desde el límite superior */
        height: 100vh !important; /* Cubre todo el largo de la pantalla */
        padding-top: 0 !important;
    }
    /* ===================================================
       AJUSTES DE COMPRESIÓN PARA CATEGORÍAS EN MÓVIL
       =================================================== */
    
    /* 1. Subimos toda la caja y le quitamos relleno innecesario */
    .project-legend {
        top: 10px !important; 
        padding: 10px 10px 10px 15px !important; 
    }

    /* 2. Reducimos el salto enorme que había después de [ ? ] | MAPA | MOSAICO */
    .view-toggle {
        margin-bottom: 10px !important; 
    }

    /* 3. Apretamos los grupos de categorías entre sí */
    .legend-group {
        margin-bottom: 2px !important; 
    }

    /* 4. Hacemos la letra y el icono de cada categoría un poco más pequeños */
    .legend-item {
        margin-bottom: 4px !important; 
        font-size: 0.65rem !important; /* Letra más compacta */
        gap: 6px !important; /* Menos espacio entre el icono y el texto */
    }

    /* 5. Comprimimos también el texto largo de las descripciones */
    .legend-desc {
        font-size: 0.6rem !important;
        line-height: 1.1 !important;
        margin-bottom: 2px !important;
    }
    /* ===================================================
       FONDO PARA MENÚ Y CATEGORÍAS EN MODO MOSAICO (MÓVIL)
       =================================================== */
    body.viewing-mosaic .project-legend {
        /* Fondo oscuro semi-transparente para contrastar con las letras blancas */
        background: rgba(22, 22, 22, 0.85) !important; 
        
        /* Efecto de cristal desenfocado para lo que quede detrás */
        backdrop-filter: blur(6px); 
        -webkit-backdrop-filter: blur(6px); /* Soporte para Safari/iPhone */
        
        /* Una sombra suave y un bordecito sutil para despegarlo de las fotos */
        box-shadow: -5px 5px 20px rgba(0, 0, 0, 0.073);
        border-left: 1px solid rgba(255, 255, 255, 0.05);
        border-bottom: 1px solid rgba(255, 0, 0, 0.785);
    }
    
    /* ===================================================
   HACER EL CONTENEDOR DERECHO 100% INVISIBLE 
   =================================================== */
.project-legend, 
body.viewing-mosaic .project-legend {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
}

/* Ocultar el botón original hamburguesa nuevo que ya no usamos */
.hamburger-menu-btn {
    display: none !important;
}
/* ===================================================
   CONTENEDOR DE LEYENDA (FILTROS Y BUSCADOR)
   =================================================== */
/* Eliminar fondos y bordes del contenedor principal en todas las vistas */
.project-legend, 
body.viewing-mosaic .project-legend {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
}

/* Modificamos el buscador para que parezca una línea sutil de texto */
#project-search {
    background: transparent !important; 
    border: none !important;
    border-bottom: 1px dashed rgba(192, 57, 43, 0.4) !important; 
    font-family: 'Space Mono', monospace; 
    font-size: 0.75rem; 
    padding: 6px 0 !important; 
    width: 100%; 
    color: #5c2c2c; 
    outline: none; 
    transition: border 0.3s;
    text-align: right;
    border-radius: 0 !important; /* Quitar bordes redondeados */
}

#project-search:focus { 
    border-bottom-color: #c0392b !important; 
    box-shadow: none !important; 
}

/* Estilos para el contenedor desplegable de filtros, eliminando la caja */
.filter-content {
    max-height: 0;
    overflow: visible; 
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent !important; /* Quitamos el fondo borroso */
    padding: 0;
    margin-top: 10px;
    border: none !important;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    box-shadow: none !important;
}

.filter-content.show {
    max-height: 800px;
    opacity: 1;
    visibility: visible;
    padding-top: 15px; /* Solo espacio arriba al abrir */
}

/* ===================================================
   EFECTO HOVER (TOOLTIP) PARA LAS DESCRIPCIONES
   =================================================== */
/* Ocultar las descripciones originales que estaban anidadas bajo el titulo de la categoria */
.legend-desc {
    display: none !important;
}

.tooltip-container {
    position: relative; 
}

.tooltip-desc {
    position: absolute;
    right: 110%; 
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    width: 250px;
    background: rgba(253, 252, 248, 0.98);
    border: 1px solid rgba(192, 57, 43, 0.2);
    padding: 12px;
    border-radius: 6px;
    font-family: 'Roboto', sans-serif;
    font-size: 0.75rem;
    color: #555;
    line-height: 1.4;
    text-align: right;
    box-shadow: -5px 5px 15px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.tooltip-desc::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px; 
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent rgba(253, 252, 248, 0.98);
    filter: drop-shadow(2px 0 1px rgba(192, 57, 43, 0.2));
}

.tooltip-container:hover .tooltip-desc {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

/* Ajustes Mosaico Tooltip */
body.viewing-mosaic .tooltip-desc {
    background: rgba(22, 22, 22, 0.98);
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.1);
}
body.viewing-mosaic .tooltip-desc::after {
    border-color: transparent transparent transparent rgba(22, 22, 22, 0.98);
}
body.viewing-mosaic #project-search {
    border-bottom-color: rgba(253, 252, 248, 0.4) !important;
    color: #fdfcf8 !important;
}
body.viewing-mosaic #filter-menu-toggle {
    color: #fdfcf8 !important;
}
}