:root {
  --pietra: #a19f97;      /* the stone grey of the home */
  --notte: #0b0b0a;       /* the dark of the library */
  --lettera: #0a0a09;     /* the giant letters */
  --carta: #f5f4ee;       /* type on both themes, and the button */
  --inchiostro: #121211;  /* type on the button */
  --accento: #c9f45a;     /* the one accent: the reference you are on */
  --bg: var(--pietra);
  --ink: var(--carta);
  --font: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--notte); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.sito {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  --margine: clamp(10px, min(1.6vw, 2.4vh), 22px);
  --piccolo: clamp(9.5px, min(1.05vw, 2.3vh), 14px);
}

/* the header stays above everything, the black included, and its colour follows the theme */
.testa {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--margine);
  font-size: var(--piccolo);
  font-weight: 560;
  line-height: 1.05;
  letter-spacing: -0.01em;
  pointer-events: none;
}
.testa a { pointer-events: auto; }
.marchio { display: flex; align-items: center; gap: 0.7em; }
.marchio__segno { width: 3.4em; height: 2.05em; fill: currentColor; }
.voci { display: flex; gap: 1.6em; padding-top: 0.25em; }
.voce { position: relative; opacity: 0.62; transition: opacity 0.3s; }
.voce sup { font-size: 0.62em; margin-left: 0.15em; vertical-align: 0.6em; }
.voce.accesa { opacity: 1; }
.voce.accesa::after {
  content: '';
  position: absolute;
  left: 0; right: 0.9em; bottom: -0.25em;
  height: 1px;
  background: currentColor;
}

/* ---------- the home ---------- */
.casa { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.giganti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--lettera);
  overflow: visible;
  pointer-events: none;
}
.volo { position: absolute; inset: 0; z-index: 2; will-change: transform; pointer-events: none; }
.volo.davanti { z-index: 4; }
.stacco { position: absolute; inset: 0; }
.giganti--ombra {
  fill: #000;
  transform: translate(3px, 6px);
  filter: blur(7px);
  opacity: 0;
  visibility: hidden;
}

.testi {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  color: var(--ink);
  font-weight: 560;
  letter-spacing: -0.012em;
}
.maschera { display: inline-block; overflow: hidden; vertical-align: top; line-height: 1; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.maschera > span { display: inline-block; }

.nota {
  position: absolute;
  top: calc(var(--margine) * 2 + 2.6em);
  left: 26%;
  width: min(38em, 46vw);
  font-size: var(--piccolo);
  line-height: 1.12;
}
.nota__n { display: inline-block; width: 34%; }

.titoli {
  position: absolute;
  left: var(--margine);
  right: var(--margine);
  top: 50%;
  transform: translateY(-58%);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(30px, min(8.6vw, 13.5vh), 150px);
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  letter-spacing: -0.045em;
  line-height: 0.9;
}
.titolo { display: block; }

.generi {
  position: absolute;
  left: var(--margine);
  bottom: var(--margine);
  list-style: none;
  font-size: var(--piccolo);
  line-height: 1.12;
}
.firma { position: absolute; right: var(--margine); bottom: var(--margine); font-size: var(--piccolo); }

/* the button that follows the pointer: an element for GSAP (position), its face for the press */
.entra {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  padding: 0;
  font-size: clamp(11px, min(1.15vw, 2.6vh), 15px);
}
.entra__faccia {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.78em 1.05em 0.78em 1.25em;
  border-radius: 999px;
  background: var(--carta);
  color: var(--inchiostro);
  font-weight: 580;
  letter-spacing: -0.01em;
  white-space: nowrap;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06),
    0 1px 1px rgba(0, 0, 0, 0.1),
    0 6px 14px -6px rgba(0, 0, 0, 0.35),
    0 18px 40px -18px rgba(0, 0, 0, 0.45);
}
.entra__scritta { font-variation-settings: 'wdth' 100; transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.entra__freccia {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.entra:focus-visible { outline: none; }
.entra:focus-visible .entra__faccia { box-shadow: 0 0 0 2px var(--inchiostro), 0 0 0 4px var(--carta); }
@media (hover: hover) {
  .casa:hover .entra__scritta { font-variation-settings: 'wdth' 112; }
  .casa:hover .entra__freccia { transform: translateX(2px); }
}

/* ---------- the library ---------- */
.libreria {
  position: absolute;
  inset: 0;
  z-index: 5;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  padding: calc(var(--margine) * 2 + 2.6em) var(--margine) var(--margine);
  font-size: var(--piccolo);
  font-weight: 540;
}
.libreria[hidden] { display: none; }
.fantasma {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--carta);
  opacity: 0.055;
  pointer-events: none;
}
.libreria__cima { position: relative; display: flex; align-items: center; justify-content: space-between; }
.indietro__faccia {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 1em 0.55em 0.8em;
  border-radius: 999px;
  border: 1px solid rgba(245, 244, 238, 0.2);
  background: rgba(245, 244, 238, 0.04);
  box-shadow: inset 0 1px 0 rgba(245, 244, 238, 0.08);
  transition: background-color 0.35s, border-color 0.35s;
}
.indietro__faccia svg { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
@media (hover: hover) {
  .indietro:hover .indietro__faccia { background: rgba(245, 244, 238, 0.1); border-color: rgba(245, 244, 238, 0.4); }
  .indietro:hover .indietro__faccia svg { transform: translateX(-2px); }
}
.vista__spenta { opacity: 0.45; }

.scelta {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  margin-top: clamp(10px, 3.2vh, 40px);
  column-gap: 1em;
}
.scelta__formato { grid-column: 1 / -1; opacity: 0.5; margin-bottom: 0.6em; }
.scelta__nomi {
  display: flex;
  flex-direction: column;
  font-size: clamp(19px, min(4.4vw, 6.6vh), 66px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.98;
}
.scelta__autore { opacity: 0.55; }
.scelta__anno {
  font-size: clamp(19px, min(4.4vw, 6.6vh), 66px);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.elenco { position: relative; margin-top: auto; }
.riga {
  display: grid;
  grid-template-columns: 0.75fr 1.15fr 2fr 0.4fr;
  column-gap: 1em;
  border-top: 1px solid rgba(245, 244, 238, 0.12);
  padding: 0.42em 0;
  line-height: 1.15;
  cursor: pointer;
  transition: opacity 0.35s;
}
.riga--testa { opacity: 0.45; cursor: default; border-top: 0; }
.cella { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; display: block; }
.cella .maschera { display: block; }
.cella--anno { text-align: right; }
.riga .cella--titolo span { transition: color 0.35s; }
.riga.accesa .cella--titolo span { color: var(--accento); }
.elenco.guarda .riga:not(.riga--testa):not(.accesa) { opacity: 0.42; }

.copertura {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.grana {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: var(--grana, 0.08);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@media (max-width: 640px) {
  .voce--extra { display: none; }
  .nota { left: var(--margine); right: var(--margine); width: auto; }
  .nota__n { width: 22%; }
  .titoli { flex-wrap: wrap; column-gap: 0.25em; font-size: clamp(28px, min(12.5vw, 11vh), 64px); }
  .titolo--anno { width: 100%; }
  .riga { grid-template-columns: 0.8fr 1.25fr 1.9fr 0.5fr; column-gap: 0.7em; }
}
