/* Explore tab.

   The v2 typed-slot chart builder, plus the featured-insights
   row that sits above it. The builder itself is in .x2-* (see
   below); legacy v1 selectors (.builder-layout, .bf-row, .bf-share*,
   .bf-color-legend, .heatmap-grid, .builder-bar) were retired
   with R-2-f.

   Hierarchy:
   - .bf-insights / .bf-insight-card — the recommended-charts row at
     the top of the tab.
   - .x2-* — the v2 typed-slot builder (shelf / rail / slots /
     filters / drag-and-drop visuals). Owns everything below the
     recommended row. */

/* Featured insights — a curated row of mini-charts at the top of
   Explore. Each card is clickable; the headline names the finding,
   the mini-chart previews it, the sub explains what to notice.
   Loads into the Builder on click. */
.bf-insights { margin: 6px 0 18px; }
.bf-insights-label {
  font-size: var(--text-xs); color: var(--ink-3); font-weight: 600;
  text-transform: uppercase; letter-spacing: var(--track-eyebrow);
  margin-bottom: var(--space-2);
}
.bf-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
/* @applies-to button */
.bf-insight-card {
  text-align: left;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--space-3);
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.bf-insight-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.bf-insight-headline {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.bf-insight-sub {
  font-size: var(--text-xs);
  color: var(--ink-3);
  line-height: 1.45;
}
/* Inside each card the mini-chart is constrained to a short row
   so the card stays roughly square — the chart renderers handle
   small sizes via the existing facet sizing path. */
.bf-insight-mini {
  flex: 1;
  min-height: 110px;
  max-height: 160px;
  overflow: hidden;
  pointer-events: none;
}
.bf-insight-mini svg { width: 100%; height: 100%; max-height: 150px; }
/* ────────────────────────────────────────────────────────────
   Explore v2: typed-slot chart builder, behind ?explore=v2.
   Owns the area below the recommended-charts row. R-2-b ships
   the layout + slot-click pickers; DnD activates in R-2-c.
   ──────────────────────────────────────────────────────────── */

.x2-builder {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.x2-shelf {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--space-3);
  font-size: var(--text-sm);
}
.x2-shelf-search {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font: inherit;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
.x2-shelf-search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.x2-shelf-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.x2-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: grab;
  color: var(--ink-2);
  user-select: none;
}
.x2-field:hover { background: var(--surface-hover); color: var(--ink); }
.x2-field-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  border-radius: var(--r-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: ui-monospace, monospace;
}
.x2-kind-categorical { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.x2-kind-ordinal     { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.x2-kind-numeric     { background: color-mix(in srgb, var(--g-strong) 14%, transparent); color: var(--g-strong); }
.x2-shelf-empty {
  color: var(--ink-3);
  font-style: italic;
  padding: 6px 8px;
}
.x2-shelf-toggle {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: var(--space-2) 0 0;
  margin-top: var(--space-2);
  border-top: 1px solid var(--rule);
  width: 100%;
  text-align: left;
}
.x2-shelf-toggle:hover { text-decoration: underline; }
.x2-shelf-toggle:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--r-sm);
}

.x2-canvas {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Recipe inherited from .card (components.css). The historical
   var(--space-4) padding stays on the variant selector so the
   chart canvas inside the v2 builder retains its tighter look —
   .card's default is var(--space-5). */
.x2-chart-card {
  padding: var(--space-4);
}
.x2-chart {
  min-height: 360px;
}
.x2-notes {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.x2-rail {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--space-3);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.x2-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border: 1px dashed var(--rule);
  border-radius: var(--r-sm);
  background: var(--card);
  min-height: 38px;
}
.x2-slot--empty {
  cursor: pointer;
  color: var(--ink-3);
}
.x2-slot--empty:hover {
  border-color: var(--accent);
  color: var(--ink-2);
}
.x2-slot--empty:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.x2-slot--filled {
  border-style: solid;
  border-color: var(--accent);
}
.x2-slot--filled:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.x2-slot-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  color: var(--ink-3);
  font-weight: 600;
  min-width: 60px;
}
.x2-slot-value {
  flex: 1;
  color: var(--ink);
  font-weight: 500;
}
.x2-slot-placeholder {
  flex: 1;
  font-style: italic;
}
.x2-slot-clear {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
}
.x2-slot-clear:hover { color: var(--ink); }
.x2-slot-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.x2-slot-picker {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 100;
  min-width: 240px;
  margin-top: var(--space-1);
  font: inherit;
  font-size: var(--text-sm);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
}
.x2-rail-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--rule);
}
.x2-agg-select {
  font: inherit;
  font-size: var(--text-sm);
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--ink);
}
.x2-agg-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* "Remap, never reset" — slots that aren't used by the current
   auto-selected chart shape stay filled (we never wipe the field)
   but render dimmed with an explanatory title. Pure visual hint;
   the picker / DnD wiring still works in case the user wants to
   change it. */
