*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: calc(var(--header-height) + var(--space-6));
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6, p { margin: 0 0 var(--space-4); }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-heading);
  color: var(--primary);
  letter-spacing: -0.02em;
}
body h1 { font-size: var(--text-h1); line-height: var(--leading-h1); }
body h2 { font-size: var(--text-h2); line-height: var(--leading-h2); }
body h3 { font-size: var(--text-h3); line-height: var(--leading-h3); }
body h4, body h5, body h6 { font-size: var(--text-body); line-height: var(--leading-body); }
body .home-hero h1 {
  font-size: var(--text-home);
  line-height: var(--leading-home);
  letter-spacing: -0.025em;
}
/* Le classi storiche che usano font-heading ereditano il sans nell'area operativa. */
body.area-admin, body:has(.login-shell) {
  --font-heading: var(--font-body);
  background: var(--admin-bg);
}
body.area-admin .admin-main h1, body .login-card h1 {
  font-size: var(--text-admin-h1);
  line-height: var(--leading-admin-h1);
}
body.area-admin h2 { font-size: 22px; line-height: 29px; }
body.area-admin h3 { font-size: 18px; line-height: 25px; }
.landing-header, footer, dialog, .toast-region { font-family: var(--font-body); }
body dialog h2 { font-family: var(--font-body); font-size: 22px; line-height: 29px; }
a {
  color: var(--link);
  text-underline-offset: 3px;
  transition: color var(--transition);
}
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.65; }
img { display: block; max-width: 100%; height: auto; }
picture { display: block; }
svg { flex-shrink: 0; }
input, textarea, select { min-width: 0; max-width: 100%; }
fieldset { min-width: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  transform: translateY(-200%);
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 5000;
}
.skip-link:focus { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
