/* ── Orchestration Viewer ────────────────────────────────── */
/* Extends the richarddun.dev design system tokens.          */

.ov-hero {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 100px 0 40px;
}
.ov-hero h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(38px, 4vw, 60px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 540;
}
.ov-hero-deck {
  max-width: 620px;
  margin: 22px 0 0;
  color: #9dabbc;
  font-size: 17px;
  line-height: 1.75;
}

/* ── Tabs ─────────────────────────────── */

.ov-tabs {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
}
.ov-tab {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  font: 600 12px/1 "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #647389;
  border-bottom: 2px solid transparent;
  transition: color .2s ease, border-color .2s ease;
}
.ov-tab:hover {
  color: var(--paper);
}
.ov-tab:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: -2px;
}
.ov-tab.active {
  color: var(--blue-bright);
  border-bottom-color: var(--blue-bright);
}
.ov-tab-number {
  color: var(--blue);
  font-weight: 500;
}

/* ── Panels ───────────────────────────── */

.ov-panels {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}
.ov-panel {
  padding: 60px 0 100px;
}
.ov-panel[hidden] {
  display: none;
}
.ov-panel-header {
  margin-bottom: 48px;
}
.ov-panel-header h2 {
  margin: 0;
  font-size: clamp(27px, 3vw, 42px);
  letter-spacing: -.04em;
  font-weight: 530;
}
.ov-panel-header p {
  max-width: 640px;
  margin: 14px 0 0;
  color: #a4b0bf;
  line-height: 1.75;
  font-size: 15px;
}
.ov-panel-header p strong {
  color: var(--paper);
  font-weight: 600;
}
.ov-panel-header code {
  font-family: "Geist Mono", monospace;
  font-size: .9em;
  color: var(--blue-bright);
}

/* ── SVG Graph container ──────────────── */

.ov-graph-container {
  background: rgba(7,14,26,.35);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.ov-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: "Geist", "Geist Mono", sans-serif;
}

/* ── Agent Graph ──────────────────────── */

/* Edges */
.ov-edge {
  stroke-width: 2;
  transition: stroke .4s ease;
}
.ov-edge-sync {
  stroke: var(--blue);
  stroke-opacity: .5;
}
.ov-edge-async {
  stroke: var(--muted);
  stroke-opacity: .35;
  stroke-dasharray: 6,4;
}

/* Nodes */
.ov-node { cursor: default; }
.ov-node[tabindex]:hover { cursor: pointer; }
.ov-node[tabindex]:focus-visible { outline: none; }
.ov-node[tabindex]:focus-visible .ov-node-bg {
  stroke: var(--blue-bright);
  stroke-width: 2;
}

.ov-node-bg { fill: var(--ink-soft); stroke: rgba(105,168,255,.15); stroke-width: 1; transition: stroke .3s ease, fill .3s ease; }
.ov-node:hover .ov-node-bg { stroke: rgba(105,168,255,.4); }
.ov-node-orchestrator { fill: rgba(105,168,255,.07); stroke: rgba(105,168,255,.3); }
.ov-node-label { fill: var(--blue-bright); font-size: 11px; font-weight: 600; font-family: "Geist Mono", monospace; }
.ov-node-name { fill: var(--paper); font-size: 13px; font-weight: 620; }
.ov-node-desc { fill: #8f9cad; font-size: 10px; }
.ov-node-mode { fill: rgba(105,168,255,.12); }
.ov-node-mode-async { fill: rgba(154,169,184,.08); }
.ov-node-modetext { fill: var(--blue); font: 600 7px/1 "Geist Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.ov-node-mode-async + .ov-node-modetext { fill: var(--muted); }

/* Legend */
.ov-legend-text { fill: #647389; font: 500 9px/1 "Geist Mono", monospace; }

/* ── Detail cards ─────────────────────── */

.ov-details {
  margin-top: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7,14,26,.2);
}
.ov-details summary {
  cursor: pointer;
  padding: 18px 24px;
  font: 600 10px/1 "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  transition: color .2s ease;
}
.ov-details summary:hover {
  color: var(--paper);
}
.ov-details summary:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
}
.ov-details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 0 24px 24px;
  background: var(--line);
}
.ov-detail-card {
  padding: 20px;
  background: var(--ink-soft);
}
.ov-detail-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 14px;
  font-weight: 620;
  color: var(--paper);
}
.ov-detail-card p {
  margin: 0;
  color: #8f9cad;
  font-size: 12px;
  line-height: 1.6;
}
.ov-detail-label {
  color: var(--blue);
  font: 600 9px/1 "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ── DAG panel ────────────────────────── */

.ov-dag-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.ov-dag-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font: 500 11px/1 "Geist Mono", monospace;
  color: var(--muted);
}
.ov-dag-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background .3s ease, box-shadow .3s ease;
}
.ov-dag-indicator.running {
  background: var(--acid);
  box-shadow: 0 0 0 4px rgba(183,243,151,.12);
  animation: pulse-dot 1.5s ease-in-out infinite;
}
.ov-dag-indicator.done {
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(105,168,255,.1);
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(183,243,151,.12); }
  50% { box-shadow: 0 0 0 8px rgba(183,243,151,.04); }
}