.x2-slot--muted {
  opacity: 0.55;
}
.x2-slot--muted .x2-slot-value {
  font-style: italic;
}
.x2-rail-row--muted {
  opacity: 0.55;
}

/* Drag-and-drop visual states. The drag source ghosts itself, and
   each slot pre-marks accept / reject as soon as the drag starts so
   the user sees the typed-DnD contract before they hover. On the
   active hover the highlight intensifies. */
.x2-field--dragging {
  opacity: 0.4;
}
.x2-slot--accept-hint {
  border-color: var(--g-strong);
  border-style: solid;
  background: color-mix(in srgb, var(--g-strong) 4%, var(--card));
}
.x2-slot--reject-hint {
  border-color: var(--rule);
  background: color-mix(in srgb, var(--ink-3) 4%, var(--card));
}
.x2-slot--drop-accept {
  border-color: var(--g-strong);
  border-style: solid;
  background: color-mix(in srgb, var(--g-strong) 12%, var(--card));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--g-strong) 28%, transparent);
}
.x2-slot--drop-reject {
  border-color: var(--neg);
  border-style: dashed;
  background: color-mix(in srgb, var(--neg) 8%, var(--card));
  cursor: not-allowed;
}

/* Filter section — sits below the encoding rail's agg row. One
   drop zone plus one card per active filter. The drop zone reuses
   the slot accept-hint / drop-accept visuals via the same class
   names, so drag feedback feels consistent across the rail. */
.x2-filters {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
}
.x2-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.x2-filter {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: var(--r-sm);
  padding: var(--space-2);
  min-width: 200px;
  flex: 0 1 auto;
}
.x2-filter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.x2-filter-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}
.x2-filter-clear {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.x2-filter-clear:hover { color: var(--ink); }
.x2-filter-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.x2-filter-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.x2-filter-numlabel {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

/* Numeric-filter histogram + dual range slider. Two
   <input type="range"> overlay on the same 200x40 box; only the
   thumbs render visibly (track and ticks suppressed). The
   histogram SVG sits behind both inputs and the bars within the
   selected range render at higher opacity. */
.x2-filter-range {
  position: relative;
  width: 100%;
  max-width: 200px;
  height: 40px;
}
.x2-filter-hist {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.x2-filter-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  pointer-events: none; /* let pointer events through to thumbs only */
}
.x2-filter-slider::-webkit-slider-runnable-track,
.x2-filter-slider::-moz-range-track {
  background: transparent;
  border: none;
  height: 100%;
}
.x2-filter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 12px;
  height: 40px;
  background: var(--accent);
  border: 0;
  border-radius: 2px;
  cursor: ew-resize;
  opacity: 0.85;
}
.x2-filter-slider::-moz-range-thumb {
  pointer-events: auto;
  width: 12px;
  height: 40px;
  background: var(--accent);
  border: 0;
  border-radius: 2px;
  cursor: ew-resize;
  opacity: 0.85;
}
.x2-filter-slider:focus-visible::-webkit-slider-thumb {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}
.x2-filter-slider:focus-visible::-moz-range-thumb {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}
.x2-filter-num {
  width: 64px;
  font: inherit;
  font-size: var(--text-sm);
  padding: 2px 6px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
}
.x2-filter-num:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.x2-filter-unit {
  color: var(--ink-3);
  font-size: var(--text-xs);
}
.x2-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.x2-filter-chip {
  font: inherit;
  font-size: var(--text-xs);
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-full);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
}
.x2-filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.x2-filter-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.x2-filter-chip--on {
  background: var(--surface-strong);
  color: var(--surface-strong-ink);
  border-color: var(--surface-strong);
}
.x2-filter-hint {
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-style: italic;
}
.x2-filter-drop {
  border: 1px dashed var(--rule);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--ink-3);
  text-align: center;
  font-style: italic;
  background: var(--paper-2);
}

