/* side_pages.css — styles for the interactive side pages (taxon pages, VANISH/BloSSUM).
   Sits on top of site.css and reuses its custom properties (--cu-gold, --line, --muted, --panel, …) with
   fallbacks, so the pages keep the Microbiome Repo's type and spacing. Interaction style (segmented
   buttons, tooltip, legend ramp, hit list) follows the microbiome-atlas site, in the Repo's light palette.
   Loads nothing from another host: no @import, no url() to an outside origin. */

:root {
  --sp-blue: #1f5aa6;
  --sp-blue-soft: #8fb3e3;
  --sp-gold: var(--cu-gold, #cfb87c);
  --sp-line: var(--line, #e6e6e6);
  --sp-muted: var(--muted, #6a6a6a);
  --sp-panel: var(--panel, #f7f7f5);
}

/* ---------- page furniture: one main thing, little text ---------- */
.sp-head { max-width: 980px; }
.sp-head h1 { margin: .2rem 0 .3rem; }
.sp-lead { font-size: 1.02rem; line-height: 1.5; color: var(--cu-dark-gray, #333); margin: 0 0 .5rem; max-width: 760px; }
.sp-sub { color: var(--sp-muted); font-size: .88rem; margin: .1rem 0 .9rem; }
.sp-main { margin: .4rem 0 1.4rem; }
.sp-panelbox { border: 1px solid var(--sp-line); border-radius: 12px; padding: .7rem .9rem 1rem; background: #fff; }
.sp-row { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.sp-row > .sp-grow { flex: 1 1 420px; min-width: 320px; }
.sp-row > .sp-side { flex: 0 0 360px; max-width: 100%; }
.sp-controls { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: center; margin: 0 0 .5rem; }
.sp-controls .sp-ctl-label { font-size: .78rem; color: var(--sp-muted); text-transform: none; }
.sp-note { font-size: .82rem; color: var(--sp-muted); margin: .45rem 0 0; }
.sp-caption { font-size: .82rem; color: var(--sp-muted); margin: .4rem 0 0; }
details.sp-more { border-top: 1px solid var(--sp-line); padding: .35rem 0; }
details.sp-more > summary { cursor: pointer; font-size: .92rem; padding: .35rem 0; color: var(--cu-dark-gray, #333); }
details.sp-more[open] > summary { font-weight: 600; }
details.sp-more > div, details.sp-more > table, details.sp-more > p { margin-top: .4rem; }

/* ---------- segmented buttons ---------- */
.sp-seg { display: inline-flex; border: 1px solid var(--sp-line); border-radius: 999px; overflow: hidden; background: #fff; }
.sp-seg-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: .85rem; padding: .32rem .8rem; color: var(--cu-dark-gray, #333);
  border-right: 1px solid var(--sp-line);
}
.sp-seg-btn:last-child { border-right: 0; }
.sp-seg-btn:hover { background: rgba(207, 184, 124, .18); }
.sp-seg-btn.active { background: var(--sp-gold); color: #1a1a1a; font-weight: 600; }
.sp-seg-btn:focus-visible { outline: 2px solid var(--sp-blue); outline-offset: -2px; }

/* ---------- tooltip ---------- */
.sp-tip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 300px;
  background: rgba(255, 255, 255, .97); border: 1px solid var(--sp-line); border-left: 3px solid var(--sp-gold);
  border-radius: 8px; padding: .4rem .55rem; font-size: .8rem; line-height: 1.35;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .13); color: #1a1a1a;
}
.sp-tip b { font-weight: 600; }
.sp-tip .sp-tip-sub { color: var(--sp-muted); }

/* ---------- search ---------- */
.sp-search { position: relative; max-width: 720px; margin: .2rem 0 .6rem; }
.sp-search input.searchbox.big { border-color: var(--sp-gold); }
.sp-hits { list-style: none; margin: .35rem 0 0; padding: 0; max-height: 46vh; overflow: auto;
  border: 1px solid var(--sp-line); border-radius: 10px; background: #fff; }
.sp-hits:empty { display: none; border: 0; }
.sp-hit { padding: .35rem .6rem; border-bottom: 1px solid var(--sp-line); display: flex; gap: .5rem; align-items: baseline; }
.sp-hit:last-child { border-bottom: 0; }
.sp-hit.active { background: rgba(207, 184, 124, .22); }
.sp-hit a { text-decoration: none; font-weight: 600; }
.sp-hit-sub { color: var(--sp-muted); font-size: .8rem; }
.sp-hit-none { padding: .4rem .6rem; color: var(--sp-muted); font-size: .85rem; }

/* ---------- bar chart ---------- */
svg.sp-chart { display: block; font: 11px/1.2 inherit; max-width: 100%; }
svg.sp-chart .sp-bar-bg { fill: #f2f2ef; }
svg.sp-chart .sp-bar-v { shape-rendering: crispEdges; }
svg.sp-chart .sp-bar-label { fill: #333; font-size: 11px; }
svg.sp-chart .sp-bar-val { fill: #555; font-size: 10.5px; }
svg.sp-chart .sp-axis-title { fill: var(--sp-muted); font-size: 10.5px; }
svg.sp-chart .sp-axis path, svg.sp-chart .sp-axis line { stroke: #d6d6d6; }
svg.sp-chart .sp-axis text { fill: #777; font-size: 10px; }
svg.sp-chart .sp-barg:hover .sp-bar-bg { fill: #eceae2; }
svg.sp-chart .sp-clickable { cursor: pointer; }

/* ---------- globe (same look as the home page's) ---------- */
.sp-globe-wrap { position: relative; display: inline-block; }
svg.sp-globe { display: block; max-width: 100%; height: auto; touch-action: none; cursor: grab; }
svg.sp-globe:active { cursor: grabbing; }
svg.sp-globe .g-sphere { fill: #f4f6f8; stroke: #d9dde1; stroke-width: .5; }
svg.sp-globe .g-grat { fill: none; stroke: #e3e6ea; stroke-width: .35; }
svg.sp-globe .g-land { fill: #e9e9e6; stroke: #fff; stroke-width: .35; }
svg.sp-globe .g-land:hover { stroke: #333; stroke-width: .7; }
.sp-globe-ctrl { position: absolute; right: 6px; bottom: 6px; display: flex; gap: .25rem; }
.sp-globe-btn {
  appearance: none; width: 26px; height: 26px; line-height: 1; border-radius: 50%;
  border: 1px solid var(--sp-line); background: rgba(255, 255, 255, .92); cursor: pointer;
  font-size: .95rem; color: #333;
}
.sp-globe-btn:hover { border-color: var(--sp-gold); background: #fff; }

/* ---------- legend ---------- */
.sp-legend { display: flex; align-items: center; gap: .5rem; font-size: .75rem; color: var(--sp-muted); margin-top: .45rem; }
.sp-legend .sp-ramp { width: 130px; height: 9px; border-radius: 5px; border: 1px solid var(--sp-line);
  background: linear-gradient(90deg, #efe4c4, #8a6d2f); }

/* ---------- icicle ---------- */
.sp-icicle { display: block; width: 100%; font: 11px/1.2 inherit; background: #fff; }
.sp-icicle .sp-ice-rect { stroke: #fff; stroke-width: 1; }
.sp-icicle .sp-ice-cell:hover .sp-ice-rect { stroke: #222; stroke-width: 1.2; }
.sp-icicle .sp-ice-text { fill: #1a1a1a; font-size: 11px; pointer-events: none; }
.sp-icicle .sp-ice-leaf .sp-ice-text { font-style: italic; }
.sp-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin: .1rem 0 .4rem; font-size: .85rem; }
.sp-crumb { appearance: none; border: 0; background: transparent; font: inherit; color: var(--sp-blue);
  cursor: pointer; padding: .1rem .15rem; border-radius: 4px; }
.sp-crumb:hover { background: rgba(207, 184, 124, .22); }
.sp-crumb:last-of-type { color: #1a1a1a; font-weight: 600; }
.sp-crumb-sep { color: var(--sp-muted); }

/* ---------- literature block ---------- */
.sp-lit { border-left: 3px solid var(--sp-gold); padding: .1rem 0 .1rem .8rem; margin: .4rem 0 0; max-width: 820px; }
.sp-lit .sp-ai-note { font-size: .78rem; color: var(--sp-muted); margin: 0 0 .4rem; }
.sp-lit ol.sp-refs { font-size: .82rem; color: var(--cu-dark-gray, #333); margin: .5rem 0 0; padding-left: 1.3rem; }
.sp-lit ol.sp-refs li { margin: .15rem 0; }

/* ---------- no-script fallback ---------- */
.sp-noscript { background: #fbf8ef; border: 1px solid #eee3c6; border-radius: 10px; padding: .6rem .8rem; font-size: .88rem; }

@media (max-width: 760px) {
  .sp-row > .sp-side { flex: 1 1 100%; }
  .sp-icicle { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-icicle * { transition: none !important; }
}

/* zoomable scatter (sp_core.js scatter; VANISH/BloSSUM page) */
.sp-scatter{display:block;width:100%;background:#fff;touch-action:none}
.sp-scatter .sp-sc-zero{stroke:#c9c9c9;stroke-dasharray:3 3;stroke-width:1}
.sp-pt{stroke:#fff;stroke-width:.5;opacity:.85;cursor:pointer}
.sp-pt-N{fill:#A2A4A3}
.sp-pt-V{fill:#CFB87C}
.sp-pt-B{fill:#2F5E8C}
.sp-pt.dim{opacity:.18}
.sp-pt.on{stroke:#111;stroke-width:1.6;opacity:1}
.sp-count{font-weight:600}
.sp-key{display:inline-flex;align-items:center;gap:.3rem;margin-right:.9rem;font-size:.85rem}
.sp-key i{display:inline-block;width:.68rem;height:.68rem;border-radius:50%}
.sp-key-V i{background:#CFB87C;border:1px solid #8A7536}.sp-key-B i{background:#2F5E8C}.sp-key-N i{background:#A2A4A3}
.sp-axis-ends{display:flex;justify-content:space-between;font-size:.82rem;color:var(--muted,#666);margin:.1rem .2rem 0}

/* ======================================================================================================
   Taxon explorer (round 3) — atlas/taxa/index.html, drawn by static/sp_explorer.js.
   One block, appended; nothing above this line is changed. Loads nothing from another host.
   ====================================================================================================== */
.spx-status { font-size: .85rem; color: var(--sp-muted); margin: .2rem 0 .6rem; }
.spx-status-error { color: #8a2b2b; background: #fdf4f4; border: 1px solid #f0dada; border-radius: 8px;
  padding: .5rem .7rem; }

/* ---------- the split: tree on the left, the chosen taxon on the right ---------- */
.spx-split { display: grid; grid-template-columns: 1fr; gap: 1.1rem; align-items: start; margin: .2rem 0 1.2rem; }
@media (min-width: 1000px) { .spx-split.spx-open { grid-template-columns: minmax(430px, 1.25fr) minmax(360px, 1fr); } }
.spx-treebox { min-width: 0; }
.spx-treebar { justify-content: space-between; }
.spx-panel { min-width: 0; border: 1px solid var(--sp-line); border-radius: 12px; background: #fff;
  padding: .7rem .95rem 1rem; position: relative; }
.spx-panel[hidden] { display: none; }
.spx-panel-head { position: relative; padding-right: 1.6rem; }
.spx-panel h2 { font-size: 1.22rem; margin: .1rem 0 .25rem; }
.spx-close { position: absolute; top: -.2rem; right: -.3rem; appearance: none; border: 0; background: transparent;
  font-size: 1.3rem; line-height: 1; color: var(--sp-muted); cursor: pointer; padding: .1rem .35rem; border-radius: 6px; }
.spx-close:hover { background: rgba(207, 184, 124, .22); color: #1a1a1a; }
.spx-lin { font-size: .8rem; color: var(--sp-muted); margin: 0 0 .35rem; line-height: 1.5; }
.spx-lin a { text-decoration: none; }
.spx-lin-sep { color: #bdbdbd; margin: 0 .25rem; }
.spx-sum { font-size: .95rem; line-height: 1.5; margin: 0 0 .7rem; color: var(--cu-dark-gray, #333); }
.spx-empty { font-size: .88rem; color: var(--sp-muted); background: var(--sp-panel); border-radius: 8px;
  padding: .6rem .7rem; }
.spx-h3 { font-size: 1rem; margin: 1rem 0 .2rem; }
.spx-globe-row { margin: .8rem 0 .2rem; }
.spx-badge { display: inline-block; font-size: .7rem; letter-spacing: .02em; text-transform: uppercase;
  border-radius: 999px; padding: .12rem .5rem; vertical-align: .22em; text-decoration: none; border: 1px solid transparent; }
.spx-badge-V { background: #cfb87c; color: #2b2410; border-color: #a78f4e; }
.spx-badge-B { background: #2f5e8c; color: #fff; }
.spx-badge-O { background: #fff; color: #333; border-color: #9aa0a4; }
.spx-splist { list-style: none; padding: 0; margin: .3rem 0 0; columns: 2; font-size: .86rem; }
.spx-splist li { break-inside: avoid; margin: .1rem 0; }
.spx-share { display: flex; align-items: center; gap: .4rem; margin: .9rem 0 0; }
.spx-link { flex: 1 1 auto; min-width: 0; font-size: .76rem; color: #555; border: 1px solid var(--sp-line);
  border-radius: 8px; padding: .3rem .45rem; background: var(--sp-panel); }
.spx-copy { border: 1px solid var(--sp-line); border-radius: 999px; }
.spx-copied { font-size: .76rem; color: #2f6b3a; }

/* ---------- zoom buttons and legend ---------- */
.spx-zoom { display: inline-flex; gap: .25rem; }
.spx-zbtn { appearance: none; width: 28px; height: 28px; line-height: 1; border-radius: 50%;
  border: 1px solid var(--sp-line); background: #fff; cursor: pointer; font-size: .95rem; color: #333; }
.spx-zbtn:hover { border-color: var(--sp-gold); }
.spx-legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; margin: .35rem 0 0;
  font-size: .76rem; color: var(--sp-muted); }
.spx-key { display: inline-flex; align-items: center; gap: .3rem; }
.spx-key b { font-weight: 600; color: #444; }
.spx-sw { display: inline-block; width: .62rem; height: .62rem; border-radius: 50%; }
.spx-sw.spx-cls-V { background: #cfb87c; border: 1px solid #8a7536; }
.spx-sw.spx-cls-B { background: #2f5e8c; }
.spx-sw.spx-cls-O { background: #fff; border: 1.5px solid #4a4a4a; }
.spx-sw.spx-cls-N { background: #9aa3a0; }
.spx-sw-wedge { background: #dfe3e6; border: 1px solid #c3c9cd; border-radius: 2px; }
svg.spx-legend-sizes { vertical-align: middle; overflow: visible; }
svg.spx-legend-sizes .spx-legend-t { fill: var(--sp-muted); font-size: 9.5px; }

/* ---------- the phylogram ---------- */
.spx-tpanel { position: relative; }
.spx-break { margin: .15rem 0 .1rem; font-size: .72rem; color: var(--sp-muted); text-align: center;
  border-top: 1px dashed #d8d8d4; padding-top: .25rem; }
svg.spx-tree { display: block; width: 100%; background: #fff; touch-action: none; cursor: grab;
  font: 11px/1.2 inherit; }
svg.spx-tree:active { cursor: grabbing; }
svg.spx-tree .spx-grid line { stroke: #f0efeb; stroke-width: 1; }
svg.spx-tree .spx-grid text { fill: #a8a8a3; font-size: 9.5px; }
svg.spx-tree .spx-br { fill: none; stroke: #9aa3a1; stroke-width: 1; shape-rendering: geometricPrecision; }
svg.spx-tree .spx-wedge { fill: #dfe3e6; stroke: #96a3ab; stroke-width: .6; cursor: pointer; }
svg.spx-tree .spx-wedge:hover { stroke: #35414a; stroke-width: 1.1; }
svg.spx-tree .spx-tip { stroke: #fff; stroke-width: .5; cursor: pointer; }
svg.spx-tree .spx-tip:hover { stroke: #1a1a1a; stroke-width: 1.1; }
svg.spx-tree .spx-cls-N { fill: #9aa3a0; }
svg.spx-tree .spx-cls-V { fill: #cfb87c; stroke: #8a7536; }
svg.spx-tree .spx-cls-B { fill: #2f5e8c; }
svg.spx-tree .spx-cls-O { fill: #fff; stroke: #4a4a4a; stroke-width: 1.2; }
svg.spx-tree text.spx-lab-clade, svg.spx-tree text.spx-lab-open, svg.spx-tree text.spx-lab-tip {
  paint-order: stroke; stroke: #fff; stroke-width: 2.6px; stroke-linejoin: round; }
svg.spx-tree .spx-lab-clade { fill: #333a37; font-size: 11px; }
svg.spx-tree .spx-lab-open { fill: #6f7673; font-size: 10px; letter-spacing: .01em; }
svg.spx-tree .spx-lab-open.spx-rank-phylum { fill: #3d4542; font-size: 11px; font-weight: 600; }
svg.spx-tree .spx-lab-tip { fill: #1a1a1a; font-size: 11px; font-style: italic; }
svg.spx-tree .spx-lab-tip.on { font-weight: 700; }
svg.spx-tree .spx-hl-band { fill: rgba(207, 184, 124, .3); }
svg.spx-tree .spx-hl-ring { fill: none; stroke: #8a6d2f; stroke-width: 1.8; }
svg.spx-tree .spx-scalebar line { stroke: #6a6a6a; stroke-width: 1; }
svg.spx-tree .spx-scalebar text { fill: #6a6a6a; font-size: 9.5px; }
svg.spx-tree .spx-panel-title { fill: #5c6360; font-size: 11px; font-weight: 600; }

@media (max-width: 999px) {
  .spx-panel { margin-top: .4rem; }
  .spx-splist { columns: 1; }
}

/* ---------- explorer, round 3 follow-up: label backing, legend rows, class rings ---------- */
svg.spx-tree text.spx-lab-halo { stroke: #fff; stroke-width: 3.2px; stroke-linejoin: round; fill: #fff;
  pointer-events: none; }
svg.spx-tree .spx-lab-n { fill: #8b918f; font-size: 9.5px; }
svg.spx-tree .spx-lab-halo .spx-lab-n { fill: #fff; }
.spx-legend-row { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; }
.spx-legend-row + .spx-legend-row { margin-top: .25rem; }
.spx-sw.spx-ring-V { background: #fff; border: 2px solid #CFB87C; }
.spx-sw.spx-ring-B { background: #fff; border: 2px solid #2F5E8C; }
.spx-sw.spx-ring-S { background: #fff; border: 2px solid #8A4A1A; }
.spx-sw.spx-ring-N { background: #c3cbcd; border: 1px solid #fff; }
.spx-badge-S { background: #8A4A1A; color: #fff; }
.spx-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; margin-right: .25rem;
  vertical-align: baseline; }

/* ---- taxon explorer, round 4: browse switch, taxonomy list, full-width taxon view ---- */
#tx-browse[hidden], .spx-treebox[hidden], .spx-listbox[hidden] { display: none; }
.spx-modebar { margin: .1rem 0 .5rem; }
.spx-panel { margin: .2rem 0 1.2rem; }
.spx-detail-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .7rem; }
.spx-detail-bar .sp-seg-btn { border: 1px solid var(--sp-line); border-radius: 999px; background: #fff; cursor: pointer; }
.spx-detail-bar .spx-back { font-weight: 600; }
.spx-detail-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; align-items: start; }
@media (min-width: 1000px) { .spx-detail-grid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); } }
.spx-detail-main, .spx-detail-side { min-width: 0; }
.spx-detail-side.spx-globe-row { margin-top: 0; }
.spx-panel h2 { font-size: 1.5rem; }
.spx-lin a { color: inherit; border-bottom: 1px dotted #b9b9b9; }
.spx-lin a:hover { color: #1a1a1a; border-bottom-color: #1a1a1a; }
.spx-linkbtn { appearance: none; border: 0; background: none; padding: 0; color: inherit; font: inherit;
  text-decoration: underline; cursor: pointer; }
.spx-listbox { border: 1px solid var(--sp-line); border-radius: 12px; background: #fff; padding: .7rem .9rem 1rem; }
.spx-ol { list-style: none; margin: 0; padding: 0 0 0 1.35rem; }
.spx-ol-root { padding-left: 0; }
.spx-orow { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .45rem; padding: .16rem .2rem; border-radius: 6px; }
.spx-orow:hover { background: #f6f4ee; }
.spx-oli-at > .spx-orow { background: rgba(207, 184, 124, .28); }
.spx-otog { appearance: none; border: 0; background: none; width: 1.2rem; padding: 0; font-size: .85rem;
  line-height: 1; color: #5c6360; cursor: pointer; text-align: center; flex: none; }
.spx-otog-none { cursor: default; display: inline-block; }
.spx-orank { flex: none; width: 1.15rem; height: 1.15rem; line-height: 1.15rem; border-radius: 4px; text-align: center;
  font-size: .7rem; font-weight: 700; color: #fff; background: #8b918e; }
.spx-orank-d { background: #3b4a54; } .spx-orank-p { background: #2f5e8c; } .spx-orank-c { background: #3f7f7a; }
.spx-orank-o { background: #6b7f3a; } .spx-orank-f { background: #9a7b2f; } .spx-orank-g { background: #a2572b; }
.spx-orank-s { background: #8b918e; }
.spx-oname { font-size: .93rem; }
.spx-oname-btn { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-size: .93rem;
  color: #1a1a1a; cursor: pointer; text-align: left; }
.spx-oname-btn:hover { text-decoration: underline; }
.spx-ocount { font-size: .78rem; color: var(--sp-muted); }
.spx-olit { font-size: .68rem; color: #5c6360; border: 1px solid #d5d5d0; border-radius: 999px; padding: 0 .4rem; }
/* ---- VANISH/BloSSUM plot, round 4: the searched taxon is marked with a star, the view does not move ---- */
svg.sp-scatter .sp-star { stroke: #1a1a1a; stroke-width: 1.4; cursor: pointer; }
svg.sp-scatter .sp-star-label { font-size: 12px; font-weight: 600; fill: #1a1a1a; paint-order: stroke;
  stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
/* ---- taxon view, round 4: the samples behind a bar ---- */
#txp-carriers { margin-top: .9rem; }
#txp-carriers:empty { margin-top: 0; }
.spx-cartable { width: 100%; border-collapse: collapse; margin: .3rem 0; }
.spx-cartable th, .spx-cartable td { text-align: left; padding: .18rem .6rem .18rem 0; border-bottom: 1px solid #ecebe6; }
.spx-cartable th { font-weight: 600; color: #5c6360; }
