.three-d-gallery {
  position: relative;
  display: block;
  width: 100%;
  height: var(--three-d-gallery-height, 100vh);
  min-height: var(--three-d-gallery-height, 100vh);
  max-height: var(--three-d-gallery-height, 100vh);
  overflow: hidden;
  background: #000;
}

@media (max-width: 767px) {
  .three-d-gallery {
    height: var(--three-d-gallery-mobile-height, 100vh);
    min-height: var(--three-d-gallery-mobile-height, 100vh);
    max-height: var(--three-d-gallery-mobile-height, 100vh);
  }
}

.three-d-gallery__scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  background: #000;
}

.three-d-gallery__scene.is-dragging,
.three-d-gallery__scene.has-active-card {
  cursor: pointer;
}

.three-d-gallery__scene.is-dragging {
  cursor: grabbing;
}

.three-d-gallery__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s linear;
}

.three-d-gallery__scene.is-ready .three-d-gallery__canvas {
  opacity: 1;
}

.three-d-gallery__gradient {
  position: absolute;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 12vh;
  pointer-events: none;
}

.three-d-gallery__gradient--top {
  top: 0;
  background: linear-gradient(0deg, transparent 0%, #000 100%);
}

.three-d-gallery__gradient--bottom {
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, #000 100%);
}

.three-d-gallery__hover-label {
  position: absolute;
  z-index: 2;
  max-width: min(280px, 60vw);
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 2px;
  color: #fff;
  font-size: 12px;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  transform: translate(16px, 16px);
  transition: opacity 120ms linear;
}

.three-d-gallery__scene.has-active-card:not(.is-dragging) .three-d-gallery__hover-label {
  opacity: 1;
}

.three-d-gallery__title-container {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.three-d-gallery__title {
  transform:
    perspective(900px)
    rotateX(var(--uswing-title-rotate-x, 0deg))
    rotateY(var(--uswing-title-rotate-y, 0deg));
  transform-style: preserve-3d;
  will-change: transform;
  text-align: center;
}

.three-d-gallery__title p {
  opacity: 1 !important;
  font-family: Clarkson, Helvetica, sans-serif !important;
  font-weight: 400 !important;
  color: #fff;
  transform: none !important;
  margin: 0;
}

/* Modal Popup Wrapper */
.three-d-gallery__modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.three-d-gallery__modal.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Overlay Backdrop */
.three-d-gallery__modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Modal Content Panel */
.three-d-gallery__modal-content {
  position: relative;
  z-index: 2;
  width: 90%;
  max-width: 960px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: rgba(20, 20, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: scale(0.92);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.three-d-gallery__modal.is-active .three-d-gallery__modal-content {
  transform: scale(1);
}

/* Premium Close Button */
.three-d-gallery__modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: background 0.3s, transform 0.3s;
}

.three-d-gallery__modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.three-d-gallery__modal-close svg {
  width: 20px;
  height: 20px;
}

/* Responsive Media Viewport */
.three-d-gallery__modal-media-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.three-d-gallery__modal-media-container img,
.three-d-gallery__modal-media-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.three-d-gallery__modal-media-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Elegant Text Caption */
.three-d-gallery__modal-caption {
  padding: 20px 24px;
  background: rgba(15, 15, 15, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: center;
}


/* Keep Retina drawing-buffer pixels independent of CSS layout on every screen. */
.three-d-gallery .three-d-gallery__canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}


/* A playable cover gallery is present while 3D loads or the GPU is unavailable. */
.three-d-gallery__fallback {
  position: absolute;
  inset: 92px 0 24px;
  z-index: 4;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  grid-auto-columns: min(66vw, 280px);
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding: 0 16px 8px;
  scrollbar-width: thin;
  scrollbar-color: #777 #000;
  -webkit-overflow-scrolling: touch;
}
.three-d-gallery__fallback[hidden] { display: none; }
.three-d-gallery.is-fallback .three-d-gallery__canvas { visibility: hidden; }
.three-d-gallery.is-fallback .three-d-gallery__title-container {
  height: 76px;
  bottom: auto;
  padding-inline: 16px;
}
.three-d-gallery__fallback-card {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  padding: 0;
  background: #171717;
  color: #fff;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  scroll-margin-inline-start: 16px;
}
.three-d-gallery__fallback-card:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.three-d-gallery__fallback-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.three-d-gallery__fallback-card img[hidden] { display: none; }
.three-d-gallery__fallback-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 24px 46px 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .9));
  font: 400 14px/1.3 var(--sort-body-font);
}
.three-d-gallery__fallback-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #000;
  color: #fff;
  font-size: 12px;
}
