/* The page transition that goes out like a candle: a dark page in warm light, a title, one link, one accent.
   On the click the light closes in to a point, flickers out, a thread of smoke rises, and the next page lights up. */
:root {
  --notte: #050403;      /* the dark around the light */
  --pagina: #14110d;     /* the page while it is lit */
  --pagina-cuore: #1e1913; /* the warmer middle of the lit page */
  --testo: #efe6d8;      /* the title and the link */
  --tenue: #8a8072;      /* the small lines */
  --accento: #ff8a3d;    /* the one accent: the warm light and the arrow */
  --fumo: #d6cdbf;       /* the thread of smoke */
}

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

html, body { height: 100%; }

body {
  background: var(--notte);
  color: var(--testo);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.scena {
  position: relative;
  height: 100vh;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* a page: a column in the middle, the header at the top */
.pagina {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.6vh, 22px);
  padding: 0 clamp(16px, 5vw, 56px);
  background: radial-gradient(ellipse 70% 60% at 50% 46%, var(--pagina-cuore), var(--pagina) 72%);
  visibility: hidden;
}
.pagina.is-on { visibility: visible; }

.testa {
  position: absolute;
  top: clamp(14px, 4vh, 34px);
  left: clamp(16px, 5vw, 56px);
  right: clamp(16px, 5vw, 56px);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: clamp(11px, min(1.6vw, 2.4vh), 14px);
  letter-spacing: 0.02em;
}
.marchio { font-weight: 640; font-variation-settings: 'wdth' 112; }
.voce { color: var(--tenue); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the title: one span per letter, the script writes their weight as the light passes them */
.titolo {
  font-size: clamp(38px, min(14.5vw, 17vh), 150px);
  font-weight: 620;
  line-height: 0.95;
  letter-spacing: -0.035em;
  white-space: nowrap;
  text-align: center;
}
.titolo .l { display: inline-block; white-space: pre; font-kerning: normal; }

.riga-sotto {
  color: var(--tenue);
  font-size: clamp(12px, min(2vw, 2.8vh), 17px);
  text-align: center;
  max-width: 34ch;
}

/* the link: the arrow takes the accent; on hover the text widens and a warm breath lights under it */
.vai {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-top: clamp(4px, 1.6vh, 14px);
  padding: 0.7em 1.15em;
  color: var(--testo);
  text-decoration: none;
  font-size: clamp(13px, min(2vw, 2.9vh), 17px);
  font-weight: 520;
  border-radius: 999px;
  border: 1px solid rgba(239, 230, 216, 0.16);
  transition: border-color 0.5s ease, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.vai::before {
  content: '';
  position: absolute;
  inset: -40% -20%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 138, 61, 0.16), rgba(255, 138, 61, 0));
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.25, 1.4, 0.5, 1);
  pointer-events: none;
}
.vai__t {
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.vai__freccia {
  width: 1.45em;
  height: 0.7em;
  fill: none;
  stroke: var(--accento);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.3, 1.7, 0.5, 1);
}
.vai:active { transform: scale(0.97); }
.vai:focus-visible { outline: 1px solid var(--accento); outline-offset: 4px; }
@media (hover: hover) {
  .vai:hover { border-color: rgba(255, 138, 61, 0.5); }
  .vai:hover::before { opacity: 1; transform: scale(1); }
  .vai:hover .vai__t { font-variation-settings: 'wdth' 110; }
  .vai:hover .vai__freccia { transform: translateX(3px); }
  .vai--torna:hover .vai__freccia { transform: translateX(-3px); }
}

/* the dark and the warm glow: the script writes their gradients every frame */
.buio, .calore {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.calore { mix-blend-mode: screen; }

.fumo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.fumo path {
  fill: none;
  stroke: url(#sfuma);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fumo__filo { stroke-width: 1.35; }
.fumo__velo { stroke-width: 5; opacity: 0.22; }
