/* Familia «mapas_tema» del diseño nuevo: páginas de aterrizaje de radar, avisos, terremotos,
   incendios, playas, nieve, cumbres, embalses, sequía, aire y polen (templates/diseno/_tema_base.php).
   Solo piezas propias (prefijo tm-); el resto es sistema.css y diseno-lugar.css. */

.tm { padding-block: var(--e-4) var(--e-7); }
.tm .lc__sub { max-width: 70ch; }

/* Punto de color de leyendas y filas */
.tm-pt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / .08); }
.l-cifra__v .tm-pt { width: 12px; height: 12px; margin-right: 8px; vertical-align: .1em; }
.l-cifra__v a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-2); }
.l-cifra__v a:hover { border-color: var(--ink); }
.tm-cifras .nota { overflow-wrap: anywhere; }

/* Fuente y licencias al pie */
.tm-fuente { display: flex; gap: 8px; align-items: flex-start; max-width: 90ch; }
.tm-fuente .ico { margin-top: 2px; }
.tm-fuente a, .tm .nota a { color: inherit; }

/* Filtros (chips) y buscadores */
.tm-filtros { gap: 6px; }
.tm-filtros .chip { cursor: pointer; }
.tm-filtros .chip[aria-pressed="true"] .tm-pt { box-shadow: 0 0 0 1.5px var(--on-ink); }
.tm-filtro-txt { max-width: 460px; background: var(--surface); border-color: var(--line-2); }
.tm-busca { align-items: stretch; }
.tm-busca__in { flex: 1 1 260px; max-width: 460px; background: var(--surface); border-color: var(--line-2); }
.tm-sug { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-2); box-shadow: var(--s-2); max-height: 260px; overflow-y: auto; }
.tm-sug li { padding: 8px 10px; border-radius: var(--r-1); cursor: pointer; color: var(--ink); }
.tm-sug li span { color: var(--muted); font-size: var(--t-1); }
.tm-sug li[aria-selected="true"], .tm-sug li:hover { background: var(--sunk); }

/* Tablas: la primera columna y las de texto, a la izquierda y con salto de línea */
.tm-tabla th.tm-l, .tm-tabla td.tm-l { text-align: left; white-space: normal; min-width: 9em; }
.tm-tabla tbody th.tm-l { min-width: 12em; max-width: 26em; }
.tm-tabla a { color: var(--ink); text-underline-offset: 2px; }
.tm-tabla tbody th a { font-weight: 600; }
.tm-tabla tr[hidden] { display: none; }
.tm-tabla .tm-sel > * { background: var(--senal-suave); }
.tm-tabla td.tm-dom { font-weight: 700; color: var(--ink); background: var(--raised); }
.tm-barra-c { min-width: 120px; width: 30%; }
.tm-mag { display: inline-flex; align-items: center; gap: 6px; }
.tm-mag::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.tm-rec, .tm-activo { height: 20px; padding: 0 6px; font-size: 11px; color: var(--senal-tinta); background: var(--senal-suave); }
.tm-vertodo { align-self: flex-start; }

/* Barra 0-100 con la marca de lo normal */
.tm-barra { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--sunk); min-width: 60px; }
.tm-barra i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c, var(--ink)); }
.tm-barra b { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }
.tm-marca { display: inline-block; width: 2px; height: 12px; background: var(--ink); margin-right: 6px; vertical-align: -2px; }

/* Leyendas en línea */
.tm-ley { gap: 4px 14px; }
.tm-ley > span { display: inline-flex; align-items: center; }

/* Plegables */
.tm-plegable { border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
.tm-plegable > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: var(--e-3); }
.tm-plegable > summary::-webkit-details-marker, .tm-grupo > summary::-webkit-details-marker { display: none; }
.tm-plegable > summary::after, .tm-grupo > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.tm-plegable[open] > summary::after, .tm-grupo[open] > summary::after { content: "−"; }
.tm-plegable > :not(summary) { margin: 0 16px 14px; }
.tm-plegable > .tabla-caja { margin: 0 0 0; border-width: 1px 0 0; border-radius: 0 0 var(--r-3) var(--r-3); }

/* Grupos plegables (playas por provincia, cuencas) */
.tm-grupo { border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); }
.tm-grupo > summary { cursor: pointer; list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; }
.tm-grupo > summary::after { margin-left: auto; }
.tm-grupo[open] > summary { border-bottom: 1px solid var(--line); }
.tm-grupo__in { padding: 12px 14px 14px; }
.tm-grupo > .tm-lista { padding: 10px 14px 14px; }
.tm-grupo-t .tit-3 { font-size: var(--t-3); }

