/* heat.css — Pagina "Rischio calore" San Marino (heat.html)
   Stili specifici; header/nav/tema arrivano da app.css/home.css. */

.heat-main { max-width: 1080px; margin: 0 auto; padding: 16px 16px 64px; }

.heat-intro h1 { font-size: clamp(1.4rem, 4vw, 2rem); margin: 12px 0 4px; }
.heat-intro p { margin: 0 0 4px; opacity: .85; line-height: 1.5; }
.heat-updated { font-size: .85rem; opacity: .7; }
.heat-badge {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 8px; border-radius: 999px;
  background: #e8531e; color: #fff; vertical-align: middle; margin-left: 6px;
}

/* Selettore modalità (osservato / previsione) */
.heat-controls { margin: 18px 0 10px; }
.heat-mode {
  display: inline-flex; gap: 2px; margin-bottom: 12px; padding: 3px;
  border: 1px solid var(--heat-border, #d6dbe4); border-radius: 999px;
  background: var(--heat-card, #fff);
}
.heat-mode-btn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  border-radius: 999px; padding: 6px 16px; font-size: .88rem; font-weight: 700;
  transition: background .15s, color .15s;
}
.heat-mode-btn[aria-pressed="true"] { background: #e8531e; color: #fff; }
.heat-mode-btn.loading { opacity: .6; cursor: progress; }
.heat-mode-btn:disabled { cursor: progress; }

/* Selettore indice */
.heat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.heat-chip {
  border: 1px solid var(--heat-border, #d6dbe4); background: var(--heat-card, #fff);
  color: inherit; border-radius: 999px; padding: 7px 14px; font-size: .9rem;
  cursor: pointer; transition: all .15s; font-weight: 600;
}
.heat-chip[aria-pressed="true"] { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.heat-scale-toggle { display: none; margin-top: 10px; gap: 6px; align-items: center; flex-wrap: wrap; }
.heat-scale-toggle.show { display: flex; }
.heat-scale-toggle .lbl { font-size: .82rem; opacity: .7; margin-right: 2px; }
.heat-scale-btn {
  border: 1px solid var(--heat-border, #d6dbe4); background: var(--heat-card, #fff);
  color: inherit; border-radius: 8px; padding: 5px 11px; font-size: .82rem; cursor: pointer; font-weight: 600;
}
.heat-scale-btn[aria-pressed="true"] { background: #444; border-color: #444; color: #fff; }
.heat-scale-note { font-size: .8rem; opacity: .65; font-style: italic; }

/* Timeline della previsione */
.heat-timeline {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 0 12px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--heat-border, #d6dbe4); background: var(--heat-card, #fff);
}
.heat-timeline[hidden] { display: none; }
.heat-timeline__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.heat-agg { display: flex; flex-wrap: wrap; gap: 6px; }
.heat-agg-btn {
  border: 1px solid var(--heat-border, #d6dbe4); background: transparent; color: inherit;
  border-radius: 8px; padding: 5px 11px; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.heat-agg-btn[aria-pressed="true"] { background: #444; border-color: #444; color: #fff; }
.heat-play {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--heat-border, #d6dbe4); background: transparent; color: inherit;
  font-size: .9rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.heat-play:hover { background: rgba(232, 83, 30, .12); border-color: #e8531e; }
.heat-step { flex: 1 1 240px; min-width: 180px; accent-color: #e8531e; }
.heat-step-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 150px; }
.heat-step-info .when { font-weight: 700; font-size: .92rem; text-transform: capitalize; }
.heat-step-info .src { font-size: .74rem; opacity: .65; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .heat-step { flex-basis: 100%; order: 3; }
  .heat-step-info { min-width: 0; }
}

/* Mappa */
.heat-map-wrap { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 14px rgba(0,0,0,.12); }
#heat-map { width: 100%; height: min(62vh, 540px); background: #0d1422; }
.heat-legend {
  display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 10px 2px 0;
  font-size: .78rem; align-items: center;
}
.heat-legend .li { display: inline-flex; align-items: center; gap: 5px; }
.heat-legend .sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.heat-legend .name { width: 100%; font-weight: 700; opacity: .8; margin-bottom: 2px; }

/* Ideogrammi dello stress termico (sprite in heat-icons.js) */
.heat-ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; vertical-align: -.22em; fill: currentColor; }
.heat-ico--lg { width: 1.7em; height: 1.7em; vertical-align: -.4em; }
.heat-legend .li .heat-ico { opacity: .85; }

/* Scala illustrata dell'indice attivo */
.heat-scale-card { margin: 22px 0 4px; }
.heat-scale-card[hidden] { display: none; }
.heat-scale-card h2 { font-size: 1.05rem; margin: 0 0 2px; }
.heat-scale-card .hint { font-size: .84rem; opacity: .7; margin: 0 0 10px; line-height: 1.45; }
.heat-scale-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.heat-scale-list li {
  display: grid; grid-template-columns: 46px 116px 1fr; align-items: center; gap: 12px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  border: 1px solid var(--heat-border, #e6e9ef); background: var(--heat-card, #fff);
}
.heat-scale-list .ic {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.heat-scale-list .rg { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.heat-scale-list .lb { font-size: .92rem; opacity: .9; }
/* Omino dell'attività sostenibile (solo WBGT) */
.heat-scale-list li.has-act { grid-template-columns: 46px 116px 1fr 34px; }
.heat-scale-list .act { display: inline-flex; align-items: center; justify-content: center; opacity: .55; }
@media (max-width: 560px) {
  .heat-scale-list li,
  .heat-scale-list li.has-act { grid-template-columns: 40px 1fr 30px; row-gap: 2px; padding: 8px 12px 8px 6px; border-radius: 14px; }
  .heat-scale-list .ic { width: 34px; height: 34px; }
  .heat-scale-list .rg { grid-column: 2; }
  .heat-scale-list .lb { grid-column: 2; }
  .heat-scale-list .act { grid-column: 3; grid-row: 1 / span 2; }
}

/* Pannello divulgativo: cosa fa il caldo al corpo */
.heat-body { margin: 30px 0 8px; }
.heat-body h2 { font-size: 1.15rem; margin: 0 0 6px; }
.heat-body__lead { margin: 0 0 14px; opacity: .85; line-height: 1.55; }
.heat-body__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.heat-body__list li {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--heat-border, #e6e9ef); background: var(--heat-card, #fff);
}
.heat-body__list .ic {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(232, 83, 30, .14); color: #e8531e;
}
.heat-body__list .ic .heat-ico { width: 26px; height: 26px; }
.heat-body__list b { display: block; font-size: .95rem; margin-bottom: 1px; }
.heat-body__list span { font-size: .88rem; opacity: .82; line-height: 1.5; }
.heat-body__src { font-size: .78rem; opacity: .6; margin: 12px 0 0; line-height: 1.5; }
@media (min-width: 760px) { .heat-body__list { grid-template-columns: 1fr 1fr; } }

/* Marker Castello sulla mappa */
.heat-marker {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  background: rgba(20,26,38,.82); color: #fff; border-radius: 999px;
  padding: 3px 8px 3px 4px; font-size: .74rem; font-weight: 700;
  box-shadow: 0 1px 5px rgba(0,0,0,.4); white-space: nowrap; transform: translate(-50%, -50%);
}
.heat-marker .dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #fff; flex: 0 0 auto; }
.heat-marker.sel { outline: 2px solid #fff; }

/* Pannello dettaglio (area + fasce) */
.heat-detail { margin-top: 22px; }
.heat-detail__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.heat-area-select {
  border: 1px solid var(--heat-border, #d6dbe4); background: var(--heat-card, #fff);
  color: inherit; border-radius: 8px; padding: 7px 10px; font-size: .92rem; font-weight: 600;
}
.heat-geo-btn {
  border: 1px solid var(--heat-border, #d6dbe4); background: var(--heat-card, #fff);
  color: inherit; border-radius: 8px; padding: 7px 12px; font-size: .88rem; cursor: pointer;
}
.heat-overall {
  display: inline-flex; align-items: center; gap: 9px; font-weight: 700;
  padding: 6px 14px 6px 10px; border-radius: 999px; color: #10151f;
}
.heat-overall .lb { line-height: 1.2; }
.heat-overall .v { font-variant-numeric: tabular-nums; opacity: .85; font-weight: 600; }

.heat-bands { width: 100%; border-collapse: collapse; margin-top: 8px; }
.heat-bands th, .heat-bands td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--heat-border, #e6e9ef); }
.heat-bands th { font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; opacity: .6; }
.heat-bands .cls { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.heat-bands .sw { width: 15px; height: 15px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); flex: 0 0 auto; }
.heat-bands .val { font-variant-numeric: tabular-nums; opacity: .8; }
.heat-bands .muted { opacity: .5; }

/* Gate login */
.heat-gate {
  display: flex; align-items: center; gap: 14px; padding: 18px; margin-top: 12px;
  border: 1px dashed var(--heat-border, #cdd3dd); border-radius: 12px; background: rgba(26,115,232,.05);
}
.heat-gate .ic { font-size: 1.6rem; }
.heat-gate .bd { flex: 1; }
.heat-gate .bd b { display: block; }
.heat-gate .bd span { font-size: .88rem; opacity: .8; }
.heat-gate .btn {
  border: 0; background: #1a73e8; color: #fff; border-radius: 999px;
  padding: 9px 18px; font-weight: 700; cursor: pointer; white-space: nowrap;
}

.heat-note { margin-top: 26px; font-size: .82rem; opacity: .68; line-height: 1.55; }
.heat-note b { opacity: .9; }

@media (prefers-color-scheme: dark) {
  :root { --heat-card: #1a2130; --heat-border: #2b3444; }
}
:root[data-theme="light"] { --heat-card: #fff; --heat-border: #d6dbe4; }
:root[data-theme="dark"]  { --heat-card: #1a2130; --heat-border: #2b3444; }
