/* ─────────────────────────────────────────────────────────────────
   Reset minimo + base elementi.
   ───────────────────────────────────────────────────────────────── */

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

/* L'attributo `hidden` deve sempre vincere sui display:flex/grid che mettiamo
   sui contenitori (.page, .view, .sheet, .empty, ecc.). Altrimenti le viste
   si impilano sovrapposte. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  min-height: 100vh;
  /* Niente bounce overscroll su iOS dentro l'app */
  overscroll-behavior-y: contain;
}

/* Disabilita tap highlight grigia, ma mantengo focus visibile */
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* Focus visibile e sempre coerente */
:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus);
  border-radius: var(--r-sm);
}

a {
  color: var(--c-info);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

h1, h2, h3, h4 { margin: 0; line-height: var(--lh-snug); font-weight: var(--fw-bold); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-body); font-weight: var(--fw-medium); }

p { margin: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Visivamente nascosto, accessibile a screen reader */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Container app */
.app-shell {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
}

/* Tipografia tabulare per i numeri di score */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' on, 'lnum' on;
}

/* Etichette uppercase tracking */
.label {
  font-size: var(--fs-label);
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text-muted);
}
