/* ==========================================================================
   BASE — reset, tipografia, layout di base
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-body);
  -webkit-font-smoothing: antialiased;
}

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

img {
  border-radius: var(--img-radius);
}

a {
  color: inherit;
  text-decoration: none;
}

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

h1,
h2,
h3,
h6,
p {
  margin: 0;
}

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

/* Azzera l'outline nativo del browser (es. il riquadro blu di default):
   senza questo reset, quando :focus-visible scatta ma non siamo in
   "is-tabbing", il browser applica comunque il proprio stile predefinito. */
a:focus-visible,
button:focus-visible {
  outline: none;
}

/* Focus visibile solo per navigazione da tastiera reale (classe "is-tabbing"
   impostata da js/main.js). Evita che il riquadro compaia sui dispositivi
   touch quando il focus viene spostato via script (es. apertura/chiusura
   del menu mobile), caso in cui l'euristica nativa di :focus-visible di
   alcuni browser mobile scatta comunque. */
html.is-tabbing a:focus-visible,
html.is-tabbing button:focus-visible {
  outline: 1px solid #FFFFFF;
  outline-offset: 3px;
}

/* Tipografia */
.h3 {
  font-weight: var(--fw-bold);
  font-size: clamp(31px, 17.74px + 3.54vw, var(--fs-h3));
  line-height: 0.952; /* 60px / 63px, come da design-token.md */
  letter-spacing: var(--ls-h3);
}

.h4 {
  font-weight: var(--fw-bold);
  font-size: clamp(23px, 13.2px + 2.64vw, var(--fs-h4));
  line-height: 1.064; /* 50px / 47px, come da design-token.md */
  letter-spacing: var(--ls-h4);
}

h6,
.h6 {
  font-weight: var(--fw-bold);
  font-size: var(--fs-h6);
  line-height: var(--lh-h6);
  letter-spacing: var(--ls-h6);
}

.label {
  font-size: var(--fs-label);
  line-height: 1.2; /* 18px / 15px, come da design-token.md */
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
}

.numero-servizio {
  font-size: var(--fs-numero);
  font-weight: var(--fw-medium);
}

/* Layout */
.container {
  max-width: var(--content-max-width);
  margin-inline: auto;
  padding-inline: var(--margin-x);
}

.section {
  padding-block: var(--section-padding-y);
}

.divider {
  border: none;
  border-top: 1px solid var(--color-divider);
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 1000;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  padding: 12px 20px;
  border: 1px solid var(--color-accent);
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

/* --- Cursore personalizzato (Reference/Design Token/design-token.md) -------
   Attivato via JS solo su dispositivi con puntatore fine (mouse/trackpad):
   in assenza di JS o su touch resta il cursore di sistema. -------------------- */
html.custom-cursor-active,
html.custom-cursor-active * {
  cursor: none;
}

.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFFFFF;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.custom-cursor--visible {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
