/* camera-live.css - Z-AXIS-AERO Live Camera + AI Vision page.
 * Truss Standard v1.0 palette. Ink base, gold accents, glass panels.
 */

:root {
  --bg: oklch(0.12 0.008 255);
  --surface: oklch(0.15 0.012 255 / 0.75);
  --surface-raised: oklch(0.18 0.014 255 / 0.6);
  --primary: oklch(0.68 0.15 255);
  --primary-deep: oklch(0.52 0.12 255);
  --accent: oklch(0.82 0.14 220);
  --gold: oklch(0.74 0.10 75);
  --gold-deep: oklch(0.74 0.08 70);
  --gold-bright: oklch(0.76 0.11 75);
  --text: oklch(0.93 0.008 255);
  --text-dim: oklch(0.72 0.015 255);
  --border: oklch(0.45 0.02 255 / 0.12);
  --grid: oklch(0.68 0.15 255 / 0.05);
  --danger: oklch(0.80 0.22 25);
  --ok: oklch(0.72 0.17 155);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --glass-blur: 16px;
  --shadow: 0 2px 4px oklch(0.05 0.01 255 / 0.3), 0 12px 32px oklch(0.05 0.01 255 / 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background:
    radial-gradient(1200px 700px at 80% -10%, oklch(0.68 0.15 255 / 0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, oklch(0.52 0.12 255 / 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Hero */
.hero {
  padding: 2.5rem 2rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--grid);
}
.hero-inner { max-width: 900px; margin: 0 auto; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.brand-mark-img {
  height: 44px;
  width: auto;
  display: block;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.subtitle {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}
.nav {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--gold-bright);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--grid);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
.nav a:hover { border-color: var(--gold); background: oklch(0.68 0.15 255 / 0.08); }

/* Control bar */
main { max-width: 1300px; margin: 0 auto; padding: 1.5rem 2rem 3rem; }
.control-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.ctrl-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.ctrl-btn:hover { border-color: var(--gold); color: var(--gold-bright); }
.ctrl-btn:not(:disabled):hover { transform: translateY(-1px); }
.ctrl-btn:disabled { opacity: 0.4; cursor: default; }
.ctrl-btn:not(:disabled):active { transform: translateY(0) scale(0.98); }
.ctrl-btn.primary {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
.ctrl-btn.primary:hover { opacity: 0.85; }
.ctrl-btn.primary:not(:disabled):hover { box-shadow: 0 2px 4px oklch(0.68 0.15 255 / 0.15), 0 4px 16px oklch(0.68 0.15 255 / 0.3); }
.ctrl-btn.small { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.ctrl-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.ctrl-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  cursor: pointer;
}
.ctrl-toggle input { accent-color: var(--gold); }

/* Pipeline grid */
.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.panel {
  will-change: transform;
  background: var(--surface-raised);
  border: 1px solid oklch(0.75 0.02 255 / 0.12);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 1px 2px oklch(0.05 0.01 255 / 0.15), 0 8px 24px oklch(0.05 0.01 255 / 0.3), inset 0 1px 0 oklch(0.95 0.02 255 / 0.04);
}
.pipeline-grid .panel:nth-child(1) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0s backwards; }
.pipeline-grid .panel:nth-child(2) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.08s backwards; }
.pipeline-grid .panel:nth-child(3) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.16s backwards; }
.pipeline-grid .panel:nth-child(4) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.24s backwards; }
.pipeline-grid .panel:nth-child(5) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.32s backwards; }
.pipeline-grid .panel:nth-child(6) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s backwards; }
.autonomy-grid .panel:nth-child(1) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.1s backwards; }
.autonomy-grid .panel:nth-child(2) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.2s backwards; }
.autonomy-grid .panel:nth-child(3) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.3s backwards; }
.autonomy-grid .panel:nth-child(4) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.4s backwards; }
.autonomy-grid .panel:nth-child(5) { animation: panelEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.5s backwards; }
@keyframes panelEnter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.panel-header {
  padding: 0.6rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  border-bottom: 1px solid var(--border);
  background: oklch(0.68 0.15 255 / 0.04);
}
.panel-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  gap: 0.5rem;
}

