/* The project photo that opens from a slit as you scroll. Colours in :root (the Playground palette). */
:root {
  --fondo: #f4f1ea;
  --inchiostro: #1c1b19;
  --tenue: #8a857c;
  --accento: #d9542b;
  --bianco: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--fondo); }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.corsa { position: relative; height: 360vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vh, 36px) clamp(10px, 3vw, 36px);
  overflow: hidden;
}

/* the artboard is drawn at 680 x 420 and scaled to fit the stage on both width and height */
.spazio { position: relative; flex: none; }
.tavola {
  position: absolute;
  left: 0;
  top: 0;
  width: 680px;
  height: 420px;
  transform-origin: 0 0;
  /* the halves of the title leave the board at its edges; the margin keeps the crop marks */
  clip-path: inset(-10px);
}

/* the studio header, small, at the top of the artboard */
.testata {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  letter-spacing: 0.01em;
  z-index: 6;
  color: var(--inchiostro);
}
.testata__marchio { display: inline-flex; align-items: center; gap: 7px; font-weight: 640; }
.testata__marchio svg { width: 14px; height: 14px; fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.testata__voce { opacity: 0.6; font-weight: 480; }

/* the photo fills the artboard; GSAP opens it with clip-path inset, in pixels */
.foto {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(50% 50% 50% 50%);
  background: #c9c0b1;
  z-index: 1;
}
.foto__dentro { position: absolute; inset: -40px 0; will-change: transform; }
.foto__img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 50% 52%; }
.foto__grana {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.foto__velo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(20, 18, 15, 0.38) 0%, rgba(20, 18, 15, 0) 22%, rgba(20, 18, 15, 0) 52%, rgba(20, 18, 15, 0.62) 100%);
  opacity: 0;
}

/* the captions arrive at the end, over the bottom of the photo */
.didascalia {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 20px;
  row-gap: 3px;
  color: var(--bianco);
  align-items: end;
}
.didascalia__riga { grid-column: 1; font-size: 13px; font-weight: 460; opacity: 0.86; }
.didascalia__riga--nome { font-size: 22px; font-weight: 660; font-stretch: 108%; opacity: 1; letter-spacing: -0.01em; }
.didascalia__lato {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0.02em;
}
.didascalia__lato span { padding: 3px 9px; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 999px; }

/* the crop marks follow the opening of the photo */
.angoli { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.angolo {
  position: absolute;
  left: 0;
  top: 0;
  width: 12px;
  height: 12px;
  border: 0 solid var(--accento);
  opacity: 0;
}
.angolo--a { border-top-width: 1.5px; border-left-width: 1.5px; }
.angolo--b { border-top-width: 1.5px; border-right-width: 1.5px; }
.angolo--c { border-bottom-width: 1.5px; border-left-width: 1.5px; }
.angolo--d { border-bottom-width: 1.5px; border-right-width: 1.5px; }

/* the title: two copies of the same line, one clipped to its top half and one to its bottom half */
.titolo {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  z-index: 5;
  font-weight: 680;
  font-stretch: 92%;
  letter-spacing: -0.035em;
  line-height: 1;
  white-space: nowrap;
}
.meta {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  justify-content: center;
  will-change: transform;
}
.meta__testo { display: block; }
.meta--su .meta__testo { clip-path: inset(-20% -5% var(--taglio, 50%) -5%); }
.meta--giu .meta__testo { clip-path: inset(calc(100% - var(--taglio, 50%)) -5% -20% -5%); }
.meta__filo {
  position: absolute;
  left: 50%;
  height: 1.5px;
  background: var(--accento);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* the hint at the bottom */
.invito {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tenue);
  z-index: 6;
}
.invito svg { width: 10px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

@media (prefers-reduced-motion: reduce) {
  .invito { display: none; }
}