@media (max-width: 999px) {
  /* Desktop-only per docs/EXPLORE-REDESIGN.md "Scope and positioning".
     Render a friendly fallback message instead of a broken layout. */
  .x2-builder {
    display: block;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--r-md);
    padding: var(--space-5);
    text-align: center;
    color: var(--ink-3);
  }
  .x2-builder > * { display: none; }
  .x2-builder::before {
    content: "The chart builder is a desktop-only feature. Pick a recommended chart above, or open the site on a wider screen.";
    display: block;
    font-size: var(--text-sm);
    line-height: var(--lh-base);
    max-width: 360px;
    margin: 0 auto;
  }
}

/* ──────────────────────────────────────────────────────────────────
   Explore-mode sub-tab toggle (Build a chart / Search bullets).
   Switches between the v2 chart-builder (default) and the bullet
   search panel below. Wired in renderBuildTab → setExploreMode.
   ────────────────────────────────────────────────────────────────── */
.explore-mode-toggle {
  display: inline-flex;
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--card);
}
/* @applies-to button */
.explore-mode-btn {
  background: transparent;
  border: 0;
  padding: 8px 14px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
  border-right: 1px solid var(--rule);
  transition: background .12s, color .12s;
}
.explore-mode-btn:last-child { border-right: 0; }
.explore-mode-btn:hover { background: var(--paper-2); }
.explore-mode-btn.on {
  background: var(--accent);
  /* --paper, not #fff: dark-mode --accent is a light blue where
     white fails AA (2.6:1) — same on-state ink as .chip--on /
     .toggle-btn.on (components.css). */
  color: var(--paper);
}

/* ──────────────────────────────────────────────────────────────────
   Bullet search panel — the "Search bullets" sub-view inside the
   Explore tab. Mounted by site/js/search.js when ?expmode=search is
   active in the URL hash. Faceted-explorer layout: query row on top,
   then a facet rail (live counts per option) beside the results
   column on desktop; at the sidebar-overlay breakpoint the rail
   collapses into a `.disclosure` fold above the results.
   ────────────────────────────────────────────────────────────────── */
.search-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.search-layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.search-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.search-controls {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.search-query-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.search-input {
  flex: 1 1 320px;
  min-width: 240px;
  padding: 8px 12px;
  font: inherit;
  font-size: var(--text-sm);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--ink);
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(22, 58, 95, 0.12);
}
/* @applies-to label */
.search-regex-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.search-regex-toggle input { margin: 0; }
/* @applies-to button */
.search-clear {
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--ink-3);
  cursor: pointer;
}
.search-clear:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* Facet rail. The whole rail sits inside one `.disclosure` fold
   (mobile collapse — summary hidden at desktop widths, where the
   rail renders as a plain sticky column), and each facet group is
   its own nested quiet disclosure so users can fold the lenses they
   don't care about. Caret / cursor / [open] chrome comes from the
   `.disclosure` primitive in components.css. */
