:root {
  --carta: #efeeed;          /* the paper of the pages */
  --inchiostro: #22201d;     /* warm black: headers, footers, text */
  --grigio: #474747;         /* body text */
  --nebbia: #e5e5e5;         /* light text on the warm black */
  --oro: #b8a88a;            /* the only accent: the line on the edge */
  --arco-h: 60px;            /* room above the footer for the bend (set by script.js) */
  --bordo-h: 26px;           /* height of the brush edge (set by script.js) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'Mulish Variable', 'Mulish', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.palco { position: fixed; inset: 0; overflow: hidden; }

/* one book = one page that scrolls inside the stage */
.foglio {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: var(--carta);
  outline: none;
}
.foglio::-webkit-scrollbar { display: none; }
.foglio.is-sotto { visibility: hidden; }

/* ---- the header: the footer of the book before, arrived at the top ---- */
.testa {
  position: relative;
  height: 60vh;
  min-height: 210px;
  background: var(--inchiostro);
  color: var(--nebbia);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(14px, 3.4vh, 30px) clamp(20px, 6vw, 64px) calc(var(--bordo-h) + clamp(14px, 4vh, 34px));
}
.testa__riga {
  display: flex;
  justify-content: space-between;
  font-size: clamp(9px, min(2.6vw, 2.6vh), 12px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(229, 229, 229, .62);
}
.testa__riga .marchio {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-variation-settings: 'opsz' 24, 'wght' 500, 'SOFT' 100;
  letter-spacing: .08em;
  text-transform: none;
  font-size: 1.35em;
  color: var(--nebbia);
}
.testa__bordo {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  width: 100%;
  height: var(--bordo-h);
  display: block;
}
.testa__bordo path { fill: var(--carta); }

.occhiello {
  font-size: clamp(9px, min(2.6vw, 2.5vh), 12px);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--oro);
  margin-bottom: .9em;
  white-space: nowrap;
}
.occhiello span { display: inline-block; }

.titolo {
  --wght: 380;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 400;
  font-optical-sizing: none;
  font-variation-settings: 'opsz' 96, 'wght' var(--wght), 'SOFT' 60, 'WONK' 0;
  letter-spacing: -.02em;
  line-height: 1;
  white-space: nowrap;
  transform-origin: 0 0;
}
.testa .titolo { font-size: clamp(34px, min(11vw, 12vh), 104px); }

/* ---- the chapter ---- */
.corpo {
  max-width: 36em;
  padding: clamp(14px, 5vh, 54px) clamp(20px, 6vw, 64px) clamp(30px, 12vh, 110px);
  font-size: clamp(13px, min(3.9vw, 3.7vh), 17px);
  line-height: 1.62;
  color: var(--grigio);
}
.corpo p + p { margin-top: 1em; }
.corpo .primo::first-letter {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-variation-settings: 'opsz' 72, 'wght' 420;
  float: left;
  font-size: 3.1em;
  line-height: .86;
  padding: .06em .1em 0 0;
  color: var(--inchiostro);
}
.fine {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-top: 2.2em !important;
  font-size: .72em;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--inchiostro);
}
.fine__riga { display: block; width: 3.2em; height: 1px; background: var(--oro); }

/* ---- the footer: the door to the next book ---- */
.piede {
  position: relative;
  height: min(56vh, 380px);
  min-height: 200px;
  background: var(--inchiostro);
  color: var(--nebbia);
  padding: clamp(18px, 5vh, 44px) clamp(20px, 6vw, 64px) clamp(12px, 3vh, 26px);
  display: flex;
  flex-direction: column;
}
/* the bend lives above the footer, in the paper */
.arco {
  position: absolute;
  left: 0;
  bottom: calc(100% - 1px);
  width: 100%;
  height: var(--arco-h);
  overflow: visible;
  pointer-events: none;
}
.arco__fondo { fill: var(--inchiostro); }
.arco__oro { fill: none; stroke: var(--oro); stroke-width: 1; }
.arco__eco { fill: none; stroke: var(--oro); stroke-width: 1; opacity: .32; }

.piede__link {
  display: block;
  align-self: flex-start;
  color: inherit;
  text-decoration: none;
  outline: none;
}
.piede__link .titolo {
  display: inline-flex;
  align-items: center;
  gap: .28em;
  font-size: clamp(28px, min(8.6vw, 9vh), 64px);
  color: var(--carta);
  transition: font-variation-settings .45s cubic-bezier(.3, 1.4, .5, 1), transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.piede__freccia {
  width: .5em;
  height: .5em;
  flex: none;
  transition: transform .45s cubic-bezier(.3, 1.6, .5, 1);
}
.piede__freccia path { fill: none; stroke: var(--oro); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.piede__link:focus-visible .titolo { --wght: 520; }
.piede__link:active .titolo { transform: scale(.985); }
@media (hover: hover) {
  .piede__link:hover .titolo { --wght: 520; }
  .piede__link:hover .piede__freccia { transform: translateX(.12em); }
}

.invito {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  font-size: clamp(10px, min(2.8vw, 2.7vh), 12px);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(229, 229, 229, .74);
}
.invito__parole span { display: inline-block; white-space: pre; }
.invito__binario {
  position: relative;
  width: 64px;
  height: 1px;
  background: rgba(229, 229, 229, .22);
  overflow: hidden;
}
.invito__pieno {
  position: absolute;
  inset: 0;
  background: var(--oro);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.invito__giu { width: 10px; height: 10px; flex: none; }
.invito__giu path { fill: none; stroke: var(--oro); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.piede__fondo {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin-top: clamp(10px, 3vh, 26px);
  padding-top: clamp(8px, 2vh, 14px);
  border-top: 1px solid rgba(229, 229, 229, .12);
  font-size: clamp(8px, min(2.4vw, 2.3vh), 11px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(229, 229, 229, .42);
  white-space: nowrap;
}

/* ---- the passage: a copy of the footer that rises, and the brush stroke ---- */
.velo { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.velo:empty { display: none; }
.pannello {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  background: var(--inchiostro);
  will-change: transform;
}
.pannello .piede { background: none; }
.pennellata {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  will-change: transform;
}
.pennellata svg { display: block; width: 100%; height: var(--bordo-h); }
.pennellata svg path { fill: var(--carta); }
.pennellata__pieno { background: var(--carta); height: calc(100% - var(--bordo-h) + 1px); margin-top: -1px; }

@media (prefers-reduced-motion: reduce) {
  .piede__link .titolo, .piede__freccia { transition: none; }
}
