/* mapa-cromo.css — interfaz COMPARTIDA de los ocho mapas (análisis 23/09 §4.2, regla 8).
   Bandas fijas: cabecera 44 · [mapa] · atribución · barra temporal 56 · leyenda 8 · pestañas 56.
   El cromo es siempre claro. Depende de las variables de cluod.css. */

body.pagina-mapa { height: 100dvh; overflow: hidden; padding-bottom: 0; background: #e9ecef; }
.pagina-mapa .cabecera { position: fixed; left: 0; right: 0; top: 0; }

.mapa-lienzo { position: fixed; left: 0; right: 0; top: var(--alto-cabecera);
  bottom: calc(var(--pila-abajo) + var(--seguro-abajo)); background: #eef0f2; }
:root { --pila-abajo: calc(var(--alto-tiempo) + 8px + var(--alto-pestanas)); }
@media (min-width: 1024px) { :root { --pila-abajo: calc(var(--alto-tiempo) + 8px); } }
.mapa-lienzo .maplibregl-canvas:focus { outline: none; }

/* Esqueleto de carga (nunca un lienzo gris sin explicación) */
.mapa-estado { position: fixed; left: 50%; top: calc(var(--alto-cabecera) + 14px); transform: translateX(-50%); z-index: 12;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  padding: 8px 14px; border-radius: 999px; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .12);
  font-size: 13.5px; font-weight: 600; color: var(--cromo-texto); color-scheme: light; }
.mapa-estado[hidden] { display: none; }
.mapa-estado .progreso { width: 72px; height: 4px; border-radius: 2px; background: var(--cromo-2); overflow: hidden; }
.mapa-estado .progreso i { display: block; height: 100%; width: var(--p, 30%); background: var(--cromo-activo); transition: width .2s; }

/* -- Pila inferior -- */
.pila-mapa { position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(var(--alto-pestanas) + var(--seguro-abajo)); color-scheme: light; }
@media (min-width: 1024px) { .pila-mapa { bottom: 0; } }
.pagina-mapa .pestanas { z-index: 21; }

/* Atribución: una línea de 10,5 px justo encima de la barra temporal, a la izquierda del pulgar libre */
.atrib { position: absolute; left: 0; right: 44px; bottom: calc(var(--alto-tiempo) + 8px);
  padding: 3px 10px; font-size: 10.5px; line-height: 1.3; color: #3b4150;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; }
.atrib span { background: rgb(255 255 255 / .82); padding: 1px 6px; border-radius: 4px; }
.atrib a { color: #3b4150; text-decoration: underline; text-underline-offset: 2px; }
/* El control nativo (compact) se conserva en su esquina: regla 15 */
.pagina-mapa .maplibregl-ctrl-bottom-right { margin-bottom: 2px; }
.pagina-mapa .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 22px; }

/* -- Barra temporal (56) -- */
.barra-tiempo { height: var(--alto-tiempo); display: grid; grid-template-columns: 44px 64px minmax(0, 1fr); align-items: center;
  gap: 4px; padding: 0 12px 0 6px; background: var(--cromo); border-top: 1px solid var(--cromo-borde); }
.barra-tiempo .reproducir { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cromo-texto); color: #fff;
  display: grid; place-items: center; cursor: pointer; }
.barra-tiempo .reproducir svg { width: 20px; height: 20px; }
.barra-tiempo .instante { font-size: 12px; line-height: 1.2; color: var(--cromo-texto-2); }
.barra-tiempo .instante b { display: block; font-size: 14px; color: var(--cromo-texto); font-weight: 700; }
.pista { position: relative; height: 44px; touch-action: none; cursor: pointer; user-select: none; -webkit-user-select: none; }
.pista-dias { position: absolute; inset: 0; display: flex; }
.pista-dias button { flex: 1 1 0; min-width: 0; border: 0; background: none; padding: 0; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 3px;
  border-left: 1px solid var(--cromo-borde); padding: 0 0 4px 6px; font-size: 12px; font-weight: 600; color: var(--cromo-texto-2);
  white-space: nowrap; overflow: hidden; }
.pista-dias button:first-child { border-left: 0; padding-left: 2px; }
.pista-dias button[aria-current="true"] { color: var(--cromo-texto); }
.pista-carril { position: absolute; left: 0; right: 0; top: 12px; height: 6px; border-radius: 3px; background: var(--cromo-2); pointer-events: none; }
.pista-carril i { position: absolute; top: 0; bottom: 0; left: 0; width: var(--pos, 0%); border-radius: 3px; background: #c9d6ea; }
.barra-tiempo.atras .pista-carril i { left: auto; right: 0; width: calc(100% - var(--pos, 100%)); }
.pulgar { position: absolute; top: 6px; left: var(--pos, 0%); width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: #fff; border: 3px solid var(--cromo-activo); box-shadow: 0 1px 4px rgb(0 0 0 / .25); pointer-events: none;
  transition: left .15s ease; }
.pista.arrastrando .pulgar { transition: none; transform: scale(1.15); }
.burbuja { position: absolute; bottom: 50px; left: var(--pos, 0%); transform: translateX(-50%); padding: 5px 10px; border-radius: 8px;
  background: var(--cromo-texto); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s; }
.pista.arrastrando .burbuja { opacity: 1; }
.pista:focus-visible { outline: 2px solid var(--cromo-activo); outline-offset: 2px; border-radius: 6px; }

/* Conmutador (Aire: Previsión / Medido; Histórico: Meses / Años) junto a la barra temporal */
.conmutador { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--alto-tiempo) + 32px);
  display: inline-flex; padding: 3px; border-radius: 999px; background: #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .14); }
.conmutador button { height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--cromo-texto-2); cursor: pointer; }
.conmutador button[aria-pressed="true"] { background: var(--cromo-texto); color: #fff; }

/* -- Leyenda: 8 px plegada; al tocar, etiquetas de umbrales.md -- */
.leyenda { position: relative; background: var(--cromo); }
.leyenda-barra { display: flex; width: 100%; height: 8px; padding: 0; border: 0; cursor: pointer; background: none; }
.leyenda-barra span { flex: 1; background: var(--c); }
.leyenda-barra::after { content: ""; position: absolute; inset: -10px 0 0; } /* zona táctil mayor sin crecer */
.leyenda-panel { position: absolute; left: 8px; right: 8px; bottom: 16px; padding: 12px 14px; border-radius: 12px; background: #fff;
  box-shadow: 0 6px 24px rgb(0 0 0 / .16); font-size: 13px; }
.leyenda-panel[hidden] { display: none; }
.leyenda-panel h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.leyenda-panel ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.leyenda-panel li { display: flex; align-items: center; gap: 8px; }
.leyenda-panel li i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none; }
.leyenda-panel li small { color: var(--cromo-texto-2); margin-left: auto; }
.leyenda-panel p { margin: 8px 0 0; color: var(--cromo-texto-2); font-size: 12px; }

