/* OPTARIS Pose — Design Lab
   Standalone stage for iterating on the human visual + sensor telemetry.
   Visual language matches atrium-test (navy + amber, monospace HUD). */

:root {
  --navy: #060d1a;
  --navy-2: #0a1628;
  --amber: #f5a623;
  --amber-soft: rgba(245, 166, 35, 0.22);
  --cyan: #3eb6ff;
  --green: #3eff8a;
  --text: #e8ece0;
  --text-dim: #8a93a3;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  overflow: hidden;
}

#pose-canvas {
  position: fixed;
  inset: 0;
  display: block;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }

/* Back button — top-left, prominent pill */
#back-btn {
  position: absolute;
  top: 18px;
  left: 22px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: linear-gradient(180deg, rgba(10,22,40,0.88), rgba(6,13,26,0.92));
  border: 1px solid rgba(245,166,35,0.35);
  border-radius: 10px;
  color: var(--amber);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-decoration: none;
  backdrop-filter: blur(10px) saturate(140%);
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
  z-index: 2;
}
#back-btn:hover {
  background: rgba(245,166,35,0.18);
  color: #ffc869;
}
#back-btn:active { transform: scale(0.97); }
#back-btn svg { color: var(--amber); }

/* Brand */
#brand {
  position: absolute;
  top: 22px;
  left: 200px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
#brand-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 5px;
  color: var(--text);
}
#brand-tagline {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 2px;
  color: var(--amber);
  text-transform: uppercase;
}
#brand-home {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-decoration: none;
}
#brand-home:hover { color: var(--amber); }

/* Source switch — top right */
#source-switch {
  position: absolute;
  top: 18px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: linear-gradient(180deg, rgba(10,22,40,0.88), rgba(6,13,26,0.92));
  border: 1px solid rgba(245,166,35,0.25);
  border-radius: 10px;
  backdrop-filter: blur(10px) saturate(140%);
}
#source-switch button {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.6px;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
#source-switch button:hover { color: var(--amber); }
#source-switch button.active {
  background: var(--amber-soft);
  color: var(--amber);
}
#source-status {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-dim);
  padding: 0 10px;
  letter-spacing: 0.4px;
}

/* Lab panels — left & right rails */
.lab-panel {
  position: absolute;
  width: 240px;
  background: linear-gradient(180deg, rgba(10,22,40,0.86), rgba(6,13,26,0.92));
  border: 1px solid rgba(245,166,35,0.22);
  border-radius: 12px;
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.04) inset,
    0 20px 36px -18px rgba(0,0,0,0.6);
}
.lab-panel__title {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 3.5px;
  color: var(--amber);
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(245,166,35,0.12);
}
.lab-panel__body { padding: 10px 14px 14px; }

#preset-panel {
  top: 72px;
  left: 22px;
  /* Bottom anchor so the panel stops above the timeline strip (which
     occupies ~120px at the bottom). Internal scroll on the body keeps
     all personas reachable even when the library grows. */
  max-height: calc(100vh - 72px - 140px);
  display: flex;
  flex-direction: column;
}
#preset-panel .lab-panel__body {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(245,166,35,0.35) transparent;
}
#preset-panel .lab-panel__body::-webkit-scrollbar { width: 6px; }
#preset-panel .lab-panel__body::-webkit-scrollbar-thumb {
  background: rgba(245,166,35,0.35);
  border-radius: 999px;
}
#preset-panel .lab-panel__body::-webkit-scrollbar-track { background: transparent; }
#preset-panel .preset {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid rgba(245,166,35,0.0);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
#preset-panel .preset:hover {
  background: rgba(245,166,35,0.06);
  color: var(--amber);
}
#preset-panel .preset.active {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(245,166,35,0.35);
}

#readout-panel {
  top: 72px;
  right: 22px;
}
.lab-readout { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; }
.r-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 2px;
  letter-spacing: 0.4px;
}
.r-row span { color: var(--text-dim); }
.r-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.r-divider {
  height: 1px;
  background: rgba(245,166,35,0.12);
  margin: 6px 0;
}

