/* =========================================================
   ALSA Ingegneria — Reset CSS
   Azzeramento degli stili di user-agent (Chrome / Safari /
   Firefox / Edge). Da caricare PRIMA di style.css.
   ========================================================= */

/* -----------------------------
   1. Box model coerente
   ----------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* -----------------------------
   2. Reset di margine e padding
   ----------------------------- */
html,
body,
h1, h2, h3, h4, h5, h6,
p, blockquote, pre,
figure, figcaption,
ul, ol, dl, dd,
fieldset, legend {
  margin: 0;
  padding: 0;
}

/* -----------------------------
   3. Documento base
   ----------------------------- */
html {
  /* Evita ridimensionamento testo su iOS in landscape */
  -webkit-text-size-adjust: 100%;
  /* Migliora la resa dei caratteri */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Scroll fluido (CSS gestisce reduce-motion) */
  scroll-behavior: smooth;
  /* Altezza minima utile per layout full-bleed */
  min-height: 100%;
  line-height: 1.5;
  /* Niente font-style di sistema per quote etc. */
  font-style: normal;
  /* NB: non impostare overflow-x: hidden qui, romperebbe position: sticky */
}

body {
  min-height: 100vh;
  min-height: 100svh; /* small viewport iOS */
  line-height: inherit;
  /* Niente background bianco di default — lo gestisce style.css */
  background: transparent;
  color: inherit;
}

/* -----------------------------
   4. Tipografia
   ----------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* Cifre tabellari uniformi per numeri e codici */
.mono,
code, kbd, samp, pre {
  font-feature-settings: "tnum" 1;
}

/* -----------------------------
   5. Liste — rimuovo solo dove ARIA list NON è dichiarato
   ----------------------------- */
ul[role="list"],
ol[role="list"],
ul[class],
ol[class] {
  list-style: none;
}

/* -----------------------------
   6. Link
   ----------------------------- */
a {
  color: inherit;
  text-decoration: none;
  background-color: transparent;
}
a:not([class]) {
  /* Sottolineatura discreta per link in prosa */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* -----------------------------
   7. Media
   ----------------------------- */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img,
video {
  /* Niente bordi spuri su IE-legacy / form image */
  border-style: none;
}

svg {
  fill: currentColor;
}

/* -----------------------------
   8. Form — reset aggressivo
   ----------------------------- */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  background: transparent;
  border: 0;
  margin: 0;
  padding: 0;
  /* Niente bordi arrotondati di sistema (iOS, Safari) */
  border-radius: 0;
  /* Niente appearance di sistema */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

button,
[type="button"],
[type="submit"],
[type="reset"] {
  cursor: pointer;
  background: transparent;
  /* Niente inset di Safari/iOS */
  -webkit-tap-highlight-color: transparent;
}
button:disabled,
[disabled] {
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  /* Niente overflow di default visibile su IE */
  overflow: auto;
}

select {
  /* Riapplico una freccia di sistema neutra */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(-45deg, transparent 50%, currentColor 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* Niente outline di default brutto */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Number input — niente frecce in Chrome / Firefox */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Search input — niente "X" e niente decoration di Safari */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* Placeholder coerente */
::placeholder {
  color: inherit;
  opacity: 0.5;
}

/* Autofill — evito il giallo Chrome */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: inherit;
  transition: background-color 9999s ease-in-out 0s;
}

/* -----------------------------
   9. Tabelle
   ----------------------------- */
table {
  border-collapse: collapse;
  border-spacing: 0;
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0;
}

/* -----------------------------
   10. Misc
   ----------------------------- */
hr {
  height: 1px;
  border: 0;
  background: currentColor;
  opacity: 0.15;
  margin: 0;
}

[hidden],
template {
  display: none !important;
}

details > summary {
  cursor: pointer;
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

mark {
  background: transparent;
  color: inherit;
}

small {
  font-size: 0.85em;
}

sub, sup {
  font-size: 0.75em;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sup { top: -0.5em; }
sub { bottom: -0.25em; }

iframe {
  border: 0;
}

/* Default focus per touch — evita il flash blu su iOS Safari */
a, button, input, textarea, select {
  -webkit-tap-highlight-color: transparent;
}

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

/* -----------------------------
   12. Stampa
   ----------------------------- */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  a, a:visited { text-decoration: underline; }
  thead { display: table-header-group; }
  tr, img { page-break-inside: avoid; }
  p, h2, h3 { orphans: 3; widows: 3; }
  h2, h3 { page-break-after: avoid; }
}