/* -- Controles del mapa: a la derecha, en la zona del pulgar -- */
.mapa-ctrl { position: fixed; right: 10px; z-index: 22; display: grid; gap: 8px;
  bottom: calc(var(--pila-abajo) + var(--seguro-abajo) + 44px); transition: bottom .2s ease; }
.mapa-ctrl .grupo { display: grid; background: #fff; border-radius: 12px; box-shadow: 0 2px 10px rgb(0 0 0 / .14); overflow: hidden; }
.mapa-ctrl button { width: 44px; height: 44px; border: 0; background: #fff; color: var(--cromo-texto); display: grid; place-items: center; cursor: pointer; }
.mapa-ctrl .grupo button + button { border-top: 1px solid var(--cromo-borde); }
.mapa-ctrl svg { width: 22px; height: 22px; }
.mapa-ctrl button:hover { background: var(--cromo-2); }
body.hoja-abierta .mapa-ctrl { bottom: calc(var(--alto-hoja, 132px) + 12px); }

/* Pastillas de primera visita (2 s) */
.pista-pastilla { position: fixed; z-index: 25; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--pila-abajo) + var(--seguro-abajo) + 12px);
  padding: 8px 14px; border-radius: 999px; background: var(--cromo-texto); color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 4px 14px rgb(0 0 0 / .2); pointer-events: none; animation: pastilla 2.4s ease both; }
