/* The figures that light up: the about section of a made-up interior studio. A cream page and, in a tall section, a
   stage that stays still while you scroll, with four cards in a row. Every card has three layers over a room drawn
   by the script: a dark veil, a pale veil on top, and the words. */
:root {
  --crema: #f4f3eb;        /* the cream of the page */
  --pallida: #eeece4;      /* the pale veil over the cards */
  --spenta: #c4c2b7;       /* the words of a card that is asleep */
  --accesa: #ffffff;       /* the words of the card that is lit */
  --buio: rgba(0, 0, 0, 0.5);  /* the dark veil under the words, over the room */
  --inchiostro: #1e1e1e;   /* the text on the cream */
  --tenue: #8c8c8c;        /* the small text */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--crema);
  color: var(--inchiostro);
  font-family: 'Roboto Condensed Variable', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.apertura {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  min-height: 90vh;
  padding: 80px 16px;
  text-align: center;
}

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

.etichetta {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.etichetta--parentesi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 9px;
}

.etichetta--parentesi svg {
  width: 5px;
  height: 13px;
}

.titolo {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: clamp(42px, 5vw, 76px);
  line-height: 0.9;
}

.titolo--medio {
  font-size: clamp(34px, 3.2vw, 52px);
}

.testo {
  max-width: 36ch;
  margin: 0;
  color: var(--tenue);
  font-size: 15px;
  line-height: 1.35;
}

/* ---------------------------------------------------------------- the tall section and its still stage */
.racconto {
  position: relative;
  height: 420lvh;
}

.palco {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  gap: clamp(20px, 4vh, 40px);
  height: 100lvh;
  padding: 0 clamp(16px, 1.6vw, 24px);
  overflow: hidden;
}

.testa {
  display: grid;
  justify-items: start;
  gap: 8px;
  width: min(100%, 1180px);
  margin: 0 auto;
}

.testo--sotto {
  width: min(100%, 1180px);
  max-width: none;
  margin: 0 auto;
  padding-left: 50%;
  padding-right: 8%;
  font-size: 13px;
}

.finestra {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.carte {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------------------------------------------------------------- one card */
.carta {
  position: relative;
  aspect-ratio: 342 / 400;
  overflow: hidden;
  border-radius: 2px;
  background: var(--pallida);
}

.carta__stanza,
.carta__buio,
.carta__velo {
  position: absolute;
  inset: 0;
}

.carta__stanza svg {
  display: block;
  width: 100%;
  height: 100%;
}

.carta__buio {
  background: var(--buio);
}

.carta__velo {
  background: var(--pallida);
}

.carta__testo {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  margin: 0;
  padding: clamp(14px, 1.4vw, 24px);
  color: var(--spenta);
  font-size: clamp(14px, 1.2vw, 19px);
}

.carta__cifra {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(64px, 7.4vw, 124px);
  line-height: 0.8;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

/* on a phone the cards are wide and the row slides sideways as you scroll */
@media (max-width: 767px) {
  .finestra {
    width: auto;
    margin: 0 calc(-1 * clamp(16px, 1.6vw, 24px));
    padding: 0 16px;
  }

  .carte {
    display: flex;
    width: max-content;
  }

  .carta {
    width: 75vw;
    aspect-ratio: 280 / 320;
  }

  .testo--sotto {
    padding-left: 0;
  }
}

/* with reduced motion on a phone, the row scrolls sideways under the finger instead */
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .finestra {
    overflow-x: auto;
  }
}
