/* =========================================================================
   02-reset.css — @layer reset
   Normalizzazione minima. Nessuna decisione estetica vive qui.
   ========================================================================= */

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

  html {
    /* clip e non hidden: hidden su html o body rompe position:sticky */
    overflow-x: clip;
    scroll-behavior: smooth;
    /* L'header e' sticky: le ancore devono atterrare sotto di lui */
    scroll-padding-top: calc(var(--header-h) + 16px);
    -webkit-text-size-adjust: 100%;
  }

  body {
    margin: 0;
    color: var(--page-ink);
    background: var(--page-bg);
    font-family: var(--body);
    font-size: var(--fs-body);
    line-height: 1.65;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1,
  h2,
  h3,
  h4,
  p,
  figure,
  blockquote,
  dl,
  dd,
  ol,
  ul {
    margin: 0;
  }

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

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

  img {
    height: auto;
  }

  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }

  button {
    cursor: pointer;
  }

  button,
  a {
    -webkit-tap-highlight-color: transparent;
  }

  table {
    width: 100%;
    border-collapse: collapse;
  }

  th {
    text-align: left;
  }

  /* Il foglio di stile del browser applica font-size: smaller a <small>: dentro
     una label da 12px produce 10px, cioe' sotto il minimo renderizzabile. La
     dimensione la decide sempre il componente. */
  small {
    font-size: inherit;
  }

  summary {
    cursor: pointer;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  ::selection {
    color: var(--ink);
    background: var(--amber);
  }

  /* Focus: l'anello non e' mai dello stesso colore del fondo su cui appare.
     Nei contesti gia' ambra la skin o il componente riassegna --focus-ring. */
  :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 3px;
    border-radius: inherit;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      scroll-behavior: auto !important;
      transition-duration: 0.01ms !important;
    }
  }
}
