/* The map view: the control rail, the floating legend, the plot badges,
   and the dark plot canvas. Tokens and the global reset live in
   00-tokens.css; this file styles only what the map draws. */

#react-entry-point, ._dash-loading { height: 100%; }

/* ---- App shell -------------------------------------------------------- */
/* Under the shell the map is a flex child below the header, so 100vh here
   would be a header's height taller than the window and scroll the whole
   page by that much. It claims what is left instead. */
.bm-app { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }


.bm-body { display: flex; flex: 1; min-height: 0; }

/* ---- Left control rail ------------------------------------------------ */
.bm-rail {
  width: 268px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: var(--border);
  padding: 16px 16px 20px;
  overflow-y: auto;
}
.bm-rail::-webkit-scrollbar { width: 8px; }
.bm-rail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-sm); }

.bm-group { margin-bottom: 20px; }
.bm-group-label {
  font-size: var(--control-font-size);
  font-weight: var(--control-weight);
  font-family: var(--font-heading);
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-primary);
  margin-bottom: 9px;
}

/* Segmented toggles, built from dcc.RadioItems.
   Dash renders each option as
     <label class="dash-options-list-option [selected]">
       <span class="dash-options-list-option-wrapper"><input type="radio"></span>
       <span class="dash-options-list-option-text">…</span>
     </label>
   The pill is therefore the *label*, and the selected state comes from Dash's
   own `.selected` class. Note that `labelClassName` lands on the inner text
   span rather than the label, so it cannot be used as the pill hook - these
   rules deliberately target Dash's structural classes, scoped under .bm-seg. */
.bm-seg {
  display: flex; background: var(--bg-inset);
  border-radius: var(--radius-sm); padding: 3px; gap: 3px;
}
.bm-seg .dash-options-list-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Contains the radio input, which is taken out of flow below rather than
     removed from the page. */
  position: relative;
  padding: 7px 6px;
  font-size: 12.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  background: transparent;
  user-select: none;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s;
}
/* The radio itself carries the state but adds nothing visually - so it is
   hidden from the eye and *kept on the page*. It used to be `display: none`,
   which takes an element out of the tab order and out of the accessibility
   tree as well as out of the picture: Projection, Dimensions and the number of
   ARCHS4 points - three of the map's six controls - could not be reached or
   operated by keyboard at all. The `:focus-within` rule below has been sitting
   here the whole time and could never fire, which is what gave it away.

   Clipped rather than `opacity: 0` on a full-size input, because a
   transparent radio would still take the click that belongs to the label. */
.bm-seg .dash-options-list-option-wrapper {
  position: absolute;
  width: 1px; height: 1px;
  margin: 0; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
/* Inherit the selected control role on Dash's nested text span. */
.bm-seg .dash-options-list-option-text { display: block; text-align: center; color: inherit; }
.bm-seg .dash-options-list-option:hover { color: var(--text-primary); }
.bm-seg .dash-options-list-option.selected {
  background: var(--bg-panel);
  color: var(--control-ink);
  box-shadow: inset 0 -2px var(--control-ink);
  font-weight: 600;
}
.bm-seg .dash-options-list-option:focus-within {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
}
.bm-seg .dash-options-list-option:has(input[disabled]) {
  color: var(--text-muted); cursor: not-allowed; opacity: 0.5;
  background: transparent; box-shadow: none;
}

/* ---- Projection parameters ---------------------------------------------
   Sits directly under the Projection control and states how the active
   projection was actually fit, read off projection_stats.json. Same rule as
   the color-by coverage readout further down - the fact that qualifies a
   control belongs against that control - and it hangs at the same 9px offset
   so the two readouts line up under their respective controls. Deliberately
   not a plot badge: that row reports what is drawn right now and changes on
   every zoom, while these describe how the coordinates were built. */
.bm-params { display: flex; flex-wrap: wrap; gap: 2px 7px; margin-top: 9px; }
/* A method with nothing recorded should not still spend its margin. */
.bm-params:empty { display: none; }
.bm-param { font-size: 11px; line-height: 1.45; color: var(--text-secondary); }
/* Drawn rather than written into the text, so the line can only break
   between parameters and never inside one. It hangs off the *preceding*
   chip rather than the following one: a ::before binds the separator to the
   chip after it, which puts a dangling "·" at the start of every wrapped
   line, and the rail wraps at four chips. */
.bm-param:not(:last-child)::after {
  content: "·"; margin-left: 7px; color: var(--border-strong);
}
/* Only the measured payload is set apart: mono a half-step down because
   JetBrains Mono's x-height runs large against Inter at a shared size, and
   tabular figures so 30 / 0.1 / 942,563 sit on one grid the way
   .bm-legend-count already does. */
.bm-param b {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  font-variant-numeric: tabular-nums; color: var(--text-primary);
}

/* --text-secondary, not --text-muted: #8a99ac on the white panel measures
   2.90:1, which fails WCAG AA for text this size, and every hint on the rail
   is 11.5px. --text-secondary is 5.47:1 and still recedes behind the
   controls. */
.bm-hint { font-size: 11.5px; color: var(--text-secondary); margin-top: 7px; line-height: 1.45; }
/* A color-by with nothing to add should not still spend its margin, the same
   rule .bm-params follows. Most fields now carry no hint at all. */
.bm-hint:empty { display: none; }

/* The rail's retrieval line is one sentence now. Everything that used to sit
   here - a swatch per cohort and a paragraph on what a ring inside a square
   means - is on the plot, in .bm-key, against the marks it decodes. */

/* Dropdown (Dash 4 dcc.Dropdown: a radix popover, not react-select).
   The menu is portaled to the end of <body>, so its rules cannot be scoped
   under .bm-rail and are written globally. */
/* The find box. The class lands on Dash's wrapper div and the id lands on the
   inner `<input>`, so the box is drawn on the wrapper and the ring is
   `:focus-within` on that same wrapper - the two must be on one element, or a
   ring is drawn inside a ring. Same arrangement as .bm-legend-search, which is
   the other dcc.Input on this view; the difference is only that this one sits
   on the light rail rather than on the dark canvas. */
.bm-find-input {
  width: 100%;
  font-size: 13px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow);
}
.bm-find-input:hover { border-color: var(--border-strong); }
.bm-find-input:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--focus-ring);
}
/* The wrapper carries the box, so the input inside it must not draw a second
   one. Scoped to this control rather than to `.dash-input-element` at large,
   which would also reach the legend filter on the dark canvas - the exact
   over-reach `test_the_retrieval_input_rules_cannot_reach_the_map` exists for,
   arriving from the other direction. */
