/* =============================================================================
   orbit.css — Orbit by ReWoo
   Live visual view of a deployed AI company.
   All Orbit-specific styles. Design tokens from styles.css.
   ============================================================================= */


/* =============================================================================
   1. PAGE LAYOUT
   ============================================================================= */

.orbit-page {
  min-height: 100vh;
  /* Grid baked directly into background — avoids z-index stacking wars from ::before */
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed; /* keeps grid fixed like a viewport texture */
  display: flex;
  flex-direction: column;
}


/* =============================================================================
   2. HEADER STRIP
   ============================================================================= */

.orbit-header {
  /* BUG FIX: was 72px — only 12px below the 60px nav. Use nav-h + breathing room. */
  padding: calc(var(--nav-h) + 40px) var(--sp-6) 0;
  text-align: center;
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}

.orbit-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--size-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: var(--sp-4);
}

.orbit-eyebrow__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3ECBAB;
  animation: eyebrowPulse 2.8s ease-in-out infinite;
}

@keyframes eyebrowPulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.4); }
}

.orbit-title {
  font-family: var(--font-display);
  font-size: var(--size-xl);
  font-weight: 300;
  color: var(--text);
  margin-bottom: var(--sp-2);
  line-height: 1.1;
}

.orbit-subtitle {
  font-size: var(--size-sm);
  color: var(--dim);
  margin-bottom: 0;
}


/* =============================================================================
   3. DEMO BADGE
   ============================================================================= */

.orbit-demo-badge {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(245, 166, 35, 0.10);
  border: 1px solid rgba(245, 166, 35, 0.25);
  font-size: 0.7rem;
  font-weight: 500;
  color: #F5A623;
  letter-spacing: 0.04em;
  z-index: 50;
  transition: opacity var(--dur) var(--ease-out);
}

.orbit-demo-badge--hidden {
  opacity: 0;
  pointer-events: none;
}

.orbit-demo-badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #F5A623;
  animation: eyebrowPulse 2s ease-in-out infinite;
}


/* =============================================================================
   4. SVG CANVAS
   ============================================================================= */

.orbit-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  min-height: 0;
}

.orbit-svg {
  display: block;
  overflow: visible;
  /* Responsive: scale to fit */
  width: min(640px, 94vw);
  height: min(640px, 94vw);
}

/* SVG ring circles */
.orbit-ring {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 8;
}

/* Connector lines from center outward */
.orbit-connector {
  stroke: var(--line-2);
  stroke-width: 1;
  fill: none;
  pointer-events: none;
}

/* =============================================================================
   5. NODES
   ============================================================================= */

.orbit-node {
  cursor: pointer;
  outline: none;
}

.orbit-node:focus-visible .node-focus-ring {
  opacity: 1;
}

/* Focus ring for keyboard nav */
.node-focus-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
  pointer-events: none;
}

/* Base circle */
.node-circle {
  transition:
    fill var(--dur) var(--ease-out),
    filter var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
  transform-origin: center;
  transform-box: fill-box;
}

.orbit-node:hover .node-circle {
  transform: scale(1.07);
}

/* Pulse ring for awaiting_approval nodes */
.node-pulse-ring {
  fill: none;
  stroke-width: 2.5;
  opacity: 0;
  transform-origin: center;
  transform-box: fill-box;
  pointer-events: none;
}

/* Active state colors */
.node--active .node-circle,
.node--idle .node-circle {
  fill: #3ECBAB;
}

.node--awaiting .node-circle {
  fill: #F5A623;
}

.node--awaiting .node-pulse-ring {
  stroke: #F5A623;
  animation: approvalPulse 2.2s ease-in-out infinite;
}

@keyframes approvalPulse {
  0%   { opacity: 0.7; transform: scale(1);    }
  70%  { opacity: 0;   transform: scale(1.65); }
  100% { opacity: 0;   transform: scale(1.65); }
}

/* Founder node — always calm, accent color */
.node--founder .node-circle {
  fill: var(--surface-2);
  stroke: var(--accent);
  stroke-width: 2;
}

/* Atlas node — inner ring, quiet authority */
.node--atlas .node-circle {
  fill: #6E6ECC;
}

/* Warming up — dashed stroke, dim fill */
.node--warming .node-circle {
  fill: var(--surface-3);
  stroke: var(--dim-2);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

/* Idle — slightly dimmer */
.node--idle .node-circle {
  fill: #2A9E88;
  opacity: 0.8;
}

/* Glow classes — driven by accuracy % */
.glow--high {
  filter: drop-shadow(0 0 12px rgba(62, 203, 171, 0.55));
}
.glow--mid {
  filter: drop-shadow(0 0 7px rgba(62, 203, 171, 0.35));
}
.glow--low {
  filter: drop-shadow(0 0 4px rgba(62, 203, 171, 0.15));
}
.glow--warming {
  filter: none;
}
.glow--amber {
  filter: drop-shadow(0 0 8px rgba(245, 166, 35, 0.5));
}
.glow--founder {
  filter: drop-shadow(0 0 14px rgba(110, 151, 255, 0.35));
}
.glow--atlas {
  filter: drop-shadow(0 0 10px rgba(110, 110, 204, 0.45));
}

/* Node label text */
.node-label-name {
  font-family: var(--font-body);
  font-weight: 600;
  fill: var(--text);
  font-size: 13px;
  text-anchor: middle;
}

.node-label-status {
  font-family: var(--font-body);
  font-weight: 400;
  fill: var(--dim);
  font-size: 11px;
  text-anchor: middle;
}

/* Waiting label in amber */
.node--awaiting .node-label-status {
  fill: #F5A623;
}

/* Warming label in dim */
.node--warming .node-label-status {
  fill: var(--dim-2);
}

/* Reduced motion: disable all animations */
@media (prefers-reduced-motion: reduce) {
  .orbit-eyebrow__dot,
  .orbit-demo-badge__dot,
  .node--awaiting .node-pulse-ring {
    animation: none !important;
  }
  .node-circle {
    transition: none !important;
  }
}


/* =============================================================================
   6. LEGEND
   ============================================================================= */

.orbit-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--size-xs);
  color: var(--dim);
  font-weight: 400;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-dot--teal   { background: #3ECBAB; }
.legend-dot--amber  {
  background: #F5A623;
  box-shadow: 0 0 0 2px rgba(245,166,35,0.25);
}
.legend-dot--dim    { background: var(--surface-3); border: 1.5px dashed var(--dim-2); }


/* =============================================================================
   7. DETAIL PANEL (SLIDE-IN DRAWER)
   ============================================================================= */

.orbit-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease-out);
}

