/* ═══════════════════════════════════════════════════════
   Meteo Pistoia · tema ilbarone.net
═══════════════════════════════════════════════════════ */
:root {
  --bg:      #0d1117;
  --bg2:     #161b22;
  --bg3:     #1e2430;
  --accent:  #10ffb4;
  --blue:    #3b82f6;
  --cyan:    #06b6d4;
  --red:     #ef4444;
  --orange:  #f59e0b;
  --green:   #22c55e;
  --purple:  #a855f7;
  --text:    #e6edf3;
  --muted:   #8b949e;
  --border:  rgba(255,255,255,.08);
  --r:       14px;
  --shadow:  0 8px 32px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 20% 10%, rgba(16,255,180,.08), transparent 60%),
    radial-gradient(ellipse 40% 35% at 80% 90%, rgba(59,130,246,.08), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #fff; }

/* ── Header ───────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(13,17,23,.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .logo { height: 46px; }
.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.site-nav a {
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: var(--bg2); }
.site-nav a.active {
  color: var(--accent);
  background: rgba(16,255,180,.08);
}
.parent-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg2);
  transition: border-color .15s, transform .15s, background .15s;
}
.parent-brand img {
  width: 22px;
  height: 22px;
  display: block;
}
.parent-brand:hover {
  border-color: var(--accent);
  background: rgba(16,255,180,.08);
  transform: translateY(-1px);
}

/* ── Containers ───────────────────────────────────── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── HERO (current weather) ───────────────────────── */
.hero-weather {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
  padding: 32px;
  margin: 28px 0;
  background: linear-gradient(135deg, rgba(16,255,180,.08), rgba(59,130,246,.05));
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-weather::before {
  content: "";
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 30% 30%, rgba(16,255,180,.08), transparent 50%);
  pointer-events: none;
}
.hw-left { position: relative; z-index: 1; }
.hw-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin-bottom: 14px;
}
.live-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,255,180,.6); }
  70%  { box-shadow: 0 0 0 10px rgba(16,255,180,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,255,180,0); }
}
.hw-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 10px;
}
.hw-icon { font-size: 5.5rem; line-height: 1; }
.hw-temp {
  font-size: 6rem;
  font-weight: 200;
  line-height: 1;
  letter-spacing: -.04em;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hw-temp span { font-size: 3rem; font-weight: 300; }
.hw-desc { font-size: 1.25rem; color: var(--text); font-weight: 500; }
.hw-sub { color: var(--muted); font-size: .92rem; margin-top: 4px; }

.hw-right {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: center;
  position: relative;
  z-index: 1;
}
.hw-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}
.hw-stat-icon { font-size: 1.5rem; flex-shrink: 0; opacity: .9; }
.hw-stat-text { min-width: 0; }
.hw-stat-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.hw-stat-value { color: var(--text); font-weight: 600; font-size: 1rem; line-height: 1.2; margin-top: 2px; }

/* ── Section title ────────────────────────────────── */
.sec-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 32px 0 14px;
}
.sec-title h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 700;
  margin: 0;
}
.sec-title .tools {
  display: flex;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
}
.sec-title .tools button,
.sec-title .tools a {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.sec-title .tools button:hover,
.sec-title .tools a:hover { color: var(--text); }
.sec-title .tools button.active,
.sec-title .tools a.active {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #0d1117;
}

/* ── Chart card ───────────────────────────────────── */
.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--shadow);
}
.chart-wrap {
  position: relative;
  height: 340px;
}

/* ── 7-day forecast ───────────────────────────────── */
.days-grid {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.day-row {
  display: grid;
  grid-template-columns: 110px 60px 70px 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.day-row:last-child { border: 0; }
.day-row:hover { background: rgba(16,255,180,.04); }
.day-name strong { color: var(--text); display: block; text-transform: capitalize; }
.day-name span { color: var(--muted); font-size: .78rem; }
.day-icon { font-size: 1.8rem; text-align: center; }
.day-rain { color: var(--cyan); font-size: .85rem; }
.day-range {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .9rem;
}
.day-range .t-min { color: #9ca3af; width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.day-range .t-max { color: var(--text); font-weight: 600; width: 30px; font-variant-numeric: tabular-nums; }
.day-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.day-bar-fill {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, #3b82f6, var(--accent), #f59e0b);
  border-radius: 999px;
  min-width: 8px;
}

/* ── Variable selector (storico) ──────────────────── */
.var-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.var-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.var-chip:hover { color: var(--text); border-color: rgba(255,255,255,.2); }
.var-chip.active {
  background: linear-gradient(135deg, rgba(16,255,180,.15), rgba(59,130,246,.08));
  border-color: var(--accent);
  color: var(--accent);
}
.var-chip .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}

/* ── Stats blocks ─────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.stat-block {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}
.stat-block-label {
  color: var(--muted);
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat-block-value {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.stat-block-sub { color: var(--muted); font-size: .75rem; }

/* ── Visits strip ─────────────────────────────────── */
.visits-strip {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  max-width: fit-content;
  margin: 30px auto 20px;
  padding: 5px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .02em;
}
.visits-strip .fv-item { display: inline-flex; align-items: center; gap: 5px; }
.visits-strip .fv-item svg { opacity: .7; }
.visits-strip .fv-sep { opacity: .35; }

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  margin-top: 60px;
  padding: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sep { margin: 0 8px; opacity: .4; }

/* ── Embed mode (inside iframe on ilbarone.net) ──── */
body.is-embed { background: transparent; }
body.is-embed .container { padding-top: 12px; }
body.is-embed .site-footer { display: none; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 720px) {
  .container { padding: 0 14px; }
  .hero-weather { grid-template-columns: 1fr; padding: 22px; }
  .hw-temp { font-size: 4.5rem; }
  .hw-temp span { font-size: 2.5rem; }
  .hw-icon { font-size: 4rem; }
  .day-row { grid-template-columns: 80px 44px 60px 1fr; padding: 12px 14px; gap: 10px; }
  .site-header { padding: 10px 14px; }
  .site-header .logo { height: 38px; }
  .site-nav a { padding: 6px 10px; font-size: .82rem; }
  .chart-wrap { height: 260px; }
}
