/* Fuentes servidas desde el propio dominio (antes Google Fonts): latin siempre, latin-ext solo si hace falta. */
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fuentes/EBGaramond-cursiva-latin-ext.a6d60ed06220.woff2") format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400; font-display: swap;
  src: url("fuentes/EBGaramond-cursiva-latin.9f79ebd15d75.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("fuentes/EBGaramond-normal-latin-ext.7b420e1876aa.woff2") format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("fuentes/EBGaramond-normal-latin.1a4b137019bd.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fuentes/InstrumentSans-normal-latin-ext.e2385a017626.woff2") format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Instrument Sans'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fuentes/InstrumentSans-normal-latin.e35fad09c70b.woff2") format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Desvelo: atlas nocturno de luces (y su versión de día, en papel).
   La interfaz es monocroma y lunar; el color vive solo en las luces del mapa (una por categoría).
   Los nombres de los tonos son los de la noche: en el modo día "tinta" es el papel y "luna" la tinta. */

:root {
  color-scheme: dark;
  --tinta: #10142e;
  --tinta-2: #181d40;
  --tinta-3: #222852;
  --luna: #e7e4f6;
  --luna-2: #b9bcdc;
  --luna-3: #8d91b8;
  --linea: rgba(200, 205, 255, 0.13);
  --linea-2: rgba(200, 205, 255, 0.24);
  --panel: rgba(16, 20, 46, 0.9);
  --borde-panel: rgba(200, 205, 255, 0.28);
  --bandeja: rgba(38, 45, 96, 0.62);          /* fondo de la zona de controles */
  --bandeja-borde: rgba(200, 205, 255, 0.3);
  --hundido: rgba(9, 11, 30, 0.72);           /* campos y botones dentro de la bandeja */
  --realce: #ffffff;
  --sombra: rgba(3, 5, 18, 0.5);
  --resalte-volver: #2c336a;
  --brillo-marca: rgba(245, 199, 110, 0.18);
  --filtro-icono-ctrl: invert(0.92) sepia(0.2) hue-rotate(200deg);
  --error: #ffa3a3;

  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-panel: 22px;
  --r-control: 12px;
  --ancho-panel: 408px;
  --hueco: 16px;
  --sale: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-tema="dia"] {
  color-scheme: light;
  --tinta: #f3eee2;
  --tinta-2: #e9e2d0;
  --tinta-3: #ddd3bc;
  --luna: #1c2042;
  --luna-2: #44486b;
  --luna-3: #686a86;
  --linea: rgba(40, 36, 80, 0.14);
  --linea-2: rgba(40, 36, 80, 0.3);
  --panel: rgba(249, 246, 238, 0.94);
  --borde-panel: rgba(40, 36, 80, 0.3);
  --bandeja: rgba(232, 224, 205, 0.9);
  --bandeja-borde: rgba(40, 36, 80, 0.26);
  --hundido: rgba(255, 253, 248, 0.95);
  --realce: #000000;
  --sombra: rgba(70, 56, 24, 0.2);
  --resalte-volver: #cfc4aa;
  --brillo-marca: transparent;
  --filtro-icono-ctrl: none;
  --error: #a82a22;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--tinta);
  color: var(--luna);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--luna); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[hidden] { display: none !important; }

.icono { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icono .relleno { fill: currentColor; stroke: none; }

/* ---------- Mapa ---------- */
/* .mapa.maplibregl-map: más específico que el position: relative de MapLibre, cargue su CSS antes o después. */
.mapa, .mapa.maplibregl-map { position: fixed; inset: 0; background: var(--tinta); }
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--borde-panel); border-radius: var(--r-control); box-shadow: none; backdrop-filter: blur(12px); overflow: hidden; }
.maplibregl-ctrl-group button { width: 36px; height: 36px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--linea); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: var(--filtro-icono-ctrl); }
.maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--panel) !important; color: var(--luna-3); font-size: 11px; }
.maplibregl-ctrl-attrib a, .maplibregl-ctrl-attrib-inner * { color: var(--luna-2) !important; }
.maplibregl-ctrl-attrib-button { filter: var(--filtro-icono-ctrl); }