.bm-find-input input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  color: var(--text-primary);
  padding: 0;
}
.bm-find-input input::placeholder { color: var(--text-muted); }

/* ---- The suggestion list ------------------------------------------------
   Inline under the box, not floating. The rail is a scroll container, so an
   absolutely-positioned popup would be clipped by it or would scroll away from
   the field it belongs to; inline it is always attached and always in flow.

   `max-height` is what keeps "compact" true. Ten suggestions in a window about
   five and a half rows tall means the sixth row is visibly cut, which is the
   affordance that says the list scrolls - a window sized to a whole number of
   rows looks complete when it is not. The rail never grows past this no matter
   what is typed.

   Two independent facts decide whether this is on screen, and each has exactly
   one owner. `:empty` is the server's: no rows, nothing to show. `.is-closed`
   is the browser's: Escape, a click outside, a row chosen. Neither writes an
   inline style, so they compose instead of racing - which is the whole reason
   the open/closed state lives in a class rather than in a callback. */
.bm-suggest {
  margin-top: 6px;
  max-height: 196px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  box-shadow: var(--shadow-raised);
  padding: 3px;
}
.bm-suggest:empty { display: none; }
#find-group.is-closed .bm-suggest { display: none; }
.bm-suggest::-webkit-scrollbar { width: 6px; }
.bm-suggest::-webkit-scrollbar-thumb {
  background: rgba(120, 150, 195, 0.4); border-radius: 3px;
}

/* Identifier above, what distinguishes it below.

   Two lines rather than one, and this was measured rather than preferred. Side
   by side on a 268 px rail the two compete for about 220 px, and the row that
   loses is decided by CSS rather than by which half matters: with both at the
   default shrink, "GSM5028824" beside "GSE165242 · Embryo / stem cell" ellipsed
   to "GSM502…" - the accession, the one string in the row that cannot be
   inferred from the rest of it. Weighting the shrink towards the detail helped
   and did not fix it, because any shrink at all on a 78 px label truncates it;
   only `flex-shrink: 0` keeps it whole, and that spends the detail down to
   "OSD-100 · l…" instead. Neither half is expendable: for the OSDR samples the
   names differ in their last characters (Rep1_M23 against Rep2_M24), which is
   exactly what an ellipsis eats.

   Stacked, both are whole at every width, at a cost of about 11 px per row -
   which the max-height above absorbs by showing four rows and part of a fifth
   instead of five and part of a sixth. The list still scrolls, still holds ten,
   and no longer hides the thing a reader is scanning for. */
