/* AltMatter — spatial-style.css
 * Tactical Telemetry styling for the interactive Holo Touch 3D CAD study.
 */
:root {
  color-scheme: dark;
  --c-bg: #0d0f11;
  --c-ink: #eaeae4;
  --c-dim: #8a8e94;
  --c-border: #25282c;
  --c-hairline: #181a1d;
  --c-accent: #ff5524;
  --c-accent-dim: #df4a1b;
  --c-accent-glow: rgba(255, 85, 36, 0.35);
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
}

[hidden] { display: none !important; }

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
#stage.is-hoverpart {
  cursor: pointer;
}
#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ── LOADER ─────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--c-bg);
  z-index: 100;
  font-family: var(--font-mono);
  transition: opacity 0.35s ease;
}
#loading.is-done {
  opacity: 0;
  pointer-events: none;
}
.spatial-loader {
  width: min(340px, 84vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spatial-loader__label {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: var(--c-accent);
  text-transform: uppercase;
  text-align: center;
}
.spatial-loader__track {
  height: 3px;
  width: 100%;
  background: var(--c-border);
  overflow: hidden;
}
.spatial-loader__bar {
  height: 100%;
  width: 6%;
  background: var(--c-accent);
  transition: width 0.15s ease-out;
}

/* ── HUD CHROME ─────────────────────────────────────────────── */
.spatial-hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(14px, 2.2vw, 28px);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.spatial-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--c-accent);
  opacity: 0.7;
  pointer-events: none;
}
.spatial-corner--tl { top: 10px; left: 10px; border-top: 1px solid; border-left: 1px solid; }
.spatial-corner--tr { top: 10px; right: 10px; border-top: 1px solid; border-right: 1px solid; }
.spatial-corner--bl { bottom: 10px; left: 10px; border-bottom: 1px solid; border-left: 1px solid; }
.spatial-corner--br { bottom: 10px; right: 10px; border-bottom: 1px solid; border-right: 1px solid; }

/* ── TOP HEADER RAIL ────────────────────────────────────────── */
.spatial-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.spatial-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-ink);
  text-decoration: none;
  pointer-events: auto;
  flex-shrink: 0;
}
.spatial-brand svg {
  width: 18px;
  height: 18px;
  stroke: var(--c-accent);
}
.spatial-brand__label {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: 0.875rem;
}

.spatial-step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(13, 15, 17, 0.9);
  border: 1px solid var(--c-accent);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
}
.spatial-step__num {
  color: var(--c-accent);
  font-weight: 600;
}
.spatial-step__phase {
  color: #0d0f11;
  background: var(--c-accent);
  padding: 2px 6px;
  font-size: 0.625rem;
  font-weight: 600;
}
.spatial-step__label {
  color: var(--c-ink);
}

.spatial-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-shrink: 0;
}

.spatial-btn {
  background: rgba(13, 15, 17, 0.86);
  border: 1px solid var(--c-border);
  color: var(--c-ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
  border-radius: 0;
  backdrop-filter: blur(8px);
}
.spatial-btn:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.spatial-btn--quiet {
  color: var(--c-dim);
}
.spatial-btn--active {
  border-color: var(--c-accent);
  background: var(--c-accent);
  color: #0d0f11;
  font-weight: 600;
}
.spatial-btn--active:hover {
  color: #0d0f11;
  background: #ff6e42;
}

/* ── SIDE TELEMETRY & INSPECTOR RAIL ────────────────────────── */
.spatial-telemetry {
  position: absolute;
  top: 76px;
  left: clamp(14px, 2.2vw, 28px);
  width: 282px;
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--c-border) transparent;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spatial-card {
  background: rgba(13, 15, 17, 0.88);
  border: 1px solid var(--c-border);
  padding: 10px 12px;
  backdrop-filter: blur(10px);
}

.spatial-card__kicker {
  font-size: 0.625rem;
  color: var(--c-dim);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.spatial-card__val {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: 0.03em;
}
.spatial-card__val--accent {
  color: var(--c-accent);
}

.spatial-data-rows {
  margin-top: 8px;
  border-top: 1px solid var(--c-hairline);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.6875rem;
}
.spatial-data-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--c-dim);
}
.spatial-data-row span:last-child {
  color: var(--c-ink);
  text-align: right;
}

