:root {
  --sfondo: #eef5fb;
  --sfondo-card: rgba(255, 255, 255, 0.82);
  --blu: #2563eb;
  --blu-scuro: #173b72;
  --testo: #142033;
  --testo-secondario: #66758a;
  --linea: rgba(40, 70, 110, 0.1);
  --ombra: 0 18px 50px rgba(48, 83, 125, 0.12);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  background:
    radial-gradient(
      circle at 15% 10%,
      rgba(120, 190, 255, 0.2),
      transparent 30%
    ),
    radial-gradient(
      circle at 90% 90%,
      rgba(100, 160, 255, 0.12),
      transparent 30%
    ),
    var(--sfondo);

  color: var(--testo);
  font-family: var(--font-display);

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 2rem 1.2rem;
}

.page {
  width: 100%;
  max-width: 30rem;

  transform: translateY(-5vh);
}

/* =========================
   HEADER
========================= */

.top {
  margin-bottom: 1.8rem;
  text-align: center;
}

.top h1 {
  margin: 0;

  font-size: 2.7rem;
  font-weight: 700;
  letter-spacing: -0.055em;

  color: var(--blu-scuro);
}

.sub {
  margin: 0.45rem 0 0;

  font-size: 0.95rem;
  color: var(--testo-secondario);
}

/* =========================
   RICERCA
========================= */

.search-block {
  position: relative;
  margin-bottom: 1.6rem;
}

.search-row {
  display: flex;
  gap: 0.7rem;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

#input-citta {
  width: 100%;

  padding: 1rem 1.1rem;

  border: 1px solid rgba(75, 110, 150, 0.15);
  border-radius: 15px;

  background: rgba(255, 255, 255, 0.92);
  color: var(--testo);

  font-family: var(--font-display);
  font-size: 0.98rem;

  text-align: center;

  box-shadow: 0 6px 20px rgba(60, 95, 135, 0.06);

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

#input-citta::placeholder {
  color: #94a1b3;
}

#input-citta:focus {
  outline: none;

  border-color: rgba(37, 99, 235, 0.5);

  box-shadow:
    0 0 0 4px rgba(37, 99, 235, 0.1),
    0 8px 25px rgba(60, 95, 135, 0.08);
}

/* Pulsante posizione */

.btn-icona {
  flex-shrink: 0;

  width: 3.15rem;

  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 15px;

  background: rgba(255, 255, 255, 0.92);
  color: var(--blu);

  cursor: pointer;

  display: grid;
  place-items: center;

  box-shadow: 0 6px 20px rgba(60, 95, 135, 0.06);

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.btn-icona:hover {
  background: var(--blu);
  color: white;

  transform: translateY(-2px);

  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.2);
}

.btn-icona:active {
  transform: translateY(0);
}

/* =========================
   SUGGERIMENTI
========================= */

.suggerimenti {
  position: absolute;
  z-index: 10;

  top: calc(100% + 8px);
  left: 0;
  right: 0;

  margin: 0;
  padding: 0;

  list-style: none;

  background: white;

  border: 1px solid rgba(75, 110, 150, 0.1);
  border-radius: 14px;

  overflow: hidden;

  text-align: left;

  box-shadow: 0 16px 40px rgba(44, 74, 110, 0.14);
}

.suggerimenti li {
  padding: 0.8rem 1rem;

  cursor: pointer;

  font-size: 0.92rem;

  border-bottom: 1px solid var(--linea);

  transition: background 0.15s ease;
}

.suggerimenti li:last-child {
  border-bottom: none;
}

.suggerimenti li:hover,
.suggerimenti li.attivo {
  background: #f1f6ff;
  color: var(--blu);
}

.suggerimenti li small {
  display: block;

  margin-top: 0.18rem;

  font-family: var(--font-mono);
  font-size: 0.68rem;

  color: var(--testo-secondario);
}

/* =========================
   STATI
========================= */

.stato {
  padding: 2rem 0;

  text-align: center;

  color: var(--testo-secondario);

  font-family: var(--font-display);
  font-size: 0.9rem;
}

