/* The jigsaw transition: two full-screen pages of a made-up studio stacked on a dark table. Only one is shown; during
   the change both are hidden and the pieces (copies of the pages, cut with clip-path) fly over the table. */
:root {
  --tavolo: #221e19;          /* the table under the pages */
  --tavolo-luce: #302a22;     /* the light on the table */
  --carta: #f3ebdc;           /* the studio page */
  --inchiostro: #1d1914;      /* the words */
  --pomodoro: #ff5b2e;        /* the studio accent */
  --bosco: #173a2e;           /* the work page */
  --miele: #ffb43a;           /* the work accent */
  --cielo: #9cc0ff;           /* a third colour for the covers */
  --cartone: #c9b18a;         /* the back of a piece */
  --cartone-scuro: #a68d66;   /* the grain on the back */
  --taglio-luce: rgba(255, 252, 244, 0.72);   /* the light edge of a cut */
  --taglio-ombra: rgba(20, 14, 8, 0.38);      /* the dark edge of a cut */
  --ombra: #0c0805;                            /* the shadow under a lifted piece */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--tavolo);
  color: var(--inchiostro);
  font-family: 'Bricolage Grotesque Variable', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.palco {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 40%, var(--tavolo-luce), var(--tavolo) 70%);
}

/* ---------------------------------------------------------------- the pages */
.pagina {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(12px, 2vh, 24px);
  padding: clamp(16px, 2.6vw, 36px);
  overflow: hidden;
}

.pagina[inert] {
  visibility: hidden;
}

.pagina--studio {
  background: var(--carta);
  color: var(--inchiostro);
  --accento: var(--pomodoro);
  --su-accento: var(--carta);
}

.pagina--work {
  background: var(--bosco);
  color: var(--carta);
  --accento: var(--miele);
  --su-accento: var(--inchiostro);
}

.pagina a {
  color: inherit;
  text-decoration: none;
}

.pagina a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
}

.titolo:focus {
  outline: none;
}

.testa {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 40px);
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 650;
}

.marchio {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: clamp(17px, 1.4vw, 22px);
  letter-spacing: -0.02em;
}

.marchio__segno {
  width: 1.35em;
  height: 1.35em;
  fill: var(--accento);
  transition: transform 0.6s cubic-bezier(0.34, 1.8, 0.5, 1);
}

.voci {
  display: flex;
  gap: clamp(14px, 2vw, 28px);
}

.voci a {
  display: inline-block;
  opacity: 0.55;
  font-stretch: 85%;
  transition: opacity 0.3s ease, font-stretch 0.45s cubic-bezier(0.34, 1.8, 0.5, 1), transform 0.45s cubic-bezier(0.34, 1.8, 0.5, 1);
}

.voci a[aria-current='page'] {
  opacity: 1;
  font-weight: 800;
}

.testa__posta {
  margin-left: auto;
  opacity: 0.7;
}

/* hovers only where there is a real pointer: the mark turns a quarter like a piece being tried, the links widen */
@media (hover: hover) {
  .marchio:hover .marchio__segno {
    transform: rotate(90deg);
  }

  .voci a:hover {
    opacity: 1;
    font-stretch: 100%;
    transform: translateY(-2px);
  }
}

.etichetta {
  margin: 0;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accento);
}