/* Lista de enlaces en columnas (playas de una provincia, todos los incendios) */
.tm-lista { list-style: none; margin: 0; padding: 0; columns: 3 220px; column-gap: var(--e-5); }
.tm-lista li { break-inside: avoid; padding: 4px 0; line-height: 1.35; }
.tm-lista a { color: var(--ink); font-weight: 500; }
.tm-plegable > .tm-lista { margin: 0 16px 16px; }

/* Cuencas: cabecera con nombre, cifra, barra y detalle */
.tm-cuenca > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 6px 12px; align-items: center; }
.tm-cuenca > summary::after { grid-column: 3; grid-row: 1; margin: 0; }
.tm-cuenca__t { display: grid; gap: 2px; min-width: 0; }
.tm-cuenca__p { grid-column: 2; grid-row: 1; white-space: nowrap; font-size: var(--t-3); }
.tm-cuenca > summary .tm-barra { grid-column: 1 / -1; }
.tm-cuenca__s { grid-column: 1 / -1; }
.tm-heat { padding: 4px 0; }
.tm-heat table { border-collapse: separate; border-spacing: 1px; font-size: 10px; }
.tm-heat td { width: 6px; height: 12px; padding: 0; }
.tm-heat td.tm-heat__a { width: auto; padding-right: 6px; color: var(--muted); text-align: right; position: sticky; left: 0; background: var(--surface); }

/* Destacados de embalses y clasificaciones */
.tm-dest { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 6px var(--e-4); }
.tm-dest li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tm-dest .nota { flex: 1 0 100%; }
.tm-dest a { color: var(--ink); font-weight: 600; }
.tm-rank { margin: 0; padding: 0 0 0 1.4em; display: grid; gap: 6px; }
.tm-rank li { padding-left: 2px; }
.tm-rank li::marker { color: var(--muted); font-size: var(--t-1); }
.tm-rank a { color: var(--ink); font-weight: 500; }
.tm-rank b { float: right; margin-left: 8px; }

/* Años (chips de enlace) */
.tm-anios { gap: 6px; }

/* Temporada de incendios frente a la media */
.tm-temp .tm-barra { height: 14px; border-radius: 7px; }
.tm-temp .tm-barra i { border-radius: 7px; }

