:root {
  /* the page: pure white in the morning, pure black in the evening (script.js fades --n from 0 to 1) */
  --carta: #ffffff;
  --notte: #000000;
  --inchiostro: #14201a;
  --inchiostro-notte: #eef0e6;
  --tenue: #7f857a;
  --tenue-notte: #8d94a3;
  --linea: rgba(20, 32, 26, 0.13);
  --linea-notte: rgba(238, 240, 230, 0.17);
  --pieno: #1d3324;
  --pieno-notte: #eef0e6;
  --fuoco: #5f8f3e;
  --e-elastico: cubic-bezier(0.34, 1.8, 0.64, 1);
  --e-uscita: cubic-bezier(0.22, 1, 0.36, 1);
  --n: 0;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: color-mix(in srgb, var(--notte) calc(var(--n) * 100%), var(--carta));
  color: color-mix(in srgb, var(--inchiostro-notte) calc(var(--n) * 100%), var(--inchiostro));
  font-family: 'Noto Serif Variable', Georgia, serif;
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.nascosto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.studio {
  --testo: color-mix(in srgb, var(--inchiostro-notte) calc(var(--n) * 100%), var(--inchiostro));
  --sbiadito: color-mix(in srgb, var(--tenue-notte) calc(var(--n) * 100%), var(--tenue));
  --filo: color-mix(in srgb, var(--linea-notte) calc(var(--n) * 100%), var(--linea));
  --fondo-pieno: color-mix(in srgb, var(--pieno-notte) calc(var(--n) * 100%), var(--pieno));
  --sfondo: color-mix(in srgb, var(--notte) calc(var(--n) * 100%), var(--carta));
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}
.studio > *,
.comandi > * {
  min-width: 0;
}

/* ------------------------------------------------------------------ the stage */
.palco {
  display: grid;
  gap: 6px;
}
.tavola {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.9;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
}
.tavola:focus-visible {
  box-shadow: 0 0 0 2px var(--sfondo), 0 0 0 4px var(--testo);
}
.tela {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.cenno {
  margin: 0;
  height: 22px;
  overflow: hidden;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 460;
  font-style: normal;
  font-stretch: 92%;
  letter-spacing: 0.01em;
  color: var(--sbiadito);
}
.cenno__testo {
  display: inline-block;
}

/* ------------------------------------------------------------------ controls */
.comandi {
  width: min(560px, 100%);
  justify-self: center;
  display: grid;
  gap: 12px;
}
.riga {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.riga--azioni {
  justify-content: center;
  gap: 10px;
}
/* the actions: the whole animation on its own line, the other two side by side under it */
.riga--azioni .pillola--piena {
  flex: 1 1 100%;
}
.riga--azioni .pillola--vuota {
  flex: 1 1 0;
  min-width: 0;
}

/* the season and the time of day: radios on one track, the cursor slides under the chosen one */
.gruppo {
  position: relative;
  display: flex;
  padding: 4px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--filo);
}
.gruppo__cursore {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 60px;
  border-radius: 999px;
  background: var(--fondo-pieno);
  pointer-events: none;
}
.voce {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 11px 0 9px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--testo);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 560;
  font-stretch: 88%;
  cursor: pointer;
  transition: font-stretch 0.5s var(--e-elastico), color 0.25s ease;
}
.voce svg {
  width: 16px;
  height: 16px;
  flex: none;
  transition: transform 0.6s var(--e-elastico);
}
.voce[aria-checked='true'] {
  color: var(--sfondo);
}
.voce:focus-visible,
.pillola:focus-visible {
  outline: 2px solid var(--testo);
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .voce:not([aria-checked='true']):hover {
    font-stretch: 100%;
  }
  .voce:not([aria-checked='true']):hover svg {
    transform: rotate(-10deg) scale(1.08);
  }
}

/* the address */
.indirizzo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 4px 4px 4px 14px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--filo);
}
.indirizzo:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--testo);
}
.indirizzo__segno {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--sbiadito);
}
.indirizzo__campo {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--testo);
  font: inherit;
  font-size: 1rem;
  font-weight: 440;
  font-stretch: 90%;
  outline: none;
}
.indirizzo__campo::selection {
  background: color-mix(in srgb, var(--fuoco) 30%, transparent);
}

