/* ===== Kairox 3D Suite — 12 interactive enhancements ===== */

/* ── 4. Glass morphism panels ── */
.k3d-glass,
.shop-filter-panel.k3d-glass,
.compare-bar.k3d-glass,
.cart-sidebar.k3d-glass {
  background: rgba(12, 14, 22, 0.72) !important;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(0, 240, 255, 0.14) !important;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .k3d-glass {
  background: rgba(255, 255, 255, 0.78) !important;
  border-color: rgba(0, 120, 160, 0.15) !important;
}

/* ── 1. Product image parallax layer ── */
.product-image { position: relative; overflow: hidden; }
.k3d-parallax-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
  transition: transform 0.12s ease-out;
  will-change: transform;
}
.k3d-parallax-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 8px 24px rgba(0, 240, 255, 0.35));
  transform: translateZ(40px);
}

/* ── 2. Scroll-linked sections ── */
.k3d-scroll-linked {
  will-change: transform, opacity;
  transition: transform 0.1s linear, opacity 0.1s linear;
}

/* ── 3. Magnetic CTA ── */
.k3d-magnetic {
  transition: transform 0.15s cubic-bezier(0.23, 1, 0.32, 1);
  will-change: transform;
}

/* ── 8. Category orbs ── */
.k3d-orbs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.k3d-orb-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  padding: 0;
}

.k3d-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  position: relative;
  transform-style: preserve-3d;
  animation: k3d-orb-spin 8s linear infinite;
  transition: box-shadow 0.3s, transform 0.3s;
}

.k3d-orb::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-cyan), var(--accent-purple), var(--accent-pink), var(--accent-cyan));
  opacity: 0.5;
  z-index: -1;
  filter: blur(6px);
}

.k3d-orb-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.15), rgba(0,0,0,0.4));
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: inset 0 -8px 16px rgba(0,0,0,0.3);
}

.k3d-orb-filter.active .k3d-orb {
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.5);
  transform: scale(1.12);
}

.k3d-orb-filter.active .k3d-orb-inner {
  border-color: var(--accent-cyan);
}

.k3d-orb-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.k3d-orb-filter.active .k3d-orb-label {
  color: var(--accent-cyan);
  font-weight: 600;
}

@keyframes k3d-orb-spin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

.k3d-orb-filter:hover .k3d-orb { animation-duration: 3s; }

/* ── 5. Product Three.js showcase ── */
.k3d-product-showcase {
  position: relative;
  min-height: 280px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(0,240,255,0.08), transparent 70%);
  border: 1px solid rgba(0, 240, 255, 0.12);
  margin-top: 16px;
}

.k3d-product-showcase canvas {
  display: block;
  width: 100% !important;
  height: 280px !important;
}

/* ── 6. Skill tag cloud ── */
.k3d-skill-cloud {
  position: relative;
  height: 220px;
  margin-bottom: 28px;
  perspective: 800px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 50% 50%, rgba(168,85,247,0.08), transparent 65%);
  border: 1px solid var(--border);
}

.k3d-skill-tag {
  position: absolute;
  left: 50%;
  top: 50%;
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--accent-cyan);
  transform-style: preserve-3d;
  animation: k3d-tag-float 6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  cursor: default;
  user-select: none;
}

@keyframes k3d-tag-float {
  0%, 100% { transform: translate(-50%, -50%) translate3d(var(--x), var(--y), var(--z)) rotateY(0deg); }
  50% { transform: translate(-50%, -50%) translate3d(calc(var(--x) * 1.1), calc(var(--y) * 0.9), var(--z)) rotateY(15deg); }
}

/* ── 7. Case study depth slider ── */
.k3d-depth-slider {
  position: relative;
  height: 320px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 32px 0;
  border: 1px solid var(--border);
  cursor: ew-resize;
  user-select: none;
}

.k3d-depth-after,
.k3d-depth-before {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.k3d-depth-before {
  z-index: 1;
  filter: grayscale(0.4) brightness(0.85);
}

.k3d-depth-after {
  z-index: 2;
  clip-path: inset(0 0 0 50%);
}

.k3d-depth-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  margin-left: -2px;
  background: var(--accent-cyan);
  z-index: 3;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

.k3d-depth-handle::after {
  content: '⟷';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.k3d-depth-label {
  position: absolute;
  bottom: 12px;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(0,0,0,0.6);
  z-index: 4;
}

.k3d-depth-label--before { left: 12px; }
.k3d-depth-label--after { right: 12px; color: var(--accent-cyan); }

/* ── 9. Hero lite particles canvas ── */
#k3dHeroParticles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

/* ── 10. Page transitions ── */
html.k3d-transitions-enabled { view-transition-name: root; }

body.k3d-page-exit {
  opacity: 0;
  transform: scale(0.98) translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

body.k3d-page-enter {
  animation: k3d-page-in 0.35s ease forwards;
}

@keyframes k3d-page-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── 11. About 3D room ── */
.k3d-about-room {
  width: 100%;
  max-width: 480px;
  height: 280px;
  margin: 32px auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(0, 240, 255, 0.15);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(0, 240, 255, 0.06);
}

.k3d-about-room canvas {
  display: block;
  width: 100% !important;
  height: 280px !important;
}

/* ── 12. Sound toggle ── */
.k3d-sound-toggle {
  position: fixed;
  bottom: 24px;
  left: 72px;
  z-index: 900;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(12, 14, 22, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.k3d-sound-toggle.on {
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

[dir="ltr"] .k3d-sound-toggle { left: auto; right: 24px; }

@media (max-width: 768px) {
  .k3d-orbs-wrap { gap: 10px; }
  .k3d-orb { width: 48px; height: 48px; }
  .k3d-skill-cloud { height: 180px; }
  .k3d-depth-slider { height: 220px; }
  .k3d-scroll-linked { transform: none !important; opacity: 1 !important; }
}

@media (prefers-reduced-motion: reduce) {
  .k3d-orb { animation: none; }
  .k3d-skill-tag { animation: none; }
  body.k3d-page-enter { animation: none; }
}
