/* AI x Bio house-ontology surface — restrained editorial styling aligned with data.html,
   using one understated clinical teal accent separated from Semi L1-L5 colors. */

:root {
  --bio-accent: oklch(42% 0.095 186);
  --bio-accent-strong: oklch(31% 0.080 190);
  --bio-accent-soft: oklch(96.5% 0.015 184);
  --bio-accent-border: oklch(80% 0.045 186);

  --bio-confirmed: oklch(41% 0.095 172);
  --bio-candidate: oklch(49% 0.125 70);
  --bio-candidate-bg: oklch(96.8% 0.024 78);

  /* Quiet 5-column entity markers (independent from Semi L1-L5) */
  --bio-ent-company: oklch(38% 0.075 198);
  --bio-ent-asset: oklch(43% 0.095 182);
  --bio-ent-target: oklch(45% 0.085 228);
  --bio-ent-disease: oklch(47% 0.090 352);
  --bio-ent-trial: oklch(45% 0.085 144);
}

.bio-page {
  background: var(--color-bg);
}

.bio-page [hidden] {
  display: none !important;
}

.bio-page :focus-visible {
  outline-color: var(--bio-accent);
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 16px;
  transform: translateY(-160%);
  padding: 8px 14px;
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
  font-size: 13px;
}

.skip-link:focus {
  transform: none;
}

.bio-shell {
  width: min(100%, var(--content-max));
  margin-inline: auto;
  padding: 26px var(--page-x) 36px;
  overflow-x: clip;
}

/* ── Masthead (matches data.html quiet editorial rhythm) ───────────────── */
.bio-masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  padding-bottom: 16px;
}

.bio-masthead h1 {
  margin: 0 0 6px;
  font: 600 27px/1.25 var(--font-serif);
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.bio-masthead p {
  margin: 0;
  color: var(--color-muted);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 78ch;
}

.bio-stamp {
  text-align: right;
  font-size: 12px;
  color: var(--color-muted);
  flex-shrink: 0;
}

.bio-stamp-main {
  display: block;
  font-family: var(--font-mono);
  color: var(--color-text-soft);
  font-size: 12px;
}

.bio-stamp-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 3px;
}

/* Single hairline typographic KPI rule */
.bio-summary-rule {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  padding: 11px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-text);
  color: var(--color-muted);
  font-size: 12px;
}

.bio-summary-rule strong {
  font-family: var(--font-mono);
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
}

/* Quiet single-line official sources + drug.html handoff */
.bio-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 10px 0 14px;
  font-size: 12px;
  color: var(--color-muted);
}

.bio-sources-inline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-muted);
}

.bio-sources-inline strong {
  color: var(--color-text-soft);
  font-weight: 600;
}

.bio-drug-handoff {
  font-size: 12px;
  color: var(--color-text-soft);
}

.bio-link {
  color: var(--bio-accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--bio-accent-border);
  text-underline-offset: 3px;
}

.bio-link:hover {
  text-decoration-color: currentColor;
}

/* ── Editorial Underline Tabs (mirrors data.html .data-tabs) ───────────── */
.bio-tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--color-border-strong);
  margin-bottom: 18px;
  overflow-x: auto;
}

.bio-tabs button {
  position: relative;
  padding: 9px 0 11px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.bio-tabs button[aria-selected="true"] {
  color: var(--color-text);
  font-weight: 600;
}

.bio-tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--bio-accent);
}

.bio-tabs button:hover {
  color: var(--bio-accent-strong);
}

.bio-tabs button span {
  margin-left: 5px;
  font: 11px var(--font-mono);
  color: var(--color-dim);
}

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

/* ── Quiet Toolbars & Controls ─────────────────────────────────────────── */
.bio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.bio-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bio-tab-btn {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-soft);
  font-size: 12px;
  cursor: pointer;
}

.bio-tab-btn:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg-soft);
}