/* Video panel */
.video-panel { grid-column: 1; }
.video-wrap {
  position: relative;
  width: 100%;
  background: var(--bg);
  aspect-ratio: 16/9;
}
.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.overlay-canvas {
  will-change: transform;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
canvas { will-change: transform; }

/* Vision panel */
.vision-panel { grid-column: 2; }
.vision-panel canvas {
  display: block;
  width: 100%;
  background: var(--bg);
  aspect-ratio: 4/3;
}

/* Telemetry panel */
.telemetry-panel { grid-column: 1 / -1; }
.aircraft-panel { grid-column: 1 / -1; }
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 1rem;
}
.tel-item {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  transition: border-color 0.15s ease;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
.tel-item:hover { border-color: oklch(0.68 0.15 255 / 0.25); }
.tel-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.tel-val {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold-bright);
}
.tel-unit {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.telemetry-extra { padding: 0 1rem 0.8rem; }
.tel-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.tel-row:last-child { border-bottom: none; }
.tel-row .tel-val { font-size: 0.85rem; }
.mono { font-family: var(--font-mono); }

/* AI panel */
.ai-panel { grid-column: 1; }
.ai-status {
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.ai-result {
  padding: 0 1rem;
  min-height: 80px;
}
.ai-scene-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text);
}
.ai-placeholder {
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0.5rem 0;
}
.ai-objects {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
}
.ai-obj-chip {
  background: oklch(0.68 0.15 255 / 0.12);
  border: 1px solid oklch(0.68 0.15 255 / 0.25);
  border-radius: 12px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  color: var(--gold-bright);
}

/* Anomaly panel */
.anomaly-panel { grid-column: 2; }
.anomaly-list {
  padding: 0.6rem 1rem;
  min-height: 60px;
}
.anomaly-item {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-left: 3px solid;
  border-radius: 4px;
  background: var(--surface);
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
}
.anomaly-sev {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  min-width: 60px;
}
.anomaly-type {
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 120px;
}

/* Custody panel */
.custody-panel { grid-column: 1 / -1; }
.custody-grid { padding: 0.8rem 1rem; }
.custody-grid .tel-row { font-size: 0.85rem; }
.custody-panel .ctrl-btn {
  margin: 0 1rem 0.8rem;
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid var(--grid);
}

/* Autonomy section */
.autonomy-section { margin-top: 2rem; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold-bright);
}
.autonomy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.auto-content {
  padding: 0.6rem 1rem;
  min-height: 80px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.auto-stat {
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.auto-stat:last-child { border-bottom: none; }
.state-EXECUTING { color: var(--ok); }
.state-MONITORING { color: var(--gold-bright); }
.state-LANDING { color: var(--danger); }
.state-COMPLETE { color: var(--ok); }
.state-ERROR { color: var(--danger); }
.healing-item { color: var(--danger); }
.replan-item { color: var(--gold-bright); }

@media (max-width: 768px) {
  .pipeline-grid { grid-template-columns: 1fr; }
  .video-panel, .vision-panel, .ai-panel, .anomaly-panel { grid-column: 1; }
  .telemetry-panel, .aircraft-panel, .custody-panel { grid-column: 1; }
  .telemetry-grid { grid-template-columns: repeat(2, 1fr); }
  .autonomy-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
}

@media (max-width: 380px) {
  .hero { padding: 1.5rem 0.75rem 1rem; }
  .hero h1 { font-size: 1.3rem; }
  .subtitle { font-size: 0.8rem; }
  .nav { gap: 0.5rem; }
  .nav a { font-size: 0.72rem; padding: 0.25rem 0.5rem; }
  main { padding: 0.75rem 0.75rem 2rem; }
  .control-bar { padding: 0.6rem; gap: 0.4rem; }
  .ctrl-btn { padding: 0.4rem 0.8rem; font-size: 0.78rem; min-height: 48px; }
  .telemetry-grid { grid-template-columns: 1fr 1fr; gap: 0.3rem; padding: 0.5rem; }
  .tel-item { padding: 0.4rem 0.5rem; }
  .tel-val { font-size: 1rem; }
  .autonomy-grid { grid-template-columns: 1fr; }
}

.live-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  margin-left: 6px;
  vertical-align: middle;
  animation: pulse 1.2s ease-in-out infinite;
}
.live-pulse[hidden] { display: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--ok); }
  50% { opacity: 0.3; box-shadow: 0 0 1px var(--ok); }
}

