/* The wheel that rounds off: a made-up bike workshop, Round Trip Cycle Works. The stage sticks while you scroll; the
   road, the wheel and the flag pole are drawn on the canvas, their colours come from the variables below. */
:root {
  --carta: #f1eadc;          /* the page */
  --terra: #e4d9c4;          /* the ground under the road */
  --inchiostro: #1c211e;     /* the text, the road and the tyre */
  --tenue: #6e685c;          /* the small text */
  --raggi: #4a4f4a;          /* the spokes */
  --accento: #e2522b;        /* the hub, the valve and the flag */
  --su-accento: #fff6ea;     /* the writing on the flag */
  --asse: rgba(28, 33, 30, 0.28); /* the dashed line of the axle */
  --polvere: rgba(28, 33, 30, 0.55); /* the dust in the dips */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Bricolage Grotesque Variable', 'Bricolage Grotesque', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

/* ---------------------------------------------------------------- the ride */
.corsa {
  position: relative;
  height: 500lvh; /* the script sets the real height from RIDE */
}

.palco {
  position: sticky;
  top: 0;
  height: 100lvh;
  overflow: hidden;
  background: var(--carta);
}

.strada {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------- the top bar */
.testa {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px clamp(16px, 3vw, 40px);
}

.marchio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--inchiostro);
  text-decoration: none;
}

.marchio__segno {
  width: 38px;
  height: 38px;
  overflow: visible;
}

.marchio__ruota {
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 3.2;
}

.marchio__raggi {
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 1.4;
}

.marchio__mozzo {
  fill: var(--accento);
  stroke: var(--inchiostro);
  stroke-width: 1.4;
}

.marchio__nome {
  display: flex;
  flex-direction: column;
  font-weight: 720;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.01em;
}

.marchio__nome span {
  margin-top: 4px;
  font-family: 'Red Hat Mono Variable', 'Red Hat Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tenue);
}

.testa__orari {
  margin: 0 0 0 auto;
  font-family: 'Red Hat Mono Variable', 'Red Hat Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tenue);
}

/* the button: the label stretches on the wdth axis, the background swells with a bounce */
.pillola {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 46px;
  padding: 0 24px;
  color: var(--carta);
  text-decoration: none;
  font-weight: 620;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

.pillola__fondo {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--inchiostro);
}

.pillola__testo {
  position: relative;
  font-stretch: 86%;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.6, 0.5, 1), letter-spacing 0.5s;
}

/* ---------------------------------------------------------------- the opening */
.apertura {
  position: absolute;
  top: clamp(84px, 13lvh, 128px);
  left: clamp(16px, 3vw, 40px);
  right: clamp(16px, 3vw, 40px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  column-gap: 40px;
  align-items: end;
  pointer-events: none;
}

.apertura__etichetta {
  grid-column: 1 / -1;
  margin: 0 0 14px;
  font-family: 'Red Hat Mono Variable', 'Red Hat Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tenue);
}

.apertura__titolo {
  margin: 0;
  font-weight: 640;
  font-stretch: 84%;
  font-size: clamp(36px, min(5vw, 8.4lvh), 76px);
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.riga {
  display: block;
  overflow: clip;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}

.riga__dentro {
  display: inline-block;
}

/* the soft half of the title: the script turns Fraunces' SOFT axis up as the wheel rounds off */
.morbido {
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-style: italic;
  font-weight: 420;
  letter-spacing: -0.02em;
  color: var(--accento);
  font-variation-settings: 'SOFT' 0, 'WONK' 0;
}

.apertura__testo {
  margin: 0 0 0.4em;
  max-width: 340px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--tenue);
}

/* ---------------------------------------------------------------- the flag on the pole */
.bandiera {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
}

.bandiera__telo {
  position: absolute;
  right: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 128px;
  padding: 8px 22px 8px 12px;
  background: var(--accento);
  color: var(--su-accento);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%);
  transform-origin: 100% 0;
}

.bandiera__nome {
  display: block;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.05;
  font-stretch: 90%;
  white-space: nowrap;
}

.bandiera__lati {
  display: block;
  margin-top: 3px;
  font-family: 'Red Hat Mono Variable', 'Red Hat Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.86;
}

/* ---------------------------------------------------------------- the hint */
.cenno {
  position: absolute;
  right: clamp(16px, 3vw, 40px);
  top: var(--cenno-y, 50%);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Red Hat Mono Variable', 'Red Hat Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tenue);
  pointer-events: none;
}

.cenno svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the four steps, on the ground */
.passi {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  right: clamp(16px, 3vw, 40px);
  bottom: clamp(20px, 4lvh, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.passo {
  position: relative;
  padding: 18px 22px 4px 0;
  margin-right: 22px;
  border-top: 1px solid rgba(28, 33, 30, 0.18);
  color: var(--tenue);
  transition: color 0.4s ease;
}

.passo.acceso {
  color: var(--inchiostro);
}

.passo__forma {
  display: block;
  width: 30px;
  height: 30px;
  margin-bottom: 14px;
  overflow: visible;
}

.passo__forma path {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: fill 0.35s ease;
}

.passo.acceso .passo__forma path {
  fill: var(--accento);
  stroke: var(--inchiostro);
}

.passo__nome {
  margin: 0 0 8px;
  font-weight: 660;
  font-stretch: 86%;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.passo__riga {
  margin: 0;
  max-width: 260px;
  font-size: 14.5px;
  line-height: 1.42;
}

.passi__ora {
  display: none;
}

/* ---------------------------------------------------------------- phone: same ride, the steps get shorter */
@media (max-width: 760px) {
  .testa {
    padding: 16px;
    gap: 12px;
  }

  .testa__orari {
    display: none;
  }

  .pillola {
    margin-left: auto;
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
  }

  .apertura {
    top: 84px;
    left: 16px;
    right: 16px;
    grid-template-columns: minmax(0, 1fr);
  }

  .apertura__titolo {
    font-size: clamp(34px, 10.4vw, 46px);
  }

  .apertura__testo {
    margin-top: 16px;
    font-size: 15px;
  }

  .passi {
    left: 16px;
    right: 16px;
    bottom: calc(20px + 4.4em);
    font-size: 14px;
  }

  .passo {
    padding: 14px 6px 0 0;
    margin-right: 8px;
  }

  .passo:last-child {
    margin-right: 0;
  }

  .passo__forma {
    width: 24px;
    height: 24px;
    margin-bottom: 10px;
  }

  .passo__nome {
    font-size: 16.5px;
    margin: 0;
  }

  .passo__riga {
    display: none;
  }

  .passi__ora {
    display: block;
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 20px;
    margin: 0;
    height: 4.4em;
    overflow: clip;
    font-size: 14px;
    line-height: 1.45;
    color: var(--inchiostro);
  }

  .passi__ora span {
    display: block;
  }

  .bandiera__telo {
    min-width: 104px;
    padding: 6px 18px 6px 10px;
  }

  .bandiera__nome {
    font-size: 14px;
  }

  .bandiera__lati {
    font-size: 9.5px;
  }

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

@media (hover: hover) {
  .pillola:hover .pillola__testo {
    font-stretch: 100%;
    letter-spacing: 0.01em;
  }
}
