:root {
  --color-memoria-urbana: #ffeb3b;
  --color-patrimonio: #ff5722;
  --color-paisaje-sonoro: #00bcd4;
  --color-cultura-popular: #e91e63;
  --color-diversidad-cultural: #b388ff;
  --color-default: #ffffff;
}

/* EL CANDADO: html y body estrictos para matar el abismo negro en móviles */
html,
body {
  margin: 0;
  padding: 0;
  background-color: #111;
  color: white;
  font-family: serif;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

h1,
h2,
h3,
.sans {
  font-family: sans-serif;
}

#mapa {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  z-index: 1;
}

/* --- MARCADORES --- */
.marcador-cultural {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--color-default);
  border: 2px solid white;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition:
    transform 0.2s ease,
    opacity 0.3s ease;
}
.marcador-cultural:hover {
  transform: scale(1.2);
  z-index: 10;
}
.marcador-cultural img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  filter: contrast(1.2) grayscale(100%);
}

.categoria-memoria-urbana {
  background-color: var(--color-memoria-urbana);
}
.categoria-patrimonio {
  background-color: var(--color-patrimonio);
}
.categoria-paisaje-sonoro {
  background-color: var(--color-paisaje-sonoro);
}
.categoria-cultura-popular {
  background-color: var(--color-cultura-popular);
}
.categoria-diversidad-cultural {
  background-color: var(--color-diversidad-cultural);
}
/* --- CAJA DE FILTROS --- */
.caja-filtros {
  position: absolute;
  top: 30px;
  left: 30px;
  z-index: 10;
  background-color: #111;
  border: 2px solid #111;
  border-radius: 2px 255px 3px 25px / 255px 5px 225px 3px;
  padding: 20px 25px;
  width: max-content;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.6);
}

.caja-filtros h3 {
  font-family: monospace;
  font-size: 16px;
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

/* MAGIA CSS GRID */
.filtros-grid {
  display: grid;
  grid-template-columns: max-content max-content;
  gap: 10px;
  justify-content: start;
}

.btn-filtro {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  padding: 6px 14px;
  background: transparent;
  color: white;
  border: 2px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  transition: all 0.2s ease;
  border-radius: 20px;
  width: max-content;
}

.btn-filtro span.icono {
  font-size: 16px;
  line-height: 1;
  margin-top: -2px;
}

.btn-filtro.inactivo {
  opacity: 0.6;
  color: white !important;
  background-color: transparent !important;
  border-color: #666 !important;
}
.btn-filtro.inactivo:hover {
  opacity: 1;
  border-color: white !important;
}

.btn-memoria-urbana.activo {
  background-color: var(--color-memoria-urbana);
  color: black;
  border-color: black;
}
.btn-patrimonio.activo {
  background-color: var(--color-patrimonio);
  color: black;
  border-color: black;
}
.btn-paisaje-sonoro.activo {
  background-color: var(--color-paisaje-sonoro);
  color: black;
  border-color: black;
}
.btn-cultura-popular.activo {
  background-color: var(--color-cultura-popular);
  color: black;
  border-color: black;
}
.btn-diversidad-cultural.activo {
  background-color: var(--color-diversidad-cultural);
  color: black;
  border-color: black;
}
/* --- MENÚ INFERIOR --- */
.menu-inferior {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 15px 30px;
  gap: 30px;
  border-top: 1px solid #222;
}

.menu-inferior a {
  color: white;
  text-decoration: none;
  font-family: monospace;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.5);
  padding-bottom: 2px;
  transition: all 0.2s ease;
}

.menu-inferior a:hover,
.menu-inferior a.activo {
  color: var(--color-memoria-urbana);
  border-bottom: 2px solid var(--color-memoria-urbana);
}

