.exhibition-gallery {
  --exhibition-ink: #0e100f;
  --exhibition-text: #fff7eb;
  --exhibition-muted: #d0c3b2;
  --exhibition-accent: #ecc58f;
  display: grid;
  grid-template-rows: auto minmax(min(11rem, 31vh), 1fr) auto;
  grid-template-rows: auto minmax(min(11rem, 31svh), 1fr) auto;
  gap: clamp(.45rem, 1.2svh, .9rem);
  min-height: 100vh;
  min-height: 100svh;
  background: var(--exhibition-ink);
  color: var(--exhibition-text);
  padding-block: clamp(.85rem, 2.5svh, 2rem) max(clamp(.85rem, 2.5svh, 2rem), env(safe-area-inset-bottom));
}

.exhibition-gallery :focus-visible {
  outline-color: var(--exhibition-accent);
}

.exhibition-gallery__header {
  position: relative;
  z-index: 2;
}

.exhibition-gallery__header h2 {
  font-size: clamp(2.8rem, min(8.4vw, 11svh), 7rem);
  letter-spacing: -0.048em;
  line-height: 0.86;
}

.exhibition-gallery__stage {
  --exhibition-stage-buffer: clamp(.7rem, 2.3svh, 1.5rem);
  --exhibition-poster-width: min(64vw, 42rem, 49svh);
  --exhibition-pitch: calc(var(--exhibition-poster-width) * 1.14);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-width: 0;
  background-color: #292420;
  background-image: radial-gradient(ellipse at 50% 46%, transparent 16%, #0e100f70 62%, var(--exhibition-ink) 97%);
  transition: background-color 700ms ease;
  touch-action: pan-y;
  user-select: none;
}

@supports (height: 100cqh) {
  .exhibition-gallery__stage {
    container-type: size;
    --exhibition-poster-width: min(64vw, 42rem, calc((100cqh - var(--exhibition-stage-buffer)) * .8));
  }
}

.exhibition-gallery__stage::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(0deg, var(--exhibition-ink), transparent 13%, transparent 85%, var(--exhibition-ink));
}

.exhibition-gallery__stage[data-tone="captured-in-colour"],
.exhibition-gallery__stage[data-tone="for-the-birds"] { background-color: #282f23; }
.exhibition-gallery__stage[data-tone="manu-muramura"],
.exhibition-gallery__stage[data-tone="life-and-colour"] { background-color: #1b2e3b; }
.exhibition-gallery__stage[data-tone="seeking-colours"] { background-color: #422d34; }
.exhibition-gallery__stage[data-tone="seeking-colours-after-dark"] { background-color: #382521; }
.exhibition-gallery__stage[data-tone="colours-of-the-wild"],
.exhibition-gallery__stage[data-tone="fiesta-of-colours"] { background-color: #352e21; }

.exhibition-gallery__slide {
  --poster-scale: .7;
  --poster-tilt: calc(var(--side) * -24deg);
  --poster-opacity: 0;
  --poster-filter: blur(7px) brightness(.85) saturate(.82);
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: var(--exhibition-poster-width);
  height: calc(100% - var(--exhibition-stage-buffer));
  opacity: var(--poster-opacity);
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) translateX(calc(var(--slot) * var(--exhibition-pitch)))
    perspective(90rem) rotateY(var(--poster-tilt)) scale(var(--poster-scale));
  transition: transform 760ms cubic-bezier(.2, .7, .22, 1), opacity 600ms ease, filter 620ms ease, visibility 600ms;
  filter: var(--poster-filter);
}

.exhibition-gallery__slide[data-position="side"] {
  --poster-scale: .83;
  --poster-opacity: .59;
  z-index: 1;
  visibility: visible;
  pointer-events: auto;
}

.exhibition-gallery__slide[data-position="centre"] {
  --poster-scale: 1;
  --poster-tilt: 0deg;
  --poster-opacity: 1;
  --poster-filter: none;
  z-index: 3;
  visibility: visible;
  pointer-events: auto;
}

.exhibition-gallery__poster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.exhibition-gallery__slide[data-position="centre"] .exhibition-gallery__poster { cursor: zoom-in; }

.exhibition-gallery__image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  outline: 1px solid #fff1d452;
  box-shadow: 0 1.8rem 4.5rem #030403b8;
}

.exhibition-gallery__details {
  display: grid;
  justify-items: center;
  text-align: center;
  color: var(--exhibition-muted);
}

.exhibition-gallery__period {
  margin-bottom: .25rem;
  color: var(--exhibition-accent);
  font-size: .875rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  font-weight: 600;
}

.exhibition-gallery__details h3 {
  margin-bottom: .22rem;
  max-width: 27ch;
  color: var(--exhibition-text);
  font-size: clamp(1.65rem, min(4.85vw, 6.5svh), 4.4rem);
  line-height: .94;
  text-wrap: balance;
}

.exhibition-gallery__meta, .exhibition-gallery__description {
  font-size: clamp(.94rem, 1.4vw, 1.1rem);
  max-width: 70ch;
  line-height: 1.3;
  text-wrap: pretty;
}

.exhibition-gallery__description { margin-top: .15rem; }

.exhibition-gallery__timeline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  column-gap: clamp(.65rem, 3vw, 2.8rem);
  max-width: 65rem;
  margin: clamp(.35rem, 1svh, .75rem) auto 0;
}

.exhibition-gallery__step {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border: 1px solid #e5d7c551;
  background: transparent;
  color: var(--exhibition-text);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 220ms ease, border-color 220ms ease, color 220ms ease;
}

.exhibition-gallery__step:is(:hover, :focus-visible) {
  color: var(--exhibition-ink);
  background: var(--exhibition-accent);
  border-color: var(--exhibition-accent);
}

.exhibition-gallery__range {
  --position: 0%;
  appearance: none;
  display: block;
  width: 100%;
  height: 2.9rem;
  margin: 0;
  padding: 0;
  background: transparent;
  accent-color: var(--exhibition-accent);
  cursor: pointer;
  color: var(--exhibition-accent);
}

.exhibition-gallery__range::-webkit-slider-runnable-track {
  height: 2px;
  background: linear-gradient(90deg, currentColor var(--position), #e5d7c556 var(--position));
}

.exhibition-gallery__range::-moz-range-track {
  height: 2px;
  background: linear-gradient(90deg, currentColor var(--position), #e5d7c556 var(--position));
}

.exhibition-gallery__range::-webkit-slider-thumb {
  appearance: none;
  width: .8rem;
  height: .8rem;
  margin-top: calc(1px - .4rem);
  border: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px #ecc58f26;
}

.exhibition-gallery__range::-moz-range-thumb {
  width: .8rem;
  height: .8rem;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px #ecc58f26;
}

.exhibition-gallery__date-options {
  display: flex;
  justify-content: space-between;
  gap: .18rem;
  color: var(--exhibition-muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.exhibition-gallery__date-options span { white-space: nowrap; }
.exhibition-gallery__date-options .is-active { color: var(--exhibition-accent); }

@media (max-width: 780px) {
  .exhibition-gallery__date-options span:not(:first-child, :last-child) { display: none; }
}

@media (max-width: 640px) {
  .exhibition-gallery__stage {
    --exhibition-pitch: calc(var(--exhibition-poster-width) * .93);
  }
}

@media (max-height: 42rem) {
  .exhibition-gallery__step { width: 2.75rem; height: 2.75rem; }
  .exhibition-gallery__range { height: 2.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .exhibition-gallery__stage, .exhibition-gallery__slide, .exhibition-gallery__step { transition: none; }
}