.bio-tab-btn.active {
  border-color: var(--bio-accent);
  color: var(--bio-accent-strong);
  background: var(--bio-accent-soft);
  font-weight: 600;
}

.bio-select {
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: 12px;
}

.bio-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 11.5px;
  color: var(--color-muted);
}

.bio-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 1.8px solid var(--bio-confirmed);
}

.legend-line.candidate {
  border-top: 1.8px dashed var(--bio-candidate);
}

.legend-tick {
  width: 7px;
  height: 7px;
  border-radius: 1.5px;
  display: inline-block;
}

/* ── Panel 1: 5-Column Ontology Graph + Hairline Evidence Drawer ───────── */
.ontology-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 0;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
}

.graph-panel {
  min-width: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
}

.graph-svg-wrap {
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 670px;
}

.graph-col-headers {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-width: 780px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-soft);
}

.graph-col-head {
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-text-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-right: 1px solid var(--color-border);
}

.graph-col-head:last-child {
  border-right: 0;
}

.graph-col-head .col-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.graph-col-head .col-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
  font-weight: 500;
}

.graph-svg-wrap svg {
  display: block;
  width: 100%;
  min-width: 780px;
}

.ont-node {
  cursor: pointer;
}

.ont-node rect.node-box {
  rx: 2;
  ry: 2;
  stroke-width: 1;
}

.ont-node:hover rect.node-box {
  stroke-width: 1.6;
}

.ont-node.selected rect.node-box {
  stroke-width: 1.8;
}

.ont-node.dimmed {
  opacity: 0.22;
}

.ont-link {
  fill: none;
  cursor: pointer;
}

.ont-link.dimmed {
  opacity: 0.08;
}

.ont-link.highlighted {
  opacity: 0.95 !important;
  stroke-width: 2 !important;
}

.ont-link-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 12;
  cursor: pointer;
}

.graph-foot-hint {
  padding: 8px 12px;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
}

/* Evidence Drawer — plain hairline rhythm, zero nested card chrome */
.evidence-drawer {
  min-width: 0;
  display: flex;
  flex-direction: column;
  max-height: 702px;
  background: var(--color-bg);
}

.drawer-header {
  padding: 14px 0 12px 20px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-kicker {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.drawer-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.drawer-sub {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--color-text-soft);
  line-height: 1.55;
}

.drawer-body {
  padding: 12px 0 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.drawer-meta-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-muted);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.drawer-meta-line .cand-flag {
  color: var(--bio-candidate);
  font-weight: 600;
}

.drawer-sec-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--color-muted);
  margin: 14px 0 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.drawer-rel-list {
  display: flex;
  flex-direction: column;
}

.drawer-rel-btn {
  text-align: left;
  width: 100%;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
}

.drawer-rel-btn:last-child {
  border-bottom: 0;
}

.drawer-rel-btn:hover .drawer-rel-name {
  text-decoration-color: currentColor;
}

.drawer-rel-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.drawer-rel-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--bio-accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--bio-accent-border);
  text-underline-offset: 2px;
}

.drawer-rel-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-muted);
  white-space: nowrap;
}

.drawer-rel-assert {
  font-size: 11.5px;
  color: var(--color-text-soft);
  margin-top: 3px;
  line-height: 1.45;
}

.drawer-doc-filter {
  display: flex;
  gap: 12px;
  margin-bottom: 6px;
}

.drawer-doc-filter button {
  padding: 3px 0;
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: transparent;
  font-size: 11.5px;
  color: var(--color-muted);
  cursor: pointer;
}

.drawer-doc-filter button.active {
  color: var(--color-text);
  border-bottom-color: var(--bio-accent);
  font-weight: 600;
}

.doc-item {
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
}

