/* ══════════════════════════════════════════════════════════════
   DOME GALLERY (3D SPHERE GLOBE) — CSS
   Based on React Bits DomeGallery / 3D Spherical Transform
   ══════════════════════════════════════════════════════════════ */

.dome-gallery-section {
  position: relative;
  background: #100d14;
  color: #ffffff;
  padding: 80px 0 60px;
  overflow: hidden;
}

.dome-gallery-viewport {
  position: relative;
  width: 100%;
  height: clamp(520px, 75vh, 720px);
  margin: 0 auto;
  overflow: hidden;
}

.sphere-root {
  position: relative;
  width: 100%;
  height: 100%;
  --radius: 520px;
  --viewer-pad: 72px;
  --circ: calc(var(--radius) * 3.14159);
  --rot-y: calc((360deg / var(--segments-x)) / 2);
  --rot-x: calc((360deg / var(--segments-y)) / 2);
  --item-width: calc(var(--circ) / var(--segments-x));
  --item-height: calc(var(--circ) / var(--segments-y));
}

.sphere-root * {
  box-sizing: border-box;
}

.sphere,
.item {
  transform-style: preserve-3d;
}

main.sphere-main {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  background: var(--overlay-blur-color, #100d14);
  cursor: grab;
}

main.sphere-main:active {
  cursor: grabbing;
}

.stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  perspective: calc(var(--radius) * 2.2);
  perspective-origin: 50% 50%;
}

.sphere {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--radius) * -1));
  will-change: transform;
}

.overlay,
.overlay--blur {
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: 3;
  pointer-events: none;
}

.overlay {
  background-image: radial-gradient(rgba(235, 235, 235, 0) 60%, var(--overlay-blur-color, #100d14) 100%);
}

.overlay--blur {
  -webkit-mask-image: radial-gradient(rgba(235, 235, 235, 0) 65%, var(--overlay-blur-color, #100d14) 94%);
  mask-image: radial-gradient(rgba(235, 235, 235, 0) 65%, var(--overlay-blur-color, #100d14) 94%);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.item {
  width: calc(var(--item-width) * var(--item-size-x));
  height: calc(var(--item-height) * var(--item-size-y));
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: calc(var(--item-height) * var(--item-size-y) / -2);
  margin-left: calc(var(--item-width) * var(--item-size-x) / -2);
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  transform: rotateY(var(--base-rot-y, 0deg))
             rotateX(var(--base-rot-x, 0deg))
             translateZ(var(--radius, 520px));
}

.item__image {
  position: absolute;
  display: block;
  inset: 5px;
  border-radius: var(--tile-radius, 16px);
  background: #18151f;
  overflow: hidden;
  backface-visibility: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .item__image:hover {
    box-shadow: 0 8px 24px rgba(197, 160, 89, 0.45);
  }
}

.item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  pointer-events: none;
  backface-visibility: hidden;
  filter: brightness(1.04) contrast(1.02) saturate(1.05); /* Pure vibrant white-scale */
}

@media (hover: hover) and (pointer: fine) {
  .item__image:hover img {
    transform: scale(1.06);
    transition: transform 0.4s ease;
  }
}


.edge-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 100px;
  z-index: 5;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--overlay-blur-color, #100d14));
}

.edge-fade--top {
  top: 0;
  transform: rotate(180deg);
}

.edge-fade--bottom {
  bottom: 0;
}

/* ══════════ FULLSCREEN DOME LIGHTBOX MODAL ══════════ */
.dome-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(8, 6, 12, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  touch-action: none;
}

.dome-lightbox.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.dome-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1000000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, transform 0.2s;
}

@media (hover: hover) and (pointer: fine) {
  .dome-lightbox-close:hover {
    background: rgba(197, 160, 89, 0.9);
    transform: scale(1.08);
  }
}

.dome-lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dome-lightbox-img {
  max-width: 90vw;
  max-height: 68vh;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid rgba(197, 160, 89, 0.5);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.9), 0 0 25px rgba(197, 160, 89, 0.25);
  background: #18151f;
  display: block;
}

.dome-lightbox-caption {
  margin-top: 14px;
  color: #f0e6d6;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-align: center;
  max-width: 540px;
  line-height: 1.45;
  padding: 0 8px;
}

@media (max-width: 768px) {
  .dome-gallery-viewport {
    height: 480px;
  }
  .dome-lightbox-close {
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    background: rgba(30, 25, 38, 0.9);
    border-color: rgba(197, 160, 89, 0.6);
  }
  .dome-lightbox-img {
    max-width: 92vw;
    max-height: 62vh;
    border-radius: 12px;
  }
  .dome-lightbox-caption {
    font-size: 12px;
    margin-top: 10px;
  }
}
