/* ═══════════════════════════════════════════════════════════════════
   METEO PORTALI — Stile principale
   Responsive, mobile-first, ottimizzato per AdSense
═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font: -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --sky-day:   linear-gradient(160deg, #1a6fc4 0%, #4ba3e3 40%, #87ceeb 100%);
  --sky-cloud: linear-gradient(160deg, #5b6e7a 0%, #8fa8b8 40%, #b8cdd8 100%);
  --sky-rain:  linear-gradient(160deg, #3a4a58 0%, #5c7080 40%, #7a94a0 100%);
  --sky-night: linear-gradient(160deg, #0a0e2e 0%, #1a2050 40%, #2a3570 100%);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: #1a1a1a;
  min-height: 100vh;
}

/* ── Sky backgrounds ──────────────────────────────────────────────── */
body.sky-day   { background: var(--sky-day); }
body.sky-cloud { background: var(--sky-cloud); }
body.sky-rain  { background: var(--sky-rain); }
body.sky-night { background: var(--sky-night); }

.container { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ── Header ───────────────────────────────────────────────────────── */
.site-header {
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.25);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-icon { font-size: 24px; }
.logo-text { font-size: 18px; color: #fff; }
.logo-text strong { font-weight: 700; }
.header-nav { display: flex; gap: 20px; }
.header-nav a {
  color: rgba(255,255,255,.9); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: color .15s;
}
.header-nav a:hover { color: #fff; }

/* ── Hero ─────────────────────────────────────────────────────────── */
.hero { padding: 48px 0 40px; }
.hero-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 20px; }

h1 { font-size: clamp(28px, 5vw, 42px); color: #fff; font-weight: 700; }
.region-tag {
  font-size: 16px; font-weight: 400;
  background: rgba(255,255,255,.2); color: #fff;
  padding: 3px 10px; border-radius: 20px; margin-left: 8px;
  vertical-align: middle;
}
.hero-date { color: rgba(255,255,255,.8); font-size: 14px; margin-top: 4px; }

/* ── Current weather card ─────────────────────────────────────────── */
.current-weather {
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: #fff;
  min-width: 300px;
  text-align: center;
}
.current-main { display: flex; align-items: center; justify-content: center; gap: 12px; }
.current-icon { font-size: 56px; line-height: 1; }
.current-temp { font-size: 72px; font-weight: 300; line-height: 1; }
.current-temp span { font-size: 32px; vertical-align: super; }
.current-desc { font-size: 20px; font-weight: 500; margin-top: 8px; }
.current-feels { font-size: 14px; opacity: .8; margin-top: 2px; }

.current-details {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
  margin-top: 20px;
}
.detail-chip {
  background: rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.chip-icon { font-size: 16px; }
.chip-val  { font-size: 16px; font-weight: 600; }
.chip-lbl  { font-size: 11px; opacity: .8; }

.update-time { font-size: 12px; opacity: .6; margin-top: 16px; }

/* ── Error ────────────────────────────────────────────────────────── */
.error-box {
  background: rgba(255,80,80,.25);
  border: 1px solid rgba(255,80,80,.4);
  border-radius: var(--radius-sm);
  padding: 16px 20px; color: #fff;
}

/* ── AdSense wrapper ──────────────────────────────────────────────── */
.ad-wrap { margin: 24px auto; }

/* ── Sections ─────────────────────────────────────────────────────── */
.forecast-section,
.province-section,
.info-section {
  background: #f4f6f8;
  padding: 40px 0;
}
.forecast-section { background: transparent; padding: 32px 0 40px; }
.province-section { background: #f4f6f8; }
.info-section     { background: #fff; }

.section-title {
  font-size: 22px; font-weight: 700; color: #1a1a1a;
  margin-bottom: 24px;
}
.section-eyebrow {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: rgba(255,255,255,.4); margin-bottom: 8px;
}

/* ── Forecast grid ────────────────────────────────────────────────── */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.forecast-card {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  color: #fff;
  transition: transform .15s, box-shadow .15s;
}
.forecast-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,.15); }
.forecast-card.today {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.35);
}
.fc-day  { font-size: 13px; font-weight: 700; }
.fc-date { font-size: 11px; opacity: .6; margin-bottom: 8px; }
.fc-icon { font-size: 30px; margin: 4px 0; }
.fc-desc { font-size: 11px; margin-bottom: 6px; opacity: .8; }
.fc-temps { font-size: 15px; font-weight: 600; display: flex; justify-content: center; gap: 6px; }
.fc-max { color: #ffb3b3; }
.fc-min { color: #b3d8ff; }
.fc-rain, .fc-wind { font-size: 11px; margin-top: 4px; opacity: .75; }

/* ── Province ─────────────────────────────────────────────────────── */
.province-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.province-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: box-shadow .15s;
}
.province-card:hover { box-shadow: var(--shadow); }
.prov-name { font-size: 15px; font-weight: 600; color: #1a6fc4; }
.prov-info { font-size: 12px; color: #888; margin-top: 4px; }

/* ── Province Open-Meteo ─────────────────────────────────────────── */
.province-grid-om {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.prov-card-om {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  text-decoration: none;
  color: #fff;
  transition: transform .15s, background .15s;
  display: block;
}
.prov-card-om:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.18);
}
.prov-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.prov-icon { font-size: 24px; }
.prov-temp { font-size: 22px; font-weight: 600; }
.prov-name-om { font-size: 14px; font-weight: 700; }
.prov-detail { font-size: 11px; color: rgba(255,255,255,.55); margin-top: 2px; }

/* ── Info / SEO section ───────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 32px;
  align-items: start;
}
.info-text { line-height: 1.75; color: #444; font-size: 15px; }
.curiosita-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fffbe6;
  border-left: 3px solid #f5a623;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 14px; color: #555;
}
.curiosita-icon { font-size: 18px; flex-shrink: 0; }
.info-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 16px;
}
.info-card h3 { font-size: 14px; font-weight: 700; color: #1a1a1a; margin-bottom: 10px; }
.info-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.info-table tr { border-bottom: 1px solid #eee; }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 6px 2px; }
.info-table td:first-child { color: #888; width: 50%; }
.info-table td:last-child  { font-weight: 500; }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  background: #1a1a1a;
  color: rgba(255,255,255,.6);
  padding: 28px 0;
}
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.footer-logo  { color: #fff; font-size: 16px; font-weight: 600; }
.footer-copy  { font-size: 13px; }
.footer-nav   { display: flex; gap: 16px; margin-top: 4px; }
.footer-nav a { color: rgba(255,255,255,.5); text-decoration: none; font-size: 13px; }
.footer-nav a:hover { color: #fff; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .header-nav { display: none; }
  .current-temp { font-size: 56px; }
  .current-icon { font-size: 44px; }
  .info-grid { grid-template-columns: 1fr; }
  .forecast-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════
   STAZIONI DAVIS + GRAFICI STORICI
═══════════════════════════════════════════════════════════════════ */

/* ── Layout sezione ──────────────────────────────────────────────── */
.stations-section { padding: 48px 0; }
.stations-section .section-title { color: #fff; }

.stations-header { margin-bottom: 28px; }
.stations-subtitle {
  font-size: 14px; color: rgba(255,255,255,.5); margin-top: 6px; max-width: 520px;
}
.stations-notice {
  background: rgba(255,165,0,.1); border: 1px solid rgba(255,165,0,.3);
  border-radius: 12px; padding: 16px 20px; color: rgba(255,255,255,.7); font-size: 14px;
}
.stations-notice code { background: rgba(255,255,255,.1); padding: 2px 6px; border-radius: 4px; }
.stations-footer {
  margin-top: 20px; font-size: 12px; color: rgba(255,255,255,.3);
}

/* ── Banner AQI ──────────────────────────────────────────────────── */
.aqi-banner {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid; border-radius: 14px; padding: 16px 20px; margin-bottom: 24px;
}
.aqi-banner-emoji { font-size: 36px; flex-shrink: 0; }
.aqi-banner-label { font-size: 12px; color: rgba(255,255,255,.5); margin-bottom: 2px; }
.aqi-banner-value { font-size: 18px; font-weight: 700; }
.aqi-banner-detail { font-size: 12px; color: rgba(255,255,255,.4); margin-top: 3px; }

/* ── Griglia stazioni ────────────────────────────────────────────── */
.stations-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  max-width: 700px;
  margin: 0 auto;
}
.stations-grid .station-card {
  flex: 0 1 320px;
  min-width: 280px;
  max-width: 380px;
}

/* ── Station card ────────────────────────────────────────────────── */
.station-card {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 16px; padding: 20px;
  backdrop-filter: blur(12px);
}
.sc-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px;
}
.sc-eyebrow { font-size: 11px; color: rgba(255,255,255,.4); letter-spacing: .06em;
  text-transform: uppercase; margin-bottom: 4px; }
.sc-name  { font-size: 17px; font-weight: 700; line-height: 1.2; color: #fff; }
.sc-meta  { font-size: 11px; color: rgba(255,255,255,.35); margin-top: 3px; }
.sc-temp-block { text-align: right; flex-shrink: 0; }
.sc-temp  { font-size: 38px; font-weight: 300; line-height: 1; letter-spacing: -2px; color: #fff; }
.sc-temp sup { font-size: 16px; opacity: .7; }
.sc-feels { font-size: 12px; color: rgba(255,255,255,.5); }

/* ── Block interni ───────────────────────────────────────────────── */
.sc-block { margin: 12px 0; }
.sc-block-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.35); margin-bottom: 8px;
}

/* Vento */
.sc-wind-row { display: flex; align-items: center; gap: 8px; }
.sc-compass  { width: 48px; height: 48px; flex-shrink: 0; }
.sc-wind-speed { font-size: 15px; font-weight: 700; color: #fff; }
.sc-unit    { font-size: 11px; opacity: .6; font-weight: 400; margin-left: 2px; }
.sc-wind-dir { font-size: 11px; color: rgba(255,255,255,.5); }
.sc-wind-gust { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 5px; }
.sc-wind-gust strong { color: #fff; }

/* Tabella dati */
.sc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.sc-table tr { border-bottom: 1px solid rgba(255,255,255,.07); }
.sc-table tr:last-child { border-bottom: none; }
.sc-table td { padding: 7px 2px; }
.sc-table td:first-child { color: rgba(255,255,255,.5); }
.sc-table td:last-child  { text-align: right; font-weight: 600; color: #fff; }
.sc-trend { font-size: 11px; color: rgba(255,255,255,.4); font-weight: 400; margin-left: 4px; }

/* Solar/UV */
.sc-solar-val { font-size: 22px; font-weight: 300; margin-bottom: 8px; color: #fff; }
.sc-uv-row  { display: flex; align-items: center; gap: 8px; }
.sc-uv-label { font-size: 11px; color: rgba(255,255,255,.5); min-width: 40px; }
.sc-uv-track { flex: 1; height: 5px; border-radius: 3px;
  background: linear-gradient(90deg,#22c55e 0%,#eab308 33%,#f97316 66%,#ef4444 100%); }
.sc-uv-fill  { height: 100%; border-radius: 3px; background: transparent;
  box-shadow: inset 0 0 0 100vw rgba(0,0,0,.4); }

/* AQI */
.sc-aqi-block {
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sc-aqi-badge {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid; border-radius: 50px; padding: 4px 12px; margin-top: 4px;
}
.sc-aqi-tag { font-size: 10px; color: rgba(255,255,255,.4); }
.sc-pm-row  { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sc-pm-label { font-size: 11px; color: rgba(255,255,255,.4); min-width: 44px; }
.sc-pm-track { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.sc-pm-fill  { height: 100%; border-radius: 3px;
  background: linear-gradient(90deg,#22c55e,#eab308,#f97316,#ef4444); }
.sc-pm-val   { font-size: 12px; font-weight: 700; min-width: 80px; text-align: right; }
.sc-pm-extra { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 6px; }

/* ── Grafici storici ─────────────────────────────────────────────── */
.wl-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.wl-hour-tabs {
  display: flex; gap: 4px; background: rgba(0,0,0,.25);
  border-radius: 50px; padding: 4px;
}
.wl-hour-btn {
  border: none; background: transparent; color: rgba(255,255,255,.5);
  font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 5px 14px; border-radius: 50px; cursor: pointer; transition: all .15s;
}
.wl-hour-btn.active { background: rgba(255,255,255,.18); color: #fff; }

.wl-tab-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.wl-tab-btn {
  border: 1px solid rgba(255,255,255,.12); background: transparent;
  color: #fff; border-radius: 50px; padding: 6px 14px; cursor: pointer;
  font-size: 12px; font-weight: 500; font-family: inherit;
  display: flex; align-items: center; gap: 5px; transition: all .15s;
}
.wl-tab-btn.active {
  background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.3);
}

.wl-chart-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 20px; backdrop-filter: blur(12px);
}
.wl-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.wl-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.wl-stat-pill {
  background: rgba(255,255,255,.08); border-radius: 8px;
  padding: 5px 12px; display: flex; gap: 6px; align-items: baseline;
}
.wl-stat-l { font-size: 10px; color: rgba(255,255,255,.4); text-transform: uppercase;
  letter-spacing: .06em; }
.wl-stat-v { font-size: 14px; font-weight: 700; color: #fff; }

.wl-update-row { font-size: 11px; color: rgba(255,255,255,.3);
  display: flex; align-items: center; gap: 6px; }
.wl-refresh-btn {
  border: 1px solid rgba(255,255,255,.15); border-radius: 6px; background: transparent;
  color: rgba(255,255,255,.5); font-size: 10px; padding: 2px 8px;
  cursor: pointer; font-family: inherit;
}
.wl-canvas-wrap { position: relative; height: 260px; min-height: 260px; }
.wl-canvas-wrap canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.wl-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px;
}
.wl-loading span { font-size: 12px; color: rgba(255,255,255,.4); }
.wl-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.1); border-top-color: #5eb8ff;
  animation: spin .8s linear infinite;
}
.wl-retry-btn {
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px;
  background: transparent; color: #fff; font-size: 12px;
  padding: 6px 16px; cursor: pointer; font-family: inherit; margin-top: 4px;
}
.wl-chart-footer {
  margin-top: 10px; font-size: 11px; color: rgba(255,255,255,.25);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .stations-grid { max-width: 100%; }
  .stations-grid .station-card { flex: 1 1 100%; max-width: 100%; min-width: 0; }
  .aqi-banner { flex-direction: column; align-items: flex-start; }
  .wl-header { flex-direction: column; align-items: flex-start; }
}
