/* ============================================================
   Il Caffettino — Base
   Font self-hosted, reset, fondamenta tipografiche e layout.
   ============================================================ */

/* ---------- Fustat self-hosted (woff2 + ttf fallback) ---------- */
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-ExtraLight.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-ExtraLight.ttf') format('truetype');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-Light.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-Regular.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-Medium.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-SemiBold.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-Bold.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fustat';
  src: url('../../assets/fonts/Fustat-ExtraBold.woff2') format('woff2'),
       url('../../assets/fonts/Fustat-ExtraBold.ttf') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--color-text-primary);
  background: var(--color-bg-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

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

ul,
ol {
  list-style: none;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container-max) + 2 * var(--container-pad));
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ---------- Stili di testo (type ramp Foundations) ---------- */
.t-display-hero {
  font-size: var(--fs-display-hero);
  font-weight: 800;
  line-height: var(--lh-display-hero);
  letter-spacing: var(--ls-display-hero);
}
.t-display {
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
}
.t-display-number {
  font-size: var(--fs-display-number);
  font-weight: 800;
  line-height: var(--lh-display-number);
  letter-spacing: var(--ls-display-number);
}
.t-h1 {
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: var(--lh-h1);
  letter-spacing: var(--ls-h1);
}
.t-h2 {
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: var(--lh-h2);
  letter-spacing: var(--ls-h2);
}
.t-h3 {
  font-size: var(--fs-h3);
  font-weight: 800;
  line-height: var(--lh-h3);
  letter-spacing: var(--ls-h3);
}
.t-h4 {
  font-size: var(--fs-h4);
  font-weight: 700;
  line-height: var(--lh-h4);
  letter-spacing: var(--ls-h4);
}
.t-h5 {
  font-size: var(--fs-h5);
  font-weight: 700;
  line-height: var(--lh-h5);
  letter-spacing: var(--ls-h5);
}
.t-h6 {
  font-size: var(--fs-h6);
  font-weight: 700;
  line-height: var(--lh-h6);
}
.t-lead {
  font-size: var(--fs-lead);
  font-weight: 500;
  line-height: var(--lh-lead);
}
.t-lead-sm {
  font-size: var(--fs-lead-sm);
  font-weight: 500;
  line-height: var(--lh-lead-sm);
}
.t-body-lg {
  font-size: var(--fs-body-lg);
  font-weight: 400;
  line-height: var(--lh-body-lg);
}
.t-body {
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: var(--lh-body);
}
.t-body-md {
  font-size: var(--fs-body-md);
  font-weight: 500;
  line-height: var(--lh-body-md);
}
.t-body-sm {
  font-size: var(--fs-body-sm);
  font-weight: 400;
  line-height: var(--lh-body-sm);
}
.t-eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  line-height: var(--lh-eyebrow);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
}
.t-eyebrow-sm {
  font-size: var(--fs-eyebrow-sm);
  font-weight: 600;
  line-height: var(--lh-eyebrow-sm);
  letter-spacing: var(--ls-eyebrow-sm);
  text-transform: uppercase;
}
.t-label-lg {
  font-size: var(--fs-label-lg);
  font-weight: 600;
  line-height: var(--lh-label-lg);
}
.t-label {
  font-size: var(--fs-label);
  font-weight: 600;
  line-height: var(--lh-label);
}
.t-meta {
  font-size: var(--fs-meta);
  font-weight: 500;
  line-height: var(--lh-meta);
}

/* ---------- Visibilità per breakpoint ----------
   m-only: solo mobile/tablet (<1024) · d-only: solo desktop (≥1024) */
@media (max-width: 1023.98px) {
  .d-only { display: none !important; }
  .d-only-inline { display: none !important; }
}
@media (min-width: 1024px) {
  .m-only { display: none !important; }
  .m-only-inline { display: none !important; }
}

/* ---------- Accessibilità ---------- */
.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: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--color-bg-accent);
  color: var(--color-text-on-accent);
  font-weight: 600;
  border-radius: var(--radius-full);
  transform: translateY(-200%);
  transition: transform 200ms var(--ease-out);
}
.skip-link:focus-visible {
  transform: none;
}

/* ---------- Reveal allo scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-reveal) var(--ease-reveal),
    transform var(--dur-reveal) var(--ease-reveal);
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* Promozione a layer solo durante l'ingresso (la toglie main.js a fine animazione) */
.reveal.will-anim,
[data-stagger].will-anim > * {
  will-change: opacity, transform;
}

/* Gruppi con ingresso a cascata: i figli entrano uno dopo l'altro
   (il ritardo incrementale è impostato da main.js e poi rimosso,
   così le transizioni di hover non ereditano il delay). */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity var(--dur-reveal) var(--ease-reveal),
    transform var(--dur-reveal) var(--ease-reveal);
}
[data-stagger].is-visible > * {
  opacity: 1;
  transform: none;
}

@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;
  }
  .reveal,
  [data-stagger] > * {
    opacity: 1;
    transform: none;
  }
}