/* ── PART INSPECTOR CARD ────────────────────────────────────── */
.spatial-inspector {
  border-color: var(--c-accent);
}
.spatial-close {
  background: none;
  border: 1px solid var(--c-border);
  color: var(--c-dim);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.spatial-close:hover {
  border-color: var(--c-accent);
  color: var(--c-accent);
}
.spatial-inspector__name {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: 0.01em;
}
.spatial-inspector__prod {
  font-size: 0.6875rem;
  color: var(--c-accent);
  margin-top: 2px;
}
.spatial-inspector__desc {
  font-family: var(--font-body);
  font-size: 0.75rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--c-dim);
  margin-top: 6px;
}
.spatial-pins {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.spatial-pin {
  font-size: 0.5625rem;
  padding: 2px 5px;
  border: 1px solid var(--c-border);
  background: rgba(255, 255, 255, 0.03);
  color: #9dc5d9;
  letter-spacing: 0.06em;
}
.spatial-links {
  margin-top: 8px;
  border-top: 1px solid var(--c-hairline);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.spatial-link-row {
  font-size: 0.625rem;
  color: var(--c-dim);
  display: flex;
  gap: 6px;
  line-height: 1.35;
}
.spatial-link-row b {
  color: var(--c-ink);
  font-weight: 500;
}

/* ── HAPTIC GAUGE ───────────────────────────────────────────── */
.spatial-gauge {
  margin-top: 8px;
  height: 4px;
  width: 100%;
  background: var(--c-border);
  position: relative;
  overflow: hidden;
}
.spatial-gauge__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 14%;
  background: var(--c-accent);
  transition: width 0.08s ease-out;
}

/* ── RIGHT CONTROLS PANEL ───────────────────────────────────── */
.spatial-controls {
  position: absolute;
  top: 78px;
  right: clamp(14px, 2.2vw, 28px);
  width: 244px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spatial-btn-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ── BOTTOM HUD BAR ─────────────────────────────────────────── */
.spatial-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.spatial-hint,
.spatial-coords {
  font-size: 0.6875rem;
  color: var(--c-dim);
  background: rgba(13, 15, 17, 0.85);
  padding: 6px 12px;
  border: 1px solid var(--c-hairline);
  backdrop-filter: blur(8px);
}
.spatial-hint {
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.spatial-coords {
  white-space: nowrap;
}
.spatial-coords span {
  color: var(--c-ink);
  font-weight: 500;
}

.spatial-mobile-controls {
  display: none;
  pointer-events: auto;
  gap: 6px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 2px;
}

/* ── RESPONSIVE ADAPTATIONS ─────────────────────────────────── */
@media (max-width: 960px) {
  .spatial-step {
    display: none;
  }
  .spatial-telemetry {
    top: auto;
    bottom: 66px;
    left: 14px;
    width: min(290px, calc(100% - 28px));
    max-height: 44vh;
  }
  .spatial-controls {
    display: none;
  }
  .spatial-hint {
    display: none;
  }
  .spatial-mobile-controls {
    display: flex;
    flex: 1 1 auto;
  }
  .spatial-mobile-controls .spatial-btn {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.625rem;
  }
  #btn-reset {
    display: none;
  }
}

@media (max-width: 600px) {
  .spatial-bottom {
    flex-direction: column;
    align-items: stretch;
  }
  .spatial-telemetry {
    bottom: 94px;
  }
  .spatial-coords {
    align-self: flex-end;
    font-size: 0.625rem;
  }
}
