/* The index that follows the reading: the index of a long essay on a made-up personal journal, Odalo, in the minimal
   style. A warm white page, black ink, one ultramarine for the bookmark of the chapter being read. In a tall section
   the stage stays still while you scroll; the script places the chapters, their sizes and their axes every frame. */
:root {
  --carta: #f4f1ea;        /* the warm white of the page */
  --inchiostro: #141414;   /* the chapters still to read */
  --tenue: #9a948a;        /* the chapters already read and the small text */
  --sottile: #d6d0c4;      /* the hairlines of the index */
  --accento: #2f3dd6;      /* the bookmark of the chapter being read */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Instrument Sans Variable', 'Instrument Sans', '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);
}

.resto {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--inchiostro);
}

.titolo {
  margin: 0;
  font-size: clamp(46px, 8.4vw, 124px);
  font-weight: 600;
  font-stretch: 82%;
  line-height: 0.94;
  letter-spacing: -0.035em;
}

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

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

.palco {
  position: sticky;
  top: 0;
  height: 100lvh;
  overflow: hidden;
}

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

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

/* the index: the script writes every position */
.indice {
  position: absolute;
  inset: 0;
}

.voci {
  margin: 0;
  padding: 0;
  list-style: none;
}

.voce {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.voce__titolo {
  display: block;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.02em;
  transform-origin: 0 0;
}

.voce__tempo {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 13px;
  font-weight: 450;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--tenue);
  will-change: transform;
}

/* the hairline under the chapter being read, and the one over the chapters already read */
.filo {
  position: absolute;
  top: 0;
  left: 0;
  height: 1px;
  background: var(--sottile);
  transform-origin: 0 50%;
}

/* the bookmark: a hairline of ultramarine beside the chapter being read */
.nastro {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: 1px;
  background: var(--accento);
  transform-origin: 50% 0;
}

/* ------------------------------------------------------------ phone: the same, with smaller measures */
@media (max-width: 640px) {
  .voce__tempo {
    font-size: 12px;
  }
}
