/* The sun behind the line: a made-up seaside hotel, Vespera. The stage sticks while you scroll; the night is a copy
   of the scene with the colours of the night, opened by the script with clip-path. */
:root {
  --carta: #f3f0e8;            /* the page by day */
  --inchiostro: #141414;       /* the line, the title and the button by day */
  --tenue: #8b867c;            /* the small text by day */
  --sole: #ff4b1f;             /* the sun, the last light and the little mark */
  --notte: #0c0c0b;            /* the page at night */
  --notte-inchiostro: #f3f0e8; /* the line, the title and the button at night */
  --notte-tenue: #7f7a70;      /* the small text at night */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

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

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

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

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

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

.scena {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--carta);
  color: var(--inchiostro);
}

/* the night: the same scene with the colours swapped, shut inside the line until it opens */
.scena--notte {
  --carta: var(--notte);
  --inchiostro: var(--notte-inchiostro);
  --tenue: var(--notte-tenue);
  clip-path: inset(50% 0 50% 0);
}

/* ---------------------------------------------------------------- the sky, the sun and the line */
.cielo {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 60%; /* the script sets it down to the horizon */
  overflow: hidden;
  pointer-events: none;
}

.sole {
  position: absolute;
  left: 0;
  top: 0;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: var(--sole);
  transform-origin: 50% 100%; /* it flattens towards the line, its bottom stays where it is */
  will-change: transform;
}

.orizzonte {
  position: absolute;
  left: 0;
  top: 60%;
  width: 100%;
  height: 1px;
  background: var(--inchiostro);
  transform-origin: 0 50%;
  pointer-events: none;
}

.luce {
  position: absolute;
  left: 0;
  top: 60%;
  width: 160px;
  height: 2px;
  margin-top: -0.5px;
  background: var(--sole);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the greeting */
.titolo {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 120px;
  font-weight: 300;
  font-optical-sizing: auto;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  /* the letters go down behind the horizon: the script cuts the box at the line (clip-path) */
}

.titolo .lettera {
  display: inline-block;
}

.titolo .lettera__dentro {
  display: inline-block;
  will-change: transform;
}

.titolo .coda {
  display: inline-grid;
}

.titolo .saluto {
  grid-area: 1 / 1;
  justify-self: start;
}

.titolo--due .coda {
  display: grid;
}

.titolo--due .spazio {
  display: none;
}

.misura {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 300;
  font-optical-sizing: auto;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.misura span {
  display: inline-block;
}

/* ---------------------------------------------------------------- the hours */
.ore {
  position: absolute;
  top: 0;
  right: 40px;
  width: 64px;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 70px, #000 32%, #000 78%, transparent calc(100% - 64px));
  mask-image: linear-gradient(to bottom, transparent 70px, #000 32%, #000 78%, transparent calc(100% - 64px));
}

.ore__nastro {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

.tacca {
  position: absolute;
  right: 0;
  width: 6px;
  height: 1px;
  background: var(--tenue);
}

.tacca--ora {
  width: 12px;
  background: var(--inchiostro);
}

.ora {
  position: absolute;
  right: 20px;
  margin-top: -0.62em;
  font-size: 12px;
  line-height: 1.24;
  font-stretch: 92%;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--inchiostro);
  font-variation-settings: 'wght' 420;
}

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

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

.marchio__segno {
  width: 26px;
  height: 16px;
  overflow: visible;
}

.marchio__segno circle {
  fill: var(--sole);
}

.marchio__segno path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
}

.marchio__nome {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 19px;
  font-weight: 420;
  letter-spacing: -0.01em;
}

/* 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: 44px;
  padding: 0 22px;
  color: var(--carta);
  text-decoration: none;
  font-weight: 600;
  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: 84%;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.6, 0.5, 1), letter-spacing 0.5s;
}

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

/* ---------------------------------------------------------------- the small text */
.nota {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  top: 64%;
  max-width: 300px;
  margin: 0;
  font-size: 14px;
  font-weight: 450;
  font-stretch: 92%;
  line-height: 1.45;
  color: var(--tenue);
}

.cenno {
  position: absolute;
  left: clamp(16px, 3vw, 40px);
  bottom: clamp(20px, 4lvh, 36px);
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  font-stretch: 90%;
  letter-spacing: 0.01em;
  color: var(--tenue);
}

.cenno__dentro {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

@media (max-width: 640px) {
  .nota {
    max-width: 62vw;
    font-size: 13px;
  }
  .ora {
    right: 16px;
    font-size: 11px;
  }
  .tacca--ora {
    width: 10px;
  }
}