.search-facet-fold {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: var(--space-3);
}
/* @applies-to summary */
.search-facet-fold__summary {
  font-size: var(--text-xs);
  color: var(--ink-2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
}
.search-facet-fold__count {
  color: var(--ink-3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: var(--track-default);
}
.search-facet-fold[open] > .search-facet-fold__summary {
  margin-bottom: var(--space-3);
}
.search-facets {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.search-facet { min-width: 0; }
/* @applies-to summary */
.search-facet__summary {
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
}
.search-facet__active {
  color: var(--accent);
  font-weight: 600;
  text-transform: none;
  letter-spacing: var(--track-default);
  margin-left: auto;
}
.search-facet__opts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-1);
}
/* @applies-to button */
.search-chip {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-full);
  padding: 3px 10px;
  font: inherit;
  font-size: var(--text-xs);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.search-chip:hover {
  border-color: var(--accent);
}
.search-chip.on {
  background: var(--accent);
  /* --paper, not #fff — see the .explore-mode-btn.on note above. */
  color: var(--paper);
  border-color: var(--accent);
}
/* Rail-row variant — full-width option row with a right-aligned
   live count. Same chip recipe (border, hover, .on state); only the
   geometry changes. */
.search-chip--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  border-radius: var(--r-sm);
  text-align: left;
}
.search-chip__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-chip__count {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.search-chip--row.on .search-chip__count { color: inherit; }
/* Zero-count options stay clickable (within-group selections are
   OR'd) but read as currently-empty. */
.search-chip--zero { opacity: 0.45; }
/* Publication-month range — two native selects, no drag interactions
   (mobile-safe). */
.search-pubdate {
  gap: var(--space-2);
}
.search-pubdate__field {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.search-pubdate__select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: var(--text-sm);
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--card);
  color: var(--ink);
}
.search-status-line {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.search-error {
  margin: 0;
  padding: 10px 14px;
  background: rgba(194, 90, 42, 0.08);
  border: 1px solid var(--accent-2);
  border-radius: var(--r-sm);
  color: var(--accent-2);
  font-size: var(--text-sm);
}
.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.search-result {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
/* School chip — name + phase + compact grade signal in one bordered
   pill that deep-links to the school profile (#tab=school&urn=…). */
.search-result-school {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-full);
  background: var(--paper-2);
  padding: 2px 10px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.search-result-school:hover {
  border-color: var(--accent);
}
.search-result-school:hover .search-result-school__name {
  text-decoration: underline;
}
.search-result-school__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-school__phase {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--ink-3);
  white-space: nowrap;
}
.search-result-meta {
  font-size: var(--text-xs);
  color: var(--ink-3);
  margin-left: auto;
}
.search-result-grade {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}
/* Grade-coloured text — JS sets data-grade to the canonical lowest_grade
   value (one of the five GRADE_ORDER values). When the bullet has no
   grade, data-grade is empty and the rule above provides the muted
   fallback colour. */
.search-result-grade[data-grade="Exceptional"]        { color: var(--g-exceptional); }
.search-result-grade[data-grade="Strong standard"]    { color: var(--g-strong); }
.search-result-grade[data-grade="Expected standard"]  { color: var(--g-expected); }
.search-result-grade[data-grade="Needs attention"]    { color: var(--g-attention); }
.search-result-grade[data-grade="Urgent improvement"] { color: var(--g-urgent); }
.search-result-text {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--lh-base, 1.45);
  color: var(--ink);
}
.search-result-text mark {
  background: rgba(245, 200, 80, 0.45);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.search-tag {
  display: inline-block;
  font-size: var(--text-xs);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--ink-2);
}
.search-tag-area {
  background: rgba(22, 58, 95, 0.08);
  border-color: rgba(22, 58, 95, 0.2);
  color: var(--accent);
}
.search-tag-posture {
  background: rgba(194, 90, 42, 0.08);
  border-color: rgba(194, 90, 42, 0.2);
  color: var(--accent-2);
}
.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0;
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.search-pagination button {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-2);
  cursor: pointer;
}
.search-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.search-pagination button:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Facet-rail responsiveness. Desktop (above the sidebar-overlay
   breakpoint): the fold's summary is hidden — JS mounts the fold
   open, so the rail reads as a plain sticky column; a media-query
   listener re-opens it if the viewport crosses up from mobile.
   Mobile (≤1000px, down to 375px): single column, the rail becomes
   a tap-to-open disclosure above the results. */
@media (min-width: 1001px) {
  .search-facet-fold__summary { display: none; }
  .search-facet-fold {
    position: sticky;
    top: var(--space-3);
    max-height: calc(100vh - var(--space-6));
    overflow-y: auto;
  }
}
@media (max-width: 1000px) {
  .search-layout { display: block; }
  .search-facet-fold { margin-bottom: var(--space-3); }
  .search-result-meta { margin-left: 0; }
}