.titolo {
  margin: 0.25em 0 0;
  font-size: clamp(42px, 7.4vw, 124px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-weight: 800;
  font-stretch: 88%;
  text-wrap: balance;
}

/* ---------------------------------------------------------------- the button shaped like a piece */
.tessera {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: clamp(48px, 5.4vh, 58px);
  padding: 0 calc(clamp(48px, 5.4vh, 58px) * 0.62 + 10px) 0 calc(clamp(48px, 5.4vh, 58px) * 0.5);
  color: var(--su-accento) !important;
  font-weight: 750;
  font-size: clamp(15px, 1.2vw, 18px);
  isolation: isolate;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tessera__forma {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  z-index: -1;
  fill: var(--accento);
}

.tessera__testo {
  font-stretch: 88%;
  transition: font-stretch 0.5s cubic-bezier(0.34, 1.8, 0.5, 1);
}

.tessera__freccia {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.8, 0.5, 1);
}

@media (hover: hover) {
  .tessera:hover .tessera__testo {
    font-stretch: 100%;
  }

  .tessera:hover .tessera__freccia {
    transform: translateX(5px);
  }
}

/* ---------------------------------------------------------------- the studio page */
.studio {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: center;
  gap: clamp(20px, 4vw, 64px);
  min-height: 0;
}

.studio__frase {
  max-width: 30em;
  margin: clamp(14px, 2.4vh, 28px) 0 clamp(20px, 3.6vh, 40px);
  font-size: clamp(15px, 1.25vw, 20px);
  line-height: 1.45;
  opacity: 0.82;
}

.composizione {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1;
  justify-self: center;
  max-height: 100%;
}

.forma {
  position: absolute;
  display: block;
}

.forma--sole {
  left: 0;
  top: 0;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  background: var(--pomodoro);
}

.forma--arco {
  right: 0;
  top: 25%;
  width: 50%;
  height: 25%;
  border-radius: 999px 999px 0 0;
  background: var(--inchiostro);
}

.forma--righe {
  left: 0;
  bottom: 0;
  width: 50%;
  height: 50%;
  background: repeating-linear-gradient(90deg, var(--bosco) 0 12%, transparent 12% 24%);
}

.forma--quarto {
  right: 0;
  bottom: 0;
  width: 50%;
  height: 50%;
  border-radius: 100% 0 0 0;
  background: var(--miele);
}

.forma--blocco {
  left: 37%;
  top: 37%;
  width: 26%;
  height: 26%;
  border-radius: 18%;
  background: var(--cielo);
  transform: rotate(12deg);
}

/* ---------------------------------------------------------------- the work page */
.lavori {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: clamp(16px, 3.4vh, 40px);
  min-height: 0;
}

.lavori__testa {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.griglia {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(12px, 1.6vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 0;
}

.lavoro {
  display: grid;
  grid-template-rows: 1fr auto auto;
  min-height: 0;
}

.lavoro p {
  margin: 0;
}

.lavoro__nome {
  margin-top: 12px !important;
  font-weight: 750;
  font-size: clamp(15px, 1.25vw, 19px);
}

.lavoro__tipo {
  opacity: 0.65;
  font-size: clamp(13px, 1vw, 15px);
}

.copertina {
  position: relative;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
}

.copertina span {
  position: absolute;
  display: block;
}

.copertina--te {
  background: var(--miele);
}

.copertina--te span:nth-child(1) {
  left: 18%;
  right: 18%;
  bottom: 14%;
  height: 46%;
  border-radius: 0 0 50% 50% / 0 0 70% 70%;
  background: var(--carta);
}

.copertina--te span:nth-child(2) {
  left: 42%;
  top: 14%;
  width: 16%;
  height: 26%;
  border-radius: 50% 50% 50% 0;
  background: var(--bosco);
  transform: rotate(-45deg);
}

.copertina--bici {
  background: var(--cielo);
}

.copertina--bici span {
  bottom: 22%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid var(--inchiostro);
}

.copertina--bici span:nth-child(1) {
  left: 10%;
}

.copertina--bici span:nth-child(2) {
  right: 10%;
  border-color: var(--pomodoro);
}

.copertina--libri {
  background: var(--carta);
}

.copertina--libri span {
  bottom: 0;
  width: 20%;
  border-radius: 4px 4px 0 0;
}

.copertina--libri span:nth-child(1) {
  left: 18%;
  height: 62%;
  background: var(--pomodoro);
}

.copertina--libri span:nth-child(2) {
  left: 40%;
  height: 78%;
  background: var(--bosco);
}

.copertina--libri span:nth-child(3) {
  left: 62%;
  height: 54%;
  background: var(--miele);
  transform-origin: 0 100%;
  transform: rotate(14deg);
}

.copertina--radio {
  background: var(--pomodoro);
}

.copertina--radio span:nth-child(1) {
  left: 50%;
  top: 50%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid var(--carta);
  box-shadow: 0 0 0 14px var(--pomodoro), 0 0 0 17px var(--carta);
  transform: translate(-50%, -50%);
}

.copertina--radio span:nth-child(2) {
  left: 50%;
  top: 50%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--inchiostro);
  transform: translate(-50%, -50%);
}

.piede {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ---------------------------------------------------------------- the table and the pieces */
.tavolo {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}

.tavolo__traccia {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--taglio-luce);
  stroke-width: 1;
  stroke-dasharray: 0.012 0.008;
  opacity: 0;
}

.tavolo__pezzi {
  position: absolute;
  inset: 0;
}

.pezzo {
  position: absolute;
  will-change: transform;
}

.pezzo__ombra {
  position: absolute;
  inset: 0;
  background: var(--ombra);
  opacity: 0;
}

.pezzo__taglio {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.pezzo__taglio > .pagina {
  right: auto;
  bottom: auto;
  visibility: visible;
}

.pezzo__retro {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    repeating-linear-gradient(115deg, transparent 0 7px, rgba(255, 255, 255, 0.06) 7px 9px),
    linear-gradient(160deg, var(--cartone), var(--cartone-scuro));
}

.pezzo__bordo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke-linejoin: round;
}

.pezzo__bordo .ombra {
  stroke: var(--taglio-ombra);
  stroke-width: 2.4;
}

.pezzo__bordo .luce {
  stroke: var(--taglio-luce);
  stroke-width: 1.1;
}

/* ---------------------------------------------------------------- the phone */
@media (max-width: 760px) {
  .testa__posta {
    display: none;
  }

  .voci {
    margin-left: auto;
  }

  .studio {
    grid-template-columns: 1fr;
    align-content: center;
  }

  .composizione {
    order: -1;
    width: min(62vw, 30vh);
    justify-self: start;
  }

  .lavori__testa {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .griglia {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .piede span:last-child {
    display: none;
  }
}

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