.bm-suggest-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  /* WCAG 2.2 SC 2.5.8 puts the floor for a pointer target at 24x24 CSS px. */
  min-height: 24px;
}
/* Hover and keyboard get the same treatment, because they mean the same thing:
   this is the row that Enter or a click would take. */
.bm-suggest-row:hover,
.bm-suggest-row.is-active { background: var(--accent-soft); }
.bm-suggest-row.is-active { box-shadow: inset 2px 0 0 var(--control-ink); }
/* Both lines still ellipse rather than wrap. Nothing in the corpus is long
   enough to need it at this width - it is the guard that keeps a row one row
   tall whatever a future metadata join puts in it, so the list's height stays a
   function of how many suggestions there are and not of what they say. */
.bm-suggest-label,
.bm-suggest-detail {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bm-suggest-label { font-size: 12px; color: var(--text-primary); }
.bm-suggest-detail { font-size: 11px; color: var(--text-secondary); }
/* A well-formed identifier this map does not carry. Not a row: there is
   nothing to select, so it must not look selectable. */
.bm-suggest-empty {
  padding: 7px 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* The status and the button hang off the control they qualify, at the rail's
   standing 9 px offset - the same one .bm-coverage and .bm-params use. */
#find-status { margin-top: 9px; }
#find-status:empty { display: none; }

.bm-dropdown {
  font-size: 13px;
  min-height: 38px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.bm-dropdown .dash-dropdown-trigger { min-height: 38px; }
.bm-dropdown:hover { border-color: var(--border-strong); }
/* Layer checklist. The checkbox is restyled rather than replaced, so keyboard
   focus and the native checked state keep working. */
.bm-checklist { display: flex; flex-direction: column; gap: 3px; }
.bm-checklist .dash-options-list-option {
  display: flex; align-items: center;
  padding: 4px 0;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.12s;
}
.bm-checklist .dash-options-list-option:hover,
.bm-checklist .dash-options-list-option.selected { color: var(--text-primary); }
.bm-checklist input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; margin: 0 9px 0 0; flex-shrink: 0;
  border: 1.5px solid var(--control-border); border-radius: var(--radius-sm);
  background: var(--bg-panel); cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.bm-checklist input[type="checkbox"]:checked {
  background: var(--control-ink); border-color: var(--control-ink);
}
.bm-checklist input[type="checkbox"]:checked::after {
  content: ""; display: block;
  width: 4px; height: 8px; margin: 1px 0 0 5px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.bm-checklist input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}

/* ---- Center plot ------------------------------------------------------ */
.bm-plot-wrap { flex: 1; position: relative; min-width: 0; background: var(--plot-bg); }
.bm-plot-loading { height: 100%; }
.bm-legend-empty { font-size: 12px; color: var(--plot-ui-muted); padding: 4px 2px; }
.bm-plot-wrap .dash-graph, .bm-plot-wrap .js-plotly-plot { height: 100% !important; }

/* Plotly's modebar is drawn for a light paper; on the navy canvas its default
   dark glyphs are all but invisible. Recolored for the dark surface, and kept
   dim until hover so it never competes with the data. */
/*.bm-plot-wrap .modebar { padding-right: 6px; }*/
.bm-plot-wrap .modebar { padding-left: 6px; }
.bm-plot-wrap .modebar-group { background: var(--plot-ui-bg) !important; }
.bm-plot-wrap .modebar-btn .icon path { fill: var(--plot-ui-muted) !important; transition: fill 0.12s; }
.bm-plot-wrap .modebar-btn:hover .icon path { fill: var(--plot-ui-text) !important; }
.bm-plot-wrap .modebar-btn.active .icon path { fill: var(--plot-ui-text) !important; }

/* dcc.Loading overlays a white sheet by default, which flashes over the navy
   canvas on every control change. */
.bm-plot-wrap .dash-loading-callback, .bm-plot-wrap ._dash-loading-callback { background: transparent !important; }

/* The strip across the top of the canvas: what is drawn right now, and nothing
   else. "Reset view" shared it until 2026-08-13 and now sits on the rail beside
   the two buttons that frame.

   `pointer-events: none` is what keeps the badges from eating drags meant for
   the plot underneath. */
.bm-plot-badges {
  position: absolute; top: 12px; left: 14px; z-index: 6;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  pointer-events: none;
}
.bm-badges { display: contents; }
.bm-badge {
  background: var(--plot-ui-bg);
  color: var(--plot-ui-text);
  border: 1px solid var(--plot-ui-border);
  border-radius: var(--radius-sm);
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 500;

}
.bm-badge b { color: #fff; }
.bm-badge.warn { border-color: rgba(215, 150, 40, 0.6); color: #ffd79a; }

/* The floating key. Sits below the modebar's row rather than beside it: Plotly
   renders the modebar at the top-right of the plot, and at narrow widths the
   two overlapped.

   Three sections, ordered by how transient each is: the retrieval on top
   (asked for a moment ago, gone next search), the color list in the middle
   (the standing state of the map), the corpus shapes at the bottom (a footnote
   that never changes). Only the middle one can grow, so only the middle one
   scrolls - `min-height: 0` on the section is what lets it, since a flex child
   defaults to its content height and would otherwise push the footer out. */
.bm-legend {
  position: absolute; top: 46px; right: 14px; z-index: 7;
  width: 228px; max-height: calc(100% - 58px);
  background: var(--plot-ui-bg);
  border: 1px solid var(--plot-ui-border);
  border-radius: var(--radius-sm);
  padding: 10px 11px;

  display: flex; flex-direction: column;
}
.bm-legend-section { display: flex; flex-direction: column; min-height: 0; }
.bm-legend-title {
  font-size: 11px; text-transform: none; letter-spacing: 0;
  font-family: var(--font-heading);
  color: var(--plot-ui-muted); font-weight: 700; margin-bottom: 8px;
}
.bm-legend-search {
  background: var(--plot-ui-inset);
  border: 1px solid var(--plot-ui-border);
  border-radius: var(--radius-sm); color: var(--plot-ui-text); font-size: 12px;
  padding: 5px 8px; width: 100%; outline: none;
}
/* The margin belongs to the wrapper, which is what the callback shows and
   hides; on the field itself it would survive as a gap when the field is
   gone. */
#legend-search-group { margin-bottom: 8px; }
.bm-legend-search input {
  color: var(--plot-ui-text); background: transparent;
  border: 0; outline: 0; padding: 0; font: inherit;
}
.bm-legend-search input::placeholder { color: var(--plot-ui-muted); }
/* `outline: none` above kills the default ring, and this field is the only
   control sitting on the dark canvas - so it needs a ring drawn for the dark
   canvas rather than no ring at all. It was the one element in either view a
   keyboard walk could land on with nothing to show for it.
   `:focus-within`, because these class names land on Dash's wrapper div and
   the element that actually takes focus is the `<input>` inside it. */
.bm-legend-search:focus-within {
  outline: 2px solid var(--plot-ui-text);
  outline-offset: 1px;
  border-color: var(--plot-ui-text);
}
/* `flex: none` on the rows is what makes the list scroll instead of squashing.
   A column flex item shrinks below its content height by default, so once the
   panel hit its own max-height the rows compressed into each other and the
   counts lost their descenders - the list never scrolled, because there was
   never any overflow to scroll. Seen at 393 px, where the panel is capped at
   46% of the canvas; the same would happen on a desktop with enough categories
   drawn to reach `calc(100% - 58px)`. */
.bm-legend-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.bm-legend-list > .bm-legend-item { flex: none; }
.bm-legend-list::-webkit-scrollbar { width: 6px; }
.bm-legend-list::-webkit-scrollbar-thumb { background: rgba(120,150,195,0.4); border-radius: 3px; }
.bm-legend-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--plot-ui-text); padding: 2px 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bm-legend-swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.bm-legend-count { margin-left: auto; color: var(--plot-ui-muted); font-variant-numeric: tabular-nums; font-size: 11px; }

/* ---- The mark key ------------------------------------------------------
   The color legend above keys hue. This keys SHAPE, which was the channel
   nothing on screen explained: that a diamond is one of the 2,108 spaceflight
   samples, that a white ring is a retrieved hit, that a round ring and a square
   ring are two different cohorts, and that a ring inside a square is a hit both
   of them found.

   Every mark is drawn as the mark. Naming a square ring in words, in a panel
   that could simply draw one, is the key doing less than it could - and the
   marks it has to match are 20 px glyphs on a navy canvas, which a 14 px box
   reproduces closely enough to recognise.

   Shapes live here; hues come from manifold/theme.py through an inline style,
   so there is no second copy of RETRIEVAL_QUERY to drift. The one color that
   IS written here is the hit ring's white, because it is the same white for the
   same measured reason: no hue clears 3:1 against the worst categorical tissue
   bucket on this background, which is why the ring is white on the plot too. */
.bm-key { display: flex; flex-direction: column; gap: 1px; }
/* The rule is on the modifier, not on `:not(:last-child)`: each key is the only
   child of its own slot div, so it is always a last child and the sibling
   selector could never fire. */
.bm-key--found,
.bm-key--retrieval {
  margin-bottom: 9px; padding-bottom: 9px;
  border-bottom: 1px solid var(--plot-ui-border);
}
.bm-key--corpus {
  margin-top: 9px; padding-top: 9px;
  border-top: 1px solid var(--plot-ui-border);
}
.bm-key-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--plot-ui-text); padding: 2px 2px;
  min-width: 0;
  /* Same reason as .bm-legend-item: these are column flex items inside a
     height-capped panel, and the default is to shrink rather than to overflow. */
  flex: none;
}
.bm-key-count {
  margin-left: auto; padding-left: 6px;
  color: var(--plot-ui-muted); font-variant-numeric: tabular-nums; font-size: 11px;
}

/* A comparison groups by ROLE, so the two member rows sit adjacent and differ
   only in hue, and the two hit rows sit adjacent and differ only in shape. The
   sub-heads are what make that pairing legible; they appear only when there are
   two cohorts, because a lone search has nothing to pair. */
.bm-key-head {
  margin: 6px 2px 2px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; color: var(--plot-ui-muted);
}
.bm-key-head:first-child { margin-top: 0; }
/* A cohort label runs long ("Liver · Space Flight"), and two arms usually
   differ only in the trailing facet - exactly the part truncation would eat.
   So it wraps instead: nothing about which arm this is can be lost. */
.bm-key-label { overflow-wrap: anywhere; }
/* An unticked arm keeps both its rows so the hue and the shape it owns are
   still named, receded and saying so. */
.bm-key-row.is-hidden { opacity: 0.45; }

/* ---- The glyphs themselves --------------------------------------------- */
.bm-key-glyph {
  position: relative; flex: none;
  width: 14px; height: 14px;
  display: block;
}
.bm-key-glyph-fill { position: absolute; inset: 0; }

/* The query / pooled member: a star in 2-D, carrying the 2 px white outline it
   wears on the plot. The outline is the outer shape and the hue is inset into
   it, which is how the plot builds it too. */
.bm-key-glyph.is-star,
.bm-key-glyph.is-star .bm-key-glyph-fill {
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%,
                     50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.bm-key-glyph.is-star { background: #ffffff; }
.bm-key-glyph.is-star .bm-key-glyph-fill { inset: 1.5px; }

/* 3-D substitutes a diamond, because Scatter3d rejects `star` outright. */
.bm-key-glyph.is-diamond {
  width: 11px; height: 11px; margin: 1.5px;
  background: #ffffff; border-radius: 1px;
  transform: rotate(45deg);
}
.bm-key-glyph.is-diamond .bm-key-glyph-fill { inset: 1.5px; border-radius: 1px; }

/* Matches: open teal marks distinguished only by shape, the same split the
   plot uses. The hue is not written here: the key sets --glyph-color inline
   from theme.MATCH_COLOR, so plot and key cannot drift apart. B's square is the
   larger, so a match both cohorts retrieved composites into a circle inside a
   square, which is exactly what .is-match-both draws. */
.bm-key-glyph.is-match,
.bm-key-glyph.is-match-b,
.bm-key-glyph.is-match-both { border: 2px solid var(--glyph-color); }
.bm-key-glyph.is-match {
  width: 10px; height: 10px; margin: 2px; border-radius: 50%;
}
.bm-key-glyph.is-match-b { width: 12px; height: 12px; margin: 1px; }
/* The doubled mark cannot be drawn to the plot's own proportions at key size:
   scaled into a 14 px box the gap between square and circle is under a pixel
   and the two strokes merge. So the box grows to 17 px and the inner circle is
   inset further, because "a circle inside a square" is this row's content. */
.bm-key-glyph.is-match-both {
  width: 17px; height: 17px; margin: -1.5px;
}
.bm-key-glyph.is-match-both::after {
  content: ""; position: absolute; inset: 4px;
  border: 2px solid var(--glyph-color); border-radius: 50%;
}

/* A found sample: an X, white for the same measured reason the hit rings are
   white - no hue clears 3:1 against the worst categorical tissue bucket on this
   background, so shape is the channel and white is its ink.

   One rule for both dimensionalities. The plot draws `x-open` in 2-D and `x` in
   3-D only because Scatter3d's eight-symbol vocabulary has no `x-open`; they
   are the same mark, and at 14 px an outlined X and a filled one are the same
   handful of pixels, so keying them apart would invent a distinction the plot
   is not making. */
.bm-key-glyph.is-found {
  background: #ffffff;
  clip-path: polygon(20% 0%, 50% 30%, 80% 0%, 100% 20%, 70% 50%,
                     100% 80%, 80% 100%, 50% 70%, 20% 100%, 0% 80%,
                     30% 50%, 0% 20%);
}

/* The corpus shapes. Neutral-filled: these marks take their color from the
   color-by above, and the shape is the whole message. */
.bm-key-glyph.is-corpus-archs4 {
  width: 7px; height: 7px; margin: 3.5px; border-radius: 50%;
}
.bm-key-glyph.is-corpus-archs4 .bm-key-glyph-fill { border-radius: 50%; }
.bm-key-glyph.is-corpus-osdr {
  width: 9px; height: 9px; margin: 2.5px;
  border-radius: 1px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 1.5px #ffffff;
}
.bm-key-glyph.is-corpus-osdr .bm-key-glyph-fill { border-radius: 1px; }

/* ---- Color-by coverage readout ---------------------------------------
   Sits directly under the color-by control and states how much of the map
   the selected field actually paints. This is the answer to "why is most of
   my map not colored?", given before the question is asked. */
.bm-coverage { margin-top: 9px; }
/* The track needs enough contrast to read as a track. An OSDR-only field fills
   0.2% of it, and against the old near-white #e3eaf3 that sliver looked like a
   stray dot floating on the panel rather than like a nearly-empty bar - which
   inverts the message, since the point of the bar is to show how much is NOT
   covered. */
.bm-coverage-bar {
  height: 4px; border-radius: 2px; overflow: hidden;
  background: var(--border-subtle); margin-bottom: 6px;
  box-shadow: none;
}
.bm-coverage-fill {
  height: 100%; border-radius: 2px;
  background: var(--text-secondary);
  transition: width 0.18s ease;
}
/* Amber, not red: a field that only describes OSDR is working correctly, not
   failing. The color marks a limit worth knowing, not an error. */
.bm-coverage-fill.partial { background: var(--status-warn); }
.bm-coverage-text {
  font-size: 11.5px; color: var(--text-secondary); line-height: 1.45;
}
.bm-coverage-fix {
  font-size: 11px; color: var(--status-warn); line-height: 1.45;
  margin-top: 5px; background: #fdf6ea; border-radius: var(--radius-sm); padding: 6px 8px;
}

/* Only real links use blue; action-like links use shared button styling. */
a:not(.app-brand):not(.app-nav-item):not(.btn-ghost) { color: var(--link-color); }
a:not(.app-brand):not(.app-nav-item):not(.btn-ghost):hover { color: var(--link-hover); }

/* A rail action. Quieter than the retrieval view's primary button: the map is
   read rather than driven, and this is the only button on the rail. */
.bm-button {
  width: 100%;
  margin-top: 2px;
  padding: 7px 10px;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;


  border-width: 1px; border-style: solid;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.bm-button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* The clicked-sample offer on the control rail. */
.bm-picked {
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-word;
  line-height: 1.35;
}
/* The record rows under the selected sample's name. Key left, value right, the
   value taking the slack - the same shape as the retrieval view's detail rows,
   and the reason for `min-width: 0` is the same too: a 39-character sample key
   or a GEO title is one unbreakable run that would otherwise push the row wider
   than the 268 px rail.

   `.bm-picked-study` used to live here, for a "· OSD-100" suffix on the sample
   name. The study is one of these rows now, so the suffix and its rule are
   gone rather than left to rot. */
.bm-picked-row {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 11.5px; line-height: 1.45; margin-top: 5px;
}
.bm-picked-key { flex: none; color: var(--text-muted); }
.bm-picked-value {
  flex: 1 1 auto; min-width: 0;
  color: var(--text-secondary); text-align: right; word-break: break-word;
}

/* dcc.Link renders an <a>; .bm-button is written for a <button>. */
a.bm-button { display: block; text-align: center; text-decoration: none; }

/* ---- Evidence neighborhood explorer ----------------------------------- */
.bm-map-workspace {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
.bm-map-workspace > .bm-plot-wrap { min-width: 0; overflow: hidden; }

.bm-neighborhood {
  width: 390px;
  min-width: 0;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: var(--border);
  color: var(--text-primary);
}
.bm-neighborhood-head {
  position: relative;
  padding: var(--space-3);
  border-bottom: var(--border);
}
.bm-neighborhood-head > .bm-group-label { margin-bottom: var(--space-1); }
.bm-neighborhood-head h2 {
  min-width: 0;
  margin: 0;
  padding-right: calc(var(--space-5) + var(--space-4));
  font-size: var(--text-lg);
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.bm-neighborhood-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  min-height: var(--space-5);
  padding: var(--space-1) var(--space-2);
  border-width: 1px; border-style: solid;
  border-radius: var(--radius-sm);


  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.bm-neighborhood-close:focus-visible,
.bm-neighborhood-geo:focus-visible,
.bm-neighborhood-row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.bm-neighborhood-arm,
.bm-neighborhood-tabs { margin-top: var(--space-3); }
.bm-neighborhood-arm .dash-options-list-option-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-neighborhood-search {
  width: 100%;
  margin-top: var(--space-3);
  min-height: var(--space-5);
  padding: var(--space-2);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-sm);
}
.bm-neighborhood-search:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: var(--focus-ring);
}
.bm-neighborhood-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}
.bm-neighborhood-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--space-3) var(--space-3);
  overscroll-behavior: contain;
}
.bm-neighborhood-summary {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-base);
  line-height: 1.5;
}
.bm-neighborhood-composition,
.bm-neighborhood-leading { margin-top: var(--space-4); }
.bm-neighborhood-section-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-sm);
  line-height: 1.4;
}
.bm-neighborhood-bar-row + .bm-neighborhood-bar-row { margin-top: var(--space-2); }
.bm-neighborhood-bar-label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.bm-neighborhood-bar-label span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-neighborhood-bar-label span:last-child {
  flex: none;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.bm-neighborhood-bar-track {
  height: var(--space-1);
  margin-top: var(--space-1);
  overflow: hidden;
  border-radius: var(--space-1);
  background: var(--bg-inset);
}
.bm-neighborhood-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-teal);
}
.bm-neighborhood-leading-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: var(--border);
  font-size: var(--text-sm);
}
.bm-neighborhood-leading-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.bm-neighborhood-leading-count { color: var(--text-secondary); }
.bm-neighborhood-muted {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.bm-neighborhood-study-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  border-top: var(--border);
}
.bm-neighborhood-row {
  width: 100%;
  min-width: 0;
  min-height: calc(var(--space-5) + var(--space-3));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-2);
  padding: var(--space-2);
  border: 0;
  border-top: var(--border);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bm-neighborhood-study-wrap .bm-neighborhood-row { border-top: 0; }
