/* ============================================================
   PREMIUM 3D IMAGE RING — CSS-TRANSFORM BASED
   All rules scoped under #rv-ring-root to prevent leakage.
   No external dependencies. GPU-friendly CSS 3D.
   ============================================================ */

#rv-ring-root {
  --rv-radius: 460px;
  --rv-card-w: 185px;
  --rv-card-h: 260px;
  --rv-perspective: 1100px;
  --rv-accent: #8b6fab;
  --rv-accent-soft: #c4a8f0;

  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  padding: 20px 0;
}

/* ── 3D Stage ── */
#rv-ring-stage {
  position: relative;
  width: 100%;
  height: 380px; /* Spacious card layout height */
  perspective: var(--rv-perspective);
  perspective-origin: 50% 50%;
  cursor: grab;
  outline: none;
  flex-shrink: 0;
}

#rv-ring-stage:active {
  cursor: grabbing;
}

#rv-ring-stage[data-dragging="true"] {
  cursor: grabbing;
}

/* ── Spinner container (retains static center) ── */
#rv-ring-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ── Individual card ── */
.rv-card {
  position: absolute;
  left: calc(var(--rv-card-w) / -2);
  top: calc(var(--rv-card-h) / -2);
  width: var(--rv-card-w);
  height: var(--rv-card-h);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: box-shadow 0.4s ease, outline 0.3s ease, opacity 0.35s ease;
  will-change: transform, opacity;
  outline: 2px solid transparent;
  outline-offset: 3px;
  box-shadow: 0 12px 36px rgba(29, 16, 76, 0.12);
  background: rgba(29, 16, 76, 0.08);
}

.rv-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
  border-radius: 14px;
  background: rgba(230, 225, 245, 0.2);
  font-size: 0;
  color: transparent;
}

/* Premium sheen overlay */
.rv-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.03) 50%,
    rgba(0,0,0,0) 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* Hairline border */
.rv-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.22);
  pointer-events: none;
  z-index: 2;
}

/* Hover outline */
.rv-card:hover {
  outline: 2px solid rgba(196, 168, 240, 0.65);
  outline-offset: 4px;
}

/* Focused front card */
.rv-card[data-focused="true"] {
  outline: 2px solid rgba(139, 107, 171, 0.95);
  outline-offset: 5px;
  box-shadow:
    0 24px 64px rgba(29, 16, 76, 0.28),
    0 8px 24px rgba(139, 107, 171, 0.18);
}

/* ── Caption area below the ring ── */
#rv-ring-caption {
  margin-top: 32px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 5;
}

#rv-ring-caption-inner {
  display: inline-block;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #1d104c; /* Plum dark color */
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s cubic-bezier(0.25, 1, 0.5, 1), transform 0.28s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform, opacity;
}

#rv-ring-caption-inner.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Loading indicator ── */
#rv-ring-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d104c;
  font-family: 'Outfit', 'Inter', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
  z-index: 10;
}

#rv-ring-loading.hidden {
  opacity: 0;
}

.rv-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(29, 16, 76, 0.15);
  border-top-color: #1d104c;
  animation: rv-spin 0.85s linear infinite;
  margin-right: 10px;
  flex-shrink: 0;
}

@keyframes rv-spin {
  to { transform: rotate(360deg); }
}

/* ── Navigation dots ── */
#rv-ring-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  min-height: 14px;
}

.rv-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(29, 16, 76, 0.16);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.3s ease, width 0.3s ease;
}

.rv-nav-dot.active {
  background: #8b6fab;
  width: 20px;
  border-radius: 3px;
}

.rv-nav-dot:focus-visible {
  outline: 2px solid #8b6fab;
  outline-offset: 2px;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 1280px) {
  #rv-ring-root {
    --rv-radius: 380px;
    --rv-card-w: 160px;
    --rv-card-h: 225px;
    --rv-perspective: 1000px;
  }
  #rv-ring-stage {
    height: 330px;
  }
}

@media (max-width: 1024px) {
  #rv-ring-root {
    --rv-radius: 300px;
    --rv-card-w: 135px;
    --rv-card-h: 190px;
    --rv-perspective: 900px;
  }
  #rv-ring-stage {
    height: 280px;
  }
  #rv-ring-caption-inner {
    font-size: 1.05rem;
  }
}

@media (max-width: 768px) {
  #rv-ring-root {
    --rv-radius: 240px;
    --rv-card-w: 110px;
    --rv-card-h: 155px;
    --rv-perspective: 800px;
  }
  #rv-ring-stage {
    height: 230px;
  }
  #rv-ring-caption-inner {
    font-size: 0.95rem;
    letter-spacing: 0.10em;
  }
}

@media (max-width: 540px) {
  #rv-ring-root {
    --rv-radius: 175px;
    --rv-card-w: 85px;
    --rv-card-h: 120px;
    --rv-perspective: 650px;
  }
  #rv-ring-stage {
    height: 180px;
  }
  #rv-ring-caption-inner {
    font-size: 0.88rem;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 390px) {
  #rv-ring-root {
    --rv-radius: 155px;
    --rv-card-w: 75px;
    --rv-card-h: 106px;
    --rv-perspective: 580px;
  }
  #rv-ring-stage {
    height: 160px;
  }
}

@media (max-width: 360px) {
  #rv-ring-root {
    --rv-radius: 140px;
    --rv-card-w: 68px;
    --rv-card-h: 96px;
    --rv-perspective: 520px;
  }
  #rv-ring-stage {
    height: 150px;
  }
}

/* Reduce-motion */
@media (prefers-reduced-motion: reduce) {
  .rv-card {
    transition: opacity 0.35s ease;
  }
  #rv-ring-caption-inner {
    transition: opacity 0.28s ease;
  }
}
