.depth-gallery {
  position: relative;
  height: 100svh;
  overflow: hidden;
  background: #03040d;
  color: #ffffff;
  --depth-edge: clamp(18px, 5vw, 88px);
  --depth-item-width: clamp(230px, 42vw, 620px);
  --depth-first-z: -118px;
}

.depth-gallery__poster {
  position: relative;
  top: 0;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  perspective: 30px;
}

.depth-gallery__background,
.depth-gallery__background img,
.depth-gallery__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.depth-gallery__background {
  z-index: -4;
}

.depth-gallery__background img {
  object-fit: cover;
  object-position: center;
  filter: saturate(0.88) brightness(0.5);
  transform: scale(1.04);
}

.depth-gallery__background::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(3, 4, 13, 0.1) 0%, rgba(3, 4, 13, 0.58) 100%),
    linear-gradient(90deg, rgba(3, 4, 13, 0.5) 0%, rgba(3, 4, 13, 0.05) 48%, rgba(3, 4, 13, 0.42) 100%);
}

.depth-gallery__overlay {
  z-index: -3;
  background: #000000;
  opacity: 0;
  pointer-events: none;
}

.depth-gallery__title {
  position: absolute;
  z-index: 2;
  top: 49%;
  left: 50%;
  width: min-content;
  margin: 0;
  color: rgba(255, 255, 255, 0.17);
  font-family: "Mango Grotesque", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(88px, 16.5vw, 270px);
  font-weight: 900;
  line-height: 0.76;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.depth-gallery__stage {
  position: relative;
  z-index: 4;
  width: min(92vw, 1320px);
  height: 100%;
  margin: 0 auto;
  transform: translateZ(30px);
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}

.depth-gallery__item {
  position: absolute;
  top: var(--depth-y, 50%);
  width: var(--depth-item-width);
  aspect-ratio: var(--ratio, 1 / 1);
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  opacity: 0;
  transform: translate3d(0, -50%, var(--depth-first-z));
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

.depth-gallery__item:first-child {
  opacity: 1;
}

.depth-gallery__item--left {
  left: var(--depth-edge);
}

.depth-gallery__item--right {
  right: var(--depth-edge);
}

.depth-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 420ms ease;
  user-select: none;
  -webkit-user-drag: none;
}

.depth-gallery__item.is-loaded img {
  opacity: 1;
}

.depth-gallery__captions {
  position: absolute;
  right: clamp(18px, 4vw, 58px);
  bottom: clamp(24px, 5svh, 58px);
  left: clamp(18px, 4vw, 58px);
  z-index: 6;
  height: clamp(24px, 2.5vw, 42px);
  overflow: hidden;
  color: #ffffff;
  text-align: center;
  pointer-events: none;
}

.depth-gallery__captions p {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: clamp(17px, 1.4vw, 25px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.62);
  transform: translateY(0);
}

.depth-gallery__captions p:first-child {
  opacity: 1;
  transform: translateY(0);
}

.depth-gallery.is-static {
  height: auto;
  min-height: 100svh;
  overflow: visible;
}

.depth-gallery.is-static .depth-gallery__poster {
  position: relative;
  height: auto;
  min-height: 100svh;
  padding: clamp(118px, 16svh, 160px) clamp(18px, 4vw, 56px) clamp(72px, 10svh, 112px);
}

.depth-gallery.is-static .depth-gallery__title {
  position: relative;
  top: auto;
  left: auto;
  width: auto;
  margin-bottom: 32px;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(82px, 20vw, 160px);
  text-align: left;
  transform: none;
}

.depth-gallery.is-static .depth-gallery__stage {
  display: grid;
  width: 100%;
  height: auto;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  transform: none !important;
}

.depth-gallery.is-static .depth-gallery__item {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  width: 100%;
  opacity: 1 !important;
  transform: none !important;
}

.depth-gallery.is-static .depth-gallery__captions {
  display: none;
}

@media (max-width: 760px) {
  .depth-gallery {
    --depth-edge: clamp(12px, 4vw, 26px);
    --depth-item-width: min(58vw, 310px);
    --depth-first-z: -84px;
  }

  .depth-gallery__title {
    top: 50%;
    font-size: clamp(84px, 28vw, 138px);
  }

  .depth-gallery__item--left {
    left: 0;
  }

  .depth-gallery__item--right {
    right: 0;
  }

  .depth-gallery__captions {
    bottom: 28px;
    height: 66px;
  }

  .depth-gallery__captions p {
    padding: 0 4px;
    line-height: 1.25;
  }

  .depth-gallery.is-static .depth-gallery__stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 340px) {
  .depth-gallery__captions {
    height: 88px;
  }
}

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