/*
 * bos-search.css
 * Advanced search page styles for Biodiversity of Singapore
 * Depends on: bos-common.css (CSS variables), Bootstrap (grid/utilities)
 *
 * Font scale from bos-common.css:
 *   --fs-xs:   12px   badges, hints, metadata labels
 *   --fs-sm:   14px   body text, inputs, labels, table cells
 *   --fs-base: 16px   section titles, prominent text
 *   --fs-md:   18px   result count, panel title
 *   --fs-lg:   22px   (not used here)
 */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.srch-page {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 62px);
  background: var(--cream, #f7f5f0);
}

/* ── Left panel: form ────────────────────────────────────────────────────── */

.srch-panel {
  background: var(--cream-dark, #fff);
  border-right: 1px solid var(--border, #e2ddd6);
  height: calc(100vh - 62px);
  position: sticky;
  top: 62px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--stone, #b0a99c) transparent;
}

.srch-panel-inner {
  padding: 28px 24px 40px;
}

.srch-panel-head {
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border, #e2ddd6);
}

.srch-panel-title {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--navy, #1c2b42);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.srch-panel-sub {
  font-size: var(--fs-xs);
  color: var(--stone-dark, #7a6f62);
  font-style: italic;
}

/* ── Form sections ───────────────────────────────────────────────────────── */

.srch-section {
  border-bottom: 1px solid var(--border, #e2ddd6);
  padding-bottom: 18px;
  margin-bottom: 18px;
}
.srch-section:last-of-type { border-bottom: none; }

.srch-section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--stone-dark, #7a6f62);
  margin-bottom: 12px;
}

/* ── Field groups ────────────────────────────────────────────────────────── */

.srch-field-group {
  margin-bottom: 16px;
}
.srch-field-group:last-child { margin-bottom: 0; }

.srch-field-row {
  display: flex;
  gap: 10px;
  margin-bottom: 0;
}
.srch-field-half { flex: 1; margin-bottom: 16px; }

.srch-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary, #4a4035);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.srch-input,
.srch-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  font-size: var(--fs-sm);
  font-family: inherit;
  color: var(--text-primary, #2a2218);
  background: var(--cream, #fff);
  border: 1px solid var(--border-strong, #c8c0b4);
  border-radius: 4px;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-sizing: border-box;
}
.srch-input:focus,
.srch-select:focus {
  outline: none;
  border-color: var(--navy, #1c2b42);
  box-shadow: 0 0 0 3px rgba(91,141,238,.2);
}
.srch-input::placeholder { color: var(--stone, #b0a99c); }

.srch-autocomplete-hint,
.srch-field-hint {
  font-size: var(--fs-xs);
  color: var(--stone-dark, #7a6f62);
  margin-top: 5px;
  line-height: 1.4;
}

/* ── Radio & checkbox rows ───────────────────────────────────────────────── */

.srch-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: flex-start;
}

.srch-check-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.srch-check-row.srch-check-inline {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px 22px;
  align-items: flex-start;
}

.srch-radio-label,
.srch-check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text-secondary, #4a4035);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}
.srch-radio-label input,
.srch-check-label input {
  margin: 0;
  accent-color: var(--navy, #1c2b42);
  cursor: pointer;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* ── Conservation status grid ────────────────────────────────────────────── */

.srch-cons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Unselected: dark tint of the IUCN colour + coloured border, light text
   (readable at any state — the old 40%-opacity chip faded the text too).
   Selected: the solid IUCN colour with --cons-text (white or dark, chosen
   per status in search.php to meet WCAG AA 4.5:1). */
.srch-cons-chip {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-primary, #eef0f4);
  background: color-mix(in srgb, var(--cons-color, #bdbdbd) 22%, transparent);
  border: 1px solid var(--cons-color, #bdbdbd);
  border-radius: 3px;
  padding: 4px 11px;
  min-height: 32px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  transition: background 0.12s, outline 0.12s;
  outline: 2px solid transparent;
}
.srch-cons-chip:has(input:checked) {
  color: var(--cons-text, #fff);
  background: var(--cons-color, #bdbdbd);
  outline: 2px solid var(--text-primary, #eef0f4);
  outline-offset: 1px;
}
.srch-cons-chip:hover { background: color-mix(in srgb, var(--cons-color, #bdbdbd) 40%, transparent); }
.srch-cons-chip:has(input:checked):hover { background: var(--cons-color, #bdbdbd); }
.srch-cons-chip:has(input:focus-visible) { outline: 2px solid var(--text-primary, #eef0f4); outline-offset: 1px; }

/* Legend of the status codes — touch screens only (no hover tooltip there). */
.srch-cons-legend { display: none; font-size: var(--fs-xs); color: var(--text-secondary, rgba(238, 240, 244, 0.72)); line-height: 1.6; margin: 0 0 6px; }
.srch-cons-legend b { color: var(--text-primary, #eef0f4); font-weight: 700; }
.srch-cons-legend span { white-space: nowrap; } /* keep each code with its name */
@media (hover: none) {
  .srch-cons-legend { display: block; }
  .srch-hint-hover { display: none; }
}

/* Live result count under the search input — stacked layout only (the
   two-column desktop layout already shows results beside the form). */
.srch-jump { display: none; }
@media (max-width: 900px) {
  .srch-jump:not([hidden]) {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; margin-top: 8px; padding: 10px 14px; min-height: 44px;
    border: 1px solid var(--navy, #5b8dee); border-radius: 6px;
    background: var(--navy-dark, #1c2b42); color: var(--text-primary, #eef0f4);
    font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
  }
  .srch-jump-cta { font-weight: 700; white-space: nowrap; color: var(--text-primary, #eef0f4); }
  .srch-jump--searching, .srch-jump--noresults, .srch-jump--error {
    cursor: default; border-color: var(--border, rgba(255, 255, 255, 0.15)); background: transparent;
    color: var(--text-secondary, rgba(238, 240, 244, 0.72));
  }
}

/* Active-filter count on a collapsed/expanded filter section header. */
.srch-active-count:not(:empty) {
  display: inline-block; margin-left: 8px; min-width: 20px; padding: 1px 7px;
  border-radius: 10px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.5;
  background: var(--navy-dark, #1c2b42); color: var(--text-primary, #eef0f4); border: 1px solid var(--navy, #5b8dee);
}
.srch-cons-chip input { position: absolute; opacity: 0; width: 0; height: 0; }

/* ── Progressive disclosure ──────────────────────────────────────────────── */

.srch-disclosure-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  padding: 0 0 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: inherit;
  color: var(--navy, #1c2b42);
  cursor: pointer;
  text-align: left;
}
.srch-disclosure-btn:hover { opacity: 0.75; }

.srch-chevron {
  flex-shrink: 0;
  transition: transform 0.18s ease;
  color: var(--stone-dark, #7a6f62);
}

.srch-disclosure-body {
  padding-top: 4px;
}

/* ── Form actions ────────────────────────────────────────────────────────── */

.srch-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
}

.srch-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--navy, #1c2b42);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 11px 22px;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s;
  flex: 1;
  justify-content: center;
}
.srch-btn-primary:hover { background: var(--navy-mid, #263d5e); }

.srch-btn-reset {
  font-size: var(--fs-sm);
  color: var(--stone-dark, #7a6f62);
  text-decoration: none;
  flex-shrink: 0;
}
.srch-btn-reset:hover { color: var(--navy, #1c2b42); }

/* ── Right panel: results ────────────────────────────────────────────────── */

.srch-results {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* ── Search-in-progress animation ───────────────────────────────────────── */

/* Progress bar — fixed at the very top of the results panel */
.srch-progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	z-index: 50;
	opacity: 0;
	transition: opacity 0.1s;
	pointer-events: none;
}
.srch-progress--active {
	opacity: 1;
}
.srch-progress-bar {
	height: 100%;
	width: 0%;
	background: #5b8dee;
	transition: width 0.1s ease-out;
	border-radius: 0 2px 2px 0;
}

/* Live-region fade during fetch */
.srch-live-fetching {
	opacity: 0.45;
	transition: opacity 0.15s;
	pointer-events: none;
	user-select: none;
}

/* Error state in live region */
.srch-idle-body--error {
	padding-top: 28px;
}
.srch-error-msg {
	font-size: var(--fs-sm);
	font-weight: 500;
	color: #f28b82;
	margin: 0 0 8px;
}
.srch-error-hint {
	font-size: var(--fs-sm);
	color: var(--stone-dark, #7a6f62);
	font-weight: 300;
	margin: 0;
}

/* Hero error state */
.srch-hero--error {
	min-height: 120px;
	align-items: center;
	background: #5c1a10;
}

/* Keep srch-results position:relative so progress bar is anchored */
.srch-results { position: relative; }

/* ── Hero strip ──────────────────────────────────────────────────────────── */

.srch-hero {
  position: relative;
  /* Was var(--navy) — that's now the bright #5b8dee dark-theme accent, too
     light for a full-width banner fill; --cream-dark is the actual dark
     "elevated surface" tone used for cards/panels elsewhere. */
  background: var(--cream-dark, #1c2b42);
  color: #fff;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 36px 36px 28px;
  transition: min-height 0.3s ease;
}

/* Idle / no-results: tall hero */
.srch-hero--idle,
.srch-hero--noresults {
  min-height: 260px;
  align-items: center;
}

/* Results: compact strip */
.srch-hero--results {
  min-height: 72px;
  align-items: center;
  padding: 18px 28px;
}


.srch-hero-content {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.srch-hero-eyebrow {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 8px;
}

.srch-hero-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.srch-hero-sub {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,0.55);
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.02em;
}

/* Results-state hero content */
.srch-hero-results-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.srch-hero-count {
  font-size: var(--fs-md);
  font-weight: 700;
  color: #fff;
}

.srch-hero-breakdown {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,0.6);
}

.srch-hero-query {
  font-size: var(--fs-sm);
  color: rgba(255,255,255,0.5);
  font-style: italic;
}

.srch-hero-time {
  font-size: var(--fs-xs);
  color: rgba(255,255,255,0.35);
  margin-left: auto;
}

/* ── Idle body: hint cards ───────────────────────────────────────────────── */

.srch-idle-body {
  padding: 32px 36px 48px;
}

.srch-hints-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.srch-hint-card {
  background: var(--cream-dark, #fff);
  border: 1px solid var(--border, #e2ddd6);
  border-radius: 6px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.srch-hint-card:hover {
  border-color: var(--stone, #b0a99c);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}

.srch-hint-card-icon {
  width: 40px;
  height: 40px;
  background: var(--cream-dark, #ede9e2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy, #1c2b42);
  flex-shrink: 0;
}

.srch-hint-card-body {
  font-size: var(--fs-sm);
  color: var(--text-secondary, #4a4035);
  line-height: 1.5;
}
.srch-hint-card-body strong {
  display: block;
  font-weight: 600;
  color: var(--navy, #1c2b42);
  margin-bottom: 5px;
}
.srch-hint-card-body p {
  margin: 0;
  font-weight: 300;
}

/* ── No-results body ─────────────────────────────────────────────────────── */

.srch-idle-body--noresults {
  padding-top: 28px;
}

.srch-noresults-suggestions {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy, #1c2b42);
  margin: 0 0 12px;
}

.srch-noresults-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.srch-noresults-list li {
  font-size: var(--fs-sm);
  color: var(--text-secondary, #4a4035);
  font-weight: 300;
  line-height: 1.5;
}

/* ── Results body ────────────────────────────────────────────────────────── */

.srch-results-body {
  padding: 0;
}

.srch-tabs {
  display: flex;
  gap: 0;
  padding: 0 28px;
  border-bottom: 1px solid var(--border, #e2ddd6);
  background: var(--cream-dark, #fff);
}

.srch-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 18px;
  font-size: var(--fs-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--stone-dark, #7a6f62);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  position: relative;
  bottom: -1px;
}
.srch-tab:hover { color: var(--navy, #1c2b42); }
.srch-tab.active {
  color: var(--navy, #1c2b42);
  font-weight: 600;
  border-bottom-color: var(--navy, #1c2b42);
}

.srch-tab-count {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--stone-dark, #7a6f62);
  background: var(--cream-dark, #ede9e2);
  border-radius: 3px;
  padding: 1px 6px;
  line-height: 1.5;
}
.srch-tab.active .srch-tab-count {
  color: #5b8dee;
  background: rgba(91, 141, 238, 0.18);
}

.srch-tab-panel-hidden { display: none; }

/* ── Results table ───────────────────────────────────────────────────────── */

/* Safety-net scroll container for every results table — table columns
   won't shrink below their content's natural minimum width (long catalog
   numbers, localities, etc.), so without this a narrow viewport would
   force the whole page to scroll horizontally instead of just the table. */
.srch-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.srch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  margin-top: 0;
}

.srch-table thead th {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-dark, #7a6f62);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border, #e2ddd6);
  background: var(--cream, #f7f5f0);
  white-space: nowrap;
}

.srch-row {
  border-bottom: 1px solid var(--border, #e2ddd6);
  transition: background 0.1s;
}
.srch-row:hover { background: rgba(255, 255, 255, 0.06); }
.srch-row-alt  { background: rgba(255, 255, 255, 0.03); }
.srch-row-alt:hover { background: rgba(255, 255, 255, 0.06); }

.srch-table td {
  padding: 12px;
  vertical-align: top;
  font-size: var(--fs-sm);
  color: var(--text-secondary, #4a4035);
}

.srch-name-cell { max-width: 320px; }

.srch-taxon-link {
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--navy, #1c2b42);
  text-decoration: none;
  display: block;
  line-height: 1.3;
}
.srch-name-syn  { color: var(--stone-dark, #7a6f62); font-style: italic; }
.srch-name-mis  { color: #f28b82; font-style: italic; }

.srch-name-badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
}
.srch-badge-syn { background: var(--stone, #c8c2b4); color: var(--text-primary, #1a1a18); }
.srch-badge-mis { background: rgba(217, 91, 71, 0.2); color: #f28b82; }

.srch-common-name {
  display: block;
  font-size: var(--fs-xs);
  color: var(--stone-dark, #7a6f62);
  font-weight: 300;
  margin-top: 3px;
}

.srch-accepted-name {
  display: block;
  font-size: var(--fs-xs);
  color: var(--stone-dark, #7a6f62);
  font-style: italic;
  margin-top: 3px;
}

/* Old/invalid name that matched the search (taxon_literature.taxonName) —
   struck through since it's not the taxon's current name. */
.srch-old-name {
  display: block;
  font-size: var(--fs-xs);
  color: var(--stone-dark, #7a6f62);
  margin-top: 3px;
}

.srch-rank-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone-dark, #7a6f62);
  background: var(--cream-dark, #ede9e2);
  border-radius: 3px;
  padding: 2px 7px;
  white-space: nowrap;
}

.srch-sp-count {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--stone-dark, #7a6f62);
  background: var(--cream-dark, #ede9e2);
  border-radius: 3px;
  padding: 2px 7px;
}

.srch-col-sp    { width: 80px; text-align: right; }

/* ── Specimen tab ────────────────────────────────────────────────────────── */

.srch-catalog-link {
  font-family: monospace;
  font-size: var(--fs-sm);
  color: var(--navy, #1c2b42);
  text-decoration: none;
}

.srch-locality-cell { max-width: 200px; }
.srch-date-cell     { white-space: nowrap; }

/* ── Literature tab ──────────────────────────────────────────────────────── */

.srch-lit-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }

.srch-lit-item {
  background: var(--cream-dark, #fff);
  border: 1px solid var(--border, #e2ddd6);
  border-radius: 4px;
  padding: 14px 18px;
}

.srch-lit-citation {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text-secondary, #4a4035);
  margin-bottom: 10px;
}
.srch-lit-authors { font-weight: 500; color: var(--navy, #1c2b42); margin-right: 4px; }
.srch-lit-year    { color: var(--stone-dark, #7a6f62); margin-right: 4px; }
.srch-lit-title   { font-weight: 400; margin-right: 4px; }
/* When title is a link (literature.url set). White at rest, blue on
   hover — per Nicky, swapped from the reverse (which in turn replaced an
   even earlier navy/black attempt) after seeing how this actually renders;
   go with the observed result rather than the color math from here. */
a.srch-lit-title  { color: #fff; text-decoration: none; }
a.srch-lit-title:hover { color: #5b8dee; text-decoration: underline; }
.srch-lit-journal { color: var(--stone-dark, #7a6f62); margin-right: 4px; }
.srch-lit-vol     { color: var(--stone-dark, #7a6f62); font-size: var(--fs-xs); }

.srch-lit-tags { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

.srch-lit-taxon-tag {
  font-size: var(--fs-xs);
  font-style: italic;
  color: #5b8dee;
  background: rgba(91, 141, 238, 0.18);
  border-radius: 20px;
  padding: 3px 10px;
  text-decoration: none;
}
/* Hover previously just darkened the same blue tint the text already uses
   (rgba(91,141,238,.18) -> .3) — text and background converging on the same
   hue made the label nearly unreadable. Invert to a solid, high-contrast
   background instead (white-on-navy, ~14:1) rather than another shade of
   the same blue. */
.srch-lit-taxon-tag:hover { background: var(--navy, #1c2b42); color: #fff; }

.srch-lit-doi {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone-dark, #7a6f62);
  background: var(--cream-dark, #ede9e2);
  border-radius: 3px;
  padding: 2px 7px;
  text-decoration: none;
  margin-left: auto;
}
.srch-lit-doi:hover { color: var(--navy, #1c2b42); }

/* ── Load more ───────────────────────────────────────────────────────────── */

.srch-more {
  padding: 16px 12px;
  font-size: var(--fs-sm);
  color: var(--stone-dark, #7a6f62);
  text-align: center;
  border-top: 1px solid var(--border, #e2ddd6);
}
.srch-more-link {
  color: var(--navy, #1c2b42);
  font-weight: 600;
  margin-left: 6px;
  text-decoration: underline;
}

/* ── Autocomplete dropdown ───────────────────────────────────────────────── */

.srch-autocomplete-wrap {
  position: relative;
}

.srch-ac-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--cream-dark, #fff);
  border: 1px solid var(--border-strong, #c8c0b4);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.srch-ac-dropdown.srch-ac-open {
  display: block;
}

.srch-ac-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #e2ddd6);
  transition: background 0.08s;
}
.srch-ac-item:last-child { border-bottom: none; }
.srch-ac-item:hover,
.srch-ac-item.srch-ac-active {
  background: rgba(255, 255, 255, 0.06);
}

.srch-ac-label {
  font-size: var(--fs-sm);
  color: var(--navy, #1c2b42);
  min-width: 0;
}
.srch-ac-label i,
.srch-ac-label em { font-style: italic; }

.srch-ac-meta {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--stone-dark, #7a6f62);
  background: var(--cream-dark, #ede9e2);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* No-results feedback inside dropdown */
.srch-ac-empty {
  padding: 14px 16px;
  font-size: var(--fs-sm);
  color: var(--stone-dark, #7a6f62);
  font-style: italic;
  text-align: center;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .srch-page { grid-template-columns: 290px 1fr; }
  .srch-hints-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .srch-page {
    display: flex;
    flex-direction: column;
  }
  .srch-panel {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border, #e2ddd6);
  }
  .srch-hero { padding: 24px 20px 20px; }
  .srch-hero--idle,
  .srch-hero--noresults { min-height: 180px; }
  .srch-hero-title { font-size: 22px; }
  .srch-idle-body { padding: 20px 20px 36px; }
  .srch-hints-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .srch-tabs { padding: 0 16px; }
  /* The drag-to-resize handle only makes sense for the desktop two-column
     grid (dragging a grid-template-columns split) — .srch-page is a
     single-column flex stack at this width, so dragging has nothing to
     resize. Left visible it would still occupy a full-viewport-height
     sticky block (its desktop sizing is untouched here) between the form
     and the results with no function. */
  .srch-panel-resizer { display: none; }
}

@media (max-width: 600px) {
  .srch-panel-inner { padding: 20px 16px 28px; }
  .srch-hero { padding: 20px 16px; }
  .srch-hero--idle,
  .srch-hero--noresults { min-height: 160px; }
  .srch-hero-title { font-size: 20px; }
  .srch-idle-body { padding: 16px 16px 30px; }
  .srch-hints-grid { grid-template-columns: 1fr; }
  .srch-tabs { padding: 0 12px; }
  .srch-field-row { flex-direction: column; gap: 0; }
  .srch-field-half { margin-bottom: 16px; }
  .srch-col-sp { display: none; }
  /* Scoped to .srch-table--taxa specifically — the bare .srch-table
     selector used to match every results table, so this accidentally hid
     the 3rd column of the specimens table (Institution) too, not just
     Rank in the taxa list. */
  .srch-table--taxa thead th:nth-child(3) { display: none; }
  .srch-table--taxa td:nth-child(3) { display: none; }
  /* Specimens table: Institution is the least essential column at this
     width — hidden explicitly (was previously an accidental side effect
     of the unscoped rule above, now an intentional, scoped one). */
  .srch-table--specimens thead th:nth-child(3) { display: none; }
  .srch-table--specimens td:nth-child(3) { display: none; }
  /* View-toggle icon buttons are 28x24px on desktop — below a comfortable
     touch target size on mobile. */
  .srch-vtoggle { width: 36px; height: 32px; }
}

/* ── Taxa view toggle ────────────────────────────────────────────────────── */

.srch-taxa-toolbar {
	display: flex;
	align-items: center;
	padding: 10px 28px 0;
	justify-content: flex-end;
}

.srch-view-toggle {
	display: flex;
	gap: 2px;
}

.srch-vtoggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 24px;
	background: var(--cream, #f7f5f0);
	border: 1px solid var(--border-strong, #c8c0b4);
	border-radius: 3px;
	cursor: pointer;
	color: var(--stone-dark, #7a6f62);
	opacity: 0.38;
	transition: opacity 0.15s;
}
.srch-vtoggle.active  { opacity: 1; }
.srch-vtoggle:hover   { opacity: 0.7; }
.srch-vtoggle.active:hover { opacity: 1; }

/* ── Taxa grid view ──────────────────────────────────────────────────────── */

.srch-taxa-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
	padding: 16px 28px 4px;
}

.srch-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--border, #e2ddd6);
	border-radius: 4px;
	overflow: hidden;
	background: var(--cream-dark, #fff);
	text-decoration: none;
	color: var(--text-primary, #2a2218);
	transition: border-color 0.15s, box-shadow 0.15s;
}
.srch-card:hover {
	border-color: var(--stone, #b0a99c);
	box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.srch-card-photo {
	width: 100%;
	aspect-ratio: 4/3;
	overflow: hidden;
	background: var(--cream-dark, #ede9e2);
	flex-shrink: 0;
	position: relative;
}
.srch-card-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s;
}
.srch-card:hover .srch-card-photo img { transform: scale(1.05); }

.srch-card-nophoto {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--stone, #b0a99c);
}

/* Conservation badge overlaid on photo */
.srch-card-cons {
	position: absolute;
	top: 6px;
	right: 6px;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	color: #fff;
	border-radius: 3px;
	padding: 2px 5px;
	line-height: 1.4;
	cursor: default;
}

.srch-card-info {
	position: relative;
	padding: 8px 10px 9px;
	display: flex;
	flex-direction: column;
	gap: 3px;
}
/* Reserve room so the name/rank text doesn't run under the count badge —
   only when a badge is actually present. */
.srch-card-info--has-count { padding-right: 38px; }

.srch-card-name-row {
	display: flex;
	align-items: baseline;
	gap: 5px;
	flex-wrap: wrap;
}

.srch-card-name {
	font-size: var(--fs-sm);
	font-weight: 400;
	color: var(--navy, #1c2b42);
	line-height: 1.3;
	flex: 1 1 auto;
	min-width: 0;
}
.srch-card-name.srch-name-syn  { color: var(--stone-dark, #7a6f62); font-style: italic; }
.srch-card-name.srch-name-mis  { color: #f28b82; font-style: italic; }

/* Species-count badge, anchored to the top-right of the textual info box
   (name + rank), over its white background — not the photo above it — so
   it always sits in a fixed spot regardless of how many lines the name
   wraps to. */
.srch-card-count {
	position: absolute;
	top: 8px;
	right: 10px;
	font-size: 10px;
	font-weight: 600;
	color: var(--stone-dark, #7a6f62);
	background: var(--cream-dark, #ede9e2);
	border-radius: 3px;
	padding: 1px 5px;
	line-height: 1.5;
	white-space: nowrap;
}

.srch-card-common {
	font-size: var(--fs-xs);
	color: var(--stone-dark, #7a6f62);
	font-weight: 300;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Old/invalid name that matched the search (taxon_literature.taxonName) —
   struck through since it's not the taxon's current name. */
.srch-card-oldname {
	font-size: var(--fs-xs);
	color: var(--stone-dark, #7a6f62);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.srch-card-meta {
	display: flex;
	align-items: center;
	gap: 5px;
	margin-top: 1px;
}

.srch-card-rank {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--stone-dark, #7a6f62);
	background: var(--cream-dark, #ede9e2);
	border-radius: 3px;
	padding: 1px 5px;
}

.srch-card-residency {
	font-size: var(--fs-xs);
	color: var(--stone-dark, #7a6f62);
	font-weight: 300;
}

/* ── Taxa list view — thumbnail column ───────────────────────────────────── */

.srch-taxa-list {
	padding: 4px 0 0;
}

.srch-col-thumb {
	width: 52px;
	padding: 6px 4px 6px 12px !important;
}

.srch-list-thumb {
	width: 44px;
	height: 44px;
	object-fit: cover;
	border-radius: 3px;
	display: block;
	background: var(--cream-dark, #ede9e2);
}

.srch-list-thumb--empty {
	width: 44px;
	height: 44px;
	border-radius: 3px;
	background: var(--cream-dark, #ede9e2);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
	.srch-taxa-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
	.srch-taxa-grid { padding: 12px 16px 4px; grid-template-columns: repeat(3, 1fr); gap: 10px; }
	.srch-taxa-toolbar { padding: 10px 16px 0; }
	.srch-taxa-list { padding: 0; }
}

@media (max-width: 600px) {
	.srch-taxa-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 12px 4px; }
	.srch-taxa-toolbar { padding: 8px 12px 0; }
}

/* ── 100-record limit note ───────────────────────────────────────────────── */
.srch-limit-note {
	margin: 12px 28px 0;
	padding: 10px 14px;
	background: rgba(232, 190, 122, 0.12);
	border: 1px solid rgba(232, 190, 122, 0.4);
	border-radius: 4px;
	font-size: var(--fs-sm);
	color: #e8be7a;
	line-height: 1.5;
}

/* ── No-image card placeholder label ────────────────────────────────────── */
.srch-card-nophoto {
	flex-direction: column;
	gap: 6px;
}
.srch-card-nophoto-label {
	font-size: var(--fs-xs);
	color: var(--stone-dark, #7a6f62);
}

/* ── Sub-label for grouped date range fields ─────────────────────────────── */
.srch-label--sub {
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	color: var(--stone-dark, #7a6f62);
	font-size: var(--fs-xs);
	margin-bottom: 4px;
}

/* ── Disabled rank options — visually faded ──────────────────────────────── */
.srch-select option:disabled {
	color: var(--stone, #b0a99c);
	background: var(--cream, #f7f5f0);
	font-style: italic;
}

/* ── Panel resize handle ─────────────────────────────────────────────────── */
.srch-panel-resizer {
	position: sticky;
	top: 62px;
	width: 5px;
	height: calc(100vh - 62px);
	background: transparent;
	cursor: col-resize;
	flex-shrink: 0;
	z-index: 10;
	transition: background 0.15s;
}
.srch-panel-resizer:hover,
.srch-panel-resizer:active {
	background: var(--navy, #1c2b42);
	opacity: 0.18;
}

/* ── Taxon filter section — disclosure button as section header ───────────── */
/* taxonToggle uses the same .srch-disclosure-btn style as other sections,
   but the section itself uses the same border-bottom pattern — no extra CSS needed */

/* ── Matched-term highlighting ────────────────────────────────────────────── */
/* Opaque colour pair (not a themed/translucent token) so contrast holds
   regardless of this page's light or dark (.btt-header-page) surroundings —
   see search-results.php's bos_highlightSearchTerms() calls. */
mark.srch-hl {
	background: #efe6c2;
	color: #5a4f2e;
	padding: 0 0 2px;
	margin: 0;
	border-radius: 2px;
}
