:root {
  /* Tema chiaro predefinito: stile Apple, bianco/grigio chiaro */
  --page-bg: linear-gradient(180deg, #ffffff 0%, #f5f5f7 55%, #e8e8ed 100%);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --text-light: #1d1d1f;
  --text-dim: rgba(0, 0, 0, 0.55);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --field-bg: rgba(0, 0, 0, 0.04);
  --field-bg-focus: rgba(0, 0, 0, 0.07);
  --field-border-focus: rgba(0, 0, 0, 0.4);
  --field-ring: rgba(0, 0, 0, 0.08);
  --placeholder: rgba(0, 0, 0, 0.35);
  --surface-2: rgba(0, 0, 0, 0.035);
  --surface-2-hover: rgba(0, 0, 0, 0.065);
  --scrollbar-thumb: rgba(0, 0, 0, 0.2);
  --spinner-track: rgba(255, 255, 255, 0.35);
  --spinner-fg: #ffffff;
  --btn-primary-bg: #1d1d1f;
  --btn-primary-text: #ffffff;
  --blob-tint: #0071e3;
  --radius: 22px;
  --transition: all 0.35s cubic-bezier(.4,0,.2,1);
  color-scheme: light;
}

body.dark-mode {
  /* Tema scuro: aspetto invariato rispetto a prima */
  --page-bg: linear-gradient(135deg,#4facfe 0%,#00c6fb 100%);
  --glass-bg: rgba(255, 255, 255, 0.16);
  --glass-bg-strong: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.35);
  --text-light: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.78);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  --field-bg: rgba(255, 255, 255, 0.14);
  --field-bg-focus: rgba(255, 255, 255, 0.24);
  --field-border-focus: rgba(255, 255, 255, 0.7);
  --field-ring: rgba(255, 255, 255, 0.15);
  --placeholder: rgba(255, 255, 255, 0.55);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-2-hover: rgba(255, 255, 255, 0.18);
  --scrollbar-thumb: rgba(255, 255, 255, 0.3);
  --spinner-track: rgba(255, 255, 255, 0.4);
  --spinner-fg: #ffffff;
  --btn-primary-bg: rgba(255, 255, 255, 0.92);
  --btn-primary-text: #1c4b6e;
  --blob-tint: #ffffff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  min-height: 100vh;
  background: var(--page-bg);
  background-attachment: fixed;
  transition: background 1.2s ease;
  color: var(--text-light);
  overflow-x: hidden;
  padding-bottom: 40px;
}

/* animated floating background blobs */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: var(--blob-opacity, 0.18);
  background: radial-gradient(circle, var(--blob-tint), transparent 70%);
  animation: floatBlob 18s ease-in-out infinite;
}
body.dark-mode { --blob-opacity: 0.35; }
.blob.b1 { width: 320px; height: 320px; top: -80px; left: -60px; animation-duration: 22s; }
.blob.b2 { width: 260px; height: 260px; bottom: -60px; right: -40px; animation-duration: 26s; animation-delay: -6s; }
.blob.b3 { width: 200px; height: 200px; top: 40%; left: 60%; animation-duration: 20s; animation-delay: -12s; }

@keyframes floatBlob {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(30px,-40px) scale(1.1); }
  66% { transform: translate(-25px,25px) scale(0.95); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  z-index: 0;
  transition: background 0.4s ease;
}
body.dark-mode::after { background: rgba(0, 0, 0, 0.45); }

/* ---------- header ---------- */
header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  animation: fadeInDown 0.6s ease both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.brand .logo {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg-strong);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}
.brand .logo svg { width: 26px; height: 26px; color: #ffe066; }
.brand .logo-img { height: 64px; width: auto; display: block; }
.brand a.logo-link { display: flex; align-items: center; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- menu hamburger + barra laterale (mobile) ---------- */
.btn.menu-toggle { display: none; }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: 280px;
  max-width: 82vw;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--glass-border);
  box-shadow: -10px 0 40px rgba(0,0,0,0.25);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 70px 16px 24px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-light);
  cursor: pointer;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
  transition: var(--transition);
}
.sidebar-link:hover { background: var(--surface-2); }
@media (max-width: 640px) {
  .top-actions.has-menu { display: none; }
  .btn.menu-toggle { display: flex; }
}

.btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-light);
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover { background: var(--glass-bg-strong); transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0) scale(0.97); }
.btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(255, 90, 90, 0.25); }
.btn.danger:hover { background: rgba(255, 90, 90, 0.4); }
.btn.small { padding: 7px 13px; font-size: 0.8rem; }
.btn.icon-btn { padding: 10px; border-radius: 50%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- hero (today) ---------- */
.hero {
  position: relative;
  border-radius: 28px;
  padding: 40px;
  /* La card di oggi mostra sempre la foto: testo e icone restano bianchi a prescindere dal tema */
  --text-light: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.78);
  color: #ffffff;
  background-color: #101a26;
  /* velo scuro leggero: la foto resta luminosa, testo e simbolo stanno su card con fondo proprio */
  background-image: linear-gradient(120deg, rgba(10,20,35,0.05), rgba(10,20,35,0.15)), url('../images/logo-hero.jpg');
  background-repeat: no-repeat;
  background-size: auto 118%;
  background-position: 459px -8px;
  border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  overflow: hidden;
  animation: fadeInUp 0.7s ease both;
  animation-delay: 0.05s;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.08), transparent 60%);
  pointer-events: none;
}

.hero-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(8, 16, 28, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 22px 26px;
  border: 1px solid rgba(255,255,255,0.12);
}
.hero-info h1 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-dim);
}
.hero-clock {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.hero-info .city {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-temps { display: flex; gap: 32px; flex-wrap: wrap; }
.hero-temp-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.hero-temp {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
  display: flex;
  align-items: flex-start;
}
.hero-temp .deg { font-size: 2rem; margin-top: 8px; }
.hero-desc { margin-top: 10px; color: var(--text-dim); max-width: 380px; font-size: 1rem; }
.hero-meta { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero-meta .m { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; color: var(--text-dim); }
.hero-icon-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(8, 16, 28, 0.3);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 18px 26px;
  border: 1px solid rgba(255,255,255,0.12);
}
.hero-icon-wrap .w-icon { width: 140px; height: 140px; color: var(--text-light); filter: drop-shadow(0 10px 20px rgba(0,0,0,0.25)); }
.hero-cond-label { font-weight: 600; font-size: 1.05rem; }
.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 59, 48, 0.2); border: 1px solid rgba(255, 99, 88, 0.55);
}
.live-badge[hidden] { display: none; }
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #ff3b30;
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
  animation: livePulse 1.6s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---------- section titles ---------- */
.section-title {
  margin: 40px 0 18px;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInUp 0.6s ease both;
}
.section-title .line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--glass-border), transparent); }
.section-title .notify-btn { font-weight: 600; white-space: nowrap; }
.notify-btn.active { background: var(--btn-primary-bg); color: var(--btn-primary-text); }