.regiones {
  display: flex; padding: 3px; margin: 16px 16px 0 0; gap: 2px;
  background: var(--panel); border: 1px solid var(--borde-panel); border-radius: 12px; backdrop-filter: blur(12px);
}
.regiones button {
  border: 0; background: none; color: var(--luna-2); font-size: 13px; padding: 6px 11px; border-radius: 9px;
}
.regiones button:hover { background: var(--tinta-3); color: var(--luna); }

.globo .maplibregl-popup-content {
  background: var(--tinta-2); color: var(--luna); border: 1px solid var(--linea-2);
  border-radius: 10px; padding: 7px 11px; box-shadow: 0 8px 28px var(--sombra);
  font: 400 17px/1.25 var(--serif); max-width: 260px;
}
.globo .maplibregl-popup-tip { display: none; }
.globo small { display: block; font: 400 12.5px/1.4 var(--sans); color: var(--luna-3); margin-top: 2px; }

/* Selector de lugares que comparten punto */
.selector .maplibregl-popup-content { padding: 6px; max-width: none; }
.selector__cabecera { margin: 2px 6px 4px; font: 400 12.5px/1.4 var(--sans); color: var(--luna-3); }
.selector ul { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; }
.selector button {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; text-align: left;
  border: 0; background: none; color: var(--luna); font: 400 16px/1.2 var(--serif);
  padding: 7px 8px; border-radius: 7px; cursor: pointer;
}
.selector button:hover, .selector button:focus-visible { background: var(--tinta-3); outline: none; }
.selector__luz {
  flex: none; width: 9px; height: 9px; margin-top: 5px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 8px var(--c);
}

.yo { width: 16px; height: 16px; border-radius: 50%; background: var(--luna); border: 3px solid var(--tinta); box-shadow: 0 0 0 6px rgba(231, 228, 246, 0.18); }

/* ---------- Panel ---------- */
.panel {
  position: fixed; top: var(--hueco); left: var(--hueco); bottom: var(--hueco);
  width: var(--ancho-panel); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--borde-panel); border-radius: var(--r-panel);
  backdrop-filter: blur(18px) saturate(1.25); -webkit-backdrop-filter: blur(18px) saturate(1.25);
  box-shadow: 0 24px 60px var(--sombra), 0 0 0 1px rgba(0, 0, 0, 0.12);
  overflow: hidden; z-index: 2;
}
.panel__asa { display: none; }

.cabecera { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 18px 14px 24px; flex: none; }
.marca {
  display: block; text-decoration: none;
  margin: 0; font: 400 36px/1 var(--serif); letter-spacing: -0.01em; color: var(--luna);
  text-shadow: 0 0 22px var(--brillo-marca);
}
.lema { margin: 8px 0 0; color: var(--luna-3); font-size: 14px; }

.cabecera__acciones { display: flex; align-items: center; gap: 8px; flex: none; }
.boton-contribuir {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  background: transparent; border: 1px solid var(--linea-2); border-radius: 999px;
  color: var(--luna); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background 0.18s, border-color 0.18s;
}
.boton-contribuir .icono { width: 18px; height: 18px; stroke-width: 1.9; }
.boton-contribuir:hover { background: var(--tinta-3); border-color: var(--luna-3); }

/* Modo día / noche: el botón enseña el modo al que se cambia. */
.boton-tema { background: transparent; border-color: var(--linea-2); }
.boton-tema .icono--luna, :root[data-tema="dia"] .boton-tema .icono--sol { display: none; }
:root[data-tema="dia"] .boton-tema .icono--luna { display: block; }

/* Bandeja de controles: una superficie propia, con borde definido, para que se distinga del resto del panel. */
.buscador {
  display: grid; gap: 12px; margin: 0 14px 10px; padding: 14px 14px 10px; flex: none;
  background: var(--bandeja); border: 1px solid var(--bandeja-borde); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px var(--sombra);
}

.campo {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 12px 0 14px;
  background: var(--hundido); border: 1px solid var(--linea-2); border-radius: var(--r-control);
  color: var(--luna-3); transition: border-color 0.2s, background 0.2s;
}
.campo:focus-within { border-color: var(--luna-3); color: var(--luna-2); }
.campo input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--luna); font-size: 16px; }
.campo input::placeholder { color: var(--luna-3); }
.campo input::-webkit-search-cancel-button { filter: invert(0.8); }
.atajo {
  font: 500 12px/1 var(--sans); color: var(--luna-3); border: 1px solid var(--linea-2);
  border-radius: 6px; padding: 4px 7px;
}
.campo:focus-within .atajo { display: none; }