.doc-item.candidate {
  padding-left: 9px;
  border-left: 2px dashed var(--bio-candidate);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.doc-status {
  color: var(--bio-confirmed);
}

.doc-status.candidate {
  color: var(--bio-candidate);
  font-weight: 600;
}

.doc-title {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--bio-accent-strong);
  text-decoration: underline;
  text-decoration-color: var(--bio-accent-border);
  text-underline-offset: 2px;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.doc-title:hover {
  text-decoration-color: currentColor;
}

.doc-sum {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--color-text-soft);
}

.doc-warn {
  margin: 4px 0 0;
  font-size: 10.5px;
  color: var(--bio-candidate);
}

/* ── Panel 2: Semi -> Bio Bridge ───────────────────────────────────────── */
.bridge-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.85fr);
  gap: 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
}

.bridge-svg-wrap {
  min-width: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 12px 14px;
  overflow-x: auto;
}

.bridge-svg-wrap svg {
  display: block;
  width: 100%;
  min-width: 620px;
}

.bridge-ev-panel {
  min-width: 0;
  max-height: 650px;
  display: flex;
  flex-direction: column;
  padding-left: 20px;
}

.bridge-ev-head {
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.bridge-ev-head h2,
.bridge-ev-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.bridge-ev-list {
  overflow-y: auto;
  flex: 1;
}

.bridge-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}

.bridge-item:last-child {
  border-bottom: 0;
}

.bridge-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.bridge-pair {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bridge-rel-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
}

.bridge-snippet {
  margin: 0 0 5px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--color-text-soft);
}

.bridge-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--color-muted);
}

/* ── Panel 3: Coverage Boundary & Directory ────────────────────────────── */
.cov-intro {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--color-text-soft);
  line-height: 1.6;
}

.bio-table-wrap {
  overflow-x: auto;
}

.bio-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12.5px;
  border-top: 1.5px solid var(--color-text);
  border-bottom: 1px solid var(--color-border-strong);
  background: var(--color-surface);
}

.bio-table th {
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-muted);
  background: var(--color-bg-soft);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.bio-table td {
  padding: 10px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  line-height: 1.45;
}

.bio-table th:first-child,
.bio-table td:first-child {
  padding-left: 0;
}

.bio-table tbody tr:last-child td {
  border-bottom: 0;
}

.bio-table tbody tr:hover {
  background: var(--color-bg-soft);
}

.mono {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.muted-sub {
  display: block;
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 2px;
}

.role-note {
  font-size: 11.5px;
  color: var(--color-text-soft);
}

.role-note.therapeutic {
  color: var(--bio-accent-strong);
  font-weight: 600;
}

.bio-disclosure {
  margin-top: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-muted);
}

.bio-disclosure summary {
  cursor: pointer;
  color: var(--color-text-soft);
  font-weight: 500;
}

.bio-disclosure p {
  margin: 8px 0 0;
  line-height: 1.65;
  max-width: 86ch;
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.bio-footer {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 11px;
  color: var(--color-muted);
  line-height: 1.6;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.bio-footer-ts {
  font-family: var(--font-mono);
  color: var(--color-dim);
  overflow-wrap: anywhere;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .bio-masthead {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .bio-stamp {
    text-align: left;
  }
  .ontology-layout,
  .bridge-layout {
    grid-template-columns: 1fr;
  }
  .graph-panel,
  .bridge-svg-wrap {
    border-right: 0;
    border-bottom: 1px solid var(--color-border);
  }
  .evidence-drawer,
  .bridge-ev-panel {
    max-height: none;
    padding-left: 0;
  }
  .drawer-header,
  .drawer-body {
    padding-left: 0;
  }
}

@media (max-width: 768px) {
  .bio-shell {
    padding: 18px var(--page-x) 28px;
  }
  .bio-masthead h1 {
    font-size: 23px;
  }
  .bio-summary-rule {
    gap: 5px 14px;
    font-size: 11px;
  }
  .bio-tabs {
    gap: 18px;
  }
  .bio-tabs button {
    font-size: 12.5px;
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bio-page *,
  .bio-page *::before,
  .bio-page *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
