:root {
  --carta: #f5eee9;          /* the rosy paper of the page */
  --inchiostro: #2b3016;     /* the ink: a very dark olive */
  --tenue: rgba(43, 48, 22, .5); /* small labels and the counter total */
  --linea: rgba(43, 48, 22, .16); /* the thin lines */
  --pillola: #fbf8f6;        /* the warm white of the Prev / Next pill (the site's) */
  --accento: #5c6e21;        /* the only accent: the reserve's olive, for the progress line */
  --fondo-foto: #373f1d;     /* what sits behind the photos before they arrive */
  --curva: cubic-bezier(.165, .84, .44, 1); /* the site's curve for the pill rows */
  --pad: clamp(16px, min(4vw, 5vh), 44px);
}

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

html, body { height: 100%; }

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

.page {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex: none;
}

.brand {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 280;
  font-variation-settings: 'opsz' 72, 'SOFT' 50;
  font-size: clamp(17px, min(2.2vw, 3.4vh), 28px);
  letter-spacing: -.01em;
}

.bar__right {
  font-size: clamp(10px, min(1vw, 1.6vh), 12.5px);
  font-variation-settings: 'wdth' 110;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tenue);
}

.gallery {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: clamp(10px, 2.4vh, 28px);
  --w: min(calc(100vw - var(--pad) * 2), calc((100vh - var(--pad) * 2 - clamp(118px, 17vh, 160px)) * 1.55), 1180px);
}

/* the photo: as wide as the page allows, measured on the height too, so it always fits with its caption */
.frame {
  position: relative;
  width: var(--w);
  aspect-ratio: 1.55;
  overflow: hidden;
  background: var(--fondo-foto);
  container-type: size;
  outline: none;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.frame:focus-visible { box-shadow: 0 0 0 2px var(--carta), 0 0 0 3px var(--accento); }

.slide {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  left: 0;
  overflow: hidden;
  z-index: 1;
}

.slide.is-on { width: 100%; z-index: 2; }

/* the photo inside keeps the frame's full width while its box opens, so it is uncovered, never squeezed */
.slide__in {
  position: absolute;
  top: 0;
  left: 0;
  width: 100cqw;
  height: 100%;
}

.slide--right .slide__in { left: auto; right: 0; }

.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 50%);
  -webkit-user-drag: none;
}

/* the soft veil on the half of the photo the pointer is on: it tells which way the click goes */
.frame__hint {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(20, 22, 10, .28), rgba(20, 22, 10, 0) 38%);
}

/* a hairline of light around the photo */
.frame__line {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

.foot {
  width: var(--w);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(10px, 2vh, 20px);
}

.cap {
  display: flex;
  align-items: baseline;
  gap: .7em;
  min-width: 0;
  white-space: nowrap;
}

.cap__place {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 300;
  font-variation-settings: 'opsz' 48, 'SOFT' 30;
  font-size: clamp(16px, min(2vw, 3.3vh), 26px);
  letter-spacing: -.01em;
}

.cap__time {
  font-size: clamp(10px, min(1vw, 1.7vh), 13px);
  font-weight: 500;
  font-variation-settings: 'wdth' 105;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tenue);
  font-variant-numeric: tabular-nums;
}

/* every word sits in its own line mask and rises from it */
.w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; margin-bottom: -.08em; }
.w__in { display: inline-block; will-change: transform; }

.foot__right {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: none;
}

.count {
  display: flex;
  align-items: center;
  gap: .35em;
  font-size: clamp(12px, min(1.2vw, 2vh), 15px);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.count__cur {
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 1.15em;
  width: .62em;
  line-height: 1.15;
}

.count__d { position: absolute; left: 0; top: 0; }

.count__sep, .count__all { color: var(--tenue); display: block; height: 1.15em; }

/* the two arrows: only where there is no pointer to follow */
.arrow {
  display: none;
  width: 30px;
  height: 30px;
  border: 1px solid var(--linea);
  border-radius: 50%;
  background: transparent;
  color: var(--inchiostro);
  cursor: pointer;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.arrow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }

.no-hover .arrow { display: grid; }

.track {
  position: relative;
  width: var(--w);
  height: 9px;
  margin-top: clamp(8px, 1.6vh, 16px);
  flex: none;
}

.track__base, .track__fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 1px;
  background: var(--linea);
}

.track__fill { background: var(--accento); transform-origin: 0 50%; transform: scaleX(0); }

.track__tick {
  position: absolute;
  top: 1px;
  width: 1px;
  height: 7px;
  background: var(--linea);
  transform-origin: 50% 100%;
}

/* the pill that follows the pointer (the site's: #fbf8f6, 23 px high, two rows that slide) */
.label {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  pointer-events: none;
}

.label__pill {
  display: block;
  height: 23px;
  padding: 0 10px;
  border-radius: 12px;
  background: var(--pillola);
  overflow: hidden;
  box-shadow: 0 6px 16px -8px rgba(20, 22, 10, .45), 0 1px 2px rgba(20, 22, 10, .12);
  opacity: 0;
  transform: scale(.6);
  transform-origin: 0 0;
}

.label__rows {
  display: flex;
  flex-direction: column;
  transition: transform .5s var(--curva);
}

.label.is-next .label__rows { transform: translateY(-23px); }

.label__row {
  display: block;
  height: 23px;
  line-height: 23px;
  font-size: 11.5px;
  font-weight: 560;
  font-variation-settings: 'wdth' 108;
  letter-spacing: .02em;
  color: var(--inchiostro);
  text-align: center;
  min-width: 3.1em;
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 30;
  width: 20px;
  height: 24px;
  pointer-events: none;
  opacity: 0;
}

.ghost__in { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3)); }

@media (hover: hover) {
  .arrow:hover { border-color: rgba(43, 48, 22, .4); }
}

@media (max-width: 520px) {
  .cap { flex-direction: column; gap: .25em; }
}

@media (prefers-reduced-motion: reduce) {
  .label__rows { transition: none; }
}
