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

* {
  margin: 0;
}

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

html {
  color-scheme: dark;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--gold);
  color: var(--bg-sunken);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: var(--s4);
}

.chapter {
  padding-block: var(--s8);
  border-top: 1px solid var(--line);
  /* lo sticky header copre l'inizio della sezione dopo scroll da CTA/ancora */
  scroll-margin-top: calc(56px + var(--s2));
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h1.display {
  font-size: var(--text-display);
}

h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--s5);
}

a {
  color: var(--gold);
  text-decoration-thickness: from-font;
  text-underline-offset: 3px;
}

.chart-host {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-sunken);
  border-radius: var(--r1);
  overflow: hidden;
}

@media (max-width: 640px) {
  .chart-host {
    aspect-ratio: 4 / 5;
  }
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--s2);
  left: var(--s2);
  z-index: var(--z-toast);
  background: var(--bg-elev);
  color: var(--ink);
  padding: var(--s2) var(--s4);
  border-radius: var(--r1);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-sunken);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
