:root {
  --carta: #f6f3ed;          /* the page */
  --carta-palco: #efebe3;    /* the band behind the gallery */
  --inchiostro: #1b1a18;     /* text */
  --grigio: #6f6a62;         /* captions, credits */
  --filetto: #d6cfc3;        /* thin rules */
  --accento: #a13d26;        /* kicker, line, end mark */
  --ombra-foto: rgba(40, 32, 22, .16);

  --serif: 'Source Serif 4 Variable', 'Source Serif 4', Georgia, serif;
  --sans: 'Inter Tight Variable', 'Inter Tight', system-ui, sans-serif;
  --margine: clamp(16px, 4vw, 56px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--carta);
  color: var(--inchiostro);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a { color: inherit; }

/* ---------------------------------------------------------------- masthead */
.testata {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin: 0 var(--margine);
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--inchiostro);
}
.testata__nome {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 600;
  font-style: italic;
  letter-spacing: -.02em;
  font-variation-settings: 'opsz' 60;
}
.testata__motto {
  margin: 0;
  font-family: var(--sans);
  font-size: .75rem;
  color: var(--grigio);
  text-align: right;
}

/* ---------------------------------------------------------------- the article */
.articolo { padding: 0 var(--margine); }
.apertura {
  max-width: 54rem;
  margin: 0 auto;
  padding: clamp(56px, 10vh, 120px) 0 clamp(36px, 6vh, 64px);
  text-align: center;
}
.apertura__occhiello {
  margin: 0 0 18px;
  font-family: var(--sans);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accento);
}
.apertura__titolo {
  margin: 0;
  font-size: clamp(3.2rem, 11vw, 8.4rem);
  font-weight: 380;
  line-height: .92;
  letter-spacing: -.035em;
  font-variation-settings: 'opsz' 60;
}
.apertura__titolo .riga { display: inline-block; overflow: clip; padding: 0 .04em .12em; margin-bottom: -.12em; vertical-align: top; }
.apertura__titolo .riga > span { display: inline-block; }
.apertura__catenaccio {
  max-width: 36rem;
  margin: 28px auto 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-style: italic;
  line-height: 1.45;
  color: #3d3a35;
}
.apertura__firma {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 30px 0 0;
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--grigio);
}
.apertura__tempo { padding-left: 18px; border-left: 1px solid var(--filetto); }

/* the byline link: the name slides to italic serif and warms up */
.firma {
  color: var(--inchiostro);
  font-weight: 600;
  text-decoration: none;
  transition: color .35s cubic-bezier(.2, .7, .2, 1), letter-spacing .45s cubic-bezier(.2, .7, .2, 1);
}
@media (hover: hover) {
  .firma:hover { color: var(--accento); letter-spacing: .03em; }
}

.testo {
  max-width: 36rem;
  margin: 0 auto;
  font-size: clamp(1.08rem, 1.5vw, 1.2rem);
  line-height: 1.68;
  font-variation-settings: 'opsz' 18;
}
.testo p { margin: 0 0 1.25em; }
.testo__primo::first-letter {
  float: left;
  margin: .06em .1em 0 0;
  font-size: 4.1em;
  line-height: .78;
  font-weight: 500;
  font-variation-settings: 'opsz' 60;
  color: var(--accento);
}
.articolo:first-of-type .testo { padding-bottom: clamp(48px, 9vh, 96px); }

.articolo--dopo { padding-top: clamp(56px, 10vh, 110px); padding-bottom: 96px; }

.citazione {
  margin: 1.8em 0;
  padding: 26px 0 0;
  position: relative;
}
.citazione::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 72px;
  height: 2px;
  background: var(--accento);
  transform-origin: 0 50%;
  transform: scaleX(var(--riga, 1));
}
.citazione p {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.25rem);
  font-style: italic;
  line-height: 1.22;
  letter-spacing: -.01em;
  font-variation-settings: 'opsz' 48;
}
.fine {
  display: inline-block;
  width: .55em;
  height: .55em;
  margin-left: .35em;
  vertical-align: baseline;
  fill: var(--accento);
}
.nota {
  max-width: 36rem;
  margin: 40px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--filetto);
  font-family: var(--sans);
  font-size: .78rem;
  line-height: 1.5;
  color: var(--grigio);
}
.nota p { margin: 0; }

