:root {
  --fondo: #ffffff;        /* the paper of the archive */
  --inchiostro: #171717;   /* the ink of the labels (the site's foreground) */
  --spento: #737373;       /* the grey of years and notes (the site's muted) */
  --carta: #f1efea;        /* the warm grey behind a photo that is still loading */
  --ombra: rgba(23, 23, 23, .16);
  --curva: cubic-bezier(.19, 1, .22, 1);   /* the site's ease-out-expo */
  --magia: cubic-bezier(.33, 0, 0, 1);     /* the site's own curve */
  --carattere: 'Geist Mono Variable', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; background: var(--fondo); }

body {
  font-family: var(--carattere);
  color: var(--inchiostro);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.palco {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.palco.is-presa { cursor: grabbing; }

/* the plane: every card is placed from its centre, the plane shrinks around the middle of the screen while held */
.piano {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

.cella {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--lato);
  will-change: transform;
}

/* the element GSAP never touches: hover and pressure live here, in CSS */
.card {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.etichetta {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6em;
  height: var(--riga);
  font-size: var(--testo);
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.etichetta__nome {
  position: relative;
  padding: .28em .32em .24em;
  margin-left: -.32em;
  flex: none;
}

/* the fill behind the bracketed name, as on the site: it stretches from the left and the text turns white */
.etichetta__nome::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--inchiostro);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .3s var(--curva);
  z-index: -1;
}

.etichetta__nome { z-index: 0; transition: color .2s linear .04s; }

.etichetta__anno { color: var(--spento); flex: none; }
.is-piccola .etichetta__anno { display: none; }

.foto {
  position: relative;
  display: block;
  width: var(--lato);
  height: var(--lato);
  background: var(--carta);
  overflow: hidden;
  transition: transform .5s ease-out;
}

/* the soft shadow that grows while the plane is held (a pre-made shadow whose opacity changes: cheap) */
.foto::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: 0 calc(var(--lato) * .1) calc(var(--lato) * .22) var(--ombra), 0 1px 2px rgba(23, 23, 23, .08);
  opacity: var(--presa, 0);
  pointer-events: none;
}

/* the photo is a touch larger than its window and leans against the pointer: depth without moving the card */
.foto img {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  display: block;
  transform: translate3d(var(--fx, 0px), var(--fy, 0px), 0);
  pointer-events: none;
  -webkit-user-drag: none;
}

.foto::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(23, 23, 23, .06);
  pointer-events: none;
}

.dono {
  display: block;
  height: var(--riga);
  padding-top: .7em;
  font-size: var(--testo);
  line-height: 1.25;
  color: var(--spento);
  white-space: nowrap;
  overflow: visible;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s linear, transform .5s var(--curva);
  pointer-events: none;
}

/* one card lit: by the pointer, by the keyboard, or by the tour of the preview */
.cella.is-accesa .foto { transform: scale(1.08); }
.cella.is-accesa .etichetta__nome::before { transform: scaleX(1); }
.cella.is-accesa .etichetta__nome { color: var(--fondo); }
.cella.is-accesa .dono { opacity: 1; transform: none; }
.cella.is-accesa { z-index: 2; }

@media (hover: hover) {
  .palco:not(.is-presa) .cella:hover .foto { transform: scale(1.08); }
  .palco:not(.is-presa) .cella:hover .etichetta__nome::before { transform: scaleX(1); }
  .palco:not(.is-presa) .cella:hover .etichetta__nome { color: var(--fondo); }
  .palco:not(.is-presa) .cella:hover .dono { opacity: 1; transform: none; }
  .palco:not(.is-presa) .cella:hover { z-index: 2; }
}

/* pressure: the card gives a little under the finger */
.card:active .foto { transform: scale(1.02); transition-duration: .15s; }

.card:focus-visible .foto { outline: 1px solid var(--inchiostro); outline-offset: 3px; }

/* ---- the frame: brand, replay, notes ---- */
.testa, .piede {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(12px, 2.6vh, 24px) clamp(14px, 2.2vw, 28px);
  font-size: clamp(9.5px, .78vw, 12px);
  letter-spacing: .03em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 5;
}

.testa { top: 0; background: linear-gradient(var(--fondo) 45%, color-mix(in srgb, var(--fondo) 0%, transparent)); padding-bottom: clamp(22px, 5vh, 44px); }
.piede { bottom: 0; color: var(--spento); background: linear-gradient(color-mix(in srgb, var(--fondo) 0%, transparent), var(--fondo) 55%); padding-top: clamp(22px, 5vh, 44px); }



.parentesi {
  pointer-events: auto;
  position: relative;
  border: 0;
  background: none;
  font: inherit;
  color: var(--inchiostro);
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  padding: .35em .1em;
}

.parentesi::before, .parentesi::after {
  display: inline-block;
  color: var(--spento);
  transition: transform .4s var(--curva);
}
.parentesi::before { content: '['; margin-right: .55em; }
.parentesi::after { content: ']'; margin-left: .55em; }

.parentesi__testo {
  position: relative;
  display: inline-block;
  padding: .2em .25em;
  z-index: 0;
  transition: color .2s linear;
}

.parentesi__testo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--inchiostro);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .3s var(--curva);
  z-index: -1;
}

@media (hover: hover) {
  .parentesi:hover .parentesi__testo { color: var(--fondo); }
  .parentesi:hover .parentesi__testo::before { transform: scaleX(1); }
  .parentesi:hover::before { transform: translateX(-2px); }
  .parentesi:hover::after { transform: translateX(2px); }
}

.parentesi:active .parentesi__testo { transform: scale(.96); }
.parentesi:focus-visible { outline: 1px solid var(--inchiostro); outline-offset: 2px; }

@media (max-width: 520px) {
  .piede__nota { display: none; }
  .piede { justify-content: flex-end; }
}
