/* The trail of heights: the way up to a made-up mountain hut, in the minimal style. A warm white page, black ink, one
   vermilion kept for the height of the hut. In a tall section a stage stays still while you scroll: a thin trail climbs
   in switchbacks, a ruler of heights runs down beside it, and every stop lands on its own height. Every position is
   written by the script from the height the trail has reached. */
:root {
  --carta: #f3f0e8;        /* the warm white of the page */
  --inchiostro: #141414;   /* the ink of the trail, the names and the big height */
  --tenue: #8f8a80;        /* the small text and the heights on the ruler */
  --sottile: #cfc9bc;      /* the way still to walk, the ticks and the lines of the stops already passed */
  --accento: #ff4a1c;      /* the height of the hut, at the end */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Archivo Variable', 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ the opening and the end */
.apertura {
  display: grid;
  align-content: center;
  gap: 22px;
  min-height: 92vh;
  padding: 80px clamp(16px, 5vw, 72px);
}

.apertura--fine {
  min-height: 72vh;
}

.piccolo {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.piccolo--tenue {
  color: var(--tenue);
}

.titolo {
  margin: 0;
  font-size: clamp(48px, 8.4vw, 124px);
  font-weight: 300;
  font-variation-settings: 'wdth' 88;
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.titolo--medio {
  font-size: clamp(40px, 6vw, 88px);
}

/* ------------------------------------------------------------ the stage */
.salita {
  position: relative;
  height: 720lvh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100lvh;
  overflow: hidden;
}

.testa {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 26px clamp(16px, 5vw, 72px);
}

.marchio {
  margin: 0;
  font-size: 17px;
  font-weight: 680;
  font-variation-settings: 'wdth' 112;
  letter-spacing: -0.02em;
}

/* the window on the world: everything fades out under the header instead of being cut by it */
.vista {
  position: absolute;
  inset: 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent 58px, #000 128px);
  mask-image: linear-gradient(to bottom, transparent 58px, #000 128px);
}

/* the world: the trail, the ruler and the stops, all on one layer that the script slides down as the trail climbs */
.mondo {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  will-change: transform;
}

.sentiero {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
}

/* the way still to walk: a light dashed line, like a path on a map */
.sentiero__guida {
  fill: none;
  stroke: var(--sottile);
  stroke-width: 1.2;
  stroke-dasharray: 3 5;
  stroke-linejoin: round;
}

/* the way already walked: the ink, drawn with stroke-dashoffset */
.sentiero__passi {
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* the ruler: a hairline spine, a short tick every 20 metres, a longer one with its height every 100 */
.righello {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  pointer-events: none;
}

.spina {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  background: var(--sottile);
  transform-origin: 50% 100%;
}

.tick {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  background: var(--sottile);
  transform-origin: 100% 50%;
  will-change: transform;
}

.tick__metri {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--tenue);
  font-size: 10px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

/* the reading mark: a short ink bar across the ruler, at the height the trail has reached. It stays still on the
   screen, the ruler runs under it */
.livello {
  position: absolute;
  left: 0;
  top: 0;
  width: 17px;
  height: 2px;
  margin: -1px 0 0 -8px;
  background: var(--inchiostro);
  z-index: 2;
  will-change: transform;
}

/* the stops */
.tappe {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tappa {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
}

/* the line of the stop's height, from the ruler to the trail: the shelf the name lands on */
.tappa__riga {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  background: var(--inchiostro);
  transform-origin: 100% 50%;
}

.tappa__metri {
  position: absolute;
  left: 0;
  bottom: 7px;
  color: var(--tenue);
  font-size: 12px;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
}

/* the name: right-aligned against the trail, sitting on its line. Every letter has its own weight, which the script
   moves from hairline to heavy as the letter lands */
.tappa__nome {
  position: absolute;
  right: 0;
  bottom: 5px;
  font-size: clamp(19px, 2.1vw, 32px);
  font-variation-settings: 'wdth' 96;
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
}

.lettera {
  display: inline-block;
  white-space: pre;
  font-weight: var(--w, 640);
  transform-origin: 50% 100%;
}

/* the big height: tabular digits, so it does not jump while it counts. Width and weight are two variables the
   script moves: narrow and thin while the trail climbs, wide and heavy when it reaches a stop */
.lettura {
  position: absolute;
  left: var(--x, 120px);
  top: max(92px, 13lvh);
  z-index: 2;
}

.quota {
  margin: 0 0 10px;
  font-size: min(10vw, 17lvh);
  font-weight: var(--wg, 760);
  font-variation-settings: 'wdth' var(--wd, 100);
  font-variant-numeric: tabular-nums;
  line-height: 0.86;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--colore, var(--inchiostro));
}

.cifra {
  display: inline-block;
}

.cifra > span {
  display: inline-block;
}

.lettura__sotto {
  padding-left: 0.2em;
}

/* ------------------------------------------------------------ phone: the same climb, narrower */
@media (max-width: 640px) {
  .quota {
    font-size: min(15vw, 11lvh);
  }

  .tappa__nome {
    font-size: 17px;
  }

  .tappa__metri {
    font-size: 11px;
  }
}