.bm-neighborhood-row:hover,
.bm-neighborhood-row:focus-visible,
.bm-neighborhood-row.is-selected { background: var(--accent-soft); }
.bm-neighborhood-row.is-selected { box-shadow: inset 2px 0 0 var(--control-ink); }
.bm-neighborhood-row-primary,
.bm-neighborhood-row-secondary,
.bm-neighborhood-row-trailing { min-width: 0; }
.bm-neighborhood-row-primary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
}
.bm-neighborhood-row-secondary {
  grid-column: 1 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 11px;
}
.bm-neighborhood-row-trailing {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.bm-neighborhood-geo {
  display: inline-flex;
  align-items: center;
  min-height: var(--space-5);
  color: var(--link-color);
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.bm-neighborhood-detail {
  margin: var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
}
.bm-neighborhood-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.bm-neighborhood-detail h3,
.bm-neighborhood-detail p { margin: 0; }
.bm-neighborhood-detail h3 { font-size: var(--text-base); }
.bm-neighborhood-detail p {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.bm-neighborhood-detail dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-2);
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}
.bm-neighborhood-detail dt { color: var(--text-secondary); }
.bm-neighborhood-detail dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
.bm-neighborhood-empty {
  margin-top: var(--space-3);
  padding: var(--space-4);
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-inset);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
  text-align: center;
}