/* DAG Nodes */
.dag-node { cursor: default; }
.dag-node-bg {
  fill: var(--ink-soft);
  stroke: var(--line);
  stroke-width: 1;
  transition: fill .4s ease, stroke .4s ease;
}
.dag-node[data-state="active"] .dag-node-bg {
  fill: rgba(105,168,255,.08);
  stroke: var(--blue);
  stroke-width: 1.5;
}
.dag-node[data-state="completed"] .dag-node-bg {
  fill: rgba(183,243,151,.06);
  stroke: var(--acid);
  stroke-width: 1.5;
}
.dag-node-label { fill: var(--muted); font-size: 10px; font-weight: 600; font-family: "Geist Mono", monospace; text-transform: uppercase; letter-spacing: .1em; }
.dag-node-agent { fill: var(--paper); font-size: 13px; font-weight: 620; }
.dag-node-task { fill: #8f9cad; font-size: 11px; }
.dag-node-dep { fill: #5c6a7c; font-size: 8px; font-family: "Geist Mono", monospace; }

/* DAG Edges */
.dag-edge {
  stroke: var(--line);
  stroke-width: 1.5;
  transition: stroke .5s ease;
}
.dag-edge.active {
  stroke: var(--acid);
  stroke-width: 2;
}

/* Log */
.ov-dag-log {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7,14,26,.35);
}
.ov-dag-log-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  font: 600 9px/1 "Geist Mono", monospace;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.ov-dag-log-entries {
  padding: 16px 20px;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ov-log-entry {
  display: block;
  font: 500 11px/1.5 "Geist Mono", monospace;
  color: #6d7c8e;
}
.ov-log-entry em {
  color: var(--paper);
  font-style: normal;
}
.ov-log-info {
  color: #6d7c8e;
}
.ov-log-run {
  color: var(--blue-bright);
}
.ov-log-done {
  color: var(--acid);
}
.ov-log-dep {
  color: var(--muted);
}

/* ── Architecture Panel ───────────────── */

.arch-node-bg {
  fill: rgba(7,14,26,.5);
  stroke: var(--line);
  stroke-width: 1;
  transition: stroke .3s ease;
}
.arch-node:hover .arch-node-bg {
  stroke: rgba(105,168,255,.3);
}
.arch-node-title {
  fill: var(--paper);
  font-size: 13px;
  font-weight: 620;
}
.arch-node-desc {
  fill: #8f9cad;
  font-size: 10px;
}
.arch-sync .arch-node-bg {
  fill: rgba(105,168,255,.06);
  stroke: rgba(105,168,255,.25);
}
.arch-sync-text {
  fill: var(--blue) !important;
  font-weight: 700 !important;
}
.arch-async .arch-node-bg {
  fill: rgba(154,169,184,.04);
  stroke: rgba(154,169,184,.15);
}
.arch-async-text {
  fill: var(--muted) !important;
  font-weight: 700 !important;
}
.arch-terminal .arch-node-bg {
  fill: rgba(183,243,151,.04);
  stroke: rgba(183,243,151,.2);
}
.arch-note .arch-node-bg {
  fill: transparent;
  stroke: none;
}
.arch-note-text {
  fill: var(--muted);
  font-size: 9px;
  font-family: "Geist Mono", monospace;
  font-style: italic;
}
.arch-flowline {
  stroke: var(--line);
  stroke-width: 1.5;
}
.arch-cross {
  stroke: rgba(105,168,255,.2);
  stroke-dasharray: 4,3;
}
.arch-annotation {
  fill: var(--blue);
  font: 500 9px/1 "Geist Mono", monospace;
}

/* ── Responsive ───────────────────────── */

@media (max-width: 900px) {
  .ov-hero { padding: 72px 0 32px; }
  .ov-panel { padding: 40px 0 80px; }
  .ov-details-grid { grid-template-columns: 1fr 1fr; }
  .ov-dag-controls { flex-wrap: wrap; }
  .ov-dag-status { margin-left: 0; width: 100%; }
}

@media (max-width: 640px) {
  .ov-hero,
  .ov-tabs,
  .ov-panels { width: min(100% - 32px, 1180px); }

  .ov-tab { flex: 1; justify-content: center; padding: 14px 8px; font-size: 10px; gap: 6px; }
  .ov-tab-number { display: none; }

  .ov-hero { padding: 52px 0 24px; }
  .ov-panel { padding: 32px 0 64px; }
  .ov-panel-header { margin-bottom: 28px; }

  .ov-details-grid { grid-template-columns: 1fr; }
  .ov-details summary { padding: 14px 16px; }
  .ov-details-grid { padding: 0 16px 16px; }
  .ov-detail-card { padding: 16px; }

  .ov-dag-log-entries { max-height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .ov-dag-indicator.running,
  .ov-edge,
  .ov-node-bg,
  .dag-node-bg,
  .dag-edge,
  .ov-log-entry,
  .arch-node-bg { animation: none !important; transition-duration: .01ms !important; }
}