/* BioXplore explorer — palette sampled from the project mark (docs/BRANDING.md).
   The mark is drawn for a navy ground, so on this light surface the ramp is used
   at its darker shade: its light end sits at 1.98:1 on white, below the 3:1 floor
   for a UI shape. */
:root {
  --ink: #12181f;
  --muted: #69737d;
  --rule: #dfe5ea;
  --wash: #f3f7f9;
  --plate: #01091e;
  --primary: #1c6393;
  --primary-deep: #3c4b86;
  --accent: #543f89;
  --leaf: #3b885b;
  --focus: #2b97de;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink); background: #fff;
}
a { color: var(--primary); }

/* The header comes from nav.css, generated by bx_site.NAV_CSS so the tool and
   the site cannot drift. The explorer's own bespoke bar is gone -- it wrapped and
   collapsed once the nav links were added to it. */

#boot { padding: 60px 20px; text-align: center; color: var(--muted); }
.spin {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid var(--rule); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

main { max-width: 1400px; margin: 0 auto; padding: 0 20px 40px; }

/* ── controls ───────────────────────────────────────────────────────── */
.controls { border-bottom: 1px solid var(--rule); padding: 16px 0 10px; }
.row { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 5px; position: relative;
         min-width: 0; }
.field.grow { flex: 1 1 320px; }
.field.narrow { width: 120px; }
.field.narrow2 { width: 176px; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: 7px;
       overflow: hidden; }
.seg button { font: inherit; font-size: 12px; padding: 7px 10px; flex: 1;
              border: none; background: #fff; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button.on { background: var(--primary); color: #fff; }
.warn { background: #fff6e8; border: 1px solid #eccf9d; border-radius: 8px;
        padding: 9px 12px; font-size: 12.5px; color: #6b4d15; margin-top: 8px; }
.warn button { font: inherit; font-size: 12px; border: 1px solid #d9b877;
               background: #fff; color: #6b4d15; border-radius: 6px;
               padding: 2px 9px; cursor: pointer; margin-left: 6px; }
.field > span { font-size: 11.5px; color: var(--muted); }
.field b { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type=text], input[type=number] {
  font: inherit; padding: 8px 10px; border: 1px solid var(--rule);
  border-radius: 7px; background: #fff; color: var(--ink); width: 100%;
}
input[type=text]:focus, input[type=number]:focus {
  outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent;
}
/* A range input has an intrinsic width and min-width:auto as a flex item, so
   without this it refuses to shrink and pushes the row out of the container. */
input[type=range] { width: 100%; min-width: 0; accent-color: var(--primary); }

.ac {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin: 3px 0 0;
  padding: 4px; list-style: none; max-height: 300px; overflow-y: auto;
  background: #fff; border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 8px 22px rgba(18, 24, 31, .13);
}
.ac li { padding: 6px 9px; border-radius: 5px; cursor: pointer;
         display: flex; gap: 10px; align-items: baseline; }
.ac li:hover, .ac li[aria-selected=true] { background: var(--wash); }
.ac .n { margin-left: auto; color: var(--muted); font-size: 11.5px;
         font-variant-numeric: tabular-nums; }
.ac .px { color: var(--muted); font-size: 11px; }

/* ── evidence lens ──────────────────────────────────────────────────── */
.lens { margin-top: 14px; }
.lens summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.lens .hint { font-weight: 400; color: var(--muted); font-size: 11.5px;
              margin-left: 8px; }
.lens .hint a { color: var(--primary); }
.lensState { float: right; font-weight: 400; font-size: 11.5px;
             color: var(--accent); }
/* One row per evidence datatype. Grouping matters because the datatypes are the
   real distinction -- "genetic association" versus "a drug hits this gene" is a
   different kind of claim, not a different vendor -- and because a preset that
   silently changed several groups at once was impossible to reason about. */
.lensGroups { display: grid; gap: 4px; margin: 10px 0 4px; }
.grow2 { display: grid; grid-template-columns: 190px 1fr; gap: 10px;
         align-items: center; padding: 3px 0; border-top: 1px solid var(--rule); }
.grow2:first-child { border-top: none; }
.gtoggle {
  font: inherit; font-size: 11.5px; padding: 5px 9px; cursor: pointer; text-align: left;
  border: 1px solid var(--rule); border-left: 4px solid var(--gc); border-radius: 7px;
  background: #fff; color: var(--ink); display: flex; align-items: center; gap: 7px;
}
.gtoggle:hover { border-color: var(--gc); }
.gtoggle .n { margin-left: auto; color: var(--muted); font-size: 10.5px;
              font-variant-numeric: tabular-nums; }
.gtoggle[data-state=all] { background: var(--gc); border-color: var(--gc); color: #fff; }
.gtoggle[data-state=all] .n { color: rgba(255,255,255,.8); }
.gtoggle[data-state=some] { background: color-mix(in srgb, var(--gc) 16%, #fff);
                            border-color: var(--gc); }
.gtoggle[data-state=none] { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font: inherit; font-size: 11px; padding: 3px 9px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; background: #fff;
  color: var(--muted); display: inline-flex; gap: 5px; align-items: center;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
                background: var(--gc); opacity: .45; }
.chip[aria-pressed=true] { border-color: var(--gc); color: var(--ink);
                           background: color-mix(in srgb, var(--gc) 12%, #fff); }
.chip[aria-pressed=true]::before { opacity: 1; }
.chip .w { font-size: 10px; color: var(--muted); }
.lensActions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
               font-size: 12px; }
.lensActions button {
  font: inherit; font-size: 11.5px; padding: 4px 10px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--wash);
  color: var(--ink);
}
.lensActions button:hover { border-color: var(--primary); color: var(--primary); }
.prune { color: var(--muted); margin-left: auto; display: flex; gap: 6px;
         align-items: center; }

/* ── result ─────────────────────────────────────────────────────────── */
.status { padding: 12px 0 0; font-size: 13px; color: var(--muted); min-height: 20px; }
.status b { color: var(--ink); }
.status.err { color: #a4243b; }
/* The diagram grows with the node budget, so it scrolls inside a fixed frame
   rather than pushing the tables off the page. Scroll buys vertical room; it does
   not buy legibility -- edge crossings still grow faster than node count. */
.chartWrap { max-height: 74vh; overflow: auto; border: 1px solid var(--rule);
             border-radius: 8px; margin-top: 6px; background: #fff; }
.chart svg { display: block; }

/* Highlighting. Dimming is applied to the SVG root so one class toggle restyles
   every mark -- cheaper and less flicker than touching hundreds of elements. */
.chart svg .link { transition: stroke-opacity .12s; }
.chart svg .node { cursor: pointer; }
.chart svg .lab  { cursor: pointer; }
/* Nodes you can open read as links; inert ones do not pretend to be clickable. */
.chart svg .node.open { cursor: zoom-in; }
.chart svg .lab.open  { cursor: zoom-in; text-decoration: underline;
                        text-decoration-color: var(--rule);
                        text-underline-offset: 2px; }
.chart svg.hl .link { stroke-opacity: .045; }
.chart svg.hl .link.on { stroke-opacity: .72; }
.chart svg.hl .node { opacity: .2; }
.chart svg.hl .node.on { opacity: 1; }
.chart svg.hl .lab { opacity: .22; }
.chart svg.hl .lab.on { opacity: 1; font-weight: 600; }
.chart svg .node:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.selrow { display: flex; align-items: baseline; gap: 16px; }
.export { margin-left: auto; display: flex; align-items: center; gap: 6px;
          font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.export button {
  font: inherit; font-size: 11.5px; padding: 3px 9px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--wash);
  color: var(--ink);
}
.export button:hover { border-color: var(--primary); color: var(--primary); }
.export button[disabled] { opacity: .45; cursor: default; }
.sel { font-size: 12px; color: var(--muted); min-height: 19px; padding-top: 6px;
       flex: 1 1 auto; }
.sel b { color: var(--ink); }
.sel .pin { color: var(--accent); }
.crumb { font-size: 11.5px; color: var(--muted); padding-top: 6px; }
.crumb b { color: var(--ink); }
.crumb .idx { color: var(--accent); }
.crumb button { font: inherit; font-size: 11.5px; background: none; border: none;
                color: var(--primary); cursor: pointer; padding: 0 2px;
                text-decoration: underline; }
td.no { color: var(--muted); }
td.papers a { text-decoration: none; }
.tblnote { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }
.pill { display: inline-block; font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
        background: var(--wash); color: var(--primary-deep); border: 1px solid var(--rule); }
.pill.on { background: var(--leaf); border-color: var(--leaf); color: #fff; }
td.yes { color: var(--leaf); font-weight: 600; }
.dropped {
  font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--rule);
  padding-top: 8px; margin-top: 4px;
}

/* ── tables ─────────────────────────────────────────────────────────── */
.tables { margin-top: 22px; display: grid; gap: 12px; }
.tables summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.count { color: var(--muted); font-weight: 400; font-size: 12px; }
table { border-collapse: collapse; width: 100%; margin-top: 8px; font-size: 12.5px; }
th { text-align: left; background: var(--wash); color: var(--primary-deep);
     padding: 6px 8px; position: sticky; top: 0; font-weight: 600; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td { padding: 5px 8px; border-bottom: 1px solid var(--rule); }
tbody tr:hover { background: var(--wash); }

.foot { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--rule);
        font-size: 11.5px; color: var(--muted); }

/* ── evidence dialog ─────────────────────────────────────────────────── */
.ev { border: none; border-radius: 14px; padding: 0; max-width: 940px; width: 94vw;
      max-height: 88vh; box-shadow: 0 24px 70px rgba(1, 9, 30, .38); color: var(--ink); }
.ev::backdrop { background: rgba(1, 9, 30, .55); }
.evx { position: absolute; top: 10px; right: 12px; border: none; background: none;
       font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.evx:hover { color: var(--ink); }
#evBody { padding: 22px 26px 26px; overflow: auto; max-height: 88vh; }
#evBody h2 { margin: 0 0 2px; font-size: 18px; }
#evBody h3 { margin: 22px 0 6px; font-size: 13px; color: var(--primary-deep);
             text-transform: uppercase; letter-spacing: .5px; }
#evBody .sub { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.scoreline { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap;
             background: var(--wash); border: 1px solid var(--rule); border-radius: 10px;
             padding: 12px 16px; margin: 14px 0 4px; }
.scoreline b { font-size: 26px; color: var(--primary-deep);
               font-variant-numeric: tabular-nums; }
.scoreline .maths { font-size: 12px; color: var(--muted); font-family: "SF Mono",
                    Menlo, Consolas, monospace; }
#evBody table { font-size: 12.5px; }
#evBody td.dim { color: var(--muted); }
.bar { display: inline-block; height: 8px; border-radius: 4px; background: var(--primary);
       vertical-align: middle; }
.pmids { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pmids a { font-size: 12px; padding: 3px 9px; border: 1px solid var(--rule);
           border-radius: 999px; text-decoration: none; background: #fff; }
.pmids a:hover { border-color: var(--primary); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--wash); }
.rowhint { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; }