.pista-pastilla.arriba { bottom: auto; top: calc(var(--alto-cabecera) + 10px); left: auto; right: 10px; transform: none; }
@keyframes pastilla { 0% { opacity: 0; translate: 0 6px; } 10%, 85% { opacity: 1; translate: 0 0; } 100% { opacity: 0; } }

/* -- Hoja inferior ESTÁNDAR (toque en el mapa): dos alturas, no bloquea el mapa -- */
.hoja { position: fixed; left: 0; right: 0; z-index: 30; bottom: 0;
  max-height: calc(100dvh - var(--alto-cabecera) - 24px);
  background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 28px rgb(0 0 0 / .16);
  padding-bottom: calc(var(--alto-pestanas) + var(--seguro-abajo));
  transform: translateY(100%); transition: transform .22s ease, height .22s ease; display: flex; flex-direction: column; }
@media (min-width: 1024px) { .hoja { left: auto; right: 12px; bottom: 12px; width: 400px; border-radius: 16px; padding-bottom: 0; } }
.hoja.abierta { transform: translateY(0); }
.hoja.baja { height: calc(196px + var(--alto-pestanas) + var(--seguro-abajo)); }
.hoja.media { height: min(58dvh, 560px); }
@media (min-width: 1024px) { .hoja.baja { height: 200px; } .hoja.media { height: min(70dvh, 620px); } }
.hoja-asa { flex: none; height: 22px; border: 0; background: none; width: 100%; cursor: grab; display: grid; place-items: center; touch-action: none; }
.hoja-asa::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: #cfd3da; }
.hoja-cuerpo { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
.hoja-cab { display: flex; align-items: flex-start; gap: 8px; }
.hoja-cab h2 { flex: 1; font-size: 20px; margin: 0; }
.hoja-cab small { display: block; font-size: 13px; font-weight: 500; color: var(--cromo-texto-2); margin-top: 2px; }
.hoja-cab .boton-cromo { margin: -8px -8px 0 0; }
.hoja-dato { display: flex; align-items: center; gap: 10px; margin: 8px 0 0; font-size: 15px; line-height: 1.35; }
.hoja-dato .muestra { flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--c); display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #111; }
.hoja-dato b { font-weight: 700; }
.hoja-accion { display: flex; align-items: center; justify-content: center; height: 44px; margin-top: 12px; border-radius: 12px;
  background: var(--cromo-texto); color: #fff; font-weight: 700; font-size: 15px; }
.hoja-accion:hover { text-decoration: none; color: #fff; background: #000; }
.hoja-semana { list-style: none; margin: 14px 0 0; padding: 0; }
.hoja-semana li { display: grid; grid-template-columns: 76px 28px minmax(0, 1fr) 60px; align-items: center; gap: 8px; min-height: 40px;
  border-top: 1px solid var(--cromo-borde); font-size: 14px; }
.hoja-semana svg { width: 24px; height: 24px; }
.hoja-semana .rango { display: block; height: 8px; margin-top: 4px; }
.hoja-semana .relleno { display: block; }
.hoja-semana .ll { text-align: right; color: #2f6fc0; font-size: 13px; }
.hoja-semana .t { display: flex; justify-content: space-between; font-size: 13px; color: var(--cromo-texto-2); }
.hoja-semana .t b { color: var(--cromo-texto); }
.hoja-nota { font-size: 12px; color: var(--cromo-texto-2); margin: 8px 0 0; }

/* -- Hoja MODAL de capas (dialog) -- */
.hoja-capas { margin: auto 0 0; padding: 0; border: 0; width: 100%; max-width: 100%; max-height: 86dvh;
  border-radius: 18px 18px 0 0; background: #fff; color-scheme: light; color: var(--cromo-texto); }
.hoja-capas::backdrop { background: rgb(10 14 20 / .35); }
.hoja-capas[open] { animation: subir .2s ease; }
@keyframes subir { from { transform: translateY(40px); opacity: .4; } }
@media (min-width: 1024px) {
  .hoja-capas { margin: 56px 12px auto auto; width: 400px; max-height: calc(100dvh - 80px); border-radius: 16px; }
}
.hoja-capas .cab { position: sticky; top: 0; display: flex; align-items: center; height: 56px; padding: 0 4px 0 18px; background: #fff;
  border-bottom: 1px solid var(--cromo-borde); }
.hoja-capas .cab h2 { flex: 1; font-size: 18px; margin: 0; }
.hoja-capas .grupo-capas { padding: 6px 12px 4px; }
.hoja-capas h3 { margin: 12px 6px 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--cromo-texto-2); }
.capa { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px 6px; border-radius: 12px;
  color: var(--cromo-texto); min-height: 60px; }
.capa:hover { background: var(--cromo-2); text-decoration: none; color: var(--cromo-texto); }
.capa[aria-current="page"] { background: #eaf1fd; }
.capa .mini { width: 52px; height: 44px; border-radius: 9px; overflow: hidden; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); }
.capa .mini i { background: var(--c); }
.capa b { display: block; font-size: 15px; }
.capa span { font-size: 13px; color: var(--cromo-texto-2); }
.subcapas { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 6px 8px 70px; }
.subcapas a { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--cromo-borde);
  font-size: 13px; font-weight: 600; color: var(--cromo-texto); }
.subcapas a:hover { text-decoration: none; border-color: var(--cromo-texto-2); }
.subcapas a[aria-current="true"] { background: var(--cromo-texto); color: #fff; border-color: var(--cromo-texto); }
.hoja-capas .mas { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 12px 18px calc(18px + var(--seguro-abajo)); border-top: 1px solid var(--cromo-borde);
  font-size: 13.5px; }
.hoja-capas .mas a { color: var(--cromo-texto-2); min-height: 32px; display: inline-flex; align-items: center; }

/* -- Texto real bajo el mapa (SEO + lector): se abre desde la cabecera, vive fuera del lienzo -- */
.texto-mapa { position: fixed; inset: var(--alto-cabecera) 0 0; z-index: 28; overflow: auto; background: var(--fondo);
  padding: 20px var(--margen) calc(var(--alto-pestanas) + 40px); transform: translateY(102%); transition: transform .22s ease; }
.texto-mapa.abierto { transform: none; }
.texto-mapa article { max-width: 680px; margin: 0 auto; }
.texto-mapa .respuesta { margin-bottom: 1em; }
@media (prefers-reduced-motion: reduce) { .hoja, .texto-mapa, .pulgar, .mapa-ctrl { transition: none; } .pista-pastilla { animation: none; opacity: 0; } }

/* ==== HOME = MAPA DE ESPAÑA A PANTALLA COMPLETA ==========================================
   Logo flotante a la izquierda, menú flotante a la derecha, pie mínimo. Sin pestañas. */
body.home-mapa { --alto-pestanas: 0px; --alto-pie: 30px; height: 100dvh; overflow: hidden; margin: 0; background: #eef0f2; }
.home-mapa .mapa-lienzo { top: 0; bottom: calc(var(--alto-pie) + var(--seguro-abajo)); }
.flota { position: fixed; z-index: 25; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; align-items: center;
  height: 48px; border-radius: 14px; background: #fff; box-shadow: 0 2px 14px rgb(0 0 0 / .14); color-scheme: light; color: var(--cromo-texto); }
.flota-logo { left: 12px; padding: 0 14px 0 10px; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--cromo-texto); }
.flota-logo:hover { text-decoration: none; color: var(--cromo-texto); }
.flota-logo svg { width: 28px; height: 28px; color: var(--cromo-activo); }
.flota-menu { right: 12px; padding: 0 2px; gap: 0; }
.flota-menu a, .flota-menu button { height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px;
  border: 0; border-radius: 11px; background: none; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--cromo-texto); cursor: pointer; }
.flota-menu a:hover, .flota-menu button:hover { background: var(--cromo-2); text-decoration: none; color: var(--cromo-texto); }
.flota-menu svg { width: 22px; height: 22px; }
.flota-menu .sep { width: 1px; height: 24px; background: var(--cromo-borde); margin: 0 2px; }
.flota-menu .solo-movil { display: none; }
.menu-desplegable { position: fixed; z-index: 26; right: 12px; top: calc(68px + env(safe-area-inset-top, 0px)); width: 240px; padding: 6px;
  border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgb(0 0 0 / .18); color-scheme: light; }
.menu-desplegable[hidden] { display: none; }
.menu-desplegable a { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 12px; border-radius: 10px; font-size: 15.5px; font-weight: 600; color: var(--cromo-texto); }
.menu-desplegable a:hover { background: var(--cromo-2); text-decoration: none; }
.menu-desplegable svg { width: 22px; height: 22px; color: var(--cromo-texto-2); }
@media (max-width: 719px) {
  .flota-menu .solo-escritorio { display: none; }
  .flota-menu .solo-movil { display: inline-flex; }
}
/* Selector de capa: pastilla flotante centrada abajo, encima de la leyenda */
.home-capas { position: fixed; z-index: 22; left: 50%; transform: translateX(-50%); bottom: calc(var(--alto-pie) + var(--seguro-abajo) + 22px);
  display: flex; gap: 2px; padding: 4px; max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none;
  border-radius: 14px; background: #fff; box-shadow: 0 2px 14px rgb(0 0 0 / .14); color-scheme: light; }
.home-capas::-webkit-scrollbar { display: none; }
.home-capas button { flex: none; height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: none; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--cromo-texto-2); cursor: pointer; white-space: nowrap; }
.home-capas button[aria-pressed="true"] { background: var(--cromo-texto); color: #fff; }
.home-mapa .leyenda { position: fixed; z-index: 21; left: 0; right: 0; bottom: calc(var(--alto-pie) + var(--seguro-abajo)); }
@media (max-width: 420px) { .home-capas button { padding: 0 10px; font-size: 13.5px; } }
.home-mapa .home-capas { bottom: calc(var(--alto-pie) + var(--seguro-abajo) + 38px); }
.home-mapa .leyenda-panel { bottom: 76px; max-width: 420px; margin: 0 auto; }
.home-mapa .mapa-ctrl { bottom: calc(var(--alto-pie) + var(--seguro-abajo) + 100px); }
.home-mapa .atrib { position: static; padding: 0; background: none; }
/* Pie mínimo */
.pie-min { position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; height: calc(var(--alto-pie) + var(--seguro-abajo)); padding: 0 12px var(--seguro-abajo);
  display: flex; align-items: center; justify-content: center; gap: 4px 14px; background: #fff; color-scheme: light;
  font-size: 12px; color: var(--cromo-texto-2); white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.pie-min a { color: var(--cromo-texto-2); }
.pie-min a:hover { color: var(--cromo-texto); }
.home-mapa .hoja { padding-bottom: calc(var(--alto-pie) + var(--seguro-abajo)); z-index: 30; }
.home-mapa .hoja.baja { height: calc(196px + var(--alto-pie) + var(--seguro-abajo)); }
@media (min-width: 1024px) { .home-mapa .hoja { bottom: calc(var(--alto-pie) + 12px); padding-bottom: 0; } .home-mapa .hoja.baja { height: 200px; } }
.home-mapa .mapa-estado { top: calc(72px + env(safe-area-inset-top, 0px)); }
