:root {
  color-scheme: light;
  --paper: #f0eee2;
  --paper-deep: #e5e2d5;
  --olive: #4f4e25;
  --forest: #163d28;
  --gold: #a58c44;
  --ink: #162a1d;
  --page-shadow: 0 2px 7px rgba(26, 39, 28, 0.12), 0 30px 90px rgba(31, 42, 27, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
  scrollbar-color: var(--olive) var(--paper-deep);
  scrollbar-width: thin;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
[tabindex] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

figure {
  margin: 0;
}

.scroll-progress {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gold);
  transform: scaleX(var(--scroll-progress, 0));
  transform-origin: left center;
  will-change: transform;
}

main {
  position: relative;
  overflow: clip;
}

.scene {
  position: relative;
  height: 144svh;
  isolation: isolate;
}

.scene--cover {
  z-index: 1;
}

.scene--about {
  z-index: 2;
  height: 154svh;
  margin-top: -24svh;
}

.scene--final {
  z-index: 4;
  height: 142svh;
  margin-top: -19svh;
  pointer-events: none;
}

.scene__sticky {
  position: sticky;
  top: 0;
  display: grid;
  width: 100%;
  min-height: 100svh;
  place-items: center;
  padding: max(18px, 2.5vw);
  overflow: hidden;
}

.scene__sticky::before {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(229, 226, 213, 0.08));
  opacity: var(--scene-wash, 0.5);
  pointer-events: none;
}

.sheet {
  position: relative;
  width: min(89vw, calc(88svh * 0.69136));
  aspect-ratio: 420 / 608;
  overflow: hidden;
  border: 1px solid rgba(79, 78, 37, 0.14);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: var(--page-shadow);
}

.sheet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene__sheet {
  z-index: 1;
  opacity: var(--scene-opacity, 0.08);
  transform: translate3d(0, var(--scene-y, 11svh), 0) scale(var(--scene-scale, 0.86));
  transform-origin: center center;
  clip-path: inset(var(--scene-clip, 7%) round var(--scene-radius, 18px));
  will-change: transform, opacity, clip-path;
}

.scene--cover .scene__sheet {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(var(--scene-scale, 1));
  clip-path: inset(0 round 2px);
}

.scroll-cue {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: max(18px, 2.6vw);
  left: 0;
  display: grid;
  place-items: center;
  height: 28px;
  opacity: var(--cue-opacity, 0.7);
  pointer-events: none;
}

.scroll-cue span {
  position: relative;
  display: block;
  width: 1px;
  height: 25px;
  overflow: hidden;
  background: rgba(22, 61, 40, 0.22);
}

.scroll-cue span::after {
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  content: "";
  background: var(--forest);
  animation: cue 1.8s var(--ease-out) infinite;
}

@keyframes cue {
  0% {
    transform: translateY(0);
  }
  65%,
  100% {
    transform: translateY(200%);
  }
}

.participants {
  position: relative;
  z-index: 3;
  height: 132svh;
  margin-top: -14svh;
  isolation: isolate;
}

.participants__sticky {
  position: sticky;
  top: 0;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: max(18px, 2.5vw);
  overflow: hidden;
  background: var(--paper);
}

.gallery {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  outline: none;
}

.gallery:focus-visible .gallery__viewport {
  outline: 2px solid var(--gold);
  outline-offset: 7px;
}

.gallery__viewport {
  position: relative;
  width: min(86vw, calc(79svh * 0.69136));
  aspect-ratio: 420 / 608;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  cursor: grab;
}

.gallery__viewport:active {
  cursor: grabbing;
}

.gallery__stack {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 1px solid rgba(79, 78, 37, 0.14);
  border-radius: 2px;
  background: var(--paper-deep);
  box-shadow: var(--page-shadow);
}

.gallery__slide {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  transform: scale(0.975);
  transition: opacity 720ms var(--ease-out), transform 720ms var(--ease-out);
  pointer-events: none;
  will-change: opacity, transform;
}

.gallery__slide.is-active {
  z-index: 1;
  opacity: 1;
  transform: none;
}

.gallery__slide.is-entering-next,
.gallery__slide.is-entering-previous {
  z-index: 3;
  opacity: 0;
}

