/* ON1 concept forest - deep midnight tree-of-life lineage atlas. */

:root {
  --bg-0: #05070d;
  --bg-1: #080d12;
  --bg-2: #0d1518;
  --bg-3: #121d20;
  --ink-0: #edf2ed;
  --ink-1: #b8c7bd;
  --ink-2: #7f9287;
  --ink-3: #4e6258;
  --rule: #1c2e2b;
  --rule-strong: #2f4c43;
  --gold: #e2bd6b;
  --leaf: #7fcf93;
  --moss: #47765c;
  --cyan: #72d2c6;
  --rose: #dd7c83;
  --violet: #b596de;
  --font-display: 'Major Mono Display', 'IBM Plex Mono', monospace;
  --font-sans: 'Familjen Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'JetBrains Mono', monospace;
  --pad: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(5, 7, 13, 0.98), rgba(7, 17, 13, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 47px, rgba(127, 207, 147, 0.055) 47px 48px),
    repeating-linear-gradient(90deg, transparent 0 95px, rgba(226, 189, 107, 0.045) 95px 96px),
    var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px var(--pad);
  border-bottom: 1px solid var(--rule);
  background: rgba(5, 7, 13, 0.94);
  backdrop-filter: blur(12px);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.strip-left,
.strip-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.strip-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.brand {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 13px;
}

.sep,
.foot span:nth-child(even) {
  color: var(--ink-3);
}

.strip-right a {
  color: var(--ink-2);
}

.strip-right a:hover {
  color: var(--gold);
}

.forest-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 30px var(--pad) 34px;
}

.forest-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink-0);
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  gap: 8px;
  align-items: end;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

.metrics span {
  border: 1px solid var(--rule);
  background: rgba(13, 21, 24, 0.78);
  color: var(--ink-1);
  padding: 8px 10px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 150px auto minmax(150px, auto);
  gap: 10px;
  align-items: end;
  padding: 16px 0;
}

.search-box,
.select-box {
  display: grid;
  gap: 5px;
}

.search-box span,
.select-box span {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.search-box input,
.select-box select,
.refresh-btn {
  height: 42px;
  border: 1px solid var(--rule-strong);
  background: rgba(5, 7, 13, 0.84);
  color: var(--ink-0);
  font: 500 13px var(--font-mono);
  outline: none;
}

.search-box input,
.select-box select {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
}

.search-box input:focus,
.select-box select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(226, 189, 107, 0.12);
}

.refresh-btn {
  padding: 0 16px;
  cursor: pointer;
  text-transform: uppercase;
}

.refresh-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.refresh-btn:disabled {
  cursor: wait;
  opacity: 0.58;
}

.status-line {
  align-self: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
  text-transform: uppercase;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.forest-panel {
  min-width: 0;
}

.forest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
}

.tree-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 13, 18, 0.96), rgba(8, 17, 13, 0.94)),
    repeating-linear-gradient(90deg, transparent 0 63px, rgba(127, 207, 147, 0.04) 63px 64px);
}

.tree-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 18px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(226, 189, 107, 0.54), transparent);
  pointer-events: none;
}

.tree-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 15px 10px 28px;
  border-bottom: 1px solid rgba(47, 76, 67, 0.72);
}

.tree-title {
  margin: 0;
  color: var(--ink-0);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.15;
}

.tree-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  border: 1px solid rgba(47, 76, 67, 0.82);
  background: transparent;
  color: var(--ink-2);
  cursor: default;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 7px;
  text-transform: uppercase;
}

.tag.live {
  color: var(--leaf);
  border-color: rgba(127, 207, 147, 0.52);
}

button.tag {
  cursor: pointer;
}

button.tag:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.tree-score {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--leaf);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.tree-scroll {
  overflow: auto;
  padding: 12px;
  scrollbar-color: var(--rule-strong) transparent;
}

.tree-svg {
  display: block;
  max-width: none;
}

.branch-link {
  fill: none;
  stroke-linecap: round;
  stroke-width: 2.1;
}

.branch-shadow {
  fill: none;
  stroke: rgba(5, 7, 13, 0.9);
  stroke-linecap: round;
  stroke-width: 5.5;
}

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

.node text {
  pointer-events: none;
}

.node-plate {
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.3));
}

.node:hover .node-plate,
.node:focus .node-plate,
.node.selected .node-plate {
  stroke-width: 2.4;
}

.node.selected .node-ring {
  stroke: var(--gold);
  stroke-width: 2.4;
}

.node-id {
  fill: var(--ink-2);
  font: 500 10px var(--font-mono);
}

.node-title {
  fill: var(--ink-0);
  font: 600 12px var(--font-sans);
}

.node-sub {
  fill: var(--ink-2);
  font: 400 10px var(--font-mono);
}

.node-score-text {
  fill: #06100b;
  font: 700 10px var(--font-mono);
  text-anchor: middle;
  dominant-baseline: middle;
}

.node.archived,
.node.failed {
  opacity: 0.58;
}

.detail-panel {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 92px);
  overflow: auto;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.96);
  padding: 16px;
}

.detail-empty,
.empty-state,
.error-state {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
}

.detail-kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.detail-panel h2 {
  margin: 0 0 10px;
  color: var(--ink-0);
  font-size: 24px;
  line-height: 1.1;
}

.detail-score {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 14px;
  font-family: var(--font-mono);
}

.score-chip {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  color: #06100b;
  font-weight: 700;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.detail-section {
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
}

.detail-section h3 {
  margin: 0 0 6px;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.detail-section p,
.detail-section li {
  color: var(--ink-1);
}

.detail-section p {
  margin: 0;
}

.detail-section ul {
  margin: 0;
  padding-left: 18px;
}

.eval-grid {
  display: grid;
  gap: 8px;
}

.eval-row {
  display: grid;
  grid-template-columns: 104px 1fr 34px;
  gap: 8px;
  align-items: center;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}

.eval-bar {
  height: 7px;
  background: rgba(79, 98, 88, 0.32);
}

.eval-bar span {
  display: block;
  height: 100%;
  background: var(--leaf);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.detail-actions a,
.detail-actions button {
  border: 1px solid var(--rule-strong);
  background: transparent;
  color: var(--ink-0);
  cursor: pointer;
  font: 500 11px var(--font-mono);
  padding: 9px 10px;
  text-transform: uppercase;
}

.detail-actions a:hover,
.detail-actions button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.empty-state,
.error-state {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.88);
  padding: 18px;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px var(--pad) 24px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
}

@media (max-width: 1120px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  :root {
    --pad: 14px;
  }

  .top-strip,
  .forest-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 42px;
  }

  .metrics,
  .controls {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .metrics {
    gap: 6px;
  }

  .status-line {
    text-align: left;
  }

  .forest-grid {
    grid-template-columns: 1fr;
  }
}