.stato p {
  margin: 0;
}

.stato-errore {
  color: #c2413a;
}

/* Spinner */

.spinner {
  width: 1.7rem;
  height: 1.7rem;

  margin: 0 auto 0.8rem;

  border: 2.5px solid rgba(37, 99, 235, 0.12);
  border-top-color: var(--blu);

  border-radius: 50%;

  animation: girare 0.8s linear infinite;
}

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

/* =========================
   RISULTATO METEO
========================= */

.risultato {
  position: relative;

  overflow: hidden;

  padding: 2rem 1.7rem;

  border: 1px solid rgba(80, 120, 165, 0.1);
  border-radius: 26px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.97),
      rgba(247, 251, 255, 0.92)
    );

  box-shadow: var(--ombra);

  text-align: center;

  animation: comparsa 0.35s ease;
}

/* Decorazione */

.risultato::before {
  content: "";

  position: absolute;

  width: 190px;
  height: 190px;

  top: -100px;
  right: -75px;

  border-radius: 50%;

  background: rgba(107, 181, 255, 0.12);

  pointer-events: none;
}

.risultato::after {
  content: "";

  position: absolute;

  width: 120px;
  height: 120px;

  bottom: -70px;
  left: -60px;

  border-radius: 50%;

  background: rgba(90, 150, 255, 0.08);

  pointer-events: none;
}

/* =========================
   LUOGO
========================= */

.luogo {
  position: relative;
  z-index: 1;

  margin: 0 0 1.15rem;

  font-size: 0.9rem;
  font-weight: 600;

  color: var(--testo-secondario);

  text-align: center;
}

/* =========================
   TEMPERATURA
========================= */

.riga-principale {
  position: relative;
  z-index: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  gap: 1rem;
}

.icona-meteo {
  font-size: 3.8rem;
  line-height: 1;

  filter: drop-shadow(
    0 5px 8px rgba(50, 80, 110, 0.1)
  );
}

.temperatura {
  font-size: 4.7rem;
  line-height: 1;

  font-weight: 700;

  letter-spacing: -0.07em;

  color: var(--blu-scuro);
}

/* =========================
   DESCRIZIONE
========================= */

.descrizione {
  position: relative;
  z-index: 1;

  margin: 0.85rem 0 1.8rem;

  font-size: 1rem;
  font-weight: 500;

  color: var(--testo-secondario);

  text-align: center;
}

/* =========================
   DETTAGLI
========================= */

.dettagli {
  position: relative;
  z-index: 1;

  display: grid;
  grid-template-columns: repeat(3, 1fr);

  gap: 0.65rem;

  padding-top: 1.25rem;

  border-top: 1px solid var(--linea);
}

.dettaglio {
  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 0.3rem;

  padding: 0.8rem 0.5rem;

  border-radius: 13px;

  background: rgba(235, 243, 252, 0.6);
}

.dettaglio-label {
  font-family: var(--font-mono);

  font-size: 0.62rem;

  text-transform: uppercase;
  letter-spacing: 0.04em;

  color: #8492a5;

  text-align: center;
}

.dettaglio-valore {
  font-size: 0.95rem;

  font-weight: 600;

  color: var(--testo);

  text-align: center;
}

/* =========================
   ANIMAZIONE
========================= */

@keyframes comparsa {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 480px) {
  body {
    padding: 2rem 1rem;
  }

  .top h1 {
    font-size: 2.2rem;
  }

  .risultato {
    padding: 1.5rem 1.1rem;
    border-radius: 22px;
  }

  .temperatura {
    font-size: 4rem;
  }

  .icona-meteo {
    font-size: 3.3rem;
  }

  .dettagli {
    gap: 0.4rem;
  }

  .dettaglio {
    padding: 0.65rem 0.35rem;
  }

  .dettaglio-label {
    font-size: 0.57rem;
  }

  .dettaglio-valore {
    font-size: 0.86rem;
  }
}