/* The canopy that changes shape: minimal. Warm white, ink of a dark pine, and one accent, the gold of the evening
   facade. A serif with a soft optical size for the statements, a narrow sans for the small labels. */
:root {
  --fondo: #f6f3ea;        /* the page */
  --inchiostro: #1f2a1c;   /* the text and the branches by day */
  --tenue: #7d8476;        /* the small labels */
  --sera: #2e3a26;         /* the facade in the evening */
  --accento: #c49a5c;      /* the branches in the evening light */
  --giorno: #ebe5d2;       /* the facade by day */
  --schermo: 100vh;
}

@supports (height: 100lvh) {
  :root {
    --schermo: 100lvh;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--fondo);
}

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

/* the long run of scroll and the still stage inside it */
.corsa {
  position: relative;
  height: 520vh;
}

.palco {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 4vw;
  height: var(--schermo);
  padding: 0 6vw;
  overflow: hidden;
}

/* the three statements share one place: only one shows at a time */
.testi {
  display: grid;
}

.schermo {
  grid-area: 1 / 1;
  align-self: center;
  max-width: 34rem;
  visibility: hidden;
}

.occhiello {
  margin: 0 0 1.4rem;
  color: var(--tenue);
  font-size: 0.72rem;
  font-stretch: 112%;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.frase {
  margin: 0;
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: clamp(2.2rem, 4.6vw, 4.4rem);
  font-weight: 340;
  font-variation-settings: 'opsz' 144, 'SOFT' 60;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

/* the link: a thin pill; on hover the words widen on the wdth axis */
.vai {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.7rem 1.4rem 0.7rem 1.6rem;
  border: 1px solid color-mix(in srgb, var(--inchiostro) 35%, transparent);
  border-radius: 999px;
  color: var(--inchiostro);
  font-size: 0.72rem;
  font-stretch: 100%;
  letter-spacing: 0.2em;
  text-decoration: none;
  text-transform: uppercase;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
}

@media (hover: hover) {
  .vai:hover {
    font-stretch: 125%;
    border-color: var(--inchiostro);
  }
}

.cornici {
  width: 100%;
  max-height: 78vh;
  overflow: visible;
}

.bordo {
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 0.18;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
}

/* the progress: the name of the statement and a hairline that fills */
.avanza {
  position: absolute;
  left: 6vw;
  bottom: 5vh;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avanza__nome {
  min-width: 5.5rem;
  color: var(--tenue);
  font-size: 0.72rem;
  font-stretch: 112%;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.avanza__riga {
  position: relative;
  width: 9rem;
  height: 1px;
  background: color-mix(in srgb, var(--tenue) 40%, transparent);
}

.avanza__pieno {
  position: absolute;
  inset: 0;
  background: var(--inchiostro);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.fine {
  display: grid;
  place-items: center;
  height: 60vh;
  color: var(--tenue);
  font-family: 'Fraunces Variable', 'Fraunces', Georgia, serif;
  font-size: 1.2rem;
  font-style: italic;
}

/* on a phone the frames go on top and the statements under them, the same animation */
@media (max-width: 760px) {
  .palco {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    align-content: center;
    gap: 3vh;
    padding: 9vh 7vw 14vh;
  }

  .cornici {
    grid-row: 1;
    max-height: 44vh;
  }

  .testi {
    grid-row: 2;
  }

  .frase {
    font-size: clamp(1.8rem, 8.4vw, 2.6rem);
  }

  .occhiello {
    margin-bottom: 0.8rem;
  }

  .vai {
    margin-top: 1.2rem;
  }
}
