:root {
  --carta: #eff0ef;
  --inchiostro: #0d1015;
  --salvia: #c4cfc6;
  --salvia-scura: #929c99;
  --tenue: #6d7673;
  --raggio: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { background: var(--carta); }
html.lenis, html.lenis body { height: auto; }

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(11px, 1.05vw, 14px);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* the story: a tall section, a stage that stays on screen */
.storia { position: relative; height: 480vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
}

/* a very fine paper grain, still */
.grana {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.05 0 0 0 0 0.06 0 0 0 0 0.08 0 0 0 0.07 0'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
}

.barra {
  position: absolute;
  z-index: 3;
  top: min(4vh, 26px);
  left: 5vw;
  right: 5vw;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.marchio {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(15px, 1.5vw, 20px);
  letter-spacing: 0.22em;
}
.capi { display: flex; gap: clamp(12px, 1.6vw, 22px); }
.capo {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: clamp(10px, 0.85vw, 12px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--salvia-scura);
  font-variation-settings: 'wdth' 90;
  font-weight: 450;
  transition: color 0.5s cubic-bezier(.645, .045, .355, 1), font-variation-settings 0.5s cubic-bezier(.645, .045, .355, 1), font-weight 0.5s cubic-bezier(.645, .045, .355, 1);
}
.capo[aria-current="true"] { color: var(--inchiostro); font-variation-settings: 'wdth' 118; font-weight: 600; }
.capo:focus-visible { outline: 1px solid var(--inchiostro); outline-offset: 4px; border-radius: 2px; }
@media (hover: hover) {
  .capo:hover { color: var(--inchiostro); }
}

/* a chapter fills the stage; only one is shown at a time */
.capitolo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  visibility: hidden;
}
.capitolo.is-attivo { visibility: visible; }

.motto {
  position: relative;
  z-index: 2;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: min(8.4vw, 9vh);
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  will-change: transform;
}
.motto em { font-style: italic; }
/* each line clips its own text: room above and below for the ascenders and the italic tails */
.riga {
  display: block;
  overflow: clip;
  padding: 0.2em 0.12em 0.2em;
  margin: -0.2em 0 -0.2em;
  white-space: nowrap;
}
.riga__in { display: inline-block; transform-origin: 0% 100%; }

/* the two pictures beside the headline: GSAP moves the figure, the inner box opens and folds */
.carta {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: min(15vw, 26vh);
  aspect-ratio: 1 / 1.2;
  will-change: transform;
}
.carta--sinistra { left: 7vw; }
.carta--destra { right: 7vw; }
.media {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--raggio);
  overflow: hidden;
  transform-origin: 50% 100%;
  box-shadow: 0 1px 1px rgba(13, 16, 21, 0.05), 0 14px 30px -18px rgba(13, 16, 21, 0.35);
}
.media img { display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 60%; }
/* a glint that crosses the ice, and the light that runs down the glass */
.lampo {
  position: absolute; inset: -40% auto -40% 0; width: 28%;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.55), rgba(255,255,255,0));
  pointer-events: none; mix-blend-mode: soft-light;
}
.riflesso {
  position: absolute; left: 44%; top: 30%; width: 3%; height: 18%; border-radius: 99px;
  background: rgba(255,255,255,0.75); filter: blur(1px); pointer-events: none; opacity: 0.2;
}

/* the small caption under it all */
.nota {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 6vh;
  width: min(46ch, 84vw);
  margin-left: calc(min(46ch, 84vw) / -2);
  text-align: center;
  will-change: transform;
}
.nota__titolo {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-variation-settings: 'wdth' 110;
  font-weight: 560;
  font-size: clamp(10px, 0.85vw, 12px);
}
.nota__testo { margin-top: 0.5em; color: var(--tenue); }
.nota p { overflow: clip; }

.scendi {
  position: absolute;
  z-index: 2;
  left: 5vw;
  bottom: 6vh;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tenue);
}
.scendi svg { width: 8px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.2; }

.chiusa {
  height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2vh;
  border-top: 1px solid rgba(13, 16, 21, 0.12);
  margin: 0 5vw;
}
.chiusa__marchio { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-size: min(12vw, 16vh); line-height: 1; }
.chiusa__riga { color: var(--tenue); }

/* tall, narrow screens: the pictures go above and below the headline */
@media (max-aspect-ratio: 1 / 1) {
  .motto { font-size: min(9.2vw, 7.4vh); }
  .carta { width: min(21vw, 15.5vh); }
  .carta--sinistra { left: 8vw; top: 22%; }
  .carta--destra { right: 8vw; top: 76%; }
  .nota { bottom: 4vh; }
  .nota__testo { display: none; }
  .scendi { display: none; }
}
