:root {
  --carta: #eff0ef;          /* the warm white paper of the page */
  --salvia: #c4cfc6;         /* the sage of the arch */
  --salvia-scura: #929c99;   /* the darker sage of the dashed line and the small text */
  --inchiostro: #0d1015;     /* the blue-black ink of the words */
  --luce: #ffffff;           /* the light that runs along the edge */
  --aw: 300px;               /* arch width, set by the script */
  --ah: 480px;               /* arch height, set by the script */
}

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

html { background: var(--carta); }
body {
  background: var(--carta);
  color: var(--inchiostro);
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  overflow-x: hidden;
}

/* a very fine paper grain over the whole page */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.52  0 0 0 0 0.5  0 0 0 0.22 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

.trittico {
  position: relative;
  height: 320vh;
}

.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.marchio {
  position: absolute;
  top: clamp(14px, 3.4vh, 28px);
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: clamp(17px, min(2.4vw, 3.4vh), 24px);
  letter-spacing: 0.01em;
}

.scendi {
  position: absolute;
  bottom: clamp(14px, 4vh, 34px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--salvia-scura);
}

/* GSAP scales this wrapper with the scroll; the arch inside settles by itself */
.arco-scala {
  width: var(--aw);
  height: var(--ah);
  transform-origin: 50% 50%;
  will-change: transform;
}

.arco {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
}

.arco__fondo {
  position: absolute;
  inset: 0;
  background: var(--salvia);
  border-radius: calc(var(--aw) / 2) calc(var(--aw) / 2) 3px 3px;
  box-shadow: 0 1px 0 rgba(13, 16, 21, 0.04), 0 18px 40px -28px rgba(13, 16, 21, 0.28);
}

/* a breath of light at the top of the curve, like water under the sky */
.arco__fondo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 60%);
}

.arco__linee {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.arco__tratteggio {
  fill: none;
  stroke: var(--salvia-scura);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
}

.arco__maschera {
  fill: none;
  stroke: #fff;
  stroke-width: 6;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.arco__luce {
  fill: none;
  stroke: var(--luce);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 0.07 1;
  stroke-dashoffset: 0.07;
  opacity: 0;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9));
}

/* the still surface of the lake: one hairline, drawn from the middle */
.arco__orizzonte {
  position: absolute;
  left: 24%;
  right: 24%;
  bottom: 21%;
  height: 1px;
  background: linear-gradient(90deg, rgba(146, 156, 153, 0), var(--salvia-scura) 30%, var(--salvia-scura) 70%, rgba(146, 156, 153, 0));
  transform-origin: 50% 50%;
}

.arco__frase {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Instrument Serif', Georgia, serif;
  font-weight: 400;
  font-size: calc(var(--aw) * 0.14);
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
}

.arco__frase em { font-style: italic; }

/* every line has its own window, with a little room above and below so ascenders and descenders are not cut */
.riga {
  display: block;
  overflow: clip;
  padding: 0.15em 0.15em 0.15em;
  margin-top: -0.15em;
}

.riga__dentro {
  display: block;
  white-space: nowrap;
  transform-origin: 0% 100%;
  will-change: transform;
}

.didascalia {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(50% + var(--ah) / 2 + clamp(10px, 2.4vh, 20px));
  font-size: clamp(9px, min(1vw, 1.6vh), 11px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--salvia-scura);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .arco-scala, .riga__dentro { will-change: auto; }
}
