/* The words that light up out of the fog on scroll. Colours in :root (the Playground palette): one accent, mint, for
   the italic words, the glow and the bright front; everything else is ivory on a deep green-black. The five tones are
   the very slight shift of the ground between one sentence and the next (moved by the script). */
:root {
  --fondo: #060908;          /* the page */
  --tono-1: #0b1512;         /* the soft light behind the first sentence */
  --tono-2: #0d1316;         /* behind the second */
  --tono-3: #0f1712;         /* behind the third */
  --tono-4: #0c1418;         /* behind the fourth */
  --tono-5: #10191a;         /* behind the last */
  --avorio: #efeae0;         /* the big serif words */
  --avorio-basso: #c9d4cc;   /* the bottom of the big words (a soft gradient) */
  --tenue: #9aa6a0;          /* the small words */
  --menta: #a9eccd;          /* the accent: italic words, glow, bright front */
  --linea: rgba(239, 234, 224, 0.1); /* hairlines */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--fondo); }
html, body { overflow-x: clip; }
body {
  background: var(--fondo);
  color: var(--avorio);
  font-family: 'Instrument Sans Variable', 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.story { position: relative; height: calc(520vh * var(--lungo, 1)); }
.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background: var(--fondo);
}
@supports (height: 100lvh) { .stage { height: 100lvh; } }

/* the light behind the words, its tone moved by the script */
.tone {
  position: absolute;
  inset: -10%;
  z-index: -2;
  background:
    radial-gradient(60% 52% at 50% 50%, var(--tono, var(--tono-1)) 0%, transparent 72%),
    radial-gradient(90% 70% at 50% 120%, rgba(169, 236, 205, 0.035), transparent 60%);
}

.gl, .dom-words { position: absolute; inset: 0; width: 100%; height: 100%; }
.gl { z-index: 0; }
.dom-words { z-index: 0; pointer-events: none; display: none; }
.no-gl .dom-words { display: block; }
.no-gl .gl { display: none; }
.dom-words canvas { position: absolute; left: 0; top: 0; opacity: 0; will-change: opacity, filter; }

/* a fine film grain over everything, moved by the script a few times a second */
.grain {
  position: absolute;
  inset: -40px;
  z-index: 3;
  pointer-events: none;
  opacity: var(--grana, 0.06);
  mix-blend-mode: screen;
  background-size: 160px 160px;
}

/* ---- the bar at the top ---- */
.bar {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: clamp(10px, 3vh, 26px);
  translate: -50% 0;
  width: min(92%, 980px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 6px 6px clamp(12px, 2vw, 18px);
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--avorio);
  text-decoration: none;
  font-family: 'Playfair Display Variable', Didot, Georgia, serif;
  font-size: clamp(15px, min(2.2vw, 2.6vh), 18px);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.brand__mark { width: 18px; height: 18px; fill: none; stroke: var(--menta); stroke-width: 1.2; stroke-linejoin: round; }
.links { display: flex; gap: clamp(14px, 2.4vw, 30px); }
.links a {
  color: var(--tenue);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
}
@media (hover: hover) { .links a:hover { color: var(--avorio); } }
@media (max-width: 620px) { .links { display: none; } }

.apply {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px 0 15px;
  border-radius: 999px;
  overflow: hidden;
  color: #07110d;
  text-decoration: none;
  font-size: 13px;
  font-weight: 560;
  font-stretch: 100%;
  font-variation-settings: 'wdth' 100;
  background: var(--avorio);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 6px 18px rgba(169, 236, 205, 0.08);
  transition: font-variation-settings 0.5s cubic-bezier(.34, 1.56, .64, 1), scale 0.25s cubic-bezier(.34, 1.56, .64, 1);
}
.apply__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--menta);
  scale: 0.2 0;
  transform-origin: 50% 100%;
  transition: scale 0.55s cubic-bezier(.34, 1.4, .64, 1);
}
/* a light that sweeps across the button once, when the last sentence has landed */
.apply__shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.85) 50%, transparent 80%);
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
}
.apply__text, .apply__arrow { position: relative; }
.apply__arrow { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: translate 0.45s cubic-bezier(.34, 1.56, .64, 1); }
@media (hover: hover) {
  .apply:hover { font-variation-settings: 'wdth' 112; }
  .apply:hover .apply__fill { scale: 1 1; }
  .apply:hover .apply__arrow { translate: 2px 0; }
}
.apply:active { scale: 0.96; }
.apply:focus-visible { outline: 1px solid var(--menta); outline-offset: 3px; }

/* ---- the hint at the start ---- */
.hint {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: clamp(14px, 5vh, 40px);
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--tenue);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hint__line { position: relative; width: 1px; height: clamp(18px, 5vh, 34px); background: var(--linea); overflow: hidden; }
.hint__line i { position: absolute; left: 0; top: 0; width: 1px; height: 40%; background: var(--menta); }

/* ---- the facts under the last sentence ---- */
.facts {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: clamp(14px, 5.5vh, 46px);
  translate: -50% 0;
  display: flex;
  width: max-content;
  max-width: 94%;
  border-top: 1px solid var(--linea);
  padding-top: clamp(8px, 1.6vh, 14px);
}
.facts > div { padding: 0 clamp(10px, 2.2vw, 26px); text-align: center; }
.facts > div + div { border-left: 1px solid var(--linea); }
.facts dt { color: var(--tenue); font-size: clamp(9.5px, min(1.4vw, 1.9vh), 11.5px); letter-spacing: 0.06em; text-transform: uppercase; }
.facts dd { margin-top: 3px; color: var(--avorio); font-family: 'Playfair Display Variable', Didot, Georgia, serif; font-size: clamp(14px, min(2.4vw, 3.4vh), 22px); font-variant-numeric: lining-nums; }
.facts > div:last-child dd { color: var(--menta); }
.facts > * { opacity: 0; }
@media (max-width: 560px) {
  .facts { display: grid; grid-template-columns: 1fr 1fr; row-gap: 8px; width: 88%; }
  .facts > div { padding: 0 8px; }
  .facts > div + div { border-left: 0; }
  .facts > div:nth-child(2n) { border-left: 1px solid var(--linea); }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