/* =====================================================================
   ZENITH ELEVATION · reticle · phosphor glow · scanline · pulse
   ===================================================================== */

/* Hover lift on pipeline panels. */
.panel {
  transition: transform 0.3s var(--ease-out), border-color 0.2s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px oklch(0.05 0.01 255 / 0.2), 0 16px 40px oklch(0.05 0.01 255 / 0.4), 0 0 28px oklch(0.68 0.15 255 / 0.06), inset 0 1px 0 oklch(0.95 0.02 255 / 0.05);
}

/* Targeting reticle overlay on the camera feed. */
.video-wrap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
  border-radius: 50%;
  border: 1px solid oklch(0.82 0.14 220 / 0.28);
  background:
    linear-gradient(oklch(0.82 0.14 220 / 0.24), oklch(0.82 0.14 220 / 0.24)) center / 1px 100% no-repeat,
    linear-gradient(90deg, oklch(0.82 0.14 220 / 0.24), oklch(0.82 0.14 220 / 0.24)) center / 100% 1px no-repeat;
  box-shadow: 0 0 20px oklch(0.82 0.14 220 / 0.12), 0 0 0 28px oklch(0.82 0.14 220 / 0.04);
  opacity: 0.7;
}

/* Vision pipeline scan-line sweep. */
.vision-panel {
  position: relative;
}
.vision-panel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, oklch(0.82 0.14 220 / 0.4), transparent);
  box-shadow: 0 0 12px oklch(0.82 0.14 220 / 0.3);
  opacity: 0;
  animation: vision-sweep 4.5s var(--ease-out) infinite;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes vision-sweep {
  0% { transform: translateY(-4px); opacity: 0; }
  6% { opacity: 0.8; }
  94% { opacity: 0.8; }
  100% { transform: translateY(100vh); opacity: 0; }
}

/* CRT / phosphor glow on the flow canvas. */
#flow-canvas {
  box-shadow: inset 0 0 40px oklch(0.72 0.17 155 / 0.12),
    0 0 22px oklch(0.68 0.15 255 / 0.08);
  filter: saturate(1.1);
}

/* AI vision engine status pulse. */
.ai-panel .live-pulse:not([hidden]) {
  animation: ai-pulse 1.6s var(--ease-out) infinite;
}
@keyframes ai-pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.72 0.17 155 / 0.45); }
  70% { box-shadow: 0 0 0 8px oklch(0.72 0.17 155 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.72 0.17 155 / 0); }
}

/* Depth on telemetry cells. */
.tel-item {
  box-shadow: inset 0 1px 0 oklch(0.95 0.02 255 / 0.05),
    inset 0 0 16px oklch(0.68 0.15 255 / 0.05);
}

/* Warning glow on anomaly items. */
.anomaly-item {
  box-shadow: inset 0 0 14px oklch(0.58 0.22 25 / 0.08);
  animation: anomaly-glow 2.4s ease-in-out infinite;
}
@keyframes anomaly-glow {
  0%, 100% { box-shadow: inset 0 0 14px oklch(0.58 0.22 25 / 0.08); }
  50% { box-shadow: inset 0 0 14px oklch(0.58 0.22 25 / 0.16), 0 0 18px oklch(0.58 0.22 25 / 0.12); }
}

/* Tabular numerals on telemetry values. */
.tel-val,
.panel-footer,
.ai-status {
  font-variant-numeric: tabular-nums;
}

/* Zenith brand layer (session 15): gold hairline under the hero header. */
.hero {
  position: relative;
}
.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 3%, oklch(0.74 0.10 75 / 0.45) 50%, transparent 97%);
  pointer-events: none;
}
.brand-mark-img {
  filter: drop-shadow(0 0 14px oklch(0.74 0.10 75 / 0.28));
}
