/* =============================================================
   3D FIGURES — CSS-only, high-detail
   ============================================================= */

.act--threed {
  background: radial-gradient(ellipse at 50% 30%, #1a1022 0%, #0a0814 70%, #050308 100%);
  color: var(--lw-paper);
  min-height: 200vh;
  padding: 180px 0;
  position: relative;
  overflow: hidden;
  perspective: 1800px;
  perspective-origin: 50% 40%;
}
.act--threed::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(198,93,58,0.15), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(58,90,120,0.2), transparent 40%);
  pointer-events: none;
}
.act--threed::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 40%, transparent 80%);
  pointer-events: none;
}

.threed-stage {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 60px 48px;
  min-height: 80vh;
  align-items: center;
}
.threed-hero {
  position: absolute;
  top: 32px; left: 0; right: 0;
  text-align: center;
  z-index: 5;
  pointer-events: none;
}
.threed-hero h2 {
  font-family: var(--lw-font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(72px, 10vw, 160px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 20px 0 0;
  background: linear-gradient(180deg, #fff 0%, #d89945 60%, #c65d3a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 40px rgba(216,153,69,0.4));
}

.figure-cell {
  position: relative;
  height: 520px;
  display: grid;
  place-items: center;
  perspective: 1400px;
}
.figure-cell .figure-label {
  position: absolute;
  bottom: 20px; left: 20px;
  font-family: var(--lw-font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  z-index: 3;
}
.figure-cell .figure-index {
  position: absolute;
  top: 20px; right: 20px;
  font-family: var(--lw-font-serif);
  font-style: italic;
  font-size: 48px;
  color: rgba(198,93,58,0.4);
  z-index: 3;
}

/* ---------------- FIGURE 1: Rotating detailed cube ---------------- */
.fig-cube {
  position: relative;
  width: 240px; height: 240px;
  transform-style: preserve-3d;
  animation: cube-spin 24s linear infinite;
  transform: rotateX(-20deg) rotateY(0);
}
@keyframes cube-spin {
  from { transform: rotateX(-20deg) rotateY(0); }
  to   { transform: rotateX(-20deg) rotateY(360deg); }
}
.cube-face {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(216,153,69,0.4);
  background:
    linear-gradient(135deg, rgba(198,93,58,0.15), rgba(58,90,120,0.3)),
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08), transparent 60%);
  backface-visibility: visible;
  overflow: hidden;
}
.cube-face::before {
  /* inner grid etching */
  content: "";
  position: absolute;
  inset: 20px;
  background-image:
    linear-gradient(rgba(216,153,69,0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216,153,69,0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.6;
}
.cube-face::after {
  content: attr(data-label);
  position: absolute;
  bottom: 12px; left: 14px;
  font-family: var(--lw-font-mono);
  font-size: 9px;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
}
.cube-face.front  { transform: translateZ(120px); }
.cube-face.back   { transform: rotateY(180deg) translateZ(120px); }
.cube-face.right  { transform: rotateY(90deg) translateZ(120px); }
.cube-face.left   { transform: rotateY(-90deg) translateZ(120px); }
.cube-face.top    { transform: rotateX(90deg) translateZ(120px); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(120px); }

/* orbiting particles inside cube */
.cube-orbit {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  animation: cube-inner-spin 14s linear infinite reverse;
  pointer-events: none;
}
@keyframes cube-inner-spin {
  from { transform: rotateY(0) rotateX(0); }
  to   { transform: rotateY(360deg) rotateX(360deg); }
}
.cube-orbit .particle {
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #d89945;
  box-shadow: 0 0 20px #d89945, 0 0 40px rgba(216,153,69,0.5);
  transform: translate(-50%, -50%);
}
.cube-orbit .particle:nth-child(1) { transform: translate(-50%, -50%) translateZ(100px); }
.cube-orbit .particle:nth-child(2) { transform: translate(-50%, -50%) translateZ(-100px); background: #c65d3a; box-shadow: 0 0 20px #c65d3a; }
.cube-orbit .particle:nth-child(3) { transform: translate(-50%, -50%) translateX(100px); background: #7ba05b; box-shadow: 0 0 20px #7ba05b; }
.cube-orbit .particle:nth-child(4) { transform: translate(-50%, -50%) translateX(-100px); background: #3a5a78; box-shadow: 0 0 20px #3a5a78; }
.cube-orbit .particle:nth-child(5) { transform: translate(-50%, -50%) translateY(100px); background: #9c3a70; box-shadow: 0 0 20px #9c3a70; }
.cube-orbit .particle:nth-child(6) { transform: translate(-50%, -50%) translateY(-100px); background: #e8c65a; box-shadow: 0 0 20px #e8c65a; }

/* ---------------- FIGURE 2: Torus / ring of cards ---------------- */
.fig-torus {
  position: relative;
  width: 380px; height: 380px;
  transform-style: preserve-3d;
  animation: torus-spin 28s linear infinite;
}
@keyframes torus-spin {
  from { transform: rotateX(70deg) rotateZ(0); }
  to   { transform: rotateX(70deg) rotateZ(360deg); }
}
.torus-ring {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.torus-blade {
  position: absolute;
  top: 50%; left: 50%;
  width: 40px; height: 120px;
  margin: -60px 0 0 -20px;
  background: linear-gradient(180deg, rgba(198,93,58,0.9), rgba(58,90,120,0.7));
  border: 1px solid rgba(216,153,69,0.6);
  transform-style: preserve-3d;
  box-shadow: inset 0 0 20px rgba(255,255,255,0.1);
}
.torus-blade::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

/* ---------------- FIGURE 3: Icosahedron-ish faceted sphere (12 faces) ---------------- */
.fig-sphere {
  position: relative;
  width: 260px; height: 260px;
  transform-style: preserve-3d;
  animation: sphere-tumble 30s linear infinite;
}
@keyframes sphere-tumble {
  0%   { transform: rotateX(0) rotateY(0) rotateZ(0); }
  100% { transform: rotateX(360deg) rotateY(360deg) rotateZ(180deg); }
}
.sphere-face {
  position: absolute;
  top: 50%; left: 50%;
  width: 140px; height: 140px;
  margin: -70px 0 0 -70px;
  clip-path: polygon(50% 0, 100% 80%, 0 80%);
  background: linear-gradient(180deg, rgba(216,153,69,0.3), rgba(198,93,58,0.6));
  border: 0;
  filter: drop-shadow(0 0 10px rgba(216,153,69,0.2));
}
/* 20 triangular faces arranged as a pseudo-icosahedron:
   top fan (5), middle band (10 alternating), bottom fan (5) */
.sphere-face.t1  { transform: rotateY(0deg)   translateZ(110px) rotateX(-30deg); }
.sphere-face.t2  { transform: rotateY(72deg)  translateZ(110px) rotateX(-30deg); }
.sphere-face.t3  { transform: rotateY(144deg) translateZ(110px) rotateX(-30deg); }
.sphere-face.t4  { transform: rotateY(216deg) translateZ(110px) rotateX(-30deg); }
.sphere-face.t5  { transform: rotateY(288deg) translateZ(110px) rotateX(-30deg); }
.sphere-face.m1  { transform: rotateY(36deg)  translateZ(110px) rotateX(30deg)  rotate(180deg); background: linear-gradient(180deg, rgba(58,90,120,0.5), rgba(47,74,58,0.7)); }
.sphere-face.m2  { transform: rotateY(108deg) translateZ(110px) rotateX(30deg)  rotate(180deg); background: linear-gradient(180deg, rgba(58,90,120,0.5), rgba(47,74,58,0.7)); }
.sphere-face.m3  { transform: rotateY(180deg) translateZ(110px) rotateX(30deg)  rotate(180deg); background: linear-gradient(180deg, rgba(58,90,120,0.5), rgba(47,74,58,0.7)); }
.sphere-face.m4  { transform: rotateY(252deg) translateZ(110px) rotateX(30deg)  rotate(180deg); background: linear-gradient(180deg, rgba(58,90,120,0.5), rgba(47,74,58,0.7)); }
.sphere-face.m5  { transform: rotateY(324deg) translateZ(110px) rotateX(30deg)  rotate(180deg); background: linear-gradient(180deg, rgba(58,90,120,0.5), rgba(47,74,58,0.7)); }
.sphere-face.b1  { transform: rotateY(0deg)   translateZ(110px) rotateX(-150deg); background: linear-gradient(180deg, rgba(156,58,112,0.4), rgba(74,45,90,0.7)); }
.sphere-face.b2  { transform: rotateY(72deg)  translateZ(110px) rotateX(-150deg); background: linear-gradient(180deg, rgba(156,58,112,0.4), rgba(74,45,90,0.7)); }
.sphere-face.b3  { transform: rotateY(144deg) translateZ(110px) rotateX(-150deg); background: linear-gradient(180deg, rgba(156,58,112,0.4), rgba(74,45,90,0.7)); }
.sphere-face.b4  { transform: rotateY(216deg) translateZ(110px) rotateX(-150deg); background: linear-gradient(180deg, rgba(156,58,112,0.4), rgba(74,45,90,0.7)); }
.sphere-face.b5  { transform: rotateY(288deg) translateZ(110px) rotateX(-150deg); background: linear-gradient(180deg, rgba(156,58,112,0.4), rgba(74,45,90,0.7)); }

/* ---------------- FIGURE 4: DNA / double helix (36 rungs) ---------------- */
.fig-helix {
  position: relative;
  width: 200px; height: 420px;
  transform-style: preserve-3d;
  animation: helix-rotate 18s linear infinite;
}
@keyframes helix-rotate {
  from { transform: rotateY(0); }
  to   { transform: rotateY(360deg); }
}
.helix-rung {
  position: absolute;
  top: var(--y); left: 50%;
  width: 140px; height: 2px;
  transform-style: preserve-3d;
  transform: translateX(-50%) rotateY(var(--r));
}
.helix-rung::before,
.helix-rung::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 12px var(--c1);
}
.helix-rung::before { left: -7px; }
.helix-rung::after  { right: -7px; background: var(--c2); box-shadow: 0 0 12px var(--c2); }
.helix-rung .bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  opacity: 0.4;
}

/* ---------------- FIGURE 5: Perspective tunnel / hallway ---------------- */
.fig-tunnel {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  perspective: 900px;
  overflow: hidden;
}
.tunnel-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 400px; height: 400px;
  margin: -200px 0 0 -200px;
  border: 1px solid rgba(216,153,69,0.5);
  transform-style: preserve-3d;
  animation: tunnel-pull 6s linear infinite;
}
.tunnel-ring::before {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(198,93,58,0.3);
}
.tunnel-ring::after {
  content: "";
  position: absolute;
  inset: 40px;
  border: 1px solid rgba(216,153,69,0.15);
}
@keyframes tunnel-pull {
  from { transform: translateZ(-2400px) rotate(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  to   { transform: translateZ(400px) rotate(60deg); opacity: 0; }
}
.tunnel-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 40px; height: 40px;
  background: radial-gradient(circle, #fff, #d89945 60%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 40px #d89945, 0 0 80px rgba(216,153,69,0.5);
  z-index: 2;
  animation: tunnel-pulse 2s ease-in-out infinite;
}
@keyframes tunnel-pulse {
  0%,100% { transform: translate(-50%, -50%) scale(1); }
  50%     { transform: translate(-50%, -50%) scale(1.3); }
}

/* ---------------- FIGURE 6: Paper/card cascade ---------------- */
.fig-cascade {
  position: relative;
  width: 320px; height: 420px;
  transform-style: preserve-3d;
  animation: cascade-tilt 12s ease-in-out infinite alternate;
}
@keyframes cascade-tilt {
  from { transform: rotateY(-25deg) rotateX(15deg); }
  to   { transform: rotateY(25deg) rotateX(-15deg); }
}
.cascade-card {
  position: absolute;
  top: 0; left: 0;
  width: 220px; height: 300px;
  background: linear-gradient(180deg, #fbf7ee, #ece4d3);
  border: 1px solid #d8ccb4;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  padding: 20px;
  font-family: var(--lw-font-serif);
  font-style: italic;
  color: var(--lw-ink);
  transform-style: preserve-3d;
}
.cascade-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(198,93,58,0.3);
  pointer-events: none;
}
.cascade-card:nth-child(1) { transform: translate(-60px, -60px) translateZ(0)   rotate(-8deg); }
.cascade-card:nth-child(2) { transform: translate(-30px, -30px) translateZ(40px) rotate(-3deg); }
.cascade-card:nth-child(3) { transform: translate(0, 0)         translateZ(80px) rotate(2deg); }
.cascade-card:nth-child(4) { transform: translate(30px, 30px)   translateZ(120px) rotate(6deg); background: linear-gradient(180deg, #c65d3a, #9c4425); color: #fbf7ee; }
.cascade-card h4 {
  font-family: var(--lw-font-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.cascade-card .num {
  font-family: var(--lw-font-mono);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.6;
}

/* ---------------- FIGURE 7: Wireframe pyramid ---------------- */
.fig-pyramid {
  position: relative;
  width: 260px; height: 260px;
  transform-style: preserve-3d;
  animation: pyramid-spin 20s linear infinite;
}
@keyframes pyramid-spin {
  from { transform: rotateX(-15deg) rotateY(0); }
  to   { transform: rotateX(-15deg) rotateY(-360deg); }
}
.pyramid-face {
  position: absolute;
  top: 0; left: 50%;
  width: 0; height: 0;
  border-left: 130px solid transparent;
  border-right: 130px solid transparent;
  border-bottom: 220px solid rgba(216,153,69,0.15);
  transform-origin: 50% 0%;
  margin-left: -130px;
  filter: drop-shadow(0 0 8px rgba(216,153,69,0.4));
}
.pyramid-face::after {
  content: "";
  position: absolute;
  top: 0; left: -130px;
  width: 260px; height: 220px;
  background:
    linear-gradient(45deg,  transparent 48%, rgba(216,153,69,0.6) 49%, rgba(216,153,69,0.6) 51%, transparent 52%),
    linear-gradient(-45deg, transparent 48%, rgba(216,153,69,0.6) 49%, rgba(216,153,69,0.6) 51%, transparent 52%),
    linear-gradient(90deg,  transparent 48%, rgba(216,153,69,0.3) 49%, rgba(216,153,69,0.3) 51%, transparent 52%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.pyramid-face.p1 { transform: rotateY(0deg) translateZ(0) rotateX(-10deg); }
.pyramid-face.p2 { transform: rotateY(90deg) translateZ(0) rotateX(-10deg); }
.pyramid-face.p3 { transform: rotateY(180deg) translateZ(0) rotateX(-10deg); }
.pyramid-face.p4 { transform: rotateY(270deg) translateZ(0) rotateX(-10deg); }

/* ---------------- FIGURE 8: Gyroscope (nested rings) ---------------- */
.fig-gyro {
  position: relative;
  width: 300px; height: 300px;
  transform-style: preserve-3d;
  animation: gyro-outer 20s linear infinite;
}
@keyframes gyro-outer { to { transform: rotateY(360deg); } }
.gyro-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(216,153,69,0.6);
  box-shadow: 0 0 30px rgba(216,153,69,0.2), inset 0 0 20px rgba(216,153,69,0.1);
  transform-style: preserve-3d;
}
.gyro-ring.r1 { animation: gyro-r1 8s linear infinite; }
.gyro-ring.r2 { inset: 30px; border-color: rgba(198,93,58,0.7); animation: gyro-r2 6s linear infinite; }
.gyro-ring.r3 { inset: 60px; border-color: rgba(58,90,120,0.7); animation: gyro-r3 5s linear infinite; }
.gyro-ring.r4 { inset: 90px; border-color: rgba(255,255,255,0.4); animation: gyro-r4 4s linear infinite; }
@keyframes gyro-r1 { to { transform: rotateX(360deg); } }
@keyframes gyro-r2 { to { transform: rotateZ(360deg) rotateX(45deg); } }
@keyframes gyro-r3 { to { transform: rotateY(360deg) rotateZ(60deg); } }
@keyframes gyro-r4 { to { transform: rotateX(360deg) rotateY(-180deg); } }
.gyro-core {
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #d89945 40%, #c65d3a 80%);
  box-shadow: 0 0 40px #c65d3a, 0 0 80px rgba(216,153,69,0.4);
  animation: gyro-core-pulse 3s ease-in-out infinite;
}
@keyframes gyro-core-pulse {
  0%,100% { transform: scale(1); }
  50%     { transform: scale(1.1); }
}
