/* ═══ Token, reset e layout generale ═══════════════════════════════════════ */

:root {
  --bg: #0c0e14;
  --surface: #13151f;
  --surface-2: #1c1f2e;
  --surface-3: #252840;
  --border: #2a2d45;
  --text: #e4e8f7;
  --muted: #8a90b0;

  --accent: #5b6af0;
  --accent-strong: #4a59e0;
  --accent-soft: rgba(91, 106, 240, .16);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, .14);
  --amber: #f0a050;
  --amber-soft: rgba(240, 160, 80, .14);
  --red: #f05b5b;
  --red-soft: rgba(240, 91, 91, .12);

  --radius: 14px;
  --radius-sm: 10px;
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --max: 1080px;
  --gutter: 16px;
  --nav-h: 64px;
  --desktop: 900px; /* soglia mobile → desktop (usata nei media query) */
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ─── Testo di servizio ───────────────────────────────────────────────── */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.empty { color: var(--muted); text-align: center; padding: 20px 0; }

/* ─── Barra superiore ─────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px max(var(--gutter), env(safe-area-inset-right)) 10px max(var(--gutter), env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.brand { display: flex; align-items: center; font-size: 20px; font-weight: 800; letter-spacing: -.02em; text-decoration: none; }
.brand-sheet { margin-left: 2px; padding: 2px 8px; border-radius: 6px; background: var(--accent-strong); color: #fff; }

/* ─── Menu: barra in basso su mobile, voci in alto su desktop ─────────── */
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-link {
  flex: 1;
  min-height: var(--nav-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.nav-link.is-active { color: var(--accent); }

/* ─── Contenuto ───────────────────────────────────────────────────────── */
.app {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px max(var(--gutter), env(safe-area-inset-right)) calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.view-narrow { max-width: 460px; margin: 0 auto; }

.footer {
  padding: 8px var(--gutter) calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .nav {
    position: static;
    inset: auto;
    background: none;
    border: 0;
    padding: 0;
    margin-left: 16px;
    gap: 4px;
  }
  .nav-link { flex: none; min-height: 40px; flex-direction: row; gap: 8px; padding: 0 16px; border-radius: 999px; font-size: 14px; }
  .nav-link:hover { background: var(--surface-2); color: var(--text); }
  .nav-link.is-active { background: var(--accent-soft); }
  .app { padding-top: 32px; padding-bottom: 40px; }
  .footer { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Telefoni molto stretti (≤ 360px): barra superiore più compatta, senza scroll laterale */
@media (max-width: 360px) {
  .topbar-inner { gap: 8px; }
  .topbar-actions { gap: 4px; }
  .brand { font-size: 17px; }
  .brand-sheet { padding: 2px 6px; }
  .lang-btn { min-width: 34px; padding: 0 8px; }
}
