/*
 * ZenbuSoft — Products page 3D showcase styles  (Apple HIG)
 * Loaded only on pages that contain [zenbu_3d_showcase].
 */

.zb3d-wrap {
  position: relative;
  margin: var(--zb-s-5) 0 var(--zb-s-7);
  border-radius: var(--zb-r-lg);
  background: linear-gradient(180deg, #0b1020 0%, #050714 100%);
  color: #f5f5f7;
  overflow: hidden;
  box-shadow: var(--zb-shadow-xl);
  border: 1px solid color-mix(in srgb, var(--zb-accent) 30%, transparent);
}

.zb3d-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 600px;
}
@media (max-width: 900px) {
  .zb3d-grid { grid-template-columns: 1fr; }
  .zb3d-stage { min-height: 60vh; max-height: 70vh; }
}

.zb3d-stage {
  position: relative;
  min-height: 600px;
  touch-action: none;     /* let Three.js handle pinch/drag */
}
.zb3d-stage canvas {
  display: block;
  position: absolute; inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* Floating chips on the stage */
.zb3d-tag {
  position: absolute;
  top: env(safe-area-inset-top, 0);
  top: calc(var(--zb-s-4) + env(safe-area-inset-top, 0px));
  left: var(--zb-s-4);
  z-index: 3;
  font-size: var(--zb-fs-caption2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 6px 10px;
  border-radius: var(--zb-r-pill);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.zb3d-tag b { color: #fff; font-weight: 600; }

.zb3d-hud {
  position: absolute;
  bottom: calc(var(--zb-s-4) + env(safe-area-inset-bottom, 0px));
  left: var(--zb-s-4); right: var(--zb-s-4);
  z-index: 3;
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: var(--zb-fs-caption1);
  pointer-events: none;
}
.zb3d-hud span {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 4px 10px;
  border-radius: var(--zb-r-xs);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}
.zb3d-hud span b { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Controls panel — Apple-style "Inspector" */
.zb3d-controls {
  background: rgba(20, 22, 35, 0.78);
  border-left: 1px solid rgba(255,255,255,0.08);
  padding: var(--zb-s-5) var(--zb-s-4);
  display: flex; flex-direction: column;
  gap: var(--zb-s-4);
  font: var(--zb-fs-subhead)/1.4 var(--zb-font);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}
@media (max-width: 900px) {
  .zb3d-controls {
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--zb-r-lg) var(--zb-r-lg) 0 0;
    padding: var(--zb-s-4);
  }
}

.zb3d-title {
  font-size: var(--zb-fs-headline);
  font-weight: 600;
  color: #fff;
  display: flex; align-items: center; gap: 8px;
  margin: 0;
}
.zb3d-title::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--zb-success);
  box-shadow: 0 0 12px var(--zb-success);
  animation: zb3d-pulse 2s ease-in-out infinite;
}
@keyframes zb3d-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.zb3d-group { display: flex; flex-direction: column; gap: var(--zb-s-2); }
.zb3d-group > label {
  font-size: var(--zb-fs-caption2);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* Segmented control — iOS style */
.zb3d-seg {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--zb-r-sm);
}
.zb3d-seg.zb3d-seg-4 { grid-template-columns: repeat(4, 1fr); }
.zb3d-pill {
  appearance: none;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.8);
  font: 600 var(--zb-fs-caption1)/1 var(--zb-font);
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all .15s var(--zb-ease);
  min-height: 36px;
}
.zb3d-pill:hover { color: #fff; }
.zb3d-pill[aria-pressed="true"] {
  background: #fff;
  color: #1d1d1f;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Slider — iOS style */
.zb3d-slider { display: flex; align-items: center; gap: var(--zb-s-3); }
.zb3d-slider input[type=range] {
  flex: 1;
  -webkit-appearance: none; appearance: none;
  background: rgba(255,255,255,0.18);
  height: 4px; border-radius: var(--zb-r-pill);
}
.zb3d-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  transition: transform .12s var(--zb-ease-spring);
}
.zb3d-slider input[type=range]::-webkit-slider-thumb:active { transform: scale(1.15); }
.zb3d-slider input[type=range]::-moz-range-thumb {
  width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.zb3d-slider output {
  min-width: 38px; text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,0.7);
  font-size: var(--zb-fs-caption1);
}

/* Switch — iOS toggle */
.zb3d-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  min-height: 44px;
}
.zb3d-toggle input { display: none; }
.zb3d-toggle .track {
  width: 51px; height: 31px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--zb-r-pill);
  position: relative;
  transition: background .2s var(--zb-ease);
  flex-shrink: 0;
}
.zb3d-toggle .track::after {
  content: ""; position: absolute;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff;
  top: 2px; left: 2px;
  transition: left .2s var(--zb-ease-spring);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.zb3d-toggle input:checked + .track { background: var(--zb-success); }
.zb3d-toggle input:checked + .track::after { left: 22px; }
.zb3d-toggle .label { color: #fff; font-size: var(--zb-fs-subhead); }

.zb3d-reset {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.85);
  padding: 10px 14px;
  border-radius: var(--zb-r-sm);
  font: 600 var(--zb-fs-caption1)/1 var(--zb-font);
  cursor: pointer;
  transition: all .15s var(--zb-ease);
  min-height: 44px;
}
.zb3d-reset:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.3); }

/* Product cards grid (sits below the showcase) */
.zb-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--zb-s-4);
  margin: var(--zb-s-6) 0 var(--zb-s-7);
}
.zb-product-card {
  background: var(--zb-bg-elev);
  border: 1px solid var(--zb-border-soft);
  border-radius: var(--zb-r-md);
  padding: var(--zb-s-5);
  position: relative;
  overflow: hidden;
  transition: transform .2s var(--zb-ease-spring), box-shadow .2s var(--zb-ease);
}
.zb-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--zb-shadow-lg);
}
.zb-product-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--zb-accent), #a855f7);
}
.zb-product-card .glyph {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--zb-r-sm);
  background: var(--zb-tint-bg);
  color: var(--zb-accent);
  font-size: 22px;
  margin-bottom: var(--zb-s-3);
}
.zb-product-card h3 { margin: 0 0 var(--zb-s-1); color: var(--zb-fg); font-size: var(--zb-fs-title3); }
.zb-product-card .tagline { color: var(--zb-fg-muted); font-size: var(--zb-fs-subhead); margin: 0 0 var(--zb-s-3); }
.zb-product-card ul { list-style: none; padding: 0; margin: 0; }
.zb-product-card li {
  font-size: var(--zb-fs-footnote);
  color: var(--zb-fg-2);
  padding: 6px 0 6px 20px;
  position: relative;
}
.zb-product-card li::before {
  content: "✓"; position: absolute; left: 0; top: 5px;
  width: 14px; height: 14px;
  font-size: 10px; line-height: 14px; text-align: center;
  color: #fff;
  background: var(--zb-success);
  border-radius: 50%;
}
