/* ==========================================================================
   AG Meteo — pages.css
   Pagine secondarie: documenti legali (Privacy, Termini) e 404.
   ========================================================================== */

/* ---------- DOCUMENTI LEGALI ---------- */
.legal__hero { padding-block: var(--s-7) var(--s-5); }
.legal__hero .h1 { font-size: clamp(1.9rem, 1.3rem + 2.6vw, 3rem); margin-block: var(--s-2) var(--s-3); }
.legal__hero p { max-width: 42rem; font-size: var(--fs-lg); color: var(--text-muted); }
.legal__meta { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--text-muted); }
.legal__meta strong { color: var(--text); }

/* "In breve": riepilogo a colpo d'occhio per chi non legge tutto */
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s-4); margin-block: var(--s-5) var(--s-6); list-style: none; }
.glance li { padding: var(--s-4) var(--s-5); }
.glance h2 { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-size: var(--fs-md); font-weight: 720; }
.glance .icon { color: var(--primary); }
.glance p { font-size: var(--fs-sm); color: var(--text-muted); }

.legal__layout { display: grid; gap: var(--s-6); padding-bottom: var(--s-6); }
@media (min-width: 60rem) {
  .legal__layout { grid-template-columns: 15rem minmax(0, 1fr); gap: var(--s-7); align-items: start; }
}

.toc { font-size: var(--fs-sm); }
@media (min-width: 60rem) { .toc { position: sticky; top: calc(var(--header-h) + var(--s-5)); } }
.toc h2 { margin-bottom: var(--s-3); font-size: var(--fs-xs); font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.toc ol { display: grid; gap: 0.15rem; list-style: none; counter-reset: toc; }
.toc a {
  display: flex;
  gap: 0.6rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 550;
  counter-increment: toc;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}
.toc a::before { content: counter(toc); min-width: 1.1em; font-variant-numeric: tabular-nums; color: var(--primary); font-weight: 700; }
.toc a:hover { background: var(--surface-2); color: var(--text); }
.toc a[aria-current='true'] { background: var(--info-bg); color: var(--text); font-weight: 700; }
/* Su mobile l'indice diventa un blocco a scomparsa */
.toc details > summary { cursor: pointer; font-weight: 700; padding: var(--s-3) var(--s-4); list-style: none; }
.toc details > summary::-webkit-details-marker { display: none; }
.toc details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); }
.toc details nav { padding: 0 var(--s-2) var(--s-3); }
@media (min-width: 60rem) {
  .toc details { background: none; border: 0; }
  .toc details > summary { display: none; }
  .toc details nav { padding: 0; }
}

