/* ==========================================================================
   base.css · font, reset leggero, tipografia, link, focus, accessibilità
   Non contiene classi di componenti: quelle stanno in layout.css e components.css.
   ========================================================================== */

/* ---- Font in locale (SIL OFL 1.1, vedi ../fonts/README.md). Solo i caratteri per l'italiano: li genera tools/subset_fonts.py, lo stesso elenco è qui sotto ---- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00A1, U+00A7, U+00A9-00AB, U+00B0-00B1, U+00B7, U+00BA-00BB, U+00BF-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+20AC, U+2192, U+2212;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-italic-latin.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00A1, U+00A7, U+00A9-00AB, U+00B0-00B1, U+00B7, U+00BA-00BB, U+00BF-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+20AC, U+2192, U+2212;
}

@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-00A1, U+00A7, U+00A9-00AB, U+00B0-00B1, U+00B7, U+00BA-00BB, U+00BF-00FF, U+2013-2014, U+2018-201A, U+201C-201E, U+2022, U+2026, U+20AC, U+2192, U+2212;
}

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

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

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

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

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

button {
  cursor: pointer;
}

[data-button-motion] {
  --button-motion-scale: 1;
}

/* Nelle foto si anima la lente: il bersaglio trasparente resta sulla cornice. */
[data-button-motion]:not(.zoom-button),
.zoom-button[data-button-motion] > svg {
  scale: var(--button-motion-scale);
}

/* Il nastro della Home occupa tutta la larghezza dello schermo. */
.marquee[data-button-motion] {
  scale: 1 var(--button-motion-scale);
}

[hidden] {
  display: none !important;
}

/* ---- Pagina ---- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* L'header resta in alto mentre si scorre: le ancore (#id) e il focus non devono finirci sotto */
  scroll-padding-top: calc(var(--header-offset, var(--header-h)) + var(--sp-1));
}

/* Sotto 48em la barra fissa in basso non deve coprire l'elemento che riceve il focus (WCAG 2.4.11) */
@media (max-width: 47.999em) {
  html {
    scroll-padding-bottom: calc(var(--action-bar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-2));
  }
}

/* Senza script il focus sui campi del modulo deve spostarsi subito. */
@media (prefers-reduced-motion: no-preference) {
  html.js {
    scroll-behavior: smooth;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-testo);
  font-size: var(--fs-base);
  line-height: var(--lh-testo);
  color: var(--testo);
  background: var(--carta);
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

::selection {
  background: var(--caramello-chiaro);
  color: var(--cioccolato);
}

/* ---- Tipografia ---- */
h1, h2, h3, h4 {
  font-family: var(--font-titoli);
  font-weight: 400;
  line-height: var(--lh-titoli);
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }

h3 {
  font-size: var(--fs-h3);
  line-height: 1.05;
}

/* Corsivo dorato dei titoli, come nella demo: solo h1 e h2 (sempre >= 38px, quindi "testo grande" per il contrasto) */
h1 em,
h2 em {
  font-style: italic;
  font-weight: 300;
  color: var(--accento);
}

h3 em {
  font-style: italic;
  font-weight: 300;
}

:where(p) {
  max-width: var(--misura);
  text-wrap: pretty;
}

b,
strong {
  font-weight: 700;
}

small {
  font-size: var(--fs-small);
}

address {
  font-style: normal;
}

hr {
  border: 0;
  border-top: 0.0625rem solid var(--linea);
}

::placeholder {
  color: var(--caffelatte);
  opacity: 1;
}

/* ---- Link: nel testo sono sempre sottolineati; i componenti scelgono se togliere la linea ---- */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
}

a:hover {
  text-decoration-thickness: 0.16em;
}

/* ---- Focus visibile: anello di 2px, colore dal contesto (crema sui fondi scuri) ---- */
:focus-visible {
  outline: 0.125rem solid var(--focus);
  outline-offset: 0.1875rem;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Accessibilità ---- */
.skip-link {
  position: absolute;
  top: -10rem;
  left: var(--sp-2);
  z-index: 100;
  padding: 0.75rem 1.25rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--cioccolato);
  background: var(--crema);
  border: 0.125rem solid var(--cioccolato);
  border-radius: 0 0 var(--raggio) var(--raggio);
}

.skip-link:focus {
  top: 0;
}

.visually-hidden:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
