/* The dripping colour transition: two pages of an invented colour studio (Treacle), one on warm white and one on near
   black, in Mona Sans with its width axis. The only accent is the colour that waits along the top edge and runs down
   the page; the script draws it on a canvas over both pages. */
:root {
  --chiaro: #f3efe7;                       /* the background of the light page */
  --scuro: #0d0d0e;                        /* the background of the dark page */
  --inchiostro: #17160f;                   /* the text on the light page */
  --latte: #eeebe4;                        /* the text on the dark page */
  --tenue-chiaro: #7a756c;                 /* the small text on the light page */
  --tenue-scuro: #8c8881;                  /* the small text on the dark page */
  --colore: #2b44f0;                       /* the colour that runs down the page */
  --riflesso: #8d9cff;                     /* the thin glint on the drips */
  --elastico: cubic-bezier(0.34, 1.9, 0.45, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  overflow-x: clip;
  background: var(--chiaro);
}

body {
  font-family: 'Mona Sans Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sito {
  position: relative;
  height: 100svh;
  min-height: 300px;
  overflow: hidden;
  isolation: isolate;
}

.pagina {
  --margine: clamp(16px, 4.4vw, 60px);
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(18px, 3.2vw, 36px) var(--margine);
}

.pagina[hidden] {
  display: none;
}

.pagina--chiara {
  background: var(--chiaro);
  color: var(--inchiostro);
  --tenue: var(--tenue-chiaro);
  --bordo: rgba(23, 22, 15, 0.2);
  --pieno: var(--inchiostro);
  --su-pieno: var(--chiaro);
}

.pagina--scura {
  background: var(--scuro);
  color: var(--latte);
  --tenue: var(--tenue-scuro);
  --bordo: rgba(238, 235, 228, 0.22);
  --pieno: var(--latte);
  --su-pieno: var(--scuro);
}

.colata {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
}

.testa,
.piede {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: clamp(11px, 1.1vw, 13px);
  letter-spacing: 0.02em;
}

.piede {
  justify-content: center;
}

.marchio {
  margin: 0;
  font-weight: 640;
  font-variation-settings: 'wdth' 90;
  letter-spacing: 0.01em;
}

.nota {
  margin: 0;
  color: var(--tenue);
}

.eroe {
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(12px, 2.4vh, 24px);
}

.occhiello {
  margin: 0;
  font-size: clamp(11px, 1vw, 12px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--tenue);
}

.titolo {
  margin: 0;
  font-weight: 560;
  font-variation-settings: 'wdth' 84;
  font-size: min(9.6vw, 12.5vh, 124px);
  line-height: 0.96;
  letter-spacing: -0.035em;
}

.riga {
  display: block;
  overflow: hidden;
  padding: 0.04em 0 0.08em;
  margin: -0.04em 0 -0.08em;
}

.riga__dentro {
  display: inline-block;
  transform-origin: 50% 100%;
  will-change: transform;
}

/* the link: a thin outline that fills with a bounce on hover, like the site's elastic pill */
.pillola {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 44px;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 540;
  font-variation-settings: 'wdth' 94;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.pillola::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--bordo);
  background: transparent;
  z-index: -1;
  transition: transform 0.55s var(--elastico), background-color 0.3s ease, border-color 0.3s ease;
}

.pillola__scritta {
  transition: font-variation-settings 0.55s var(--elastico), color 0.25s ease;
}

/* the arrow: the span is for GSAP (it turns to point down when the colour starts), the svg inside is for the hover */
.pillola__freccia {
  display: inline-flex;
  width: 15px;
  height: 15px;
}

.pillola__freccia svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.55s var(--elastico);
}

.pillola:active::before {
  transform: scale(0.95);
}

.pillola:focus-visible {
  outline: none;
}

.pillola:focus-visible::before {
  border-color: var(--colore);
}

@media (hover: hover) {
  .pillola:hover::before {
    transform: scale(1.06, 1.1);
    background: var(--pieno);
    border-color: var(--pieno);
  }

  .pillola:hover {
    color: var(--su-pieno);
  }

  .pillola:hover .pillola__scritta {
    font-variation-settings: 'wdth' 108;
  }

  .pillola:hover .pillola__freccia svg {
    transform: translateX(3px);
  }

  .pillola:hover .pillola__freccia--indietro svg {
    transform: translateX(-3px);
  }

  .pillola:active::before {
    transform: scale(0.97);
  }
}

@media (max-width: 560px) {
  .testa .nota {
    display: none;
  }

  .pillola {
    height: 40px;
    padding: 0 16px;
    font-size: 13px;
  }
}

@media (max-height: 460px) {
  .piede .nota {
    font-size: 10px;
  }

  .eroe {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pillola::before,
  .pillola__scritta,
  .pillola__freccia svg {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  }
}