.gallery__slide.is-entering-next {
  transform: translate3d(16%, 0, 0) scale(0.965);
}

.gallery__slide.is-entering-previous {
  transform: translate3d(-16%, 0, 0) scale(0.965);
}

.gallery__slide.is-entering-next.is-active,
.gallery__slide.is-entering-previous.is-active {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.gallery__slide.is-exiting-next,
.gallery__slide.is-exiting-previous {
  z-index: 2;
  opacity: 0;
}

.gallery__slide.is-exiting-next {
  transform: translate3d(-16%, 0, 0) scale(0.965);
}

.gallery__slide.is-exiting-previous {
  transform: translate3d(16%, 0, 0) scale(0.965);
}

.gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}

.gallery__button {
  position: absolute;
  z-index: 8;
  top: 50%;
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0 0 4px;
  place-items: center;
  border: 1px solid rgba(22, 61, 40, 0.24);
  border-radius: 50%;
  background: rgba(240, 238, 226, 0.9);
  box-shadow: 0 7px 24px rgba(22, 42, 29, 0.12);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
  backdrop-filter: blur(12px);
}

.gallery__button span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.3rem;
  font-weight: 400;
  line-height: 1;
}

.gallery__button--previous {
  left: max(-78px, calc((100vw - 100%) / -2 + 18px));
}

.gallery__button--next {
  right: max(-78px, calc((100vw - 100%) / -2 + 18px));
}

.gallery__button:hover {
  background: var(--forest);
  color: var(--paper);
}

.gallery__button:active {
  transform: translateY(-50%) scale(0.94);
}

.gallery__button:focus-visible,
.gallery__dots button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.gallery__footer {
  display: grid;
  width: min(86vw, calc(79svh * 0.69136));
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 24px;
  padding-top: 17px;
}

.gallery__counter {
  min-width: 4.8rem;
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.gallery__counter [data-current] {
  font-size: 1.35rem;
}

.gallery__dots {
  display: grid;
  grid-template-columns: repeat(11, minmax(8px, 1fr));
  align-items: center;
  gap: 7px;
}

.gallery__dots button {
  position: relative;
  width: 100%;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.gallery__dots button::after {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  content: "";
  background: rgba(79, 78, 37, 0.22);
  transform: translateY(-50%) scaleY(0.65);
  transform-origin: center;
  transition: background-color 220ms ease, transform 220ms ease;
}

.gallery__dots button:hover::after {
  background: rgba(22, 61, 40, 0.58);
}

.gallery__dots button.is-active::after {
  background: var(--forest);
  transform: translateY(-50%) scaleY(1.4);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 640px) {
  .scene {
    height: 132svh;
  }

  .scene--about {
    height: 143svh;
    margin-top: -18svh;
  }

  .scene--final {
    height: 132svh;
    margin-top: -13svh;
  }

  .scene__sticky,
  .participants__sticky {
    padding: 14px;
  }

  .sheet {
    width: min(91vw, calc(88svh * 0.69136));
  }

  .participants {
    height: 120svh;
    margin-top: -8svh;
  }

  .gallery__viewport,
  .gallery__footer {
    width: min(88vw, calc(74svh * 0.69136));
  }

  .gallery__button {
    width: 44px;
    height: 44px;
    background: rgba(240, 238, 226, 0.92);
  }

  .gallery__button--previous {
    left: -14px;
  }

  .gallery__button--next {
    right: -14px;
  }

  .gallery__footer {
    gap: 12px;
    padding-top: 12px;
  }

  .gallery__counter {
    min-width: 4.2rem;
    font-size: 0.875rem;
  }

  .gallery__counter [data-current] {
    font-size: 1.15rem;
  }

  .gallery__dots {
    gap: 4px;
  }
}

@media (max-height: 650px) and (orientation: landscape) {
  .sheet {
    width: calc(84svh * 0.69136);
  }

  .gallery__viewport,
  .gallery__footer {
    width: calc(72svh * 0.69136);
  }

  .gallery__footer {
    padding-top: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .scroll-cue span::after {
    animation: none;
  }

  .gallery__button,
  .gallery__dots button::after,
  .gallery__slide {
    transition: none;
  }
}