/* ---------- forecast cards row ---------- */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: var(--transition);
  animation: fadeInUp 0.6s ease both;
  position: relative;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow);
  background: var(--glass-bg-strong);
}
.card .date { font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.card .w-icon { width: 62px; height: 62px; margin: 4px auto 8px; color: var(--text-light); }
.card .cond { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 10px; }
.card .temps { font-size: 1.05rem; font-weight: 700; }
.card .temps .min { color: var(--text-dim); font-weight: 500; margin-left: 6px; }

/* stagger animation delays for cards */
.cards-row .card:nth-child(1) { animation-delay: .05s; }
.cards-row .card:nth-child(2) { animation-delay: .12s; }
.cards-row .card:nth-child(3) { animation-delay: .19s; }
.cards-row .card:nth-child(4) { animation-delay: .26s; }
.cards-row .card:nth-child(5) { animation-delay: .33s; }
.cards-row .card:nth-child(6) { animation-delay: .40s; }
.cards-row .card:nth-child(7) { animation-delay: .47s; }

/* ---------- stazione meteo in tempo reale ---------- */
.station-panel { text-align: center; }
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.station-stat {
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 10px;
}
.station-stat .s-icon { display: flex; align-items: center; justify-content: center; margin-bottom: 6px; color: var(--text-light); }
.station-stat .s-val { font-size: 1.3rem; font-weight: 700; }
.station-stat .s-lab { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
.station-note { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 16px; }

/* ---------- notizie ---------- */
.news-list { display: flex; flex-direction: column; gap: 16px; }
.news-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  animation: fadeInUp 0.5s ease both;
}
.news-card { cursor: pointer; }
.news-card:hover { box-shadow: var(--shadow); }
.news-card:focus-visible { outline: 2px solid var(--text-light); outline-offset: 2px; }
.news-card img {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}
.news-card-body { padding: 20px 24px; }
/* altre foto della notizia, sotto il testo */
.news-card .news-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.news-card .news-thumbs img { width: 100%; max-height: none; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.news-card .news-date { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 6px; text-transform: capitalize; }
.news-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.news-card p { margin: 0; color: var(--text-dim); line-height: 1.5; white-space: pre-line; }
.news-card.pinned { border-color: rgba(255, 184, 0, 0.7); box-shadow: 0 0 0 1px rgba(255, 184, 0, 0.35); }
.pinned-badge {
  display: inline-block; margin-bottom: 8px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  background: #ffe066; color: #4a3b00;
}

/* ---------- sponsor (galleria) ---------- */
.sponsors-panel { text-align: center; }
/* schede centrate e di larghezza fissa: con pochi sponsor non restano spazi vuoti a destra */
.sponsors-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 22px;
}
.sponsors-row .empty-state { flex-basis: 100%; }
.sponsor-item {
  display: flex;
  flex-direction: column;
  width: 240px;
  padding: 0;
  background: #ffffff;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transition: var(--transition);
  cursor: zoom-in;
  font: inherit;
  color: #1c2733;
  animation: fadeInUp 0.5s ease both;
}
.sponsor-item:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.18); }
.sponsor-item:focus-visible { outline: 2px solid var(--text-light); outline-offset: 3px; }
/* area immagine quadrata: loghi e volantini (anche verticali) restano leggibili */
.sponsor-media {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
}
.sponsor-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid rgba(0,0,0,0.07);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
}
.sponsor-caption .sponsor-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sponsor-caption .sponsor-hint { color: #6b7785; font-weight: 500; font-size: 0.78rem; flex-shrink: 0; }
@media (max-width: 640px) {
  .sponsors-row { gap: 12px; }
  .sponsor-item { width: calc(50% - 6px); }
  .sponsor-caption { padding: 8px 10px; font-size: 0.8rem; }
}

/* ---------- sponsor ingrandito (lightbox) ---------- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(10, 20, 35, 0.8);
  backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: min(92vw, 900px);
  max-height: 78vh;
  width: auto; height: auto;
  object-fit: contain;
  background: #ffffff;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  transform: scale(0.85);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
}
.lightbox.open img { transform: scale(1); }
.lightbox-name { color: #ffffff; font-weight: 700; font-size: 1.05rem; text-align: center; }
.lightbox-close {
  position: absolute; top: 16px; right: 16px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
}
/* posizionata dentro il riquadro quadrato: un volantino verticale non lo allunga */
.sponsor-media { position: relative; }
.sponsor-media img {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  display: block;
}
@media (max-width: 640px) {
  .sponsor-media img { inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); }
}

/* ---------- collabora con noi ---------- */
.contact-intro { color: var(--text-dim); margin: 0 0 18px; font-size: 0.92rem; }
#contact-form .field-row { margin-bottom: 0; }

/* ---------- radar page ---------- */
.embed-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.embed-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: rgba(0,0,0,0.15);
}
.embed-frame-wrap iframe { width: 100%; height: 100%; border: 0; }
.embed-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: var(--text-dim); text-align: center; padding: 20px;
}
.embed-placeholder .big-icon { font-size: 2.6rem; }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
  background: var(--glass-bg);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius);
}