.orbit-backdrop--open {
  opacity: 1;
  pointer-events: all;
}

.orbit-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  z-index: 101;
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease-out);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.orbit-panel--open {
  transform: translateX(0);
}

/* Panel top bar */
.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.panel-bar__left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.panel-node-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.panel-agent-name {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 400;
  color: var(--text);
  line-height: 1;
}

.panel-close {
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  line-height: 1;
  transition: color var(--dur-fast), background var(--dur-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.panel-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Panel body */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* Status badge */
.panel-status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.badge--active {
  background: rgba(62, 203, 171, 0.12);
  border: 1px solid rgba(62, 203, 171, 0.25);
  color: #3ECBAB;
}

.badge--idle {
  background: rgba(62, 203, 171, 0.07);
  border: 1px solid rgba(62, 203, 171, 0.15);
  color: #2A9E88;
}

.badge--awaiting {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.30);
  color: #F5A623;
}

.badge--warming {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--dim);
}

.badge--founder {
  background: rgba(110, 151, 255, 0.10);
  border: 1px solid rgba(110, 151, 255, 0.25);
  color: var(--accent);
}

/* Panel info rows */
.panel-info-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.panel-info-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim-2);
}

.panel-info-value {
  font-size: var(--size-sm);
  color: var(--text);
  line-height: 1.5;
}

.panel-info-value--dim {
  color: var(--dim);
  font-style: italic;
}

/* Accuracy bar */
.accuracy-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.accuracy-bar-track {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.accuracy-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3ECBAB, #6E97FF);
  transition: width 0.6s var(--ease-out);
}

.accuracy-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--dim);
}

.accuracy-pct {
  font-weight: 600;
  color: #3ECBAB;
}

/* Divider */
.panel-divider {
  height: 1px;
  background: var(--line);
  flex-shrink: 0;
}

/* Panel CTA button */
.panel-cta {
  display: block;
  width: 100%;
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r);
  font-family: var(--font-body);
  font-size: var(--size-sm);
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: opacity var(--dur-fast), transform var(--dur-micro);
  text-decoration: none;
}

.panel-cta:active { transform: scale(0.98); }

.panel-cta--approve {
  background: #F5A623;
  color: #0A0A0B;
}

.panel-cta--approve:hover { opacity: 0.88; }

.panel-cta--ledger {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}

.panel-cta--ledger:hover { background: var(--surface-3); }

.panel-cta--founder {
  background: var(--accent);
  color: #ffffff;
}

.panel-cta--founder:hover { opacity: 0.85; }

/* Panel footer note */
.panel-footer-note {
  font-size: 0.7rem;
  color: var(--dim-2);
  text-align: center;
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* =============================================================================
   8. EMPTY STATE
   ============================================================================= */

.orbit-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-24) var(--sp-6);
  text-align: center;
}

.orbit-empty__icon {
  width: 48px;
  height: 48px;
  color: var(--dim-2);
  stroke-width: 1.2;
}

.orbit-empty__title {
  font-family: var(--font-display);
  font-size: var(--size-lg);
  font-weight: 300;
  color: var(--text);
}

.orbit-empty__desc {
  font-size: var(--size-sm);
  color: var(--dim);
  max-width: 320px;
}

/* =============================================================================
   9. RESPONSIVE
   ============================================================================= */

@media (max-width: 480px) {
  .orbit-header {
    padding-top: 52px;
  }

  .orbit-title {
    font-size: var(--size-lg);
  }

  .orbit-legend {
    gap: var(--sp-5);
  }

  .orbit-demo-badge {
    right: 12px;
    font-size: 0.65rem;
  }

  .panel-body {
    padding: var(--sp-4);
  }
}

/* =============================================================================
   10. NAV ORBIT LINK (matches forge link style)
   ============================================================================= */

/* BUG FIX: @keyframes pulse was only in orbit.html inline style — moved here so
   .nav__orbit-dot animation is self-contained in this stylesheet. */
@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.3); }
}

.nav__orbit-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #3ECBAB;
  transition: opacity 0.2s;
}

.nav__orbit-link:hover {
  opacity: 0.8;
}

.nav__orbit-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #3ECBAB;
  display: inline-block;
  animation: pulse 2.8s ease-in-out infinite;
}