/* the elastic pill: the fill swells with a bounce, the label widens on the wdth axis */
.pillola {
  --pb: var(--fondo-pieno);
  --pt: var(--sfondo);
  --pbordo: 0 0 0 transparent;
  --gonfia: 6px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--pt);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  font-stretch: 84%;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  isolation: isolate;
  flex: none;
}
.pillola::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--pb);
  box-shadow: var(--pbordo);
  transition: inset 0.6s var(--e-elastico), transform 0.25s var(--e-uscita);
}
.pillola__testo {
  display: inline-grid;
  text-align: center;
  transition: font-stretch 0.6s var(--e-elastico);
}
/* the label at its widest, invisible: it keeps the room */
.pillola__testo::before {
  content: attr(data-testo);
  grid-area: 1 / 1;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 100%;
}
.pillola__segno {
  width: 18px;
  height: 18px;
  flex: none;
  transition: transform 0.6s var(--e-elastico);
}
.pillola--vuota {
  --pb: transparent;
  --pt: var(--testo);
  --pbordo: inset 0 0 0 1px var(--filo);
}
.pillola--piena {
  height: 48px;
}
.pillola[hidden] {
  display: none;
}
/* while the zip is being made */
.pillola[aria-busy='true'] {
  cursor: progress;
}
.pillola[aria-busy='true'] .pillola__testo {
  opacity: 0.6;
}
/* inside the field the pill swells only a little, without leaving the border */
.indirizzo .pillola {
  --gonfia: 1px;
}
@media (hover: hover) and (pointer: fine) {
  .pillola:hover::before {
    inset: -2px calc(var(--gonfia) * -1);
  }
  .pillola:hover .pillola__testo {
    font-stretch: 100%;
  }
  .pillola:hover .pillola__segno {
    transform: translateY(2px);
  }
  .pillola:hover .pillola__segno--anima {
    transform: translateX(1px) scale(1.08);
  }
  .pillola--vuota:hover {
    --pbordo: inset 0 0 0 1.5px var(--testo);
  }
}
.pillola:active::before {
  transform: scale(1.03, 0.88);
}

@media (max-width: 460px) {
  .studio { gap: 14px; }
  .riga--scelte { justify-content: center; gap: 8px; }
  .voce { padding: 0 8px 0 7px; gap: 4px; font-size: 0.79rem; font-stretch: 80%; }
  .voce svg { width: 15px; height: 15px; }
  .pillola { padding: 0 18px; }
  .riga--azioni { gap: 8px; }
  .riga--azioni .pillola--vuota { padding: 0 12px; }
}
@media (max-width: 372px) {
  .voce { padding: 0 6px 0 5px; gap: 3px; font-stretch: 72%; }
  .riga--azioni .pillola--vuota { padding: 0 8px; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .voce,
  .voce svg,
  .pillola::before,
  .pillola__testo,
  .pillola__segno {
    transition: opacity 0.2s ease, color 0.2s ease;
  }
}

/* ------------------------------------------------------------------ the preview (?anteprima=1): only the stage, square */
.anteprima body {
  padding: 0;
  overflow: hidden;
}
.anteprima .studio {
  width: 100vw;
  height: 100vh;
  display: block;
}
.anteprima .palco {
  display: block;
  height: 100%;
}
.anteprima .tavola {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  cursor: default;
}
.anteprima .cenno,
.anteprima .comandi {
  display: none;
}

/* ------------------------------------------------------------------ the animation on its own (the downloaded zip:
   class solo-palco on <html>): only the stage and the hint, as big as the window allows, centred, never cut */
.solo-palco,
.solo-palco body {
  height: 100%;
  overflow: hidden;
}
.solo-palco body {
  min-height: 0;
  height: 100vh;
  height: 100svh;
  display: block;
  padding: clamp(10px, 3vmin, 32px);
}
.solo-palco .studio {
  width: 100%;
  height: 100%;
  display: block;
}
.solo-palco .palco {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
}
.solo-palco .tavola {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
.solo-palco .comandi {
  display: none;
}
/* the narrowest phones: the icons stay only on the chosen season and time */
@media (max-width: 340px) {
  .voce:not([aria-checked='true']) svg { display: none; }
}