/* Timeline — bottom bar */
#timeline-panel {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  height: 92px;
  background: linear-gradient(180deg, rgba(10,22,40,0.86), rgba(6,13,26,0.92));
  border: 1px solid rgba(245,166,35,0.22);
  border-radius: 12px;
  backdrop-filter: blur(10px) saturate(140%);
  padding: 10px 14px;
  display: grid;
  grid-template-rows: 1fr 1fr auto;
  gap: 4px;
}
.tl-track {
  position: relative;
  height: 22px;
  border-radius: 4px;
  background: rgba(245,166,35,0.04);
  overflow: hidden;
}
.tl-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 1.6px;
  color: var(--text-dim);
}

/* Motion legend — bottom-right corner above timeline */
#motion-legend {
  position: absolute;
  right: 22px;
  bottom: 130px;
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  background: rgba(6,13,26,0.7);
  border: 1px solid rgba(245,166,35,0.18);
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  backdrop-filter: blur(8px);
}
.ml-item { display: inline-flex; align-items: center; gap: 6px; }
.ml-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ml-still { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.ml-walk { background: var(--green); box-shadow: 0 0 8px var(--green); }
.ml-run { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.ml-linger { background: #b388ff; box-shadow: 0 0 8px #b388ff; }

/* Scenario / Story controls */
.lab-panel__divider {
  height: 1px;
  background: rgba(245, 166, 35, 0.15);
  margin: 8px 4px 6px;
}
.preset--story {
  background: rgba(245, 166, 35, 0.08);
  border: 1px solid rgba(245, 166, 35, 0.3);
  letter-spacing: 0.4px;
}
.preset--story.active {
  background: rgba(245, 166, 35, 0.22);
  color: #fff;
}
.lab-scenario {
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(6,13,26,0.6);
  border: 1px solid rgba(245,166,35,0.15);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-dim);
}
.lab-scenario .scn-label {
  color: var(--amber);
  margin-bottom: 4px;
  letter-spacing: 0.4px;
}
.lab-scenario .scn-bar {
  height: 3px;
  background: rgba(245,166,35,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}
.lab-scenario .scn-fill {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width 0.15s linear;
}
.lab-scenario .scn-step {
  text-align: right;
  font-size: 9px;
}
.preset.active--ghost {
  background: rgba(245, 166, 35, 0.10);
  color: var(--amber);
  border-color: rgba(245, 166, 35, 0.25);
}

/* Event personas (fall, stumble) — red-tint to signal high alert. */
.preset--event {
  border: 1px solid rgba(255, 90, 110, 0.35);
}
.preset--event.active,
.preset--event.active--ghost {
  background: rgba(255, 90, 110, 0.20);
  color: #ffd0d6;
  border-color: rgba(255, 90, 110, 0.55);
}
/* Recovery personas (stand-up transitions) — green-tint. */
.preset--recover {
  border: 1px solid rgba(80, 220, 140, 0.30);
}
.preset--recover.active,
.preset--recover.active--ghost {
  background: rgba(80, 220, 140, 0.18);
  color: #c8ffe0;
  border-color: rgba(80, 220, 140, 0.5);
}
.preset--agent {
  background: rgba(94, 224, 216, 0.10);
  border-color: rgba(94, 224, 216, 0.4);
}
.preset--agent.active {
  background: rgba(94, 224, 216, 0.22);
  color: #d4ffff;
  border-color: rgba(94, 224, 216, 0.6);
}

/* Hide-HUD toggle (bottom-right) — hides all panels like the atrium pages */
#hud-toggle {
  position: absolute;
  top: 18px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(10,22,40,0.88), rgba(6,13,26,0.92));
  border: 1px solid rgba(245,166,35,0.35);
  border-radius: 10px;
  color: var(--amber);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(10px) saturate(140%);
  transition: background 160ms ease, color 160ms ease;
  z-index: 4;
}
#hud-toggle:hover { background: rgba(245,166,35,0.18); color: #ffc869; }
body.hud-hidden #source-switch,
body.hud-hidden .lab-panel,
body.hud-hidden #timeline-panel,
body.hud-hidden #motion-legend { display: none !important; }