/* --- OVERLAY DE BIENVENIDA --- */
.overlay-intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.5s ease;
}
.caja-intro {
  max-width: 600px;
  width: 100%;
  box-sizing: border-box;
  padding: 40px;
  text-align: center;
  background: #010101;
  border: 1px solid black;
  border-radius: 1px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
}
.caja-intro p {
  font-size: 18px;
  line-height: 1.6;
  font-family: serif;
  color: #eee;
}
.btn-entrar {
  margin-top: 20px;
  font-family: monospace;
  font-size: 16px;
  text-transform: uppercase;
  background: white;
  color: black;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.btn-entrar:hover {
  background: var(--color-memoria-urbana);
}

/* --- BOTÓN DE AUDIO EN MENÚ --- */
.btn-audio {
  background: transparent;
  border: 1px solid white;
  color: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s;
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
}
.btn-audio:hover {
  background: white;
  color: black;
}
.btn-audio.mutado {
  opacity: 0.5;
  border-color: #666;
}

/* =========================================
   NUEVO: PANEL EDITORIAL FIJO+FLUIDO (Imagen Izquierda / Texto Derecha)
   ========================================= */
.panel-lateral {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  z-index: 500;
  transform: translateY(100%);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.panel-lateral.abierto {
  transform: translateY(0);
}

.btn-cerrar {
  position: fixed;
  top: 30px;
  right: 30px;
  background: transparent;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  transition: opacity 0.2s;
  opacity: 0.6;
}
.btn-cerrar:hover {
  opacity: 1;
}

/* --- CONTENEDOR PRINCIPAL --- */
.nodo-inmersivo {
  width: 100%;
  height: 100vh;
  display: flex;
}

/* 1. LADO IZQUIERDO: LA FOTOGRAFÍA (Fluida) */
.nodo-galeria {
  flex-grow: 1; /* MAGIA: Toma todo el espacio sobrante */
  height: 100vh;
  position: relative;
  background: #000;
  display: flex;
  flex-direction: column;
}

.foto-principal-contenedor {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.foto-principal {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Tira de miniaturas flotante sobre la foto principal */
.tira-miniaturas {
  display: flex;
  justify-content: center; /* Centra las miniaturas horizontalmente */
  flex-wrap: wrap; /* Si hay muchas fotos, saltan a la línea siguiente sin romper la caja */
  gap: 15px;
  padding: 15px 20px 25px 20px; /* Un poco de aire abajo */
  background: #000; /* Se funde con el fondo de la galería */
  width: 100%;
  box-sizing: border-box;
  z-index: 20;
}

.btn-miniatura {
  width: 60px;
  height: 40px;
  padding: 0;
  cursor: pointer;
  background: #000;
  border: 2px solid transparent;
  opacity: 0.5;
  transition: all 0.2s;
}
.btn-miniatura:hover,
.btn-miniatura.activa {
  opacity: 1;
  border-color: white;
}
.btn-miniatura img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555;
  font-family: monospace;
}

/* 2. LADO DERECHO: EL TEXTO (Fijo 500px) */
.nodo-info {
  width: 500px; /* MAGIA: Ancho exacto e ideal para lectura */
  flex-shrink: 0; /* Impide que se comprima */
  background: #111;
  padding: 80px 40px 120px 40px; /* Padding fijo para asegurar el espacio */
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  box-sizing: border-box;
  /* MAGIA CINE: Transiciones añadidas */
  transition:
    width 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
}

/* Cabecera Fija (Título y Etiqueta) */
.nodo-info-header {
  flex-shrink: 0;
  margin-bottom: 20px;
}

.etiqueta-nodo {
  display: inline-block;
  padding: 4px 12px;
  font-size: 11px;
  font-family: sans-serif;
  text-transform: uppercase;
  font-weight: bold;
  letter-spacing: 2px;
  color: black;
  width: max-content;
  margin-bottom: 30px;
}
.nodo-titulo {
  font-family: sans-serif;
  font-size: 52px;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -1px;
}

/* Cuerpo con Scroll Independiente */
.nodo-texto {
  font-size: 18px;
  line-height: 1.8;
  color: #ccc;
  max-width: 100%;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 20px;
  margin-bottom: 20px;
}

/* Scrollbar sutil solo para el bloque de texto */
.nodo-texto::-webkit-scrollbar {
  width: 4px;
}
.nodo-texto::-webkit-scrollbar-track {
  background: transparent;
}
.nodo-texto::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Audio fijo abajo (si existe) */
.nodo-audio {
  flex-shrink: 0;
  width: 100%;
  margin-top: 10px;
}
.nodo-audio audio {
  width: 100%;
}

/* 3. PASTILLA DE NAVEGACIÓN INFERIOR (Centrada en los 500px) */
.pastilla-navegacion {
  position: fixed;
  bottom: 40px;
  right: 250px; /* MAGIA: A exactamente la mitad de los 500px desde la derecha */
  left: auto;
  transform: translateX(50%); /* Centrado sobre su propio eje */
  background: rgba(20, 20, 20, 0.95);
  border: 1px solid #333;
  border-radius: 40px;
  display: flex;
  align-items: center;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 600;
  /* MAGIA CINE: Transición añadida */
  transition:
    right 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s ease;
}
.nav-btn {
  color: white;
  text-decoration: none;
  font-family: monospace;
  text-transform: uppercase;
  font-size: 13px;
  padding: 12px 30px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color 0.2s;
}
.nav-btn:hover {
  color: var(--color-memoria-urbana);
}
.nav-btn.cerrar {
  border-left: 1px solid #333;
  border-right: 1px solid #333;
  font-weight: bold;
}
.nav-btn.deshabilitado {
  opacity: 0.3;
  cursor: default;
}

/* =========================================
   ANIMACIONES Y MODO CINE
   ========================================= */

/* Cuando se activa el Modo Cine: El texto colapsa a 0px */
.nodo-inmersivo.modo-cine .nodo-info {
  width: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  opacity: 0;
}

/* En Modo Cine, la pastilla se va al centro exacto de la pantalla entera */
.nodo-inmersivo.modo-cine .pastilla-navegacion {
  right: 50%;
}

/* Botón flotante para activar el Modo Cine */
.btn-toggle-panel {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(4px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.3s ease;
}

.btn-toggle-panel:hover {
  background: white;
  color: black;
  transform: translateY(-50%) scale(1.1);
}

/* =========================================
   GEOLOCALIZACIÓN
   ========================================= */
/* =========================================
   GEOLOCALIZACIÓN (UX Mejorado)
   ========================================= */
.btn-geolocalizacion {
  position: absolute;
  top: 30px; /* Alineado con la altura de la caja de filtros */
  right: 30px; /* Lo pasamos a la esquina superior derecha */
  bottom: auto; /* Anulamos el valor anterior por si acaso */
  width: 44px; /* Un pelín más grande para pulgares */
  height: 44px;
  border-radius: 50%;
  background: rgba(240, 240, 240, 0.95); /* Relleno casi blanco mate */
  border: none; /* Quitamos el borde, el relleno hace el trabajo */
  color: #111; /* Ícono oscuro para máximo contraste */
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6); /* Sombra más pronunciada */
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.btn-geolocalizacion:hover {
  background: white;
  transform: scale(1.1);
}

/* Estado cuando el GPS está activo */
.btn-geolocalizacion.activo {
  background: var(--color-paisaje-sonoro);
  color: black;
}

/* Animación cuando está buscando el GPS */
.btn-geolocalizacion.cargando i {
  animation: girar 1s linear infinite;
  color: #666; /* Un gris mientras carga */
}

@keyframes girar {
  100% {
    transform: rotate(360deg);
  }
}

/* El punto azul que representa al usuario en el mapa */
.marcador-usuario {
  width: 20px;
  height: 20px;
  background-color: #00bcd4;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 188, 212, 0.8);
  animation: pulso-gps 2s infinite;
}

/* Efecto de radar para el marcador de usuario */
.marcador-usuario::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: rgba(0, 188, 212, 0.1);
  border: 1px solid rgba(0, 188, 212, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: radar 3s infinite;
  pointer-events: none;
}

@keyframes radar {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

@keyframes pulso-gps {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(0, 188, 212, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 188, 212, 0);
  }
}

/* =========================================
   TAGS / ATRIBUTOS TRANSVERSALES
   ========================================= */
.nodo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.tag-pastilla {
  font-family: monospace;
  font-size: 12px;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: #aaa;
  background: rgba(255, 255, 255, 0.03);
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  cursor: default;
}

.tag-pastilla:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   RESPONSIVE MÓVIL (PILA EDITORIAL)
   ========================================= */
@media (max-width: 900px) {
  .filtros-grid {
    grid-template-columns: 1fr;
  }
  .caja-intro {
    width: 90%;
    padding: 30px 20px;
  }
  .menu-inferior {
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 70px 15px 15px;
  }
  .btn-audio {
    right: 15px;
  }

  /* --- ADAPTACIÓN A MÓVIL --- */
  .panel-lateral {
    overflow-y: auto;
  }

  .nodo-inmersivo {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .nodo-galeria {
    flex: none;
    height: auto;
    aspect-ratio: 16 / 9; /* Forzamos la proporción perfecta de video/foto en móviles */
    max-height: 50vh;
    order: -1;
  }

  /* Ocultamos el botón del Modo Cine en móviles, ya que no hay panel lateral que contraer */
  .btn-toggle-panel {
    display: none;
  }

  .btn-cerrar {
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
  }

  .nodo-info {
    width: 100% !important; /* MAGIA: Reiniciamos el ancho en celular a 100% */
    flex: none;
    height: auto;
    padding: 40px 25px 120px 25px !important;
    overflow: visible;
    opacity: 1 !important;
  }

  .nodo-titulo {
    font-size: 38px;
  }

  .nodo-texto {
    overflow-y: visible;
    padding-right: 0;
  }

  /* MAGIA: Reiniciamos el centrado de la pastilla para celular */
  .pastilla-navegacion {
    right: auto !important;
    left: 50%;
    transform: translateX(-50%) !important;
    bottom: 20px;
    width: 90%;
    justify-content: space-between;
  }
  .nav-btn {
    padding: 10px 15px;
  }
  .btn-geolocalizacion {
    bottom: 80px;
    right: 15px;
  }
}
