/* The photo that comes into focus on scroll: one picture on a warm white page, a thin distance scale under it, one
   accent for the index and the corner marks. The picture is drawn by the script; its colours are in script.js. */
:root {
  --ground: #f3f0e8;        /* the page */
  --ink: #161512;           /* the caption and the numbers */
  --hint: #9a958a;          /* the small text, the ticks and the corner marks */
  --hairline: #d8d3c7;      /* the frame of the photo */
  --accent: #e0461d;        /* the index of the scale and the marks when it is sharp */
  --screen: 100vh;
}
@supports (height: 100lvh) {
  :root { --screen: 100lvh; }
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
}

body {
  background: var(--ground);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* the long run of the page: the stage stays put while it scrolls */
.corsa {
  position: relative;
  height: calc(var(--screen) * 3.2);
}

.palco {
  position: sticky;
  top: 0;
  height: var(--screen);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.foto {
  --w: min(84vw, 66vh * 1.3333, 720px);
  width: var(--w);
  margin: 0;
  display: grid;
  gap: clamp(10px, 2.2vh, 20px);
}

/* the frame: the planes are drawn a little bigger than it, so the blur never shows a soft edge */
.cornice {
  position: relative;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lente {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #1f2a44;
  outline: 1px solid var(--hairline);
  outline-offset: -1px;
  will-change: transform;
}

.piano {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  display: block;
  object-fit: cover;
  will-change: filter, transform;
}

/* the same photo four times, each copy cut to its band with a soft edge: the sky is whole at the back, the far
   ridges start at the skyline, the near hill below them and the water in front */
.piano[data-plane="far"] { -webkit-mask-image: linear-gradient(transparent 27%, #000 31%); mask-image: linear-gradient(transparent 27%, #000 31%); }
.piano[data-plane="mid"] { -webkit-mask-image: linear-gradient(transparent 41%, #000 45%); mask-image: linear-gradient(transparent 41%, #000 45%); }
.piano[data-plane="near"] { -webkit-mask-image: linear-gradient(transparent 79%, #000 82%); mask-image: linear-gradient(transparent 79%, #000 82%); }

/* the corner marks: an element for GSAP, the border drawn by the CSS */
.angolo {
  position: absolute;
  width: clamp(10px, 2.2vw, 16px);
  height: clamp(10px, 2.2vw, 16px);
  border: 0 solid var(--hint);
  pointer-events: none;
}
.angolo--a { top: -7px; left: -7px; border-top-width: 1px; border-left-width: 1px; }
.angolo--b { top: -7px; right: -7px; border-top-width: 1px; border-right-width: 1px; }
.angolo--c { bottom: -7px; left: -7px; border-bottom-width: 1px; border-left-width: 1px; }
.angolo--d { bottom: -7px; right: -7px; border-bottom-width: 1px; border-right-width: 1px; }

/* the distance scale */
.scala {
  position: relative;
  height: clamp(34px, 6vh, 44px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
}

.scala__nastro {
  position: absolute;
  left: 50%;
  top: 0;
  height: 100%;
  will-change: transform;
}

.tacca {
  position: absolute;
  top: 0;
  width: 1px;
  height: 7px;
  background: var(--hint);
  transform-origin: 50% 0;
}
.tacca--lunga { height: 12px; }

.numero {
  position: absolute;
  top: 17px;
  transform: translateX(-50%);
  font-size: clamp(11px, 1.6vh, 13px);
  font-weight: 380;
  font-stretch: 92%;
  letter-spacing: 0.01em;
  color: var(--hint);
  white-space: nowrap;
  font-variation-settings: 'wght' var(--peso, 380);
}
.numero--infinito svg {
  display: block;
  width: 1.25em;
  height: 0.8em;
  margin-top: 0.22em;
}

/* the fixed index: a thin accent line in the middle */
.scala__indice {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 14px;
  margin-left: -0.5px;
  background: var(--accent);
  transform-origin: 50% 0;
}

/* the caption: two lines that rise out of a mask only when the picture is sharp */
.dida {
  display: grid;
  gap: 3px;
  min-height: 2.6em;
}

.dida__riga {
  display: block;
  overflow: hidden;
  padding-bottom: 2px;
}

.dida__testo,
.dida__meta {
  display: block;
  white-space: nowrap;
}

.dida__testo {
  font-size: clamp(14px, 2.1vh, 17px);
  font-weight: 540;
  font-stretch: 88%;
  letter-spacing: -0.005em;
}

.dida__meta {
  font-size: clamp(11px, 1.6vh, 13px);
  font-weight: 400;
  color: var(--hint);
}

.nota {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  margin: 0;
  font-size: 12px;
  font-weight: 420;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--hint);
  pointer-events: none;
}