/* ---------------------------------------------------------------- the gallery */
.galleria {
  position: relative;
  height: 500lvh; /* the script sets the real height from LENGTH */
  background: var(--carta-palco);
  border-top: 1px solid var(--filetto);
  border-bottom: 1px solid var(--filetto);
}
.palco {
  position: sticky;
  top: 0;
  height: 100lvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
.palco__testa {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 var(--margine);
  padding: 18px 0 12px;
  border-bottom: 1px solid var(--filetto);
  font-family: var(--sans);
  font-size: .72rem;
  letter-spacing: .02em;
  color: var(--grigio);
}
.palco__testa i { font-family: var(--serif); font-size: 1.1em; color: var(--inchiostro); margin-left: .3em; }

.palco__finestra {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  /* --t: the height the pictures are measured in (the strip minus the room for the captions) */
  --t: calc(100lvh - 13.5rem);
  padding: 22px 0 0;
}
.binario {
  display: flex;
  align-items: flex-start;
  gap: clamp(40px, 6vw, 112px);
  width: max-content;
  height: calc(var(--t) + 5.5rem);
  padding: 0 var(--margine);
  will-change: transform;
}

.apri {
  flex: none;
  align-self: center;
  width: clamp(230px, 26vw, 360px);
  padding-bottom: 5.5rem;
}
.apri__occhiello {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accento);
}
.apri__titolo {
  margin: 0;
  font-size: clamp(2rem, 3.6vw, 3.1rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -.025em;
  font-variation-settings: 'opsz' 60;
}
.apri__titolo em { font-weight: 300; }
.apri__testo {
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.5;
  color: #45413b;
}
.apri__freccia {
  display: block;
  width: 64px;
  margin-top: 22px;
  fill: none;
  stroke: var(--inchiostro);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foto {
  flex: none;
  position: relative;
  margin: calc(var(--t) * var(--y)) 0 0;
  width: calc(var(--t) * var(--h) * var(--r));
}
.foto__cornice {
  position: relative;
  height: calc(var(--t) * var(--h));
  overflow: hidden;
  background: #cfc8bc;
  box-shadow: 0 18px 40px -22px var(--ombra-foto);
  will-change: transform;
}
/* wider than the frame by --m on each side: the script slides it the other way (parallax) */
.foto__scorre {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--m, .12) * -100%);
  right: calc(var(--m, .12) * -100%);
  will-change: transform;
}
.foto__scorre img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.1s cubic-bezier(.16, 1, .3, 1);
}
@media (hover: hover) {
  .foto:hover .foto__scorre img { transform: scale(1.035); }
}

.foto__dida {
  margin: 12px 0 0;
  max-width: 34ch;
  font-family: var(--sans);
  font-size: .76rem;
  line-height: 1.45;
  color: #4a463f;
  will-change: transform, opacity;
}
.foto__luogo {
  font-weight: 650;
  color: var(--inchiostro);
  margin-right: .25em;
}
.foto__fonte {
  display: block;
  margin-top: 3px;
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grigio);
}

/* the line under the pictures */
.corso {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 0 var(--margine);
  padding: 14px 0 22px;
  font-family: var(--sans);
  font-size: .72rem;
  color: var(--grigio);
}
.corso__luogo { white-space: nowrap; }
.corso__luogo:last-child { text-align: right; }
.corso__linea {
  position: relative;
  height: 9px;
}
.corso__linea::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 1px;
  background: var(--filetto);
}
.corso__pieno {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 1px;
  background: var(--inchiostro);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.corso__tacca {
  position: absolute;
  top: 0;
  width: 1px;
  height: 9px;
  margin-left: -.5px;
  background: var(--inchiostro);
  transform-origin: 50% 100%;
  opacity: .3;
}

/* ---------------------------------------------------------------- phone */
@media (max-width: 700px) {
  .testata__motto { max-width: 15rem; }
  .palco__titolo { display: none; }
  .palco__finestra { --t: min(calc(100lvh - 15rem), 112vw); align-items: flex-end; padding-bottom: 6px; }
  .apri { width: min(64vw, 260px); }
  .apri__titolo { font-size: 2.1rem; }
  .apri__testo { font-size: .95rem; }
  .foto__dida { font-size: .72rem; }
  .apertura__tempo { padding-left: 0; border-left: 0; }
}
@media (max-height: 560px) {
  .palco__finestra { --t: calc(100lvh - 11rem); padding-top: 12px; }
  .foto__fonte { display: none; }
}

/* ---------------------------------------------------------------- reduced motion: a row you swipe */
.ridotto .galleria { height: auto; }
.ridotto .palco { position: relative; height: 100lvh; }
.ridotto .palco__finestra { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.ridotto .palco__finestra::-webkit-scrollbar { display: none; }
.ridotto .binario { will-change: auto; }