/* Tipos: plegados tras el botón «Tipos». Plegados solo se ven los elegidos (para quitarlos de un toque);
   desplegados, todos, con altura máxima para que la lista de resultados conserve siempre su sitio. */
.filtros {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: min(42vh, 330px); overflow-y: auto;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--tinta-3) transparent;
}
.filtros:not([data-abierto]) .chip[aria-pressed="false"] { display: none; }
.filtros:not([data-abierto]):not(:has(.chip[aria-pressed="true"])) { display: none; }
.filtros:not([data-abierto]) .chip__n { display: none; }

.boton-tipos {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px 0 9px; flex: none;
  background: var(--hundido); border: 1px solid var(--linea-2); border-radius: var(--r-control); color: var(--luna);
  font-size: 14px; transition: background 0.18s, border-color 0.18s;
}
.boton-tipos .icono { width: 18px; height: 18px; color: var(--luna-2); }
.boton-tipos:hover { background: var(--tinta-3); }
.boton-tipos[aria-expanded="true"] { border-color: var(--luna-3); background: var(--tinta-3); }
.boton-tipos__n {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--luna); color: var(--tinta); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px 0 9px;
  border-radius: 999px; border: 1px solid var(--linea-2); background: var(--hundido);
  color: var(--luna-2); font-size: 13px; white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, opacity 0.18s;
}
.chip:hover { border-color: var(--luna-3); color: var(--luna); }
/* Cada elemento trae el color nocturno de su categoría; de día baja de luminosidad conservando el tono
   (la misma conversión que hace mapa.js con las luces del mapa). */
:is(.chip, .item, .ficha) { --luz: var(--luz-noche); }
:root[data-tema="dia"] :is(.chip, .item, .ficha) { --luz: oklch(from var(--luz-noche) 0.55 max(c, 0.11) h); }
.chip__luz { width: 8px; height: 8px; border-radius: 50%; background: var(--luz); box-shadow: 0 0 8px var(--luz); }
.chip__n { color: var(--luna-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] {
  background: color-mix(in oklab, var(--luz) 16%, transparent);
  border-color: color-mix(in oklab, var(--luz) 60%, transparent); color: var(--luna);
}
.chip[aria-pressed="true"] .chip__n { color: var(--luna-2); }
.chip[data-vacia] { opacity: 0.38; }

.barra { display: flex; gap: 8px; }
.selector { position: relative; flex: 1; min-width: 0; }
.selector::after {
  content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px;
  border: solid var(--luna-3); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); pointer-events: none;
}
.selector select {
  appearance: none; width: 100%; height: 40px; padding: 0 28px 0 12px; text-overflow: ellipsis;
  background: var(--hundido); border: 1px solid var(--linea-2); border-radius: var(--r-control); color: var(--luna);
}
.selector select option { background: var(--tinta-2); }
.boton-icono {
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
  background: var(--hundido); border: 1px solid var(--linea-2); border-radius: var(--r-control); color: var(--luna-2);
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.boton-icono:hover { background: var(--tinta-3); color: var(--luna); }
.boton-icono[aria-pressed="true"] { color: var(--tinta); background: var(--luna); border-color: var(--luna); }

.estado { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#recuento { margin: 0; color: var(--luna-2); font-size: 13.5px; }
#recuento strong { color: var(--luna); font-weight: 600; font-variant-numeric: tabular-nums; }
.interruptor { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--luna-3); cursor: pointer; white-space: nowrap; }
.interruptor input {
  appearance: none; width: 30px; height: 18px; margin: 0; border-radius: 999px; position: relative;
  background: var(--tinta-3); border: 1px solid var(--linea-2); transition: background 0.18s; cursor: pointer;
}
.interruptor input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--luna-3); transition: transform 0.2s var(--sale), background 0.2s;
}
.interruptor input:checked { background: var(--luna-2); }
.interruptor input:checked::after { transform: translateX(12px); background: var(--tinta); }

