/* ==========================================================================
   Takin (תקין) — 3D Digital Twin Stage, Hotspots, Simulator, Bento & Checkout
   File: public/css/experience-3d-stage.css (Strictly <= 600 lines & < 42KB)
   ========================================================================== */

/* Stage 1: 3D Digital Twin Viewport & Floating HUD */
.twin-stage-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.twin-3d-viewport {
  position: relative;
  width: 100%;
  height: 550px;
  min-height: 540px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 38%, rgba(16, 185, 129, 0.14), transparent 62%),
    radial-gradient(circle at 20% 80%, rgba(14, 165, 233, 0.12), transparent 55%),
    var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-ambient-elevated);
}

.takin-3d-canvas,
#takin3dCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: pan-y;
}

.takin-3d-canvas:active,
#takin3dCanvas:active {
  cursor: grabbing;
}

/* Top Telemetry Strip & Live Narrative Banner inside 3D Viewport */
.twin-telemetry-strip {
  position: absolute; top: 10px; inset-inline: 12px; z-index: 12;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.45rem; pointer-events: none;
}

.twin-status-pill,
.twin-score-badge {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.28rem 0.76rem; border-radius: 3px;
  background: var(--bg-glass-strong); border: none; border-right: 3px solid currentColor;
  backdrop-filter: blur(14px); font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 700; color: var(--text-primary);
  box-shadow: var(--shadow-border-sheen-inset);
}

.twin-narrative-banner {
  position: absolute; top: 44px; inset-inline: 12px; z-index: 12;
  padding: 0.34rem 0.85rem; border-radius: 11px;
  background: rgba(6, 12, 24, 0.88); border: 1px solid var(--border-emerald);
  backdrop-filter: blur(14px); font-size: 0.8rem; font-weight: 700;
  color: var(--text-primary); text-align: center;
  box-shadow: var(--shadow-ambient-card); pointer-events: none;
  transition: border-color 0.25s ease, background-color 0.25s ease;
}
[data-theme="light"] .twin-narrative-banner { background: rgba(255, 255, 255, 0.94); }
.twin-narrative-banner[data-act-state="defect"] { border-color: var(--accent-amber); }
.twin-narrative-banner[data-act-state="scan"] { border-color: var(--accent-cyan-bright); }

/* Projected RTL 3D Hotspot Callouts Overlay */
.twin-hotspots-overlay,
#twinHotspotsOverlay {
  position: absolute; inset: 0; z-index: 10; pointer-events: none; overflow: hidden;
}

.twin-hotspot-card {
  position: absolute; top: 0; left: 0; pointer-events: auto; box-sizing: border-box;
  direction: rtl; text-align: right; width: 156px; max-width: 168px; overflow: hidden;
  padding: 6px 8px; border-radius: 12px; background: var(--bg-glass-strong);
  border: 1px solid var(--border-strong); backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%); box-shadow: var(--shadow-ambient-card);
  cursor: pointer; transition: opacity 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  will-change: transform, opacity;
}
html[dir="ltr"] .twin-hotspot-card { direction: ltr; text-align: left; }

.twin-hotspot-card:hover,
.twin-hotspot-card.is-focused,
.twin-hotspot-card.is-active {
  border-color: var(--accent-emerald-bright);
  box-shadow: var(--shadow-ambient-glow-emerald);
  z-index: 15;
}
.twin-hotspot-card.is-defect { border-color: var(--accent-amber); }
.twin-hotspot-card.is-dimmed { opacity: 0.38; }

.hotspot-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.15rem; margin-bottom: 0.18rem; min-width: 0; overflow: hidden;
}

.hotspot-anchor-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-emerald-bright); box-shadow: 0 0 8px var(--accent-emerald-bright);
}
.twin-hotspot-card.is-defect .hotspot-anchor-dot {
  background: var(--accent-amber); box-shadow: 0 0 8px var(--accent-amber);
}

.hotspot-weight-badge {
  font-family: var(--font-mono); font-size: 0.61rem; font-weight: 700;
  padding: 0.03rem 0.22rem; border-radius: var(--radius-pill);
  background: var(--accent-emerald-soft); color: var(--accent-emerald-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58%;
}

.hotspot-state-tag {
  font-family: var(--font-mono); font-size: 0.61rem; font-weight: 700;
  padding: 0.03rem 0.22rem; border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.18); color: var(--accent-emerald-bright);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42%;
}
.twin-hotspot-card.is-defect .hotspot-state-tag {
  background: rgba(245, 158, 11, 0.22); color: var(--accent-amber);
}

.hotspot-title {
  font-family: var(--font-heading); font-size: 0.70rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.22;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; text-overflow: ellipsis; word-break: break-word;
}
.hotspot-meta { display: none; }

/* Floating Glass HUD Control Bar */
.twin-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.85rem 1.15rem;
  border-radius: 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-ambient-card);
}

.twin-slider-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1 1 240px;
}

.twin-slider-group label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  white-space: nowrap;
}

#layerPeelSlider,
#simTrafficSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
  outline: none;
  cursor: pointer;
}

#layerPeelSlider::-webkit-slider-thumb,
#simTrafficSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--accent-emerald);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.twin-preset-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.peel-preset-btn,
.camera-view-btn,
[data-peel-preset],
[data-camera-view] {
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.peel-preset-btn:hover,
.peel-preset-btn.is-active,
[data-peel-preset].is-active,
.camera-view-btn:hover,
.camera-view-btn.is-active,
[data-camera-view].is-active {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  color: var(--text-primary);
}

/* Stage 2: 4-Layer Exploded Digital Twin Explorer Cards */
.layer-explorer-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.15rem;
}

