/* 그룹 선택 3D 카드 — group-3d.js와 함께 사용. 기존 catalog.css / experience.css 뒤에 불러오세요. */

.group-choices.g3d-ready {
  gap: 28px;
}

.group-choice.g3d {
  position: relative;
  display: block;
  min-height: 440px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  perspective: 1200px;
  isolation: isolate;
  text-decoration: none;
  color: var(--ink, #f5f5f2);
}

/* 기울어지는 몸체 */
.g3d-tilt {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.5s cubic-bezier(.2, .7, .2, 1), box-shadow 0.5s ease;
  box-shadow:
    0 30px 60px -20px rgba(0, 0, 0, .75),
    0 0 0 1px rgba(255, 255, 255, .14);
  will-change: transform;
}
.group-choice.g3d.is-hover .g3d-tilt {
  transition: transform 0.12s linear, box-shadow 0.5s ease;
  box-shadow:
    0 45px 90px -25px rgba(0, 0, 0, .85),
    0 0 0 1px rgba(255, 255, 255, .28),
    0 0 60px -10px var(--g3d-glow, rgba(182, 195, 255, .45));
}

/* 썸네일 배경 무대 */
.g3d-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #0b0c10;
  perspective: 900px;
}
.g3d-wall {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 170%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) rotateX(22deg) rotateZ(-9deg) translateZ(-60px);
  animation: g3d-drift 28s ease-in-out infinite alternate;
}
.g3d-wall img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, .55);
  filter: saturate(1.05) brightness(.72);
  transition: transform .6s cubic-bezier(.2, .7, .2, 1), filter .6s ease;
}
.g3d-wall img:nth-child(odd) { transform: translateZ(18px); }
.g3d-wall img:nth-child(3n) { transform: translateZ(40px); }
.group-choice.g3d.is-hover .g3d-wall img { filter: saturate(1.15) brightness(.95); }
.group-choice.g3d.is-hover .g3d-wall img:nth-child(3n) { transform: translateZ(70px); }

@keyframes g3d-drift {
  from { transform: translate(-54%, -50%) rotateX(22deg) rotateZ(-9deg) translateZ(-60px); }
  to   { transform: translate(-46%, -52%) rotateX(18deg) rotateZ(-6deg) translateZ(-40px); }
}

/* 가독성용 그림자 막 + 빛 */
.g3d-shade {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(8, 9, 12, .6) 0%, rgba(8, 9, 12, .2) 32%, rgba(8, 9, 12, .78) 62%, rgba(8, 9, 12, .96) 100%),
    radial-gradient(120% 80% at 0% 100%, var(--g3d-tint, rgba(182, 195, 255, .25)), transparent 60%);
  pointer-events: none;
}
.g3d-shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .16), transparent 55%);
  opacity: 0;
  transition: opacity .4s ease;
  pointer-events: none;
  mix-blend-mode: screen;
}
.group-choice.g3d.is-hover .g3d-shine { opacity: 1; }

/* 기존 글자 요소를 앞으로 띄움 */
.group-choice.g3d .choice-top,
.group-choice.g3d .choice-body {
  position: absolute;
  left: 32px;
  right: 32px;
  transform-style: preserve-3d;
}
.group-choice.g3d .choice-top {
  top: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transform: translateZ(40px);
}
.group-choice.g3d .choice-body {
  bottom: 30px;
  transform: translateZ(90px);
}
.group-choice.g3d .choice-kicker {
  letter-spacing: .18em;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(8, 9, 12, .72);
}
.group-choice.g3d .count-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(8, 9, 12, .72);
  border: 1px solid rgba(255, 255, 255, .35);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.group-choice.g3d h2 {
  margin: 0 0 14px;
  font-size: clamp(64px, 9vw, 112px);
  line-height: .95;
  font-weight: 800;
  letter-spacing: -.03em;
  color: #fff;
  /* 또렷한 흰 글자 + 진한 그림자 한 겹 (입체감은 카드 기울기·깊이로) */
  text-shadow:
    0 2px 2px rgba(0, 0, 0, .9),
    0 10px 30px rgba(0, 0, 0, .7);
}
.group-choice.g3d .choice-action {
  display: inline-flex;
  width: max-content;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  background: #fff;
  color: #0c0d10;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .4);
  transition: transform .3s ease, background .3s ease;
}
.group-choice.g3d.is-hover .choice-action {
  transform: translateY(-3px);
  background: #fff;
}

/* 그룹별 색감 */
.group-choice.g3d[data-group="A"] { --g3d-tint: rgba(255, 140, 90, .35); --g3d-glow: rgba(255, 150, 100, .5); }
.group-choice.g3d[data-group="B"] { --g3d-tint: rgba(110, 150, 255, .38); --g3d-glow: rgba(120, 160, 255, .5); }

.group-choice.g3d:focus-visible {
  outline: none;
}
.group-choice.g3d:focus-visible .g3d-tilt {
  box-shadow: 0 0 0 3px var(--accent, #b6c3ff), 0 30px 60px -20px rgba(0, 0, 0, .75);
}

.group-choice.g3d h2,
.group-choice.g3d .choice-kicker,
.group-choice.g3d .count-pill,
.group-choice.g3d .choice-action { white-space: nowrap; }

@media (max-width: 760px) {
  .group-choices.g3d-ready { grid-template-columns: 1fr; gap: 18px; }
  .group-choice.g3d { min-height: 300px; }
  .group-choice.g3d h2 { font-size: clamp(52px, 17vw, 76px); margin-bottom: 12px; }
  .group-choice.g3d .choice-top,
  .group-choice.g3d .choice-body { left: 20px; right: 20px; }
  .group-choice.g3d .choice-body { bottom: 22px; }
  .g3d-wall { width: 220%; }
}

@media (prefers-reduced-motion: reduce) {
  .g3d-wall { animation: none; }
  .g3d-tilt, .g3d-wall img { transition: none; }
}
