/* The spiral page transition: two pages of an invented coil pottery studio (Orra), one on warm white and one on near
   black, in Mona Sans with its width axis. The only accent is the band of clay that winds over the page; the script
   draws it as one stroked SVG path 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: #c4532f;                       /* the band of clay that winds over the page */
  --cucitura: #a8432a;                     /* the thin seam between one turn of the band and the next */
  --labbro: #e88a63;                       /* the lighter lip along the moving end of the band */
  --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);
}

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

.spirale g {
  transform-origin: 50% 50%;
  transform-box: view-box;
}

.spirale path {
  fill: none;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
}

.spirale__cucitura {
  stroke: var(--cucitura);
}

.spirale__nastro {
  stroke: var(--colore);
}

.spirale__labbro {
  stroke: var(--labbro);
}

.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(8.6vw, 12vh, 118px);
  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;
  font-variation-settings: 'wdth' var(--wdth, 84);
  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 mark: a small square spiral, the gesture in miniature. The span is for GSAP (it turns a quarter when the band
   starts), the svg inside is for the hover, where the line winds in again from its outer end */
.pillola__segno {
  display: inline-flex;
  width: 14px;
  height: 14px;
}

.pillola__segno svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: square;
  stroke-linejoin: miter;
  transition: transform 0.55s var(--elastico);
}

.pillola__segno path {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

.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__segno svg {
    transform: rotate(90deg);
  }

  .pillola:hover .pillola__segno path {
    animation: avvolgi 0.7s cubic-bezier(0.65, 0, 0.35, 1) both;
  }

  .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;
  }
}

@keyframes avvolgi {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pillola:hover .pillola__segno path {
    animation: none;
  }

  .pillola::before,
  .pillola__scritta,
  .pillola__segno svg {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  }
}
