/* Paint chips: the autumn colour card of a made-up paint maker, in the minimal style. A warm white page, black ink and
   six paint colours. In a tall section a stage stays still while you scroll: on it a row of tall, narrow chips. Every
   chip is a layer as big as the stage, cut down to its strip by a clip-path that the script writes; inside it the
   script adds the big name, a hairline with a note and the colour code, and a copy of the header in the colour that
   reads on the paint. */
:root {
  --carta: #f2efe9;        /* the warm white of the page */
  --inchiostro: #161514;   /* the words */
  --tenue: #8f8a81;        /* the small text */
  --chiaro: #f7f4ee;       /* the words on a dark paint */
  --clay: #c46a46;         /* the paints, one per chip */
  --fog: #b9bfc2;
  --saffron: #e2a43a;
  --moss: #5d6a3b;
  --lagoon: #2c7a82;
  --plum: #5a2741;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Archivo Variable', 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------ the opening and the end */
.apertura {
  display: grid;
  align-content: center;
  gap: 22px;
  min-height: 92vh;
  padding: 80px clamp(16px, 5vw, 72px);
}

.apertura--fine {
  min-height: 70vh;
}

.piccolo {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.piccolo--tenue {
  color: var(--tenue);
}

.titolo {
  margin: 0;
  font-size: clamp(48px, 8.6vw, 128px);
  font-weight: 300;
  font-stretch: 78%;
  line-height: 0.94;
  letter-spacing: -0.035em;
}

.titolo--medio {
  font-size: clamp(38px, 6vw, 88px);
}

/* ------------------------------------------------------------ the stage */
.racconto {
  position: relative;
  height: 760lvh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100lvh;
  overflow: hidden;
  background: var(--carta);
}

.testa {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 26px clamp(16px, 5vw, 72px);
  pointer-events: none;
}

.marchio {
  margin: 0;
  font-size: 17px;
  font-weight: 640;
  font-stretch: 88%;
  letter-spacing: -0.02em;
}

.campioni {
  position: absolute;
  inset: 0;
}

/* every chip covers the whole stage; the script cuts it down to its strip */
.campione {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--tinta);
  color: var(--su-tinta, var(--inchiostro));
  clip-path: inset(50% 50% 50% 50%);
}

/* the name on the strip, small, reading upwards from its foot */
.campione__nome {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 11px;
  font-weight: 560;
  font-stretch: 100%;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transform-origin: 0 0;
}

/* the big name, in the middle of the stage: one window per letter, so each letter can rise into it */
.grande {
  position: absolute;
  left: 50%;
  top: 47%;
  margin: 0;
  font-size: var(--corpo, 160px);
  font-weight: var(--peso, 640);
  font-stretch: calc(var(--wd, 62) * 1%);
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.grande__finestra {
  display: inline-block;
  overflow: hidden;
  padding: 0.08em 0.1em 0.2em;
  margin: -0.08em -0.1em -0.2em;
  vertical-align: top;
}

.grande__lettera {
  display: inline-block;
}

/* under the name: a hairline that draws itself, with a note on the left and the colour code on the right */
.dati {
  position: absolute;
  left: 50%;
  top: calc(47% + var(--corpo, 160px) * 0.5 + 26px);
  width: min(var(--largo, 520px), calc(100% - 32px));
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 480;
}

.dati__linea {
  display: block;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

.dati__riga {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
}

.dati__finestra {
  display: block;
  overflow: hidden;
  padding: 2px 0;
}

.dati__testo {
  display: inline-block;
  white-space: nowrap;
}

.dati__codice {
  font-stretch: 75%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* the copy of the header inside a chip, in the colour that reads on that paint */
.campione .testa {
  color: inherit;
}

@media (max-width: 640px) {
  .dati {
    font-size: 12px;
  }

  .dati__riga {
    gap: 10px;
  }
}
