:root {
  --carta: #f6f4ef;          /* the warm white paper of the first and last chapter */
  --indaco: #4b3bff;         /* the one accent: the indigo of the pitch chapter */
  --notte: #0e0c14;          /* the near black of the keynote chapter */
  --inchiostro: #17141f;     /* the ink on the paper */
  --latte: #f6f4ef;          /* the ink on the indigo and on the near black */
  --fumo: rgba(23, 20, 31, 0.56); /* the soft ink of the small notes on paper */
  --fumo-chiaro: rgba(246, 244, 239, 0.62); /* the soft ink on the dark colours */
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--carta); color: var(--inchiostro); }
html.lenis, html.lenis body { height: auto; }
body {
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.fondo {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%; display: block;
  pointer-events: none;
}

.testa {
  position: fixed; inset: 0 0 auto; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: clamp(12px, 2.4vh, 22px) clamp(14px, 3vw, 32px);
  font-size: clamp(10px, 1.6vh, 12.5px); letter-spacing: 0.02em;
  color: var(--inchiostro);
  transition: color 0.28s cubic-bezier(.3, 0, .2, 1);
  pointer-events: none;
}
.testa p { margin: 0; display: flex; align-items: center; gap: 0.5em; }
.testa__marca { font-weight: 620; font-variation-settings: "wdth" 104; }
.testa__marca svg { width: 1.6em; height: 1.6em; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.testa .testa__capitolo {
  align-items: flex-start;
  height: 1.3em; overflow: hidden; opacity: 0.72;
  font-variation-settings: "wdth" 112;
}
.testa__rullo { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3em; }
.testa__rullo span { display: block; height: 1.3em; }

main { position: relative; z-index: 1; }

.capitolo {
  position: relative;
  height: 100vh;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 12vh clamp(18px, 8vw, 120px) 8vh;
  color: var(--inchiostro);
}
.capitolo__dentro { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(8px, 2vh, 18px); }
.capitolo[data-colore="indaco"], .capitolo[data-colore="notte"] { color: var(--latte); }

.occhiello {
  margin: 0; font-size: clamp(10px, min(1.8vw, 1.9vh), 13px); letter-spacing: 0.06em; text-transform: uppercase;
  font-variation-settings: "wdth" 118; font-weight: 520; opacity: 0.66;
}
.titolo {
  margin: 0; max-width: 11ch;
  font-weight: 640; font-variation-settings: "wdth" 100;
  font-size: clamp(30px, min(9.2vw, 10.4vh), 112px); line-height: 0.94; letter-spacing: -0.025em;
}
.titolo .riga { display: inline-block; vertical-align: top; overflow: clip; padding: 0 0.04em 0.08em; margin: 0 -0.04em -0.08em; }
.titolo .parola { display: inline-block; will-change: transform; }
.nota { margin: 0; max-width: 34ch; font-size: clamp(11px, min(2vw, 2.1vh), 15px); line-height: 1.45; opacity: 0.68; }

.invito { margin: clamp(6px, 2vh, 20px) 0 0; display: flex; align-items: center; gap: 0.5em; font-size: clamp(10px, 1.6vh, 12px); opacity: 0.6; }
.invito svg { width: 0.8em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; animation: invito 2.4s cubic-bezier(.45, 0, .2, 1) infinite; }
@keyframes invito { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

.azione { margin: clamp(4px, 1.4vh, 14px) 0 0; }
.pillola {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6em;
  padding: 0 1.5em; height: clamp(40px, 6.4vh, 52px);
  font-size: clamp(12px, min(2vw, 2.1vh), 15px); font-weight: 560; letter-spacing: 0.01em;
  font-variation-settings: "wdth" 100;
  color: var(--latte); text-decoration: none;
  transition: font-variation-settings 0.5s cubic-bezier(.2, 1.4, .3, 1);
}
.pillola__fondo {
  position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: var(--indaco);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 10px 24px -14px rgba(75, 59, 255, 0.9);
}
.pillola__freccia { width: 0.95em; height: 0.95em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .pillola:hover { font-variation-settings: "wdth" 116; }
}

/* reduced motion: no canvas, every chapter keeps its own colour */
.ridotto .fondo { display: none; }
.ridotto .capitolo[data-colore="carta"] { background: var(--carta); }
.ridotto .capitolo[data-colore="indaco"] { background: var(--indaco); }
.ridotto .capitolo[data-colore="notte"] { background: var(--notte); }
.ridotto [data-entra], .ridotto .titolo { opacity: 0; transition: opacity 0.7s ease; }
.ridotto .vista [data-entra], .ridotto .vista .titolo { opacity: 1; }