/* ---------- modal (card detail) ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 20, 35, 0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  backdrop-filter: blur(20px);
  transform: scale(0.85) translateY(20px);
  transition: transform 0.3s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
/* variante per le notizie ingrandite */
.modal.news-modal { max-width: 680px; max-height: 90vh; overflow-y: auto; text-align: left; padding: 24px; }
.modal.news-modal img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 16px; display: block; margin-bottom: 16px; }
.modal.news-modal .news-date { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 6px; text-transform: capitalize; }
.modal.news-modal h2 { margin: 0 0 12px; }
.modal.news-modal .news-text { color: var(--text-dim); line-height: 1.6; white-space: pre-line; margin: 0 0 20px; }
.modal.news-modal .news-gallery { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.modal.news-modal .news-gallery img { margin-bottom: 0; }
/* guida "notifiche non attivate" */
.modal.help-modal { max-width: 520px; }
.help-modal .help-icon {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); margin-bottom: 12px;
}
.help-modal h2 { font-size: 1.25rem; }
.help-modal .help-intro { color: var(--text-dim); line-height: 1.5; margin: 0 0 14px; }
.help-modal .help-h { font-size: 0.95rem; margin: 16px 0 6px; }
.help-modal .help-steps { margin: 0; padding-left: 22px; line-height: 1.55; }
.help-modal .help-steps li { margin-bottom: 8px; }
.help-modal .help-note {
  font-size: 0.85rem; line-height: 1.5; color: var(--text-dim);
  background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 10px 0 0;
}
.help-modal a { color: inherit; }
.help-modal .help-actions { display: flex; gap: 10px; margin-top: 20px; }
.help-modal .help-actions .btn { flex: 1; justify-content: center; }
.help-modal .help-detail { font-size: 0.72rem; color: var(--text-dim); opacity: 0.8; margin: 14px 0 0; overflow-wrap: anywhere; }
.help-modal .help-detail:empty { display: none; }
.modal .w-icon { width: 100px; height: 100px; margin: 0 auto 12px; }
.modal h2 { margin: 0 0 4px; }
.modal .modal-city { color: var(--text-dim); margin-bottom: 16px; }
.modal .modal-temp { font-size: 2.6rem; font-weight: 800; margin-bottom: 6px; }
.modal .modal-desc { color: var(--text-dim); margin-bottom: 18px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.modal-grid .stat { background: var(--surface-2); border-radius: 14px; padding: 10px; }
.modal-grid .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
.modal-grid .stat .v { font-weight: 700; font-size: 1.1rem; }
.modal-grid .stat .l { font-size: 0.75rem; color: var(--text-dim); }

/* ---------- weather icon animations ---------- */
.sun-core { transform-origin: 50px 50px; }
.sun-rays { transform-origin: 50px 50px; animation: spin 12s linear infinite; }
.sun-rays-sm { transform-origin: 40px 40px; animation: spin 12s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.w-moon .star { animation: twinkle 2.4s ease-in-out infinite; }
.w-moon .star2 { animation-delay: 0.6s; }
.w-moon .star3 { animation-delay: 1.2s; }
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.cloud-float { animation: cloudDrift 6s ease-in-out infinite; }
.cloud-back { animation: cloudDrift 7s ease-in-out infinite reverse; }
@keyframes cloudDrift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }

.rain-drop { animation: fall 1s linear infinite; opacity: 0; }
.rain-drop-0 { animation-delay: 0s; } .rain-drop-1 { animation-delay: .15s; }
.rain-drop-2 { animation-delay: .3s; } .rain-drop-3 { animation-delay: .45s; } .rain-drop-4 { animation-delay: .6s; }
@keyframes fall { 0% { opacity: 0; transform: translateY(-6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(10px); } }

.snow-flake { animation: snowFall 2.6s ease-in-out infinite; }
.snow-flake-0 { animation-delay: 0s; } .snow-flake-1 { animation-delay: .4s; }
.snow-flake-2 { animation-delay: .8s; } .snow-flake-3 { animation-delay: 1.2s; } .snow-flake-4 { animation-delay: 1.6s; }
@keyframes snowFall { 0% { transform: translate(0,0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(4px, 22px); opacity: 0; } }

.sun-rays-var { transform-origin: 34px 34px; }
.cloud-pass { animation: cloudPass 7s ease-in-out infinite; }
@keyframes cloudPass { 0%, 100% { transform: translateX(-10px); } 50% { transform: translateX(6px); } }

.w-storm .bolt, .w-unstable .bolt { animation: flash 1.8s ease-in-out infinite; transform-origin: center; }
@keyframes flash { 0%, 100% { opacity: 0.3; } 8%, 12% { opacity: 1; filter: drop-shadow(0 0 6px #ffe066); } 20% { opacity: 0.3; } }

.fog-line { animation: fogWave 3.5s ease-in-out infinite; opacity: 0.7; }
.fog-line-0 { animation-delay: 0s; } .fog-line-1 { animation-delay: .3s; } .fog-line-2 { animation-delay: .6s; } .fog-line-3 { animation-delay: .9s; }
@keyframes fogWave { 0%, 100% { transform: translateX(0); opacity: 0.5; } 50% { transform: translateX(8px); opacity: 0.9; } }

.wind-line { stroke-dasharray: 90; animation: windBlow 2.2s linear infinite; }
.wind-line-1 { animation-delay: .3s; } .wind-line-2 { animation-delay: .6s; }
@keyframes windBlow { 0% { stroke-dashoffset: 90; opacity: 0; } 20% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }

/* ---------- generic animations ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}
.shake { animation: shake 0.5s; }

/* ---------- toast ---------- */
#toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: rgba(20, 30, 45, 0.92);
  color: #fff;
  padding: 14px 20px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  font-size: 0.9rem;
  min-width: 220px;
  animation: fadeInUp 0.3s ease both;
  border-left: 4px solid #4facfe;
}
.toast.success { border-left-color: #4ade80; }
.toast.error { border-left-color: #f87171; }
.toast.fade-out { animation: fadeOutRight 0.3s ease forwards; }
@keyframes fadeOutRight { to { opacity: 0; transform: translateX(20px); } }

/* ---------- login page ---------- */
.login-wrap {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  padding: 38px 32px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  animation: fadeInUp 0.6s ease both;
}
.login-card .logo-big {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  background: var(--glass-bg-strong);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--glass-border);
}
.login-card .logo-big svg { width: 36px; height: 36px; color: #ffe066; }
.login-card h1 { text-align: center; font-size: 1.4rem; margin: 0 0 4px; }
.login-card p.sub { text-align: center; color: var(--text-dim); margin: 0 0 26px; font-size: 0.9rem; }

.field { margin-bottom: 16px; text-align: left; }
.field label { display: block; font-size: 0.82rem; margin-bottom: 6px; color: var(--text-dim); font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--field-bg);
  color: var(--text-light);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  font-family: inherit;
}
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.field input:focus, .field select:focus, .field textarea:focus {
  background: var(--field-bg-focus);
  border-color: var(--field-border-focus);
  box-shadow: 0 0 0 3px var(--field-ring);
}
.field select option { color: #1c1c1c; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.error-msg {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

.full-btn { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }

/* ---------- foto della notizia nel pannello gestore ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 10px; }
.photo-grid:empty { display: none; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-remove {
  position: absolute; top: 4px; right: 4px;
  width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.8rem; line-height: 1;
}
.photo-remove:hover { background: rgba(220, 40, 40, 0.9); }
.photo-cover {
  position: absolute; left: 4px; bottom: 4px;
  font-size: 0.62rem; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.65); color: #fff;
}

/* ---------- admin layout ---------- */
.admin-grid {
  display: grid;
  /* minmax(0, 1fr): un testo lungo nelle liste non deve allargare la colonna oltre lo schermo */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.admin-grid > * { min-width: 0; }
@media (max-width: 860px) {
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 26px;
  backdrop-filter: blur(14px);
  animation: fadeInUp 0.6s ease both;
}
.panel h2 { margin-top: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }

.preview-card {
  /* Mostra sempre un gradiente meteo vivace: testo bianco fisso a prescindere dal tema */
  --text-light: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.78);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.2);
  transition: background 0.6s ease;
}
.preview-card .w-icon { width: 90px; height: 90px; margin: 6px auto 10px; }
.preview-card .p-date { font-weight: 700; text-transform: capitalize; margin-bottom: 4px; }
.preview-card .p-city { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 14px; }
.preview-card .p-temp { font-size: 2.2rem; font-weight: 800; }
.preview-card .p-desc { color: var(--text-dim); font-size: 0.88rem; margin-top: 10px; }

.forecast-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.forecast-list::-webkit-scrollbar { width: 6px; }
.forecast-list::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 12px 14px;
  transition: var(--transition);
  animation: fadeInUp 0.4s ease both;
}
.list-item:hover { background: var(--surface-2-hover); }
.list-item .w-icon { width: 40px; height: 40px; flex-shrink: 0; }
.list-item .li-info { flex: 1; min-width: 0; }
.list-item .li-date { font-weight: 700; font-size: 0.9rem; text-transform: capitalize; overflow-wrap: anywhere; }
.list-item .li-sub { color: var(--text-dim); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-actions { display: flex; gap: 6px; flex-shrink: 0; }
.list-item.today-badge { border-color: rgba(255, 224, 102, 0.6); box-shadow: 0 0 0 1px rgba(255,224,102,0.3); }
.badge-today {
  font-size: 0.65rem;
  font-weight: 700;
  background: #ffe066;
  color: #4a3b00;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

.top-bar-admin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.top-bar-admin .who { color: var(--text-dim); font-size: 0.85rem; }

.link-quiet { color: var(--text-dim); font-size: 0.85rem; text-decoration: underline; cursor: pointer; background: none; border: none; }
.link-quiet:hover { color: var(--text-light); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--spinner-track);
  border-top-color: var(--spinner-fg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

footer.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 50px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.reserved-link {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-decoration: none;
  opacity: 0.6;
  border: 1px solid var(--glass-border);
  padding: 4px 12px;
  border-radius: 999px;
  transition: var(--transition);
}
.reserved-link:hover { opacity: 1; background: var(--glass-bg); }

/* Desktop: la card del testo occupa per intero la zona senza foto (a sinistra),
   la foto parte dove finisce la card e il simbolo sta sopra la foto. */
@media (min-width: 1001px) {
  .hero {
    display: grid;
    grid-template-columns: 480px 1fr;
    padding: 0;
    gap: 0;
    min-height: 381px;
    background-image: none;
  }
  .hero::after {
    content: '';
    grid-column: 2;
    grid-row: 1;
    background:
      linear-gradient(120deg, rgba(10,20,35,0.05), rgba(10,20,35,0.15)) 0 0 / 100% 100% no-repeat,
      url('../images/logo-hero.jpg') left -8px / auto 118% no-repeat;
  }
  .hero-info {
    grid-column: 1; grid-row: 1; z-index: 1;
    border: 0; border-radius: 0;
    padding: 40px 26px 40px 66px;
  }
  .hero-icon-wrap {
    grid-column: 2; grid-row: 1; z-index: 1;
    justify-self: end;
    margin: 40px 40px 40px 0;
  }
}

/* Tablet e telefono: card del testo, fascia con la foto, card del simbolo.
   Le card occupano per intero le zone senza foto. */
@media (max-width: 1000px) {
  .hero {
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: auto 320px auto;
    gap: 0;
    padding: 0;
    background-image: none;
  }
  .hero::after {
    content: '';
    grid-row: 2;
    background:
      linear-gradient(120deg, rgba(10,20,35,0.05), rgba(10,20,35,0.15)) 0 0 / 100% 100% no-repeat,
      url('../images/logo-hero.jpg') center 45% / cover no-repeat;
  }
  .hero-info, .hero-icon-wrap { border: 0; border-radius: 0; }
  .hero-info { grid-row: 1; padding: 40px 26px; }
  .hero-icon-wrap { grid-row: 3; padding: 30px 26px; }
}

@media (max-width: 600px) {
  .hero { text-align: center; }
  .hero-meta { justify-content: center; }
  .hero-temps { justify-content: center; gap: 28px; }
  .hero-temp { font-size: 3.2rem; }
  .hero-temp .deg { font-size: 1.5rem; margin-top: 6px; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page { padding: 16px 14px 0; }
  header.top {
    gap: 12px;
    margin: 0 -14px 20px;
    padding: 14px;
    position: sticky;
    top: 0;
    z-index: 150;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
  }
  .brand { font-size: 1.05rem; gap: 10px; }
  .brand .logo-img { height: 46px; }
  .btn { padding: 9px 14px; font-size: 0.85rem; }
  .section-title { font-size: 1.05rem; margin: 30px 0 14px; }
  .hero-icon-wrap .w-icon { width: 110px; height: 110px; }
  .card { background: rgba(255,255,255,0.8); }
  body.dark-mode .card { background: rgba(255,255,255,0.28); }
}