/* ==========================================================================
   Responsive: two columns → rail above map

   The map had no breakpoints at all until 2026-08-11, and the two fixed widths
   in this file are what made that fail rather than merely tighten: a 268 px
   rail and a 228 px floating key are 496 px of furniture, so on a 393 px phone
   the plot was a 125 px strip and the key sat on top of the rail, covering the
   projection pills and half the Layers group. Measured on the running app,
   both views, before this block existed.

   Retrieve already answers this by stacking its columns and handing the scroll
   back to the document (retrieve.css, max-width: 1180px). The map does the
   same, one breakpoint lower, because the rail is the narrower of the two and
   the plot is the thing that must not be squeezed.
   ========================================================================== */

@media (max-width: 900px) {
  /* The map is a viewport-locked instrument by default: an unbroken chain of
     `flex: 1; min-height: 0` from the shell down to the canvas. Stacked, that
     chain is what has to go, or the rail and the plot would divide one screen
     between them and both would be too small. */
  .bm-app { flex: none; min-height: 0; overflow: visible; }
  .bm-body { flex-direction: column; }

  .bm-rail {
    width: auto;
    overflow-y: visible;
    border-right: none;
    border-bottom: 1px solid var(--border-strong);
    /* Above the map rather than beside it, the rail is wide and short instead
       of narrow and tall, so the groups run across: one column on a phone,
       three on a tablet, decided by the 210 px a control needs rather than by
       a second breakpoint.

       Columns rather than a grid, because the groups are wildly unequal in
       height - "Your retrieval" is three paragraphs and a button, "Dimensions"
       is two pills - and a grid row is as tall as its tallest cell, which left
       about 250 px of empty rail under the short ones on an iPad. Columns
       balance instead, and `break-inside` is what keeps a group whole. */
    columns: 210px 3;
    column-gap: var(--space-4);
  }
  .bm-group { margin-bottom: 16px; break-inside: avoid; }

  /* An explicit height, because the plot no longer has a column to fill. Two
     thirds of the viewport keeps the projection legible while leaving the rail
     visible above it, and the floor keeps it a map rather than a band on a
     short landscape phone. */
  .bm-map-workspace {
    position: relative;
    flex: none;
    height: 68vh;
    min-height: 420px;
  }
  .bm-map-workspace > .bm-plot-wrap {
    flex: 1;
    height: 100%;
    min-height: 0;
  }
  .bm-neighborhood {
    position: absolute;
    z-index: 12;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: min(72%, 560px);
    border-left: 0;
    border-top: var(--border);
    box-shadow: var(--shadow-raised);
  }
  .bm-neighborhood-close,
  .bm-neighborhood-geo { min-height: 44px; }

  /* Plotly parks its modebar at the top right of the canvas, which is where
     the badges wrap into once the plot is narrow. */
  .bm-plot-badges { max-width: calc(100% - 168px); }
}

