/* ══════════════════════════════════════════════════════════════════
   3D TECH CUBE — Hardware-Accelerated 360° CSS + Dynamic 3D Shadow (Enlarged)
   ══════════════════════════════════════════════════════════════════ */

/* ── SCENE CONTAINER ── */
.cube-scene {
  position: relative;
  width: 440px;
  height: 440px;
  perspective: 1100px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  z-index: 10;
  margin: 0 auto;
}

/* ── CUBE WRAPPER ── */
.cube-wrapper {
  width: 280px;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  z-index: 2;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

/* .cube-scene:hover .cube-wrapper {
  transform: scale(1.06);
} */

/* ── CUBE INNER (Interactive 3D Art Engine) ── */
.cube {
  width: 280px;
  height: 280px;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ── CUBE FACES (280px × 280px, TranslateZ = 140px) ── */
.cube-face {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 22px;
  background: rgba(18, 18, 20, 0.94);
  border: 1.5px solid rgba(203, 213, 225, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
  transform-style: preserve-3d;
}

.cube-face::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, transparent 60%);
  pointer-events: none;
}

/* Real-cube surface grid */
.cube-face::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(90deg,
      rgba(203, 213, 225, 0.16) 0px,
      rgba(203, 213, 225, 0.16) 1px,
      transparent 1px,
      transparent calc(100% / 3)),
    repeating-linear-gradient(0deg,
      rgba(203, 213, 225, 0.16) 0px,
      rgba(203, 213, 225, 0.16) 1px,
      transparent 1px,
      transparent calc(100% / 3));
  mix-blend-mode: overlay;
}

/* Face positions */
.cube-front  { transform: rotateY(0deg)    translateZ(140px); border-color: rgba(203, 213, 225, 0.55); }
.cube-back   { transform: rotateY(180deg)  translateZ(140px); border-color: rgba(203, 213, 225, 0.30); }
.cube-right  { transform: rotateY(90deg)   translateZ(140px); border-color: rgba(226, 232, 240, 0.42); }
.cube-left   { transform: rotateY(-90deg)  translateZ(140px); border-color: rgba(226, 232, 240, 0.26); }
.cube-top    { transform: rotateX(90deg)   translateZ(140px); border-color: rgba(203, 213, 225, 0.50); }
.cube-bottom { transform: rotateX(-90deg)  translateZ(140px); border-color: rgba(203, 213, 225, 0.24); }

/* ── 2×2 ICON GRID ── */
.face-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
}

.face-icon-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.face-icon-wrap svg {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  display: block;
  flex-shrink: 0;
}

.face-icon-wrap span {
  font-size: 0.66rem;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  color: rgba(255, 255, 255, 0.80);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Category label pill */
.face-label {
  position: absolute;
  bottom: 11px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(229, 231, 235, 0.80);
  white-space: nowrap;
  padding: 3px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
}

/* ── DYNAMIC 3D FLOOR SHADOW ── */
.cube-3d-shadow {
  position: absolute;
  bottom: 20px;
  left: 50%;
  width: 270px;
  height: 55px;
  margin-left: -135px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.16) 0%, rgba(203, 213, 225, 0.08) 45%, transparent 75%);
  /* PERF: blur was 14px and this element's transform is rewritten every
     animation frame while the cursor moves — animating a blurred layer
     every frame is very GPU-heavy, especially on mobile, and was a big
     part of the stutter. The radial-gradient already fades out softly on
     its own, so a lighter blur still looks soft without the cost. */
  filter: blur(6px);
  transform: rotateX(75deg) scale(1);
  will-change: transform;
  pointer-events: none !important;
  z-index: 1;
}

/* ── DRAG HINT ── */
.cube-drag-hint {
  position: absolute;
  bottom: -38px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.70rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(154, 156, 163, 0.85);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: opacity 0.6s ease;
  pointer-events: none !important;
  z-index: 3;
}

.cube-drag-hint.hidden { opacity: 0 !important; }