.layer-cards-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.15rem;
}

.layer-spec-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.35rem;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-ambient-card);
  cursor: pointer;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.layer-spec-card:hover,
.layer-spec-card.is-active {
  transform: translateY(-3px);
  border-color: var(--accent-emerald);
  box-shadow: var(--shadow-ambient-glow-emerald);
}

.layer-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.layer-weight-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.24rem 0.65rem;
  border-radius: 3px;
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald-bright);
  border: none;
  border-right: 3px solid currentColor;
}

/* Stage 3: Interactive Before / After What-If Simulator */
.sim-console-grid {
  display: grid;
  grid-template-columns: minmax(300px, 5fr) minmax(340px, 7fr);
  gap: 1.5rem;
  align-items: stretch;
}

.sim-controls-panel,
.sim-results-panel {
  padding: 1.25rem 1.45rem;
  border-radius: var(--radius-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-ambient-card);
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.sim-results-panel[data-active-mode="before"] {
  border-color: var(--border-amber);
  background:
    radial-gradient(circle at 90% 10%, rgba(245, 158, 11, 0.12), transparent 55%),
    var(--bg-glass);
}

.sim-results-panel[data-active-mode="after"] {
  border-color: var(--border-emerald);
  box-shadow: var(--shadow-ambient-glow-emerald);
}

.sim-toggle-group {
  display: inline-flex;
  padding: 0.3rem;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  gap: 0.35rem;
}

.sim-toggle-pill,
[data-sim-state] {
  flex: 1;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.22s ease;
}

[data-sim-state="before"].is-active {
  background: var(--accent-amber);
  color: #180d02;
}

[data-sim-state="after"].is-active {
  background: var(--accent-emerald);
  color: #02140d;
}

[data-theme="light"] [data-sim-state="after"].is-active {
  background: #047857;
  color: #ffffff;
}

[data-theme="light"] .hotspot-weight-badge,
[data-theme="light"] .hotspot-state-tag,
[data-theme="light"] .layer-weight-pill {
  color: #047857;
}

.sim-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.sim-preset-btn,
[data-sim-archetype],
[data-sim-traffic] {
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sim-preset-btn.is-active,
[data-sim-archetype].is-active,
[data-sim-traffic].is-active {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  color: var(--text-primary);
}

.sim-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.sim-metric-card {
  padding: 1.15rem;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-border-sheen-inset);
}

.sim-metric-value {
  font-family: var(--font-mono);
  font-size: clamp(1.04rem, 1.25vw, 1.26rem);
  line-height: 1.32;
  font-weight: 800;
  color: var(--text-primary);
  margin-block: 0.35rem;
}

/* Stage 4: Self-Animating Bento Grid with Radial Spotlight */
.bento-showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.bento-card {
  position: relative;
  overflow: hidden;
  padding: 1.55rem;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(500px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(16, 185, 129, 0.13), transparent 40%),
    var(--bg-glass);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-ambient-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.1rem;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.bento-card:hover {
  border-color: var(--border-emerald);
  transform: translateY(-2px);
}

.bento-visual-box {
  position: relative;
  min-height: 130px;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  overflow: hidden;
}

.bento-radar-pulse {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--accent-emerald);
  margin: 0.4rem auto;
  position: relative;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.28);
}

/* Stage 5: Smart Tiered Purchase & Domain Intake Console */
.checkout-console-card {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border-radius: var(--radius-xl);
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-ambient-elevated);
}

.package-selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin-block: 1.4rem;
}

.package-tier-card,
[data-exp-package] {
  position: relative;
  padding: 1.4rem;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-ambient-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.22s ease;
}

.package-tier-card.is-selected,
[data-exp-package].is-selected,
[data-exp-package][aria-checked="true"] {
  border-color: var(--accent-emerald);
  box-shadow: var(--shadow-ambient-glow-emerald);
  transform: translateY(-2px);
}

.payment-method-pills,
.site-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.payment-pill,
[data-payment-method],
[data-exp-site-type] {
  padding: 0.52rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.payment-pill.is-active,
[data-payment-method].is-active,
[data-exp-site-type].is-active {
  border-color: var(--accent-emerald);
  background: var(--accent-emerald-soft);
  color: var(--text-primary);
}

/* Mobile & Tablet Responsive Adaptation */
@media (max-width: 1024px) {
  .layer-explorer-grid,
  .bento-showcase-grid,
  .package-selector-grid,
  .sim-console-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .twin-3d-viewport { height: 460px; min-height: 440px; }
  .twin-telemetry-strip { top: 9px; inset-inline: 10px; flex-wrap: nowrap; gap: 0.3rem; }
  .twin-status-pill,
  .twin-score-badge { font-size: 0.69rem; padding: 0.18rem 0.42rem; gap: 0.25rem; white-space: nowrap; }
  .twin-hotspot-card { width: 158px; max-width: 162px; padding: 6px 8px; }
  .hotspot-weight-badge { font-size: 0.69rem; padding: 0.08rem 0.32rem; white-space: nowrap; }
  .hotspot-title { font-size: 0.75rem; line-height: 1.22; }
  .hotspot-meta { display: none; }
  .sim-metrics-grid { grid-template-columns: 1fr; }
  .peel-preset-btn,
  .camera-view-btn,
  .sim-preset-btn,
  .sim-toggle-pill,
  .payment-pill {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
