/* The words split in two colours by the edge of the images. Colours in :root (the Playground palette): the cream page
   and the dark copy outside the frame, the light copy and the ember word inside it. The frame (.quadro) is a size
   container: every measure of the words is in cqw, so the dark and the light copy always line up. The script moves
   --k on the two columns (how many lines they sit below the midline) and scales the materials inside the frame. */
:root {
  --page: #f3f1ec;          /* the cream page */
  --ink: #15130f;           /* the dark copy on the page */
  --soft: #77716a;          /* the small words */
  --light: #fbf8f2;         /* the light copy inside the frame */
  --ember: #ff5a1f;         /* the accent: the last word inside the frame */
  --hair: rgba(21, 19, 15, 0.1); /* the thin lines */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
html, body { overflow-x: clip; }
body {
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.75), transparent 60%),
    radial-gradient(60% 50% at 85% 100%, rgba(255, 90, 31, 0.05), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* a veil of grain over the page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.42  0 0 0 0 0.38  0 0 0 0.22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

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

.corsa { position: relative; height: 360vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.6vh, 26px);
  padding: clamp(10px, 2.4vh, 28px) 16px;
  overflow: hidden;
}

/* the top line: the fund and the section */
.testa {
  position: absolute;
  top: clamp(10px, 3vh, 28px);
  left: clamp(16px, 3vw, 40px);
  right: clamp(16px, 3vw, 40px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(9px, min(1.1vw, 1.8vh), 12px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}
.marchio {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--ink);
  font-weight: 600;
}
.marchio svg { width: 1.35em; height: 1.35em; fill: var(--ember); }

/* the frame: 58.4 by 65, as tall as the screen allows, narrow enough for the words on both sides */
.quadro {
  position: relative;
  flex: none;
  width: min(58.4vh, calc((100vw - 40px) / 1.53), 600px);
  aspect-ratio: 58.4 / 65;
  container-type: size;
  margin-top: clamp(14px, 3vh, 30px);
}

/* the hairline the words sit on, across the page */
.linea {
  position: absolute;
  left: -60vw;
  right: -60vw;
  top: calc(50cqh - 3px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hair) 25%, var(--hair) 75%, transparent);
}
.croce {
  position: absolute;
  width: clamp(9px, 2.4cqw, 13px);
  height: clamp(9px, 2.4cqw, 13px);
  stroke: var(--ink);
  stroke-width: 1;
  fill: none;
  opacity: 0.55;
}
.croce-a { left: -4.6cqw; top: -4.6cqw; }
.croce-b { right: -4.6cqw; bottom: -4.6cqw; }

/* the two copies of the words: same box, same measures */
.parole {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: max(20px, calc(var(--size, 15.2) * 1cqw));
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 1.09;
  --a: 1.09em;
}
.col {
  position: absolute;
  bottom: calc(50cqh - 3px);
  white-space: nowrap;
  transform: translate3d(0, calc(var(--k, 0) * var(--a)), 0);
}
.col-s { left: -23.2cqw; --k: 3; }
.col-d { right: -26.5cqw; text-align: right; --k: 1; }
.w { display: block; opacity: 0; }
.fuori { color: var(--ink); }
.dentro { color: var(--light); text-shadow: 0 1px 18px rgba(0, 0, 0, 0.16); }
.dentro .col-d { color: var(--ember); text-shadow: 0 0 22px rgba(255, 90, 31, 0.25); }

/* the window: the materials and the light words are clipped by its edge */
.finestra {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  border-radius: 3px;
  background: #0d1220;
  box-shadow:
    0 1px 1px rgba(21, 19, 15, 0.08),
    0 12px 24px -8px rgba(21, 19, 15, 0.22),
    0 40px 80px -30px rgba(21, 19, 15, 0.35);
}
.bordo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.materiali, .mat { position: absolute; inset: 0; }
.mat { transform-origin: 50% 50%; }
.mat img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; user-select: none; }
.mat:nth-child(1) img { object-position: 30% 50%; }
.mat:nth-child(3) img { object-position: 46% 60%; }
/* a soft vignette over every photo, so the light words read on the brightest parts */
.mat::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, rgba(8, 10, 16, 0) 40%, rgba(8, 10, 16, 0.42) 100%),
    linear-gradient(rgba(8, 10, 16, 0.14), rgba(8, 10, 16, 0.14));
}
/* the parts of the materials that move on their own */
.vivo { position: absolute; pointer-events: none; }
.riflesso {
  inset: -20% -40%;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 236, 214, 0.2) 47%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 236, 214, 0.2) 53%, transparent 62%);
  mix-blend-mode: screen;
}
.lucido {
  top: 0;
  bottom: 0;
  left: 18%;
  width: 16%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  filter: blur(6px);
  mix-blend-mode: soft-light;
}
.vapore {
  width: 46%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 150, 90, 0.34), rgba(255, 110, 50, 0.1) 55%, transparent);
  mix-blend-mode: screen;
  filter: blur(10px);
  opacity: 0;
}

/* the product tag on each material: frosted glass that catches a light when it arrives */
.etichette { position: absolute; inset: 0; pointer-events: none; }
.et {
  position: absolute;
  left: 4.6cqw;
  bottom: 4.6cqw;
  display: grid;
  gap: 0.35em;
  min-width: 46cqw;
  padding: 0.9em 1.05em 0.95em;
  font-size: clamp(8px, 2.75cqw, 12.5px);
  color: rgba(255, 255, 255, 0.92);
  border-radius: 9px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 10px 28px -8px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  opacity: 0;
}
.et-testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: 0.86em;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}
.et-nome { font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif; text-transform: none; font-weight: 600; font-size: 1.12em; letter-spacing: -0.01em; color: #fff; }
.et-cosa {
  font-size: 0.95em;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: -0.005em;
}
.et-giro {
  padding: 0.2em 0.55em;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.88em;
}
.et-dato {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
  margin-top: 0.15em;
  font-weight: 500;
}
.et-num {
  font-size: 2.1em;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.et-unita { color: rgba(255, 255, 255, 0.7); font-size: 0.95em; }
.et-luce {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.42) 50%, rgba(255, 255, 255, 0.05) 70%, transparent);
  mix-blend-mode: overlay;
  transform: translateX(-120%);
}
.et-filo {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  opacity: 0;
}

/* the rail under the frame: the three materials, the one on screen filling its line */
.binario {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 2vw, 18px);
  width: min(58.4vh, calc((100vw - 40px) / 1.53), 600px);
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(8px, min(1vw, 1.6vh), 11px);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
}
.binario li { display: grid; gap: 0.7em; }
.binario span { color: var(--ink); opacity: 0.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.binario i {
  position: relative;
  display: block;
  height: 1px;
  background: var(--hair);
  overflow: hidden;
}
.binario b {
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.nota {
  position: absolute;
  bottom: clamp(8px, 2.2vh, 22px);
  left: 16px;
  right: 16px;
  text-align: center;
  font-size: clamp(9px, min(1vw, 1.6vh), 11px);
  color: var(--soft);
  opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
  .w { opacity: 1; }
  .col-s, .col-d { --k: 0; }
}