.legal__body { max-width: 46rem; counter-reset: sec; }
.legal__body section { padding-block: var(--s-5); border-top: 1px solid var(--border); }
.legal__body section:first-child { border-top: 0; padding-top: 0; }
.legal__body h2 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: var(--s-3);
  font-size: 1.375rem;
  font-weight: 720;
  counter-increment: sec;
}
.legal__body h2::before {
  content: counter(sec);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2rem; height: 2rem;
  border-radius: 50%;
  background: var(--info-bg);
  color: var(--primary);
  font-size: var(--fs-sm);
  font-weight: 750;
}
.legal__body p, .legal__body li { color: var(--text-muted); }
.legal__body p + p, .legal__body p + ul { margin-top: var(--s-3); }
.legal__body strong { color: var(--text); }
.legal__body ul { display: grid; gap: var(--s-2); padding-left: 1.2rem; }
.legal__body li::marker { color: var(--primary); }
.legal__body table { width: 100%; margin-top: var(--s-3); border-collapse: collapse; font-size: var(--fs-sm); }
.legal__body th, .legal__body td { padding: 0.65rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.legal__body th { font-size: var(--fs-xs); letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); background: var(--surface-2); }
.legal__body td { color: var(--text-muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.table-wrap table { margin: 0; min-width: 34rem; }
.table-wrap tr:last-child td { border-bottom: 0; }

.callout { margin-top: var(--s-4); padding: var(--s-4) var(--s-5); border-left: 4px solid var(--primary); border-radius: var(--r-sm); background: var(--info-bg); font-size: var(--fs-sm); }
.callout p { color: var(--text) !important; }
/* Segnaposto da compilare prima della pubblicazione */
mark.placeholder { padding: 0.05em 0.35em; border-radius: 0.3em; background: var(--warning-bg); color: var(--warning); font-weight: 650; }

/* ---------- 404 ---------- */
.notfound { position: relative; display: grid; place-items: center; min-height: calc(100dvh - var(--header-h)); padding-block: var(--s-7); overflow-x: clip; /* le nuvole non creano scorrimento, ma l'elenco della ricerca può uscire dal riquadro */ text-align: center; isolation: isolate; }
.notfound__sky { position: absolute; inset: 0; z-index: -1; background: radial-gradient(60rem 30rem at 50% 0%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 70%), radial-gradient(40rem 22rem at 50% 100%, color-mix(in srgb, var(--text) 6%, transparent), transparent 70%); }
.cloud { position: absolute; z-index: -1; color: var(--surface); filter: drop-shadow(0 8px 18px rgb(15 23 42 / 0.08)); animation: drift linear infinite; }
[data-theme='dark'] .cloud { color: var(--surface-2); }
.cloud svg { width: 100%; height: auto; fill: currentColor; }
.cloud--1 { top: 12%; left: -12rem; width: 11rem; animation-duration: 38s; }
.cloud--2 { top: 62%; left: -16rem; width: 15rem; animation-duration: 54s; animation-delay: -20s; opacity: 0.8; }
.cloud--3 { top: 32%; left: -9rem; width: 8rem; animation-duration: 46s; animation-delay: -34s; opacity: 0.65; }
@keyframes drift { to { transform: translateX(calc(100vw + 30rem)); } }
@media (prefers-reduced-motion: reduce) { .cloud, .notfound__code, .notfound__rays { animation: none; } .cloud--1 { left: 8%; } .cloud--2 { left: 62%; } .cloud--3 { left: 76%; } }

.notfound__inner { display: grid; justify-items: center; }
/* 4 ☀ 4 */
.notfound .notfound__code {
  display: flex; align-items: center; justify-content: center; gap: 0.02em;
  max-width: none; margin: 0;
  font-size: clamp(5.5rem, 3.5rem + 13vw, 12rem);
  font-weight: 850; line-height: 0.95; letter-spacing: -0.05em;
  animation: float 6s ease-in-out infinite;
}
.notfound__code > span {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--text)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.notfound__sun { width: 0.86em; height: 0.86em; flex: none; overflow: visible; }
.notfound__rays { transform-origin: 60px 60px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.notfound__cloud { fill: var(--surface); stroke: var(--border); stroke-width: 1.5; filter: drop-shadow(0 6px 10px rgb(15 23 42 / 0.12)); }
[data-theme='dark'] .notfound__cloud { fill: var(--surface-2); }
@keyframes float { 50% { transform: translateY(-10px); } }
.notfound h1 { margin-top: var(--s-4); font-size: var(--fs-xl); font-weight: 760; text-wrap: balance; }
.notfound .notfound__text { max-width: 32rem; margin: var(--s-3) auto 0; color: var(--text-muted); font-size: var(--fs-lg); text-wrap: balance; }
.notfound .notfound__path { max-width: 100%; margin-top: var(--s-4); padding: 0.25rem 0.8rem; font-size: var(--fs-xs); color: var(--text-muted); background: var(--surface-2); border-radius: var(--r-pill); }
.notfound__path[hidden] { display: none; }
.notfound__path code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: var(--text); overflow-wrap: anywhere; }

.notfound__search { width: min(100%, 30rem); margin-top: var(--s-6); padding: var(--s-4); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); text-align: left; }
.notfound__search h2 { margin-bottom: var(--s-3); font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted-strong, var(--text-muted)); text-align: center; text-wrap: balance; }
.notfound__search form { display: flex; gap: var(--s-2); align-items: stretch; }
.notfound__search .citysearch { flex: 1; width: auto; min-width: 0; }
.notfound__search form .btn { flex: none; min-height: 2.75rem; padding-inline: 1rem; font-size: var(--fs-base); }
@media (max-width: 30rem) { .notfound__search form .btn span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }
.notfound .geo-msg { margin: var(--s-2) 0 0; max-width: none; font-size: var(--fs-sm); font-weight: 600; color: var(--text); text-align: center; }
.notfound .geo-msg[data-tone='error'] { color: var(--danger); }
.notfound .geo-msg[hidden] { display: none; }