/* Riesgo de incendio, 7 días */
.tm-dias7 { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.tm-dias7 li { display: grid; gap: 2px; justify-items: center; padding: 8px 2px; border-radius: var(--r-2); background: var(--c); color: #fff; text-align: center; min-width: 0; }
.tm-dias7 li .nota { color: inherit; opacity: .9; text-transform: capitalize; }
.tm-dias7 li b { font-size: var(--t-3); font-variant-numeric: tabular-nums; }
.tm-dias7 li small { font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.tm-dias7 li.tm-dias7--sin { background: var(--sunk); color: var(--muted); }
@media (max-width: 520px) { .tm-dias7 li small { display: none; } }

/* ¿Lloverá en tu zona? */
.tm-nc__ver { font-weight: 600; font-size: var(--t-3); }
.tm-nc__ver.seco { color: var(--ok); }
.tm-nc__barras { display: flex; align-items: flex-end; gap: 2px; height: 80px; border-bottom: 1px solid var(--line-2); }
.tm-nc__barras > div { flex: 1; min-width: 0; border-radius: 2px 2px 0 0; }
.tm-nc__barras .tm-nc__ahora { flex: 0 0 2px; align-self: stretch; background: var(--senal); opacity: .7; }
.tm-nc__ejes { display: flex; justify-content: space-between; gap: 4px; font-variant-numeric: tabular-nums; overflow: hidden; }

/* Canarias: el radar de AEMET en bucle */
.tm-can { max-width: 520px; }
.tm-can__img { width: 100%; height: auto; background: #000; border-radius: var(--r-2); }
.tm-can__pista { flex: 1; min-width: 0; accent-color: var(--ink); }

/* Avisos */
.tm .seg[role=tablist] { flex-wrap: wrap; align-self: flex-start; }
.tm-av__dias .seg__op .nota { font-size: 11px; }
.tm-av__g .tit-4 { margin: 0; }
.tm-av__tl { display: grid; gap: 6px; margin-top: 4px; }
.tm-av__fila { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.tm-av__ft { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: var(--t-1); }
.tm-av__ft b { font-weight: 600; }
.tm-av__barra { position: relative; height: 10px; border-radius: 5px; background: var(--sunk); overflow: hidden; }
.tm-av__barra i { position: absolute; top: 0; bottom: 0; background: var(--c); border-radius: 5px; }
.tm-av__barra em { position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--senal); }
.tm-av__eje { display: flex; justify-content: space-between; font-size: 11px; font-variant-numeric: tabular-nums; }
.tm-ahora { display: inline-block; width: 2px; height: 12px; background: var(--senal); margin-right: 6px; vertical-align: -2px; }
.tm-av__zonas summary { cursor: pointer; }
@media (min-width: 700px) { .tm-av__fila { grid-template-columns: minmax(150px, 30%) minmax(0, 1fr); align-items: center; gap: 10px; } }
.tm-me__res { padding: 12px 14px; border-radius: var(--r-2); border: 1px solid var(--line); background: var(--surface); }
.tm-me__res.is-amarillo { border-left: 6px solid var(--av-amarillo); }
.tm-me__res.is-naranja { border-left: 6px solid var(--av-naranja); }
.tm-me__res.is-rojo { border-left: 6px solid var(--av-rojo); }
.tm-me__res.is-no { border-left: 6px solid var(--ok); }
.tm-me__res a { color: var(--ink); font-weight: 600; }
.tm-com { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tm-com .chip { height: 32px; }
.tm-com .tm-com--si { border-color: var(--av-naranja); }
.tm-com b { font-variant-numeric: tabular-nums; }

/* Calidad del aire: escala */
.tm-escala { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; border-radius: var(--r-2); overflow: hidden; }
.tm-escala li { display: grid; gap: 2px; padding: 8px 6px; background: var(--c); color: #fff; text-align: center; min-width: 0; }
.tm-escala li b { font-variant-numeric: tabular-nums; }
.tm-escala li span { font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; text-shadow: 0 0 2px rgb(0 0 0 / .35); }
@media (max-width: 520px) { .tm-escala { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tm-recom { margin: 0; padding: 0 16px 14px 32px; display: grid; gap: 6px; color: var(--ink-2); }
.tm-recom li::marker { color: var(--muted); }
.l-faq details > .tm-recom, .l-faq details > p + .tm-recom { margin-top: 0; }

/* Polen: previsión y tipos */
.tm-prev { list-style: none; margin: 0; padding: 0; }
.tm-prev .chip { height: auto; min-height: 28px; white-space: normal; gap: 4px; }
.tm-tipos { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: var(--e-2); }
.tm-tipos li { display: grid; gap: 2px; align-content: start; padding: 10px 12px; }
.tm-tipos li .chip { justify-self: start; margin-top: 4px; height: 22px; }
.tm-tipos--act { border-color: var(--ok); }

/* Leyenda del gráfico de sequía */
.tm-k { display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--senal); }
.tm-k--normal { border-top: 2px dashed var(--ink); }
.tm-k--banda { height: 10px; border: 0; background: var(--line-2); opacity: .7; }

@media print { .tm-filtros, .tm-filtro-txt, .tm-busca, .vm { display: none !important; } }

/* Tablas por grupo (estaciones de esquí, cumbres): mismas columnas en todas */
.tm-grupo-t .tm-tabla { table-layout: fixed; min-width: 720px; }
.tm-grupo-t .tm-tabla thead th:first-child { width: 28%; }
.tm-grupo-t .tm-tabla tbody th.tm-l { min-width: 0; }
.tm .busca input:focus-visible { outline: none; }

/* Enlace de una fila al visor con su elemento ya marcado (TemaDiseno::enMapa) */
.tm-enmapa { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; vertical-align: -2px; color: var(--muted); text-decoration: none; font-weight: 500; }
.tm-enmapa:hover, .tm-enmapa:focus-visible { color: var(--senal-tinta); }
.tm-enmapa span { font-size: var(--t-1); text-decoration: underline; text-underline-offset: 2px; }
.tm-tabla .tm-enmapa { color: var(--muted); }

/* En móvil, las tablas anchas (radar, terremotos, polen) pasan a tarjetas: nada cortado ni desplazado */
@media (max-width: 560px) {
  .tm-tabla--tarj, .tm-tabla--tarj tbody { display: block; width: 100%; min-width: 0 !important; table-layout: auto; }
  .tm-tabla--tarj td.tm-barra-c { flex: 1 0 100%; width: auto; }
  .tm-tabla--tarj td[colspan] { flex: 1 0 100%; }
  .tm-tabla--tarj thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tm-tabla--tarj tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tm-tabla--tarj tr:last-child { border-bottom: 0; }
  .tm-tabla--tarj tr[hidden] { display: none; }
  .tabla.tm-tabla--tarj tr > th, .tabla.tm-tabla--tarj tr > td { display: block; position: static; padding: 0; border: 0; min-width: 0; max-width: none; text-align: left; white-space: normal; background: none; }
  .tm-tabla--tarj tbody th.tm-l, .tm-tabla--tarj td.tm-ancho { flex: 1 0 100%; min-width: 0; }
  .tm-tabla--tarj td[data-c]::before { content: attr(data-c); margin-right: 5px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .tm-tabla--tarj td.tm-dom { padding: 0 4px; border-radius: var(--r-1); background: var(--raised); }
  .tm-tabla--tarj tbody tr:hover > * { background: none; }
}
