/* Herpetofauna: mapa por subprovincias. Sitio solo oscuro: fondo #0f0f0f, tarjetas #161616, borde #262626, acento #4ade80 / #2e7d32. */

.hf-body { background: #0f0f0f; color: #e5e7eb; }
.hf-pagina { max-width: 1280px; margin: 0 auto; padding: 24px 5% 56px; box-sizing: border-box; }

.hf-encabezado { margin-bottom: 22px; }
.hf-titulo { margin: 0 0 8px; font-size: 28px; font-weight: 800; color: #fff; }
.hf-subtitulo { margin: 0; max-width: 78ch; font-size: 14px; line-height: 1.6; color: #9ca3af; }
.hf-h2 { margin: 0 0 12px; font-size: 18px; font-weight: 700; color: #f3f4f6; }
.hf-h3 { margin: 22px 0 10px; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #9ca3af; }
.hf-aviso { padding: 22px; background: #161616; border: 1px dashed #333; border-radius: 12px; color: #d1d5db; }

/* Cómo explorar el mapa (bloque plegable) */
.hf-guia { margin-bottom: 22px; background: #161616; border: 1px solid #262626; border-left: 4px solid #2e7d32; border-radius: 12px; }
.hf-guia__titulo { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 18px; font-size: 16px; font-weight: 700; color: #4ade80; cursor: pointer; list-style: none; }
.hf-guia__titulo::-webkit-details-marker { display: none; }
.hf-guia__titulo::after { content: "+"; flex: none; width: 28px; height: 28px; line-height: 26px; text-align: center; border: 1px solid #333; border-radius: 50%; font-size: 18px; color: #e5e7eb; }
.hf-guia[open] > .hf-guia__titulo::after { content: "−"; }
.hf-guia__titulo:focus-visible { outline: 3px solid #4ade80; outline-offset: -3px; border-radius: 10px; }
.hf-guia__pasos { margin: 0; padding: 0 22px 18px 42px; font-size: 14px; line-height: 1.65; color: #d1d5db; }
.hf-guia__pasos li { margin: 6px 0; padding-left: 4px; }
.hf-guia__pasos li::marker { color: #4ade80; font-weight: 700; }

/* Búsqueda general */
.hf-buscar { margin-bottom: 24px; padding: 18px 20px; background: #161616; border: 1px solid #262626; border-radius: 14px; }
.hf-etiqueta { display: block; margin-bottom: 6px; font-size: 13px; color: #9ca3af; }
.hf-campo { width: 100%; max-width: 520px; box-sizing: border-box; padding: 11px 14px; background: #0f0f0f; border: 1px solid #333; border-radius: 10px; color: #fff; font: inherit; font-size: 16px; }
.hf-campo:focus { outline: 3px solid #4ade80; outline-offset: 1px; border-color: #4ade80; }
.hf-campo:disabled { opacity: 0.55; cursor: not-allowed; }
.hf-resultados { margin-top: 12px; }
.hf-res-lista { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.hf-res { padding: 10px 12px; background: #0f0f0f; border: 1px solid #262626; border-radius: 10px; }
.hf-res__donde { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.hf-res__texto { font-size: 12px; color: #9ca3af; }
.hf-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 12px; background: #1a1a1a; border: 1px solid #333; border-radius: 999px; color: #e5e7eb; font: inherit; font-size: 12.5px; cursor: pointer; }
.hf-chip:hover { border-color: #4ade80; }
.hf-vacio { margin: 8px 0 0; font-size: 13px; color: #9ca3af; list-style: none; }

/* Cuerpo: mapa a la izquierda, panel a la derecha (en celular, el panel va debajo del mapa) */
.hf-cuerpo { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.hf-mapa-col { min-width: 0; padding: 20px; background: #161616; border: 1px solid #262626; border-radius: 14px; }
.hf-mapa { position: relative; z-index: 0; isolation: isolate; height: 560px; background: #0b0b0b; border: 1px solid #262626; border-radius: 12px; overflow: hidden; }
.hf-mapa__cargando { position: absolute; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; margin: 0; padding: 20px; text-align: center; font-size: 14px; color: #9ca3af; }
.hf-mapa__cargando[hidden] { display: none; }
.hf-ayuda-tactil { display: none; margin: 8px 0 0; font-size: 12px; color: #9ca3af; }

/* Capas opcionales */
.hf-capas { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px; }
.hf-capa { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; font-size: 14px; color: #e5e7eb; cursor: pointer; }
.hf-capa input { width: 18px; height: 18px; accent-color: #2e7d32; }
.hf-capa small { font-size: 11.5px; color: #9ca3af; }
.hf-capa input:focus-visible { outline: 3px solid #4ade80; outline-offset: 2px; }

/* Leyenda: cada fila es un botón que elige la subprovincia */
.hf-leyenda { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.hf-leyenda__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 12px; box-sizing: border-box; background: #0f0f0f; border: 1px solid #262626; border-radius: 10px; color: #e5e7eb; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.hf-leyenda__item:hover { border-color: #4ade80; }
.hf-leyenda__item:focus-visible { outline: 3px solid #4ade80; outline-offset: 2px; }
.hf-leyenda__item[aria-pressed="true"] { border-color: #4ade80; background: #15241a; box-shadow: inset 0 0 0 1px #4ade80; }
.hf-muestra { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); box-sizing: border-box; display: inline-block; }
.hf-muestra--anp { border-radius: 4px; border: 1.5px dashed #fff; background: rgba(255, 255, 255, 0.16); }
.hf-clave { flex: none; min-width: 34px; font-weight: 800; font-size: 12px; letter-spacing: 0.04em; color: #4ade80; }
.hf-nombre { flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.hf-riqueza { flex: none; min-width: 28px; padding: 2px 8px; border-radius: 999px; background: #262626; font-size: 12px; font-weight: 700; text-align: center; color: #d1d5db; }
.hf-leyenda__anp { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; box-sizing: border-box; font-size: 13px; color: #d1d5db; }
.hf-leyenda__anp[hidden] { display: none; }
.hf-nota { margin: 10px 0 0; font-size: 12px; color: #9ca3af; }

/* Panel */
.hf-panel { min-width: 0; padding: 20px; background: #161616; border: 1px solid #262626; border-radius: 14px; position: sticky; top: 16px; }
.hf-panel:focus { outline: none; }
.hf-panel__titulo { margin: 0 0 6px; font-size: 20px; font-weight: 800; color: #fff; line-height: 1.25; }
.hf-panel__meta { margin: 0 0 14px; font-size: 13.5px; line-height: 1.5; color: #9ca3af; }
.hf-panel__meta strong { color: #d1d5db; }
.hf-contador { margin: 8px 0; font-size: 12px; color: #9ca3af; }
.hf-lista { margin: 0; padding: 0; list-style: none; max-height: 460px; overflow-y: auto; border-top: 1px solid #262626; }
.hf-lista li { border-bottom: 1px solid #1f1f1f; }
.hf-lista li.is-destacada { background: #15241a; box-shadow: inset 3px 0 0 #4ade80; }
.hf-especie { display: block; padding: 10px 6px; color: #e5e7eb; text-decoration: none; font-size: 14px; }
.hf-especie:hover, .hf-especie:focus-visible { color: #4ade80; text-decoration: underline; text-underline-offset: 3px; }
.hf-especie:focus-visible { outline: 3px solid #4ade80; outline-offset: -3px; }
.hf-sinjs { margin-top: 28px; }
.hf-sinjs .hf-lista { max-height: none; }

/* Leaflet en tema oscuro */
.hf-mapa .leaflet-container { background: #0b0b0b; font-family: inherit; }
.hf-mapa .leaflet-bar a, .hf-mapa .leaflet-bar a:hover { background: #161616; color: #e5e7eb; border-bottom-color: #262626; width: 36px; height: 36px; line-height: 36px; }
.hf-mapa .leaflet-bar a:hover { background: #2e7d32; }
.hf-mapa .leaflet-bar { border: 1px solid #262626; box-shadow: none; }
.hf-mapa .leaflet-control-attribution { background: rgba(15, 15, 15, 0.82); color: #9ca3af; font-size: 11px; }
.hf-mapa .leaflet-control-attribution a { color: #4ade80; }
.leaflet-tooltip.hf-tooltip { background: #0f0f0f; color: #fff; border: 1px solid #4ade80; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); font-size: 13px; font-weight: 600; }
.leaflet-tooltip.hf-tooltip::before { display: none; }
.hf-popup-caja .leaflet-popup-content-wrapper, .hf-popup-caja .leaflet-popup-tip { background: #161616; color: #e5e7eb; border: 1px solid #262626; }
.hf-popup { font-size: 13px; line-height: 1.5; }
.hf-popup strong { color: #fff; }
.hf-mapa .leaflet-interactive:focus { outline: none; }

@media (max-width: 900px) {
    .hf-cuerpo { grid-template-columns: 1fr; }
    .hf-panel { position: static; }
    .hf-mapa { height: 56vh; min-height: 320px; max-height: 480px; }
    .hf-lista { max-height: 420px; }
    .hf-titulo { font-size: 24px; }
}
@media (pointer: coarse) { .hf-ayuda-tactil { display: block; } }
@media (max-width: 560px) {
    .hf-pagina { padding: 18px 16px 44px; }
    .hf-mapa-col, .hf-panel, .hf-buscar { padding: 14px; }
    .hf-leyenda { grid-template-columns: 1fr; }
    .hf-chip { font-size: 12px; }
}
/* Texto editable bajo el mapa (Textos de las páginas) */
.hf-actualizacion { margin-top: 26px; padding: 18px 22px; background: #161616; border: 1px solid #262626; border-radius: 14px; }
.hf-actualizacion__texto { margin: 0; max-width: 90ch; font-size: 14px; line-height: 1.65; color: #d1d5db; }
.hf-actualizacion .tp-enlaces { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) { .hf-mapa * { transition: none !important; } }

/* Municipios: buscador con autocompletado y panel de reparto */
.hf-combo { position: relative; max-width: 520px; }
.hf-combo__lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 320px; overflow-y: auto; background: #0f0f0f; border: 1px solid #4ade80; border-radius: 10px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55); }
.hf-combo__lista[hidden], #hfSubBloque[hidden], .hf-muni[hidden], .hf-vacio[hidden] { display: none; }
.hf-combo__op { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 6px 12px; border-radius: 8px; color: #fff; font-size: 15px; cursor: pointer; }
.hf-combo__op:hover, .hf-combo__op.is-activa { background: #1f3a2a; }
.hf-combo__claves { flex: none; font-size: 11.5px; color: #9ca3af; letter-spacing: 0.02em; }
.hf-muni__texto { margin: 0 0 10px; font-size: 14px; color: #d1d5db; }
.hf-muni__lista { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.hf-muni__fila { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.hf-muni__sub { text-align: left; }
.hf-muni__pct { font-size: 12.5px; color: #d1d5db; }
.hf-muni__nota { margin: 14px 0 0; padding: 10px 12px; background: #0f0f0f; border: 1px solid #333; border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: #9ca3af; }
/* Una regla global del sitio limita los canvas al 100 % de su contenedor, que en un panel de Leaflet mide 0: la capa de municipios no se veía en el celular */
.hf-mapa .leaflet-pane canvas { max-width: none !important; max-height: none !important; }
