/* ==========================================================================
   3D Image Gallery — styles
   A quiet, dark stage designed so nothing competes with the photographs.
   ========================================================================== */

:root {
  --bg-0: #0a0b0d;
  --bg-1: #131519;
  --glow: rgba(120, 130, 165, 0.10);
  --chrome: rgba(237, 236, 232, 0.86);
  --chrome-dim: rgba(237, 236, 232, 0.40);
  --chrome-bg: rgba(255, 255, 255, 0.06);
  --chrome-bg-hover: rgba(255, 255, 255, 0.12);
  --shadow-deep: rgba(0, 0, 0, 0.65);

  --item-w: 300px;
  --item-h: 400px;
  --spacing: 190px;
  --depth: 260px;
  --angle: 34deg;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 42%, var(--glow), transparent 60%),
              linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 70%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--chrome);
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}

/* ---------- Empty state --------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--chrome-dim);
  padding: 0 32px;
  text-align: center;
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  opacity: 0.55;
}

.empty-state__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  max-width: 340px;
}

.empty-state__text code {
  color: var(--chrome);
  background: var(--chrome-bg);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 13px;
}

/* ---------- Carousel --------------------------------------------------- */

.carousel-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1600px;
  perspective-origin: 50% 50%;
}

.carousel {
  position: relative;
  width: var(--item-w);
  height: var(--item-h);
  transform-style: preserve-3d;
}

.carousel__item {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--item-w);
  height: var(--item-h);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  will-change: transform, opacity;
  transform: translate3d(calc(var(--tx, 0px) - 50%), -50%, var(--tz, 0px)) rotateY(var(--ry, 0deg)) scale(var(--sc, 1));
  top: 50%;
  opacity: var(--op, 1);
  z-index: var(--zi, 1);
  transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.6s cubic-bezier(0.22, 0.61, 0.36, 1),
              filter 0.6s ease;
  box-shadow: 0 20px 55px var(--shadow-deep), 0 2px 10px rgba(0, 0, 0, 0.4);
  background: var(--bg-1);
}

.carousel__item.is-far {
  pointer-events: none;
}

.carousel__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.carousel__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, var(--dim, 0));
  transition: background 0.6s ease;
  pointer-events: none;
}

.carousel__item.is-center {
  cursor: zoom-in;
}

/* ---------- Nav buttons ------------------------------------------------ */

.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--chrome-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--chrome);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: background 0.25s ease, transform 0.25s ease;
}

.nav-btn:hover {
  background: var(--chrome-bg-hover);
  transform: translateY(-50%) scale(1.06);
}

.nav-btn:active {
  transform: translateY(-50%) scale(0.96);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn--prev { left: clamp(12px, 4vw, 48px); }
.nav-btn--next { right: clamp(12px, 4vw, 48px); }

/* ---------- Dots --------------------------------------------------------- */

.dots {
  position: absolute;
  bottom: clamp(18px, 4vh, 36px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 50;
}

.dots__item {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chrome-dim);
  transition: background 0.3s ease, transform 0.3s ease, width 0.3s ease;
}

.dots__item.is-active {
  background: var(--chrome);
  width: 20px;
  border-radius: 3px;
}

/* ---------- Lightbox ----------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 7, 9, 0.97);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__stage {
  width: min(92vw, 1400px);
  height: min(88vh, 900px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.4s ease;
}

.lightbox.is-open .lightbox__img {
  transform: scale(1);
  opacity: 1;
}

.lightbox__close {
  position: absolute;
  top: clamp(14px, 3vh, 28px);
  right: clamp(14px, 3vw, 28px);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--chrome-bg);
  color: var(--chrome);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.lightbox__close:hover {
  background: var(--chrome-bg-hover);
  transform: rotate(90deg);
}

.lightbox__close svg {
  width: 18px;
  height: 18px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--chrome-bg);
  color: var(--chrome);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.lightbox__nav:hover {
  background: var(--chrome-bg-hover);
}

.lightbox__nav svg {
  width: 22px;
  height: 22px;
}

.lightbox__nav--prev { left: clamp(10px, 3vw, 40px); }
.lightbox__nav--next { right: clamp(10px, 3vw, 40px); }

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 900px) {
  :root {
    --item-w: 240px;
    --item-h: 330px;
    --spacing: 140px;
    --depth: 200px;
  }
}

@media (max-width: 600px) {
  :root {
    --item-w: 210px;
    --item-h: 300px;
    --spacing: 105px;
    --depth: 160px;
  }

  .nav-btn {
    width: 40px;
    height: 40px;
  }

  .nav-btn svg {
    width: 17px;
    height: 17px;
  }

  .lightbox__nav {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 380px) {
  :root {
    --item-w: 175px;
    --item-h: 250px;
    --spacing: 84px;
    --depth: 130px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel__item,
  .lightbox__img,
  .lightbox {
    transition-duration: 0.01ms !important;
  }
}