.notfound__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: center; margin-top: var(--s-5); }
.notfound .btn { min-height: 3rem; padding-inline: 1.4rem; font-size: var(--fs-md); }
.notfound .notfound__forecast { max-width: 26rem; margin-top: var(--s-6); font-size: var(--fs-xs); font-style: italic; color: var(--text-muted); }

/* Avviso "documenti solo in italiano" (visibile quando la lingua scelta non è l'italiano) */
.notice { margin-top: var(--s-5); padding: 0.8rem 1rem; border-radius: var(--r-md); background: var(--info-bg); font-size: var(--fs-sm); font-weight: 600; }


/* ---------- CREDITI E FONTI ---------- */
.credits { display: grid; gap: var(--s-7); padding-bottom: var(--s-7); }
.credits__group h2 { margin-bottom: var(--s-4); font-size: var(--fs-xs); font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.credits__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--s-4); list-style: none; margin: 0; padding: 0; }
.credits__card { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-5); }
.credits__card h3 { font-size: var(--fs-lg); font-weight: 750; letter-spacing: -0.01em; }
.credits__card p { font-size: var(--fs-sm); color: var(--text-muted-strong, var(--text-muted)); }
.credits__card .credits__lic { font-size: var(--fs-xs); color: var(--text-muted); }
.credits__link { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: auto; padding-top: var(--s-3); font-size: var(--fs-sm); font-weight: 700; color: var(--primary); text-decoration: none; }
.credits__link .icon { width: 1em; height: 1em; }
.credits__link:hover { text-decoration: underline; text-underline-offset: 3px; }
.credits__link:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: var(--r-sm); }
.credits__note { max-width: 46rem; font-size: var(--fs-sm); color: var(--text-muted); }


/* ---------- INFORMATIVA PRIVACY DELL'APP (app-privacy.html: pagina collegata dal Play Store, stesso indirizzo di sempre) ---------- */
.legal__hero h1 em { color: var(--primary); font-style: normal; }
.app-privacy__back { margin-bottom: var(--s-2); }
.legal__hero .app-privacy__back { font-size: var(--fs-sm); color: var(--text); }
.app-privacy__intro { padding-bottom: var(--s-5); }
.app-privacy__cards { margin-block: var(--s-3) 0; padding-left: 0; grid-template-columns: 1fr; }
.glance h3 { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); font-size: var(--fs-md); font-weight: 720; }
.app-privacy__cards li { list-style: none; }
.callout--danger { border-left-color: var(--danger); background: var(--danger-bg); }
.callout > p > span[aria-hidden] { margin-right: 0.4rem; }
.app-privacy__sign { margin-top: var(--s-5); font-style: italic; opacity: 0.8; }


/* Le tabelle larghe scorrono dentro il loro riquadro invece di allargare tutta la pagina (la colonna della griglia non deve adattarsi al contenuto) */
.legal__layout > * { min-width: 0; }
.legal__body table { min-width: 34rem; }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.legal__body code { padding: 0.05em 0.35em; border-radius: 0.3em; background: var(--surface-2); color: var(--text); font-size: 0.88em; overflow-wrap: anywhere; }