/* ── LIGHT THEME ── */
.cube-face,
.face-label,
.face-icon-wrap span,
.cube-3d-shadow {
  transition: background-color 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              color 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              border-color 0.35s cubic-bezier(0.25, 1, 0.5, 1),
              box-shadow 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="light"] .cube-face {
  background-color: rgba(244, 244, 247, 0.95);
  box-shadow: inset 0 0 24px rgba(15, 23, 42, 0.05), 0 10px 36px rgba(0, 0, 0, 0.13);
}
[data-theme="light"] .cube-face::after {
  background-image:
    repeating-linear-gradient(90deg,
      rgba(51, 65, 85, 0.12) 0px,
      rgba(51, 65, 85, 0.12) 1px,
      transparent 1px,
      transparent calc(100% / 3)),
    repeating-linear-gradient(0deg,
      rgba(51, 65, 85, 0.12) 0px,
      rgba(51, 65, 85, 0.12) 1px,
      transparent 1px,
      transparent calc(100% / 3));
  mix-blend-mode: multiply;
}
[data-theme="light"] .cube-front  { border-color: rgba(51, 65, 85, 0.45); }
[data-theme="light"] .cube-back   { border-color: rgba(51, 65, 85, 0.25); }
[data-theme="light"] .cube-right  { border-color: rgba(100, 116, 139, 0.38); }
[data-theme="light"] .cube-left   { border-color: rgba(100, 116, 139, 0.24); }
[data-theme="light"] .cube-top    { border-color: rgba(71, 85, 105, 0.40); }
[data-theme="light"] .cube-bottom { border-color: rgba(71, 85, 105, 0.22); }
[data-theme="light"] .face-label {
  color: rgba(51, 65, 85, 0.85);
  border-color: rgba(51, 65, 85, 0.22);
  background: rgba(51, 65, 85, 0.06);
}
[data-theme="light"] .face-icon-wrap span { color: rgba(22, 23, 27, 0.70); }
[data-theme="light"] .face-icon-wrap svg { filter: drop-shadow(0 0 8px rgba(15, 23, 42, 0.12)); }
[data-theme="light"] .cube-3d-shadow {
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.16) 0%, rgba(100, 116, 139, 0.10) 45%, transparent 75%);
}

/* ── RESPONSIVE BREAKPOINTS ── */
@media (max-width: 1024px) {
  .cube-scene { margin: 0 auto; }
}

@media (max-width: 768px) {
  .cube-scene    { width: 320px; height: 320px; perspective: 800px; margin: 0 auto; }
  .cube-wrapper,
  .cube,
  .cube-face     { width: 200px; height: 200px; }
  .cube-face     { padding: 14px; border-radius: 18px; }
  .cube-front    { transform: rotateY(0deg)    translateZ(100px); }
  .cube-back     { transform: rotateY(180deg)  translateZ(100px); }
  .cube-right    { transform: rotateY(90deg)   translateZ(100px); }
  .cube-left     { transform: rotateY(-90deg)  translateZ(100px); }
  .cube-top      { transform: rotateX(90deg)   translateZ(100px); }
  .cube-bottom   { transform: rotateX(-90deg)  translateZ(100px); }
  .face-icon-wrap svg { width: 34px; height: 34px; }
  .face-icon-wrap span { font-size: 0.58rem; }
  .face-grid     { gap: 8px; }
  .cube-3d-shadow { width: 200px; margin-left: -100px; height: 42px; bottom: 15px; }
}

@media (max-width: 480px) {
  .cube-scene    { width: 270px; height: 270px; perspective: 650px; margin: 0 auto; }
  .cube-wrapper,
  .cube,
  .cube-face     { width: 170px; height: 170px; }
  .cube-face     { padding: 10px; border-radius: 16px; }
  .cube-front    { transform: rotateY(0deg)    translateZ(85px); }
  .cube-back     { transform: rotateY(180deg)  translateZ(85px); }
  .cube-right    { transform: rotateY(90deg)   translateZ(85px); }
  .cube-left     { transform: rotateY(-90deg)  translateZ(85px); }
  .cube-top      { transform: rotateX(90deg)   translateZ(85px); }
  .cube-bottom   { transform: rotateX(-90deg)  translateZ(85px); }
  .face-icon-wrap svg  { width: 28px; height: 28px; }
  .face-icon-wrap span { font-size: 0.52rem; }
  .face-grid     { gap: 6px; }
  .face-label    { bottom: 8px; font-size: 0.52rem; padding: 2px 8px; }
  .cube-3d-shadow { width: 170px; margin-left: -85px; height: 36px; bottom: 10px; }
}