/* Phone: the key has to stop being a panel and start being a caption. At 228 px
   it covered 58% of a 393 px canvas. Narrowed and capped it costs about a
   ninth of the plot, and the list inside it goes on scrolling, so nothing is
   lost - only smaller. */
@media (max-width: 620px) {
  .bm-legend {
    width: 184px;
    right: 10px;
    max-height: min(46%, 300px);
    padding: 8px 9px;
  }
  .bm-legend-item, .bm-key-row { font-size: 11.5px; }
  /* The count is what squeezes the name, and the name is the part that cannot
     be guessed: "Blood / imm…" beside 155,761 tells you less than the whole
     bucket beside a smaller number. */
  .bm-legend-count, .bm-key-count { font-size: 10.5px; }
  .bm-plot-badges { gap: 6px; top: 10px; left: 10px; }
  .bm-badge { font-size: 11px; padding: 3px 9px; }
  /* One column, and tighter: stacked, the rail stands between the reader and
     the map, so every row it saves is a row of map above the fold. */
  .bm-rail { padding: 14px 14px 16px; columns: 1; }
  .bm-group { margin-bottom: 13px; }
}
/* Fit provenance stays beside its projection without filling the main rail. */
.bm-method-details {
  margin-top: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}
.bm-method-details > summary { cursor: pointer; }
.bm-method-details > summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