/* ---------- Lista de resultados ---------- */
.lista {
  list-style: none; margin: 0; padding: 0 12px 16px; overflow-y: auto; flex: 1;
  scrollbar-width: thin; scrollbar-color: var(--tinta-3) transparent;
}
.lista__mas { height: 1px; }
.item {
  color: inherit; text-decoration: none;
  display: grid; grid-template-columns: 14px 1fr auto; column-gap: 12px; width: 100%;
  padding: 13px 12px; text-align: left; background: none; border: 0; border-radius: 14px;
  transition: background 0.15s;
}
.item:hover, .item[data-activo] { background: color-mix(in oklab, var(--luna) 6%, transparent); }
.item__luz { width: 9px; height: 9px; margin-top: 8px; border-radius: 50%; background: var(--luz); box-shadow: 0 0 10px var(--luz); }
.item__titulo { font: 400 19px/1.25 var(--serif); color: var(--luna); }
.item__dist { font-size: 12.5px; color: var(--luna-3); font-variant-numeric: tabular-nums; padding-top: 4px; }
.item__sitio { grid-column: 2 / 4; font-size: 13px; color: var(--luna-3); margin-top: 2px; }
.item__zona {
  display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px dashed var(--linea-2); border-radius: 999px;
  font-size: 11.5px; line-height: 18px; color: var(--luna-2);
}
.item__extracto {
  grid-column: 2 / 4; margin-top: 6px; font-size: 13.5px; line-height: 1.5; color: var(--luna-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
mark { background: none; color: var(--luna); box-shadow: inset 0 -0.42em color-mix(in oklab, var(--luz, #f5c76e) 34%, transparent); }

.vacio { padding: 36px 16px; text-align: center; color: var(--luna-2); }
.vacio p { margin: 0 0 14px; }
.boton-texto {
  background: none; border: 1px solid var(--linea-2); border-radius: 999px; padding: 7px 14px;
  color: var(--luna); font-size: 13.5px;
}
.boton-texto:hover { background: var(--tinta-3); }

/* ---------- Ficha ---------- */
.ficha {
  flex: 1; overflow-y: auto; padding: 4px 28px 32px; border-top: 1px solid var(--linea);
  scrollbar-width: thin; scrollbar-color: var(--tinta-3) transparent;
  animation: entra 0.35s var(--sale);
}
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }
.volver {
  text-decoration: none;
  position: sticky; top: 12px; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 14px 0 20px -4px; padding: 0 18px 0 12px;
  background: var(--tinta-3); border: 1px solid var(--linea-2); border-radius: 999px;
  box-shadow: 0 6px 18px var(--sombra);
  color: var(--luna); font-size: 14.5px; font-weight: 500; cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.volver .icono { width: 22px; height: 22px; stroke-width: 2.2; transition: transform 0.18s var(--sale); }
.volver:hover { background: var(--resalte-volver); border-color: var(--luna-3); }
.volver:hover .icono { transform: translateX(-3px); }
.volver:active { transform: scale(0.98); }
.ficha__tipo { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13.5px; color: var(--luna-2); }
.ficha__tipo span { width: 9px; height: 9px; border-radius: 50%; background: var(--luz); box-shadow: 0 0 12px var(--luz); }
.ficha__titulo { margin: 0; font: 400 34px/1.08 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.ficha__sitio { margin: 10px 0 0; color: var(--luna-3); font-size: 14px; }
.ficha__sitio small { display: block; margin-top: 2px; font-size: 12.5px; }
.ficha__aviso { margin: 14px 0 0; font-size: 13.5px; color: var(--luna-2); }
.ficha__aviso .boton-texto { margin-left: 4px; padding: 4px 11px; font-size: 13px; }
.ficha__historia {
  margin: 24px 0 0; padding: 4px 0 4px 18px; position: relative;
  font: italic 400 21px/1.5 var(--serif); color: var(--luna);
}
.ficha__historia::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px; border-radius: 2px;
  background: var(--luz); box-shadow: 0 0 14px var(--luz);
}
.ficha__desc { margin-top: 22px; color: var(--luna-2); font-size: 14.5px; line-height: 1.65; max-width: 62ch; }
.ficha__desc p { margin: 0; }
.ficha__desc[data-recortada] p { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.ficha__desc .boton-texto { margin-top: 10px; }

.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.accion {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: var(--r-control); border: 1px solid var(--linea-2); background: var(--tinta-2);
  color: var(--luna); font-size: 14px; text-decoration: none; transition: background 0.18s;
}
.accion:hover { background: var(--tinta-3); }
.accion--icono { width: 40px; padding: 0; justify-content: center; }
.accion--principal { background: var(--luna); color: var(--tinta); border-color: var(--luna); font-weight: 500; }
.accion--principal:hover { background: var(--realce); border-color: var(--realce); }
.accion .icono { width: 18px; height: 18px; }

.seccion { margin-top: 30px; }
.seccion :is(h2, h3) { margin: 0 0 10px; font: 400 20px/1.2 var(--serif); color: var(--luna); }
.fuentes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fuentes a {
  display: block; padding: 9px 12px; margin: 0 -12px; border-radius: 10px;
  color: var(--luna); text-decoration: none; font-size: 14px;
}
.fuentes a:hover { background: var(--tinta-2); }
.fuentes small { display: block; color: var(--luna-3); font-size: 12.5px; }
.cercanos { list-style: none; margin: 0 -12px; padding: 0; }
.cercanos .item { padding: 10px 12px; }
.cercanos .item__titulo { font-size: 17px; }

.error { margin-top: 24px; color: var(--luna-2); }

/* ---------- Contribuir ---------- */
.ficha__corregir { margin: 18px 0 0; }
.ficha__corregir .boton-texto { color: var(--luna-2); }
.contribuir__intro { margin: 12px 0 0; color: var(--luna-2); font-size: 14.5px; line-height: 1.6; max-width: 62ch; }
.contribuir__intro strong { color: var(--luna); font-weight: 500; }

.formulario { display: grid; gap: 20px; margin-top: 24px; position: relative; }
.formulario__campo { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.formulario__campo > span, .formulario legend { padding: 0; font-size: 13.5px; font-weight: 500; color: var(--luna-2); }
.formulario em { font-style: normal; font-weight: 400; color: var(--luna-3); }
.formulario input[type="text"], .formulario input[type="email"], .formulario textarea {
  width: 100%; padding: 10px 12px; background: var(--hundido); border: 1px solid var(--linea-2);
  border-radius: var(--r-control); color: var(--luna); font-size: 15px; line-height: 1.5;
  transition: border-color 0.18s;
}
.formulario textarea { resize: vertical; min-height: 64px; }
.formulario :is(input, textarea)::placeholder { color: var(--luna-3); }
.formulario :is(input, textarea):focus { outline: none; border-color: var(--luna-3); }
.formulario :is(input, textarea):focus-visible { outline: 2px solid var(--luna); outline-offset: 1px; }
.formulario small { font-size: 12.5px; color: var(--luna-3); }
.formulario [aria-invalid="true"] { border-color: var(--error); }
.formulario small.formulario__fallo { color: var(--error); }
.formulario__donde { gap: 10px; }
.formulario__botones { display: flex; flex-wrap: wrap; gap: 8px; }
.formulario__botones .boton-texto[aria-busy="true"] { opacity: 0.6; }
.punto {
  margin: 0; padding: 10px 12px; border: 1px dashed var(--linea-2); border-radius: var(--r-control);
  font-size: 13.5px; color: var(--luna-2);
}
.punto[data-hecho] { border-style: solid; border-color: var(--luna-3); color: var(--luna); }
.punto__coords { font-variant-numeric: tabular-nums; }
.formulario__donde[data-invalido] .punto { border-color: var(--error); }
.formulario__casilla { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; line-height: 1.5; color: var(--luna-2); cursor: pointer; flex-wrap: wrap; }
.formulario__casilla input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--luna); }
.formulario__casilla span { flex: 1 1 0; min-width: 0; }
.formulario__casilla .formulario__fallo { flex-basis: 100%; }
.formulario__error { margin: 0; color: var(--error); font-size: 14px; }
.formulario__enviar { justify-self: start; height: 44px; padding: 0 20px; cursor: pointer; }
.formulario__enviar:disabled { opacity: 0.6; cursor: progress; }
/* Campo trampa para bots: fuera de la vista y del orden de tabulación. */
.trampa { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.chincheta { width: 28px; height: 38px; cursor: grab; filter: drop-shadow(0 4px 8px var(--sombra)); }
.chincheta:active { cursor: grabbing; }
.chincheta svg { width: 100%; height: 100%; display: block; }
.chincheta path { fill: var(--luna); stroke: var(--tinta); stroke-width: 1.5; }
.chincheta circle { fill: var(--tinta); }
body[data-contribuir] .maplibregl-canvas-container.maplibregl-interactive { cursor: crosshair; }

/* ---------- Avisos ---------- */
.aviso {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; z-index: 5;
  background: var(--luna); color: var(--tinta); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px var(--sombra); transition: opacity 0.25s, transform 0.25s var(--sale); pointer-events: none;
}
.aviso[data-visible] { opacity: 1; transform: translate(-50%, 0); }

.sin-js { position: fixed; inset: auto 0 0; padding: 16px; text-align: center; background: var(--tinta-2); margin: 0; }
.sin-js p { margin: 0 auto 6px; max-width: 640px; }

/* ---------- Móvil: hoja inferior ---------- */
@media (max-width: 720px) {
  :root { --hueco: 0px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: var(--alto-hoja, 46dvh); border-radius: var(--r-panel) var(--r-panel) 0 0;
    border-bottom: 0; transition: height 0.32s var(--sale);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 40px var(--sombra), 0 0 0 1px rgba(0, 0, 0, 0.12);
  }
  body[data-hoja="baja"] { --alto-hoja: calc(150px + env(safe-area-inset-bottom)); }
  body[data-hoja="media"] { --alto-hoja: 55dvh; }
  body[data-hoja="alta"] { --alto-hoja: calc(100dvh - 64px - env(safe-area-inset-top)); }
  body[data-arrastrando] .panel { transition: none; }
  .panel__asa {
    display: block; position: absolute; top: 0; left: 0; right: 0; height: 30px; background: none; border: 0; z-index: 1; touch-action: none;
  }
  .panel__asa::before { content: ""; position: absolute; top: 10px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 5px; background: var(--luna-3); opacity: 0.6; }

  /* Cabecera compacta: marca y modo día/noche en una línea, a la altura del asa. */
  .cabecera { align-items: center; padding: 26px 14px 10px 18px; }
  .marca { font-size: 25px; }
  .lema { display: none; }
  .cabecera .boton-icono { width: 36px; height: 36px; }

  .buscador { margin: 0 10px 8px; padding: 10px; gap: 10px; border-radius: 16px; }
  .campo { height: 46px; }
  .filtros { max-height: 34dvh; }
  .chip { height: 34px; }
  .boton-tipos { height: 42px; padding: 0 11px 0 9px; }
  .selector select { font-size: 16px; height: 42px; }    /* 16 px: iOS no hace zoom al enfocar */
  .boton-icono { width: 42px; height: 42px; }
  .estado { flex-wrap: wrap; row-gap: 4px; }
  body[data-hoja="baja"] .filtros, body[data-hoja="baja"] .barra, body[data-hoja="baja"] .estado { display: none; }

  .lista { padding: 0 6px 16px; }
  .item { padding: 12px 10px; }
  .item__titulo { font-size: 18px; }

  .ficha { padding: 0 18px 28px; border-top: 0; }
  body:is([data-ficha], [data-contribuir]) .cabecera { display: none; }
  body:is([data-ficha], [data-contribuir]) .volver { margin-top: 30px; }
  .cabecera__acciones { gap: 6px; }
  .boton-contribuir { height: 36px; padding: 0 12px 0 8px; font-size: 13.5px; }
  .formulario :is(input, textarea) { font-size: 16px; }   /* 16 px: iOS no hace zoom al enfocar */
  .formulario__enviar { height: 48px; justify-self: stretch; justify-content: center; }
  .ficha__titulo { font-size: 28px; }
  .ficha__historia { font-size: 19px; }
  .acciones .accion { height: 44px; }

  /* Mapa: sin botones de zoom (se pellizca) y con los controles fuera de la hoja y de la muesca. */
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: none; }
  .maplibregl-ctrl-bottom-right { bottom: var(--alto-hoja, 46dvh); transition: bottom 0.32s var(--sale); }
  body[data-hoja="alta"] .maplibregl-ctrl-bottom-right { display: none; }
  .maplibregl-ctrl-top-right { top: env(safe-area-inset-top); }
  .regiones { margin: 10px 10px 0 0; }
  .regiones button { font-size: 12.5px; padding: 7px 10px; }
  .aviso { bottom: calc(var(--alto-hoja, 46dvh) + 16px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
