:root {
  --carta: #ebe6e0;          /* the warm paper of the page */
  --inchiostro: #141312;     /* the ink: titles and the pill */
  --tenue: rgba(20, 19, 18, .52); /* small labels */
  --linea: rgba(20, 19, 18, .14); /* the thin lines */
  --pillola: #111111;        /* the black pill under the photo */
  --puntino: #d9d9d9;        /* the grey dot that stretches under the word */
  --parola: #8c8c8c;         /* the grey of Prev and Next at rest */
  --accento: #c4532d;        /* the only accent: a terracotta, for the tick of the wall you are on */
  --fondo-foto: #26221e;     /* what sits behind the photos */
  --pad: clamp(14px, 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-weight: 640;
  font-stretch: 85%;
  font-size: clamp(14px, min(1.6vw, 2.4vh), 18px);
  letter-spacing: -.01em;
}

.bar__right,
.kicker,
.meta,
.where {
  font-family: 'Roboto Mono Variable', ui-monospace, monospace;
  font-size: clamp(10px, min(1.1vw, 1.7vh), 13px);
  letter-spacing: .02em;
  color: var(--tenue);
}

/* ---------------------------------------------------------------- the walk: caption left, photo right */
.walk {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 26rem) auto;
  justify-content: center;
  align-items: center;
  gap: clamp(24px, 7vw, 120px);
  padding-top: clamp(8px, 2vh, 24px);
}

.info {
  align-self: end;
  padding-bottom: clamp(4px, 4vh, 48px);
  max-width: 30rem;
}

.kicker { margin-bottom: clamp(6px, 1.4vh, 14px); }

.name {
  font-weight: 560;
  font-stretch: 78%;
  font-size: clamp(26px, min(5.4vw, 8.4vh), 78px);
  line-height: .96;
  letter-spacing: -.025em;
  margin-bottom: clamp(6px, 1.4vh, 14px);
}

.meta { color: var(--inchiostro); }
.where { margin-top: .35em; }

.name, .meta, .where { overflow: hidden; }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.w__in { display: inline-block; will-change: transform; }

.ticks {
  display: flex;
  gap: 6px;
  margin-top: clamp(10px, 2.6vh, 28px);
  height: 10px;
  align-items: center;
}
.tick {
  display: block;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--linea);
}

/* ---------------------------------------------------------------- the stage and the tall frame */
.stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame {
  position: relative;
  height: min(100%, 76vh);
  aspect-ratio: 330 / 435;
  max-width: 44vw;
  overflow: hidden;
  border-radius: 4px;
  background: var(--fondo-foto);
  outline: none;
  touch-action: pan-y;
  box-shadow: 0 1px 1px rgba(20, 19, 18, .06), 0 24px 48px -22px rgba(20, 19, 18, .35);
  isolation: isolate;
}
.frame:focus-visible { box-shadow: 0 0 0 2px var(--carta), 0 0 0 3.5px var(--inchiostro); }

.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  will-change: transform;
}
.slide.is-on { visibility: visible; }

.slide__in {
  position: absolute;
  inset: 0;
}
.slide__in::after {
  /* the shade on the photo that is being covered */
  content: '';
  position: absolute;
  inset: 0;
  background: #0c0b0a;
  opacity: var(--shade, 0);
  pointer-events: none;
}

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

/* the two halves of the photo: a click there goes that way too */
.frame__half {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 4;
  cursor: pointer;
}
.frame__half--prev { left: 0; }
.frame__half--next { right: 0; }

/* ---------------------------------------------------------------- the pill: Prev, the dot, Next */
.pill {
  position: absolute;
  left: 50%;
  bottom: clamp(12px, 7%, 30px);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: .55em;
  padding: .5em 1.125em;
  border-radius: 30px;
  background: var(--pillola);
  font-family: 'Roboto Mono Variable', ui-monospace, monospace;
  font-size: clamp(11px, min(1.25vw, 2.1vh), 16px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 10px 24px -10px rgba(0, 0, 0, .55);
  white-space: nowrap;
}
.pill__x { display: block; }

.pill__word {
  position: relative;
  z-index: 1;
  font: inherit;
  line-height: 1;
  color: var(--parola);
  background: none;
  border: 0;
  padding: .3em 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pill__word:focus-visible { outline: 1px solid var(--puntino); outline-offset: 3px; border-radius: 4px; }

.dot {
  position: relative;
  width: 1.875em;
  height: 1.875em;
  flex: none;
}

.dot__blob {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: var(--puntino);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 -1px 0 rgba(0, 0, 0, .08) inset;
}

.dot__core {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 1.25em;
  height: 1.25em;
  margin: -.625em 0 0 -.625em;
  border-radius: 50%;
  background: var(--pillola);
  opacity: 0;
}
.dot__arrow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .62em;
  height: .42em;
  margin: -.21em 0 0 -.31em;
  fill: none;
  stroke: var(--puntino);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  overflow: visible;
}

/* ---------------------------------------------------------------- narrow screens: photo on top, caption below */
@media (max-width: 700px), (max-aspect-ratio: 1/1) {
  .walk {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: clamp(8px, 2vh, 20px);
  }
  .stage { order: 1; min-height: 0; }
  .info { order: 2; align-self: start; padding-bottom: 0; max-width: none; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: end; }
  .kicker { display: none; }
  .name { font-size: clamp(20px, min(6.4vw, 5.4vh), 40px); margin-bottom: 4px; grid-column: 1; }
  .meta { grid-column: 1; }
  .where { display: none; }
  .ticks { grid-column: 2; grid-row: 1 / span 2; margin: 0 0 .3em; align-self: end; }
  .tick { width: 10px; }
  .frame { max-width: 86vw; height: min(100%, 70vh); }
  .pill { font-size: clamp(10px, min(3vw, 2.4vh), 15px); }
}