/* ---- The first figure's skeleton (layout.map_skeleton) ------------------
   Over the navy canvas, under the real badges and key (z 6 and 7), until the
   figure that replaces the placeholder lands; then it fades in 180 ms and
   stops taking pointer events. Positions mirror the real badges and key. */
.bm-map-skeleton {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  --sk-base: rgba(255, 255, 255, 0.07);
  --sk-sheen: rgba(255, 255, 255, 0.13);
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 180ms;
}
.bm-map-skeleton.is-done { opacity: 0; visibility: hidden; }
.bm-skel-badges { position: absolute; top: 12px; left: 14px; display: flex; gap: 8px; }
.bm-skel-badge { width: 163px; height: 27px; }
.bm-skel-badge.is-short { width: 130px; }
.bm-skel-key {
  position: absolute;
  top: 46px; right: 14px;
  width: 228px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 12px 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
}
.bm-skel-key-title { width: 42%; height: 12px; }
.bm-skel-key-filter { width: 100%; height: 30px; margin-bottom: 2px; }
.bm-skel-key-row { display: flex; align-items: center; gap: 8px; }
.bm-skel-swatch { width: 10px; height: 10px; flex: none; border-radius: 2px; }
.bm-skel-key-label { height: 10px; }
.bm-skel-status {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  color: var(--plot-ui-muted);
  font: 500 var(--text-sm)/1.4 var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
@media (max-width: 620px) {
  .bm-skel-key { width: 184px; right: 10px; max-height: min(46%, 300px); overflow: hidden; }
  .bm-skel-badge.is-short { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bm-map-skeleton { transition: none; }
}
