.gallery3dSection {
  position: relative;
  overflow: hidden;
  padding: 90px clamp(20px, 6vw, 90px) 76px;
  background:
    radial-gradient(circle at 18% 18%, rgba(204, 233, 74, .16), transparent 34%),
    radial-gradient(circle at 82% 70%, rgba(69, 134, 238, .18), transparent 34%),
    #0b211a;
  color: #fff;
}

.gallery3dSection::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}

.gallery3dHead {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  gap: 40px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto 12px;
}

.gallery3dHead h2 {
  margin: 8px 0 0;
  max-width: 760px;
  font-size: clamp(38px, 5vw, 72px);
  line-height: .98;
}

.gallery3dHead h2 span { color: #d7ef55; }
.gallery3dHead > p { margin: 0 0 6px; color: rgba(255,255,255,.75); line-height: 1.7; }

.gallery3d {
  position: relative;
  z-index: 2;
  max-width: 1260px;
  margin: 0 auto;
  outline: none;
}

.gallery3dStage {
  position: relative;
  height: clamp(390px, 48vw, 570px);
  perspective: 1500px;
  transform-style: preserve-3d;
  touch-action: pan-y;
  user-select: none;
}

.gallery3dCard {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(64vw, 660px);
  aspect-ratio: 3 / 2;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 30px;
  background: #102c23;
  box-shadow: 0 34px 90px rgba(0,0,0,.48);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.7);
  transform-style: preserve-3d;
  transition: transform .75s cubic-bezier(.2,.8,.2,1), opacity .5s ease, filter .5s ease, box-shadow .5s ease;
  will-change: transform, opacity;
}

.gallery3d:not(.is-ready) .gallery3dCard:first-child {
  z-index: 5;
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.gallery3dCard img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: transform .8s ease;
}

.gallery3dCard:hover img,
.gallery3dCard:focus-visible img { transform: scale(1.035); }

.gallery3dCard > span {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 5px;
  padding: 58px 28px 24px;
  text-align: left;
  background: linear-gradient(transparent, rgba(4,18,13,.9));
}

.gallery3dCard b { font-size: clamp(20px, 2.2vw, 31px); }
.gallery3dCard small { color: rgba(255,255,255,.78); font-size: 14px; }
.gallery3dCard:focus-visible { outline: 4px solid #d7ef55; outline-offset: 5px; }

.gallery3dControls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 50px;
}

.gallery3dArrow,
.gallery3dToggle,
.gallery3dDot {
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

.gallery3dArrow {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 21px;
}

.gallery3dToggle {
  min-width: 82px;
  height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  font-weight: 700;
}

.gallery3dDots { display: flex; align-items: center; gap: 7px; }
.gallery3dDot { width: 9px; height: 9px; padding: 0; border-radius: 50%; }
.gallery3dDot[aria-current="true"] { width: 27px; border-radius: 999px; background: #d7ef55; border-color: #d7ef55; }

.gallery3dArrow:hover,
.gallery3dArrow:focus-visible,
.gallery3dToggle:hover,
.gallery3dToggle:focus-visible,
.gallery3dDot:hover,
.gallery3dDot:focus-visible { background: #d7ef55; color: #0b211a; transform: translateY(-1px); outline: none; }

.gallery3dStatus {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .gallery3dSection { padding: 68px 18px 58px; }
  .gallery3dHead { grid-template-columns: 1fr; gap: 14px; }
  .gallery3dStage { height: clamp(350px, 70vw, 500px); }
  .gallery3dCard { width: min(76vw, 600px); border-radius: 24px; }
}

@media (max-width: 600px) {
  .gallery3dSection { padding-inline: 12px; }
  .gallery3dHead { padding-inline: 8px; }
  .gallery3dHead h2 { font-size: clamp(36px, 12vw, 54px); }
  .gallery3dHead > p { font-size: 14px; }
  .gallery3dStage { height: 390px; }
  .gallery3dCard { width: 84vw; border-radius: 21px; }
  .gallery3dCard > span { padding: 48px 20px 18px; }
  .gallery3dCard small { font-size: 12px; }
  .gallery3dControls { gap: 8px; }
  .gallery3dArrow { width: 42px; height: 42px; }
  .gallery3dToggle { min-width: 70px; padding-inline: 10px; font-size: 12px; }
  .gallery3dDots { gap: 5px; }
  .gallery3dDot { width: 7px; height: 7px; }
  .gallery3dDot[aria-current="true"] { width: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .gallery3dCard,
  .gallery3dCard img,
  .gallery3dArrow,
  .gallery3dToggle,
  .gallery3dDot { transition: none !important; }
}
