/* ============================================================
   base.css — Reset, variabili, stili globali, responsive grid
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Syne:wght@400;600;700;800&display=swap');

/* ── Variabili ─────────────────────────────────────────────── */
:root {
  --bg:         #0a0e1a;
  --surface:    #111827;
  --surface2:   #1a2235;
  --border:     #1e2d45;
  --accent:     #00d4ff;
  --accent2:    #ff6b35;
  --text:       #e8edf5;
  --text-muted: #5a7090;
  --text-dim:   #8aa0bc;
  --success:    #00e676;
  --warning:    #ffab40;
  --danger:     #ff5252;
  --radius:     12px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin:     0;
  padding:    0;
  -webkit-tap-highlight-color: transparent; /* rimuove flash blu su tap mobile */
}

/* ── Body ──────────────────────────────────────────────────── */
html {
  /* evita scroll orizzontale su mobile */
  overflow-x:      hidden;
  /* scroll fluido per anchor e programmatic scroll */
  scroll-behavior: smooth;
}

body {
  background:   var(--bg);
  color:        var(--text);
  font-family:  'Syne', sans-serif;
  min-height:   100vh;
  min-height:   100dvh; /* dynamic viewport height su mobile */
  /* clip non crea uno scroll container (a differenza di hidden),
     quindi non rompe position:sticky su header e status-bar */
  overflow-x:   clip;
  /* momentum scrolling nativo su iOS (deprecato ma ancora utile su Safari < 16) */
  -webkit-overflow-scrolling: touch;
  /* padding bottom per status bar sticky */
  padding-bottom: 40px;
}

/* Griglia decorativa di sfondo */
body::before {
  content:    '';
  position:   fixed;
  inset:      0;
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events:  none;
  z-index:         0;
}

/* ── Contenitore principale ────────────────────────────────── */
.container {
  max-width: 1400px;
  margin:    0 auto;
  padding:   0 16px;
  position:  relative;
  z-index:   1;
}

@media (min-width: 600px)  { .container { padding: 0 20px; } }
@media (min-width: 900px)  { .container { padding: 0 24px; } }

/* ── Titolo sezione ────────────────────────────────────────── */
.section-title {
  font-family:    'DM Mono', monospace;
  font-size:      0.65rem;
  color:          var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom:  14px;
  display:        flex;
  align-items:    center;
  gap:            10px;
  white-space:    nowrap;
}

.section-title::after {
  content:    '';
  flex:       1;
  height:     1px;
  background: var(--border);
}

/* ── Badge contatore ───────────────────────────────────────── */
.city-count {
  background:    rgba(0,212,255,0.1);
  color:         var(--accent);
  border:        1px solid rgba(0,212,255,0.2);
  border-radius: 4px;
  padding:       2px 8px;
  font-size:     0.6rem;
  white-space:   nowrap;
}

/* ── Griglia card — mobile first ───────────────────────────── */
.city-grid {
  display:               grid;
  grid-template-columns: 1fr; /* 1 colonna su mobile */
  gap:                   16px;
  margin-bottom:         36px;
}

@media (min-width: 600px) {
  .city-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (min-width: 1100px) {
  .city-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* ── Animazione ingresso card ──────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Spinner ───────────────────────────────────────────────── */
.spinner {
  width:            24px;
  height:           24px;
  border:           2px solid var(--border);
  border-top-color: var(--accent);
  border-radius:    50%;
  animation:        spin 0.8s linear infinite;
  margin:           0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Colori temperatura ────────────────────────────────────── */
.temp-cold { color: #60b4ff; }
.temp-mild { color: var(--success); }
.temp-warm { color: var(--warning); }
.temp-hot  { color: var(--danger); }

/* ── Banner errore inizializzazione ───────────────────────── */
.init-error {
  background:    rgba(255,82,82,0.08);
  border:        1px solid rgba(255,82,82,0.3);
  border-radius: var(--radius);
  padding:       16px 20px;
  font-family:   'DM Mono', monospace;
  font-size:     0.78rem;
  color:         var(--danger);
  margin-bottom: 24px;
  line-height:   1.6;
}

.init-error strong { display: block; margin-bottom: 6px; font-size: 0.85rem; }

.init-error code {
  background:    rgba(255,82,82,0.15);
  padding:       1px 5px;
  border-radius: 3px;
}