/* The strategies of the fund with the emblem that folds on scroll. Colours in :root (the Playground palette): the
   warm page, the card's paper frame, the grey of the stage, the ink and the red of the emblem. The script builds the
   four panels (a real photo, name, two lines), the index and the rolling figures, and morphs the two red shapes. */
:root {
  --page: #e9e8e4;          /* the page around the card */
  --paper: #f7f6f3;         /* the frame of the card */
  --stage: #d5d5d5;         /* the grey of the stage, as on the original */
  --ink: #2b2b2b;           /* titles and figures */
  --soft: #858481;          /* the small words and the idle index */
  --red: #e41613;           /* the emblem */
  --hair: rgba(43, 43, 43, 0.12); /* the thin lines */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--page); }
html, body { overflow-x: clip; }
body {
  background:
    radial-gradient(90% 60% at 50% 0%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(70% 50% at 50% 100%, rgba(0, 0, 0, 0.05), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the card: a paper frame with a header and the grey stage set into it */
.card {
  position: relative;
  width: min(1120px, 100%);
  height: min(700px, 100%);
  display: flex;
  flex-direction: column;
  padding: clamp(5px, 0.8vw, 9px);
  border-radius: clamp(16px, 2.2vw, 28px);
  background: linear-gradient(180deg, #fbfaf8, var(--paper) 40%, #f1f0ec);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 0 1px rgba(30, 28, 24, 0.07),
    0 1px 2px rgba(30, 28, 24, 0.06),
    0 6px 14px -4px rgba(30, 28, 24, 0.1),
    0 24px 48px -16px rgba(30, 28, 24, 0.18),
    0 60px 90px -40px rgba(30, 28, 24, 0.22);
}

.testa {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: clamp(30px, min(5.4vw, 7.4vh), 52px);
  padding: 0 clamp(6px, 1.2vw, 14px) clamp(4px, 0.6vw, 8px);
  font-size: clamp(10px, min(1.1vw, 1.9vh), 13px);
  letter-spacing: -0.005em;
  color: var(--soft);
}
.marchio {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.marchio svg { width: 1.45em; height: 1.45em; }
.marchio .m-a, .marchio .m-b { fill: var(--red); }
.marchio .m-b { transform: translateX(-2px); }
.testa-centro { font-variant-numeric: lining-nums; }

/* the small dark button: the fill swells on hover, the arrow slips out and comes back */
.portale {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 2.3em;
  padding: 0 0.95em 0 1.05em;
  border-radius: 99px;
  color: #f4f3f0;
  text-decoration: none;
  font-weight: 500;
  font-variation-settings: 'wdth' 100;
  -webkit-tap-highlight-color: transparent;
}
.portale-fondo {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, #3a3a39, #222221);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 14px -6px rgba(0, 0, 0, 0.45);
}
.portale-testo, .portale-freccia { position: relative; }
.portale-freccia { width: 0.85em; height: 0.85em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* the grey stage */
.scena {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: clamp(11px, 1.6vw, 20px);
  overflow: hidden;
  isolation: isolate;
  background: var(--stage);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), inset 0 1px 3px rgba(0, 0, 0, 0.08);
  container-type: size;
}
.pannelli { position: absolute; inset: 0; }
.pannello {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* the light of the room the photos were taken in: soft from the top left, falling off to the corners */
  background:
    radial-gradient(70% 80% at 32% 18%, rgba(255, 255, 255, 0.34), transparent 70%),
    radial-gradient(90% 70% at 70% 110%, rgba(0, 0, 0, 0.1), transparent 70%),
    var(--stage);
}
.foto { position: absolute; inset: 0; }
.foto-dentro { position: absolute; inset: -3%; }
/* the real photo fills the stage; a little bigger than it, so the slow sway never shows an edge */
.foto::after {
  /* the light of the room over the print: a soft grey veil where the words sit, so the plant stays in the middle */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 55% at 0% 100%, rgba(213, 213, 213, 0.78), transparent 70%),
    radial-gradient(42% 60% at 100% 85%, rgba(213, 213, 213, 0.7), transparent 72%),
    radial-gradient(40% 45% at 0% 0%, rgba(225, 225, 225, 0.6), transparent 70%),
    linear-gradient(rgba(213, 213, 213, 0.16), rgba(213, 213, 213, 0.16));
}
.foto img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }

.info { position: absolute; inset: 0; pointer-events: none; }
.titolo-posto {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -54%;
}
.titolo {
  width: max-content;
  font-weight: 500;
  font-size: clamp(30px, min(10.4cqw, 21cqh), 150px);
  line-height: 0.84;
  letter-spacing: -0.05em;
  color: rgba(43, 43, 43, 0.86);
}
.titolo span { display: block; }
.titolo span + span { padding-left: 0.9em; }
.descrizione {
  position: absolute;
  left: 4.2cqw;
  bottom: 6cqh;
  width: min(34ch, 30cqw);
  font-size: clamp(10px, min(1.5cqw, 2.6cqh), 15px);
  line-height: 1.34;
  letter-spacing: -0.01em;
  color: #3d3d3c;
}
.descrizione b {
  display: block;
  margin-bottom: 0.7em;
  font-size: 0.78em;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--soft);
}

/* the emblem sits over the panels and darkens them, so the black plant passes over the red */
.emblema {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: darken;
  pointer-events: none;
  overflow: visible;
}
.forma { fill: var(--red); }
.ombra path { fill: rgba(40, 8, 6, 0.55); }
.lucido { fill: url(#lucido); }
.filo { fill: none; stroke: url(#filo); stroke-width: 3; }

/* the index: the active strategy in ink, a thin red bar beside it */
.indice {
  position: absolute;
  left: 4.2cqw;
  top: 5.5cqh;
  z-index: 3;
  font-size: clamp(10px, min(1.35cqw, 2.6cqh), 14px);
}
.indice ul { list-style: none; position: relative; }
.indice li { height: 1.9em; }
.indice button {
  display: block;
  height: 100%;
  font: inherit;
  letter-spacing: -0.01em;
  color: var(--soft);
  background: none;
  border: 0;
  padding: 0 0 0 0.9em;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.indice button span { display: inline-block; }
.indice-segno {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 1.9em;
}
.indice-segno span {
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 2px;
  height: 1em;
  border-radius: 2px;
  background: var(--red);
  box-shadow: 0 1px 3px rgba(150, 12, 10, 0.25);
}

/* the figures: label above, value that rolls like a counter */
.dati {
  position: absolute;
  right: 4.2cqw;
  bottom: 6cqh;
  z-index: 3;
  display: grid;
  gap: clamp(8px, 2.6cqh, 22px);
  text-align: right;
  font-size: clamp(11px, min(1.75cqw, 3.2cqh), 19px);
}
.dato dt {
  font-size: 0.6em;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a4a49;
  margin-bottom: 0.3em;
}
.dato dd {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-family: 'Newsreader Variable', 'Newsreader', Georgia, serif;
  font-size: 1.12em;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}
.cella {
  position: relative;
  display: inline-block;
  height: 1.12em;
  width: 0.56em;
  overflow: hidden;
  text-align: center;
  vertical-align: top;
}
.rullo { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; }
.rullo i { font-style: normal; height: 1.12em; line-height: 1.12em; }
.segno { display: inline-block; line-height: 1.12em; }
.tra { width: 1.25em; height: 0.6em; margin: 0 0.18em; fill: none; stroke: currentColor; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }

/* a veil of grain over the whole stage, red included, as in a print */
.grana {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  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='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.4  0 0 0 0 0.4  0 0 0 0 0.4  0 0 0 0.2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.nota {
  position: absolute;
  bottom: clamp(2px, 0.9vh, 10px);
  left: 0;
  right: 0;
  text-align: center;
  font-size: clamp(8px, min(0.9vw, 1.5vh), 11px);
  color: rgba(43, 43, 43, 0.4);
}

@media (hover: hover) {
  .indice button { transition: color 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
  .indice button span { transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
  .indice button:hover { color: var(--ink); }
  .indice button:hover span { transform: translateX(3px); }
  .portale-fondo { transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s; }
  .portale-freccia { transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
  .portale:hover .portale-fondo { transform: scale(1.06, 1.12); background: linear-gradient(180deg, #454544, #262625); }
  .portale:hover .portale-freccia { transform: translate(2px, -2px); }
}
.portale:active .portale-fondo { transform: scale(0.96); transition-duration: 0.12s; }
.indice button:active span { transform: translateX(1px) scale(0.98); }
.indice button:focus-visible, .portale:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 6px; }

/* narrow stages: the figures go up to the right in two columns, the description shortens */
@container (max-width: 560px) {
  .dati {
    top: 5.5cqh;
    bottom: auto;
    grid-template-columns: auto auto;
    column-gap: 4.5cqw;
    row-gap: 1.6cqh;
    font-size: clamp(10px, 3.4cqw, 15px);
  }
  .indice { font-size: clamp(9px, 3.1cqw, 13px); }
  .descrizione { width: 62cqw; font-size: clamp(9px, 3.1cqw, 13px); }
  .titolo { font-size: clamp(26px, min(14cqw, 13cqh), 90px); }
  /* the eucalyptus: on a tall stage show the carafe side, where fewer leaves fall behind the index */
  .pannello:nth-child(3) .foto img { object-position: 14% 40% !important; }
  /* on a tall stage the index and the figures sit at the top: the veil moves up there */
  .foto::after {
    background:
      linear-gradient(rgba(218, 218, 218, 0.8), rgba(218, 218, 218, 0) 32%),
      radial-gradient(90% 30% at 0% 100%, rgba(213, 213, 213, 0.75), transparent 75%),
      linear-gradient(rgba(213, 213, 213, 0.16), rgba(213, 213, 213, 0.16));
  }
}
@media (max-width: 520px) {
  .testa-centro { display: none; }
}
