/* assets/css/bento.css */
:root {
  /* Stony Brook Brand Colors */
  --b-brand: #990000;       /* SBU Red */
  --b-brand-dark: #7a0000;
  --b-accent: #FFF;      /* SBU Gold/Yellow (optional accent) */
  --b-ink: #1e1e1e;         /* SBU Black/Gray */
  --b-muted: #000;
  --b-line: #e2e8f0;
  --b-card: #fff;
  --b-radius: 8px;

  /* Light Glass Panel */
  --b-panel-bg: rgba(255, 255, 255, 0.72);
  --b-panel-blur: blur(12px);
  --b-panel-text: #1e1e1e;
  --b-panel-muted: #000;
}

.sbu-bento-wrapper { font-family: "Effra", "Inter", system-ui, sans-serif; overflow-x: visible; visibility: visible; }
.sbu-bento-wrapper.sbu-ready { visibility: visible; }
.sbu-bento-wrapper * { box-sizing: border-box; }
.sbu-bento-wrapper a { color: inherit; text-decoration: none; }
.sbu-container { max-width: 1280px; margin-inline: auto; padding: 0 10px; }

/* --- GLASS PANEL CONTAINER --- */
.sbu-glass-panel {
  background: var(--b-panel-bg);
  backdrop-filter: var(--b-panel-blur);
  border-radius: 16px;
  padding: 30px 40px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  margin-bottom: 30px;
  border: 1px solid rgba(0,0,0,0.08);
  position: relative;
  z-index: 60;
}

/* --- TABS --- */
.sbu-tabs-nav {
  display: flex; justify-content: center; gap: 10px;
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  margin-bottom: 25px;
}
.sbu-tabs-nav::-webkit-scrollbar { display: none; }
.sbu-tab {
  background: transparent;
  color: var(--b-panel-muted);
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: .023rem;
}
.sbu-tab:hover { color: #fff; background: var(--b-brand); border-radius: 6px; }
.sbu-tab.active {
  color: #fff;
  background: var(--b-brand);
  border-radius: 6px;
  border-bottom-color: transparent;
}
.sbu-tab.active:hover {
  color: #fff;
}
.sbu-tab:focus-visible {
  outline: 2px solid #1e40af;
  outline-offset: 3px;
  border-radius: 4px;
  background: transparent;
  color: var(--b-panel-text);
}
.sbu-tab.active:focus-visible {
  color: #fff;
  background: var(--b-brand);
}

/* --- SEARCH INPUT --- */
.sbu-search-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 50px;
  padding: 6px 6px 6px 24px;
  height: 64px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  border: 2px solid transparent;
  transition: border-color 0.2s;
  position: relative;
}
.sbu-search-wrap:focus-within { border-color: var(--b-brand); }

.sbu-search-input {
  flex: 1; border: 0; background: transparent;
  color: var(--b-ink); font-size: 16px; outline: 0;
  height: 100%; font-weight: 500;
}

.sbu-search-btn {
  height: 52px; width: 80px;
  border-radius: 40px; border: none;
  background: var(--b-brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s;
}
.sbu-search-btn:hover { background: var(--b-brand-dark); }

/* Voice search button — sits at the LEFT edge of the search pill (Google-style),
   so it's near the input field where it logically belongs and doesn't crowd
   the right-side controls. */
.sbu-mic-btn {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  margin-left: -12px; /* pull a bit into the pill's left padding so it sits visually closer to the edge */
  margin-right: 6px;  /* gap from the input field */
  flex-shrink: 0;
  position: relative; /* enables the absolutely-positioned listening pulse */
  transition: color 0.15s, background-color 0.15s;
}
.sbu-mic-btn:hover { color: var(--b-brand); background: rgba(153, 0, 0, 0.06); }
.sbu-mic-btn:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }
.sbu-mic-btn .sbu-mic-icon { display: block; }

/* Listening state: brand-red icon + pulsing halo */
.sbu-mic-btn.sbu-mic-listening {
  color: var(--b-brand);
  background: rgba(153, 0, 0, 0.10);
}
.sbu-mic-btn.sbu-mic-listening::after {
  content: "";
  position: absolute;
  width: 40px; height: 40px;
  border-radius: 50%;
  pointer-events: none;
  animation: sbu-mic-pulse 1.4s ease-out infinite;
}
@keyframes sbu-mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(153, 0, 0, 0.45); }
  70%  { box-shadow: 0 0 0 12px rgba(153, 0, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(153, 0, 0, 0); }
}

/* Processing state: transcript is being fetched from the STT service */
.sbu-mic-btn.sbu-mic-processing { color: var(--b-brand); cursor: default; }
.sbu-mic-btn.sbu-mic-processing .sbu-mic-icon { opacity: 0; }
.sbu-mic-btn.sbu-mic-processing::after {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(153, 0, 0, 0.25);
  border-top-color: var(--b-brand);
  pointer-events: none;
  animation: sbu-mic-spin 0.7s linear infinite;
}
@keyframes sbu-mic-spin { to { transform: rotate(360deg); } }

/* --- CONTEXT AREA (Chips & A-Z) --- */
.sbu-context-area {
  min-height: 100px;
  display: flex; justify-content: center; align-items: flex-start;
  color: var(--b-panel-muted);
  font-size: 1rem;
      width: 80%;
    margin: auto;
    text-align: center;
}
.sbu-label { margin-right: 10px; font-weight: 500; color: var(--b-panel-muted); }

/* Helper Chips */
.sbu-chip {
  background: rgba(0,0,0,0.06);
  color: var(--b-panel-text); border: 1px solid rgba(0,0,0,0.12);
  border-radius: 20px; padding: 4px 14px; margin: 0 4px;
  cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
  margin-bottom: 10px;
}
.sbu-chip:hover { background: var(--b-brand); color: #fff; border-color: var(--b-brand); }

/* A-Z List */
.sbu-az-link {
  color: var(--b-panel-text); font-weight: 700; margin: 0 3px;
  padding: 2px 4px; border-radius: 4px; transition: color 0.2s;
}
.sbu-az-link:hover { color: var(--b-brand); text-decoration: underline; }
.sbu-sep { opacity: 0.4; font-size: 0.8em; margin: 0 1px; }

/* Utilities */
.sbu-hidden { display: none !important; }
.sbu-fade-in { animation: fadeIn 0.3s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- SKELETON LOADING --- */
.sbu-skel-card {
  background: var(--b-card);
  border: 1px solid var(--b-line);
  border-radius: var(--b-radius);
  padding: 24px;
  min-height: 220px;
}
.sbu-skel-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: sbuPulse 1.5s ease-in-out infinite;
  margin-bottom: 12px;
}
.sbu-skel-line.sbu-skel-h { height: 20px; width: 50%; margin-bottom: 16px; }
.sbu-skel-line.sbu-skel-short { width: 70%; }
.sbu-skel-line.sbu-skel-med { width: 85%; }
.sbu-skel-line.sbu-skel-long { width: 95%; }
@keyframes sbuPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- CARD ENTRANCE ANIMATION --- */
.sbu-card-enter {
  animation: sbuSlideUp 0.4s ease both;
}
@keyframes sbuSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- CARD ICON --- */
.sbu-card-icon {
  display: inline-flex;
  align-items: center;
  color: var(--b-brand);
}
.sbu-card-icon svg { width: 20px; height: 20px; }

/* --- BENTO GRID --- */
.sbu-found-section {
  background: #fff; border-radius: 10px; padding: 10px 20px;
  margin: 0 auto; border: 1px solid var(--b-line); display: none;
}
.sbu-found { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.9rem; }
.sbu-found a { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: #fff; border-radius: 6px; border: 1px solid #9ca3af; font-weight: 600; color: #111827; font-size: 0.85rem; text-decoration: none; transition: all 0.15s; cursor: pointer; }
.sbu-found a:hover { background: #eef2ff; border-color: var(--b-brand); color: var(--b-brand); }
.sbu-found-badge { font-size: 0.7rem; font-weight: 700; background: #f1f5f9; color: #475569; padding: 2px 6px; border-radius: 10px; margin-left: 2px; }
.sbu-found a:hover .sbu-found-badge { background: var(--b-brand); color: #fff; }
.sbu-found .found-label { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #111827; margin-right: 4px; }
.sbu-found .found-sep { color: #6b7280; font-size: 0.85rem; margin: 0 2px; }

.sbu-did-you-mean { text-align: center; padding: 0 0 16px 0; font-size: 1.05rem; color: var(--b-panel-muted); font-weight: 400; }
.sbu-dym-link { color: var(--b-brand); font-weight: 700; font-size: 1.1rem; text-decoration: none; cursor: pointer; transition: all 0.2s; border-bottom: 2px dashed var(--b-brand); padding-bottom: 1px; }
.sbu-dym-link:hover { color: var(--b-brand-dark); border-bottom-style: solid; }

/* AI boolean banner — muted grey, always-visible boolean, click code → edit.
   Compact (default): one-line ellipsis-truncated boolean. Click → .editing
   (textarea + Cancel + Search). Search bypasses the AI proxy.
   Color contrast meets WCAG AA: body text ~7.5:1, code text ~10:1,
   button text on dark grey ~14:1, borders ≥3:1 against the page background. */
.sbu-ai-boolean {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  margin: -8px auto 18px; padding: 6px 12px;
  max-width: 900px; width: fit-content;
  background: #f3f4f6;            /* gray-100 */
  border: 1px solid #d1d5db;      /* gray-300 — 3.5:1 vs white page bg */
  border-radius: 10px;
  font-size: 0.85rem; line-height: 1.4;
  color: #374151;                  /* gray-700 — 10.3:1 on #f3f4f6 */
}
.sbu-ai-boolean-text {
  display: inline-flex; align-items: center; gap: 4px;
  color: #374151; font-size: 0.8rem; font-weight: 600;
  flex-shrink: 0; white-space: nowrap;
}
.sbu-ai-boolean-text svg { color: #6b7280; flex-shrink: 0; width: 12px; height: 12px; }

/* Compact code chip — click anywhere to edit */
.sbu-ai-boolean-query {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem; color: #1f2937;          /* gray-800 on #fff = 14.7:1 */
  background: #fff; border: 1px solid #d1d5db;
  padding: 3px 8px; border-radius: 4px;
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: text;
}
.sbu-ai-boolean-query:hover { background: #fafafa; border-color: #9ca3af; }
.sbu-ai-boolean-query:focus-visible {
  outline: 2px solid #1f2937; outline-offset: 2px;
}

/* Editing — textarea replaces the code chip; row wraps to fit textarea.
   Visibility is driven by .editing on the parent (no [hidden] attribute) so
   button display rules don't get specificity-clobbered. */
.sbu-ai-boolean-editor {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem; color: #1f2937;
  background: #fff; border: 1px solid #e5e7eb;
  padding: 12px 16px; border-radius: 12px;
  flex-basis: 100%; order: 2;
  resize: vertical; min-height: 96px; width: 100%;
  line-height: 1.6; letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), inset 0 1px 1px rgba(15, 23, 42, 0.02);
  transition: border-color 0.15s, box-shadow 0.15s;
  display: none;
}
.sbu-ai-boolean-editor::placeholder { color: #9ca3af; }
.sbu-ai-boolean-editor:hover { border-color: #d1d5db; }
.sbu-ai-boolean-editor:focus {
  outline: none;
  border-color: #6b7280;
  box-shadow: 0 0 0 3px rgba(55, 65, 81, 0.12), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.sbu-ai-boolean.editing { flex-wrap: wrap; width: 100%; max-width: 1100px; }
.sbu-ai-boolean.editing .sbu-ai-boolean-query { display: none; }
.sbu-ai-boolean.editing .sbu-ai-boolean-editor { display: block; }
.sbu-ai-boolean.editing .sbu-ai-boolean-text { order: 1; }
.sbu-ai-boolean.editing .sbu-ai-boolean-toggle { order: 3; margin-left: auto; }
.sbu-ai-boolean.editing .sbu-ai-boolean-search { order: 4; display: inline-flex; }

/* Edit ⇄ Cancel toggle + Copy — outlined neutral, always visible */
.sbu-ai-boolean button.sbu-ai-boolean-toggle,
.sbu-ai-boolean button.sbu-ai-boolean-copy {
  appearance: none; -webkit-appearance: none;
  background: #fff; border: 1px solid #6b7280; color: #1f2937;
  font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 4px 12px; border-radius: 14px;
  cursor: pointer; line-height: 1.3; white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.sbu-ai-boolean button.sbu-ai-boolean-toggle:hover,
.sbu-ai-boolean button.sbu-ai-boolean-copy:hover {
  background: #f3f4f6; border-color: #374151;
}
.sbu-ai-boolean button.sbu-ai-boolean-toggle:focus-visible,
.sbu-ai-boolean button.sbu-ai-boolean-copy:focus-visible {
  outline: 2px solid #1f2937; outline-offset: 2px;
}
/* Copy success — brief brand-green feedback (white on #15803d = 5.3:1, AA) */
.sbu-ai-boolean button.sbu-ai-boolean-copied {
  background: #15803d; border-color: #15803d; color: #fff;
}
.sbu-ai-boolean button.sbu-ai-boolean-copied:hover {
  background: #15803d; border-color: #15803d; color: #fff;
}
/* Editing-state button order: Cancel | Copy | Search →  (Cancel leftmost) */
.sbu-ai-boolean.editing .sbu-ai-boolean-toggle { order: 3; margin-left: auto; }
.sbu-ai-boolean.editing .sbu-ai-boolean-copy { order: 4; margin-left: 0; }
.sbu-ai-boolean.editing .sbu-ai-boolean-search { order: 5; }

/* Search → — filled neutral dark grey (not brand red). White on #374151 = 10.3:1.
   Hidden by default in compact mode; .editing reveals it via the override above. */
.sbu-ai-boolean button.sbu-ai-boolean-search {
  appearance: none; -webkit-appearance: none;
  display: none; align-items: center;
  background: #374151; border: 1px solid #374151; color: #fff;
  font: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 5px 14px; border-radius: 14px;
  cursor: pointer; line-height: 1.3; white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s, transform 0.1s;
}
.sbu-ai-boolean button.sbu-ai-boolean-search:hover { background: #1f2937; border-color: #1f2937; }
.sbu-ai-boolean button.sbu-ai-boolean-search:active { transform: translateY(1px); }
.sbu-ai-boolean button.sbu-ai-boolean-search:focus-visible {
  outline: 2px solid #1f2937; outline-offset: 2px;
}

@media (max-width: 600px) {
  .sbu-ai-boolean { flex-wrap: wrap; width: auto; max-width: 100%; }
  .sbu-ai-boolean-query { flex-basis: 100%; }
}

.sbu-bento-grid:has(.sbu-card) { margin-top: 30px; }
.sbu-bento-grid { margin: 0 auto; display: grid; gap: 24px; grid-template-columns: repeat(12, 1fr); }
.sbu-card {
  background: var(--b-card);
  border: 1px solid var(--b-line);
  border-radius: var(--b-radius);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
  padding: 24px;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  scroll-margin-top: 160px;
}
.sbu-bento-grid.loading .sbu-card { opacity: 0.6; pointer-events: none; }

.sbu-card h2 { margin: 0 0 4px; font-size: 1rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--b-ink); font-weight: 800; }
.sbu-card .desc { margin: 0 0 16px; color: var(--b-muted); font-size: 0.875rem; line-height: 1.5; }
.sbu-card .count { font-weight: 700; color: var(--b-muted); font-size: 0.85rem; background: #f1f5f9; padding: 4px 10px; border-radius: 6px; margin-left: auto; }
.sbu-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }

/* --- ARTICLES FILTER TOGGLE BUTTON --- */
/* Cards with inline Filter button: align description text left, button right */
#card-articles > .desc,
#card-catalog > .desc { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sbu-filter-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; color: var(--b-ink); border: 1px solid var(--b-line); border-radius: 6px;
  padding: 3px 10px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  margin-left: auto; font-family: inherit; transition: all 0.15s;
}
.sbu-filter-toggle svg { width: 13px; height: 13px; }
.sbu-filter-toggle:hover { border-color: var(--b-brand); color: var(--b-brand); background: rgba(153, 0, 0, 0.04); }
.sbu-filter-toggle:hover svg { stroke: var(--b-brand); }
/* Active state — light brand tint instead of full red. Less visually loud. */
.sbu-filter-toggle.active {
  background: rgba(153, 0, 0, 0.08);
  color: var(--b-brand);
  border-color: var(--b-brand);
}
.sbu-filter-toggle.active svg { stroke: var(--b-brand); }
.sbu-filter-toggle.active:hover { background: rgba(153, 0, 0, 0.14); }

/* Badge inside the Filter button — shows count of active filter chips.
   Always solid brand red so the number is the most visible signal. */
.sbu-filter-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 14px; height: 14px; padding: 0 4px;
  margin-left: 2px;
  border-radius: 7px;
  background: var(--b-brand);
  color: #fff;
  font-size: 0.65rem; font-weight: 700;
  line-height: 1;
}
.sbu-filter-toggle:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }
.sbu-filter-toggle:focus:not(:focus-visible) { outline: none; }

/* --- ARTICLES FILTER TOOLBAR --- */
/* Per-card filter/sort toolbar — shared by Articles and Books & Media cards.
   Compact single-row layout: inline section labels + chips + sort dropdown,
   no outer box. Wraps gracefully on narrow viewports. */
.sbu-card-toolbar[hidden],
.sbu-articles-toolbar[hidden] { display: none; }
.sbu-card-toolbar,
.sbu-articles-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  margin: 6px 0 12px;
  /* no border, no fill, no padding — toolbar reads as inline metadata */
}

/* Inline group: mini label + chips. Subtle vertical bar marks every group
   (including the first) so all rows align at the same left edge when the
   toolbar wraps onto multiple lines. */
.sbu-tb-group {
  display: inline-flex; align-items: center; gap: 5px;
  flex-wrap: wrap;
  border-left: 1px solid #e5e7eb;
  padding-left: 14px;
}
/* Sort group is always label + select — never wrap internally */
.sbu-tb-sort { flex-wrap: nowrap; }
.sbu-tb-mini {
  font-size: 0.68rem; font-weight: 700; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.06em;
  white-space: nowrap; margin-right: 2px;
}

/* Filter chip — defined border, soft pill shape, comfortable padding.
   !important on font-size/border to beat Elementor Kit's global `button` reset
   (.elementor-kit-27 button { font-size: 16px; border-style: none; }) */
.sbu-filter-chip {
  background: #fff; color: #334155;
  border: 1px solid #cbd5e1 !important; border-radius: 16px;
  padding: 3px 14px; font-size: 14px !important; font-weight: 400 !important;
  cursor: pointer; font-family: inherit;
  transition: all 0.15s; white-space: nowrap; line-height: 1.4;
}
/* Inactive chip: hover — soft brand tint, not full saturation */
.sbu-filter-chip:hover { border-color: var(--b-brand) !important; background: rgba(153, 0, 0, 0.06) !important; color: var(--b-brand) !important; }

/* Active chip: light brand tint instead of solid red. Brand-red border + text
   keeps it clearly "on" without shouting. */
.sbu-filter-chip.active,
.sbu-filter-chip.active:hover,
.sbu-filter-chip.active:focus,
.sbu-filter-chip.active:active {
  background: rgba(153, 0, 0, 0.08) !important;
  color: var(--b-brand) !important;
  border-color: var(--b-brand) !important;
  font-weight: 600;
}
.sbu-filter-chip.active:hover { background: rgba(153, 0, 0, 0.16) !important; }
.sbu-filter-chip.active::after {
  content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 5px; vertical-align: middle;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23990000' stroke-width='3' stroke-linecap='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'/%3E%3Cline x1='6' y1='6' x2='18' y2='18'/%3E%3C/svg%3E") no-repeat center;
  background-size: contain;
}

/* Inactive chip: focus (mouse click — no visible ring) */
.sbu-filter-chip:focus:not(.active) { outline: none !important; background: #fff !important; color: var(--b-ink) !important; border-color: var(--b-line) !important; }

/* Keyboard focus (ADA) */
.sbu-filter-chip:focus-visible { outline: 2px solid var(--b-brand) !important; outline-offset: 2px; }
.sbu-sort-wrap { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sbu-sort-label { font-size: 0.78rem; font-weight: 700; color: var(--b-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sbu-sort-select {
  appearance: auto; background: #fff;
  border: 1px solid #cbd5e1; border-radius: 16px;
  padding: 5px 10px; font-size: 14px; font-weight: 600;
  font-family: inherit; color: #334155; cursor: pointer;
  line-height: 1.4;
}
.sbu-sort-select:hover, .sbu-sort-select:focus { border-color: var(--b-brand); outline: none; }

/* Narrow viewports — force each group to its own row; pipe alignment preserved */
@media (max-width: 600px) {
  .sbu-tb-group { flex-basis: 100%; }
}

.sbu-list { display: grid; gap: 14px; margin: 12px 0; }
.sbu-item { padding-bottom: 12px; border-bottom: 1px dashed var(--b-line); }
.sbu-item:last-child { border-bottom: none; }
.sbu-item .title { display: block; font-weight: 700; line-height: 1.4; margin-bottom: 4px; color: #000; font-size: 1rem; transition: color 0.2s; }
.sbu-item .title:hover { color: #1e40af; text-decoration: underline; }
.sbu-subline { font-size: 0.875rem; color: var(--b-muted); line-height: 1.5; margin-top: 4px; }
.sbu-author-link { text-decoration: none; color: var(--b-muted); transition: color 0.2s; }
.sbu-author-link:hover { color: #1e40af; text-decoration: underline; }
.sbu-card-body { flex: 1; display: flex; flex-direction: column; }
.sbu-card-actions { margin-top: auto; padding-top: 15px; display: flex; gap: 8px; flex-wrap: wrap; }
.sbu-more { display: inline-flex; align-items: center; font-size: 0.875rem; font-weight: 600; color: var(--b-brand); background: #f8fafc; padding: 8px 14px; border-radius: 8px; }
.sbu-more:hover { background: #fee2e2; }

/* --- EMPTY STATE --- */
.sbu-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; text-align: center; gap: 8px;
}
.sbu-empty-state svg { color: var(--b-muted); opacity: 0.5; margin-bottom: 4px; }
.sbu-empty-text { font-size: 1.05rem; font-weight: 600; color: var(--b-ink); }
.sbu-empty-hint { font-size: 0.95rem; color: var(--b-muted); }

/* --- ERROR STATE --- */
.sbu-error-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; text-align: center; gap: 8px;
}
.sbu-error-state svg { color: var(--b-brand); opacity: 0.7; margin-bottom: 4px; }
.sbu-error-text { font-size: 1.05rem; font-weight: 600; color: var(--b-brand); }
.sbu-error-hint { font-size: 0.95rem; color: var(--b-muted); }

/* --- TYPE BADGE (unified blue for all: articles, books, journals, guides, pages) --- */
.sbu-type-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 6px;
  vertical-align: middle;
}

/* --- HELP TEXT (redirect tabs) --- */
.sbu-help-text {
  color: var(--b-panel-muted);
  font-style: italic;
  font-size: 1rem;
  text-align: center;
  padding: 6px 0;
  line-height: 1.6;
}

/* Direct-to-Primo escape hatch — sits below the help text on the Browse tab.
   Picks up whatever the user has typed and routes them straight to Primo. */
#sbu-context-chips { text-align: center; }
.sbu-primo-direct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 14px;
  color: var(--b-brand);
  background: #fff;
  border: 1px solid var(--b-brand);
  border-radius: 18px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.sbu-primo-direct:hover {
  background: var(--b-brand);
  color: #fff;
}
.sbu-primo-direct:active { transform: translateY(1px); }
.sbu-primo-direct:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; }
.sbu-primo-direct svg { flex-shrink: 0; }

/* --- RECENT SEARCHES --- */
.sbu-recent-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  border: 1px solid var(--b-line);
  padding: 12px 16px;
  z-index: 200;
  animation: fadeIn 0.15s ease;
  max-height: 380px;
  overflow-y: auto;
  scrollbar-width: none;
}
.sbu-recent-dropdown::-webkit-scrollbar { display: none; }
.sbu-recent-header {
  display: flex; justify-content: space-between; align-items: center;
  /* Match sticky behavior of .sbu-suggest-label so this header also stays put */
  position: sticky; top: 0; z-index: 3;
  background: #fff;
  margin-left: -16px; margin-right: -16px;
  padding: 4px 16px 6px;
  margin-bottom: 8px; font-size: 0.8rem; color: var(--b-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.sbu-clear-recent {
  background: none; border: 1px dashed var(--b-line); border-radius: 6px;
  padding: 2px 8px; font-size: 1rem; color: var(--b-muted); cursor: pointer;
  transition: all 0.2s;
}
.sbu-clear-recent:hover { border-color: var(--b-brand); background: var(--b-brand); color: #fff; }
.sbu-recent-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sbu-recent-chip {
  position: relative;
  background: #f1f5f9;
  color: var(--b-ink);
  border: 1px solid var(--b-line);
  border-radius: 20px;
  padding: 2px 28px 2px 12px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.sbu-recent-chip:hover { background: #e2e8f0; border-color: #cbd5e1; }
@media (max-width: 768px) { .sbu-recent-chip { font-size: 14px; } }
.sbu-chip-remove {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--b-muted); font-size: 0.9rem; line-height: 1;
  padding: 0 2px; opacity: 0.6; transition: opacity 0.2s;
}
.sbu-chip-remove:hover { opacity: 1; color: var(--b-brand); }

/* Responsive */
.col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-8 { grid-column: span 8; }
@media (max-width:1024px) { .col-8, .col-6 { grid-column: span 12; } .col-4 { grid-column: span 12; }
  .sbu-tab { padding: 4px 6px; font-size: 13px !important; }
}
@media (max-width:768px) {
    .sbu-glass-panel { padding: 20px 15px; }
    .sbu-search-btn { width: 30px; height: 30px; }
    .sbu-context-area { flex-direction: column; gap: 10px; text-align: center; width: 100%; margin: auto;}
    #sbu-context-chips .sbu-chip { font-size: 0.8rem; padding: 3px 10px; }
    #sbu-context-chips .sbu-label { font-size: 0.85rem; }
    .sbu-tabs-nav {
      justify-content: flex-start;
      gap: 4px;
      -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
      mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }
    .sbu-tab { font-size: 0.85rem; padding: 6px 10px; }
    .sbu-ask-content { flex-direction: column; text-align: center; gap: 16px; }
}
.sr-only { position: absolute!important; clip: rect(1px,1px,1px,1px); }
/* Hero Context Override */
.sbu-hero-context .sbu-glass-panel {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
/* Make active tab pop on the hero */
.sbu-hero-context .sbu-tab.active {
    color: var(--b-brand);
    border-bottom-color: var(--b-brand);
}
@media (max-width:1024px) {
.sbu-tab {
      padding: 8px 8px;
}
.found-label{
  display: none;
}
}

/* --- SEARCH WITH AI (inside search bar) --- */
.sbu-ai-label {
  display: none;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--b-brand);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
  margin-right: 6px;
  flex-shrink: 0;
  border-left: 2px solid var(--b-line);
  padding-left: 12px;
  margin-left: 8px;
}
.sbu-ai-text {
  letter-spacing: 0.01em;
}

/* "Search with AI" hover popup — appears below the label with a Learn-more link.
   The label itself has position: relative so the popup anchors correctly. */
.sbu-ai-label { position: relative; }
.sbu-ai-tip {
  /* Spans default to inline; force block so width/wrapping take effect.
     !important defends against any theme rule resetting these. */
  display: block !important;
  white-space: normal !important;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px !important;
  max-width: calc(100vw - 32px);
  box-sizing: border-box !important;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.10);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--b-ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, visibility 0.15s, transform 0.15s;
  z-index: 100;
  pointer-events: none;
}
/* Invisible bridge so moving the cursor from label to popup doesn't lose hover */
.sbu-ai-tip::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
  background: transparent;
}
/* Show state — toggled via JS with a hide-delay so the user can move from the
   text/checkbox down into the tooltip to click the link. Keyboard focus also
   shows it (CSS-only, since focus chains don't have the same hover-gap problem). */
.sbu-ai-tip.sbu-ai-tip-open,
.sbu-ai-input:focus-visible ~ .sbu-ai-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
.sbu-ai-tip-body {
  display: block;
  color: var(--b-ink);
  margin-bottom: 8px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.sbu-ai-tip a {
  display: inline-block;
  color: var(--b-brand);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sbu-ai-tip a:hover { color: var(--b-brand-dark); }
.sbu-ai-tip a:focus-visible { outline: 2px solid var(--b-brand); outline-offset: 2px; border-radius: 2px; }
.sbu-ai-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.sbu-ai-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--b-line);
  border-radius: 4px;
  background: #fff;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sbu-ai-check::after {
  content: '';
  display: block;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s ease;
}
.sbu-ai-input:checked + .sbu-ai-check {
  background: var(--b-brand);
  border-color: var(--b-brand);
}
.sbu-ai-input:checked + .sbu-ai-check::after {
  transform: rotate(45deg) scale(1);
}
.sbu-ai-input:focus-visible + .sbu-ai-check {
  outline: 2px solid var(--b-brand);
  outline-offset: 2px;
}
@media (max-width: 768px) {
  .sbu-search-wrap .sbu-search-input { min-width: 0; font-size: 14px; }
  .sbu-search-wrap .sbu-search-btn { flex-shrink: 0; }
  .sbu-search-wrap .sbu-ai-label {
    order: 3; width: 100%; justify-content: center;
    margin: 6px 0 4px; padding: 0;
  }
}

/* Spinner inside search button while AI fetch is in progress */
.sbu-btn-spin {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sbuAiSpin 0.7s linear infinite;
}
@keyframes sbuAiSpin {
  to { transform: rotate(360deg); }
}
@media (max-width: 768px) {
  .sbu-search-wrap { flex-wrap: wrap; height: auto; border-radius: 24px; padding: 6px 6px 6px 16px; }
  .sbu-help-links { gap: 20px; }
}

/* --- SUGGEST DROPDOWN ITEMS --- */
.sbu-suggest-section { margin-bottom: 14px; }
.sbu-suggest-section:last-child { margin-bottom: 0; }
.sbu-suggest-label {
  display: flex; align-items: center;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: #6b7280;
  border: none; border-left: none; /* defensive: kill any inherited left border */
  /* Sticky inside the scrolling dropdown so the section header stays visible
     while items scroll underneath. Solid white background covers content
     scrolling beneath. */
  position: sticky; top: 0; z-index: 3;
  background: #fff;
  margin: 0 -16px 6px;
  padding: 6px 16px 8px;
}
.sbu-suggest-item {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer;
  font-size: 16px; color: var(--b-ink);
  line-height: 1.4;
  transition: background 0.12s;
}
.sbu-suggest-item:hover { background: #f3f4f6; }
.sbu-suggest-item:focus-visible { outline: 2px solid var(--b-brand); outline-offset: -2px; }
/* Leading icon — magnifier on Primo items, sparkle on AI items (set by JS) */
.sbu-suggest-item svg {
  width: 16px; height: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}

/* AI section — primary source of suggestions, sits at the top */
.sbu-ai-section {
  /* No bottom border — section separation comes from the gap and the next
     section's sticky label */
  margin-bottom: 8px;
}
.sbu-ai-label {
  /* Brand color + inherits sticky behavior from .sbu-suggest-label */
  color: var(--b-brand);
  gap: 6px;
  border: none; border-left: none; /* defensive: no leading border */
}
.sbu-ai-label .sbu-ai-spark { color: var(--b-brand); flex-shrink: 0; }
/* AI item search icon picks up brand color so the section is visually distinct */
.sbu-ai-item svg { color: var(--b-brand); opacity: 0.7; }
.sbu-ai-item:hover svg { opacity: 1; }
.sbu-ai-item:hover { background: rgba(153, 0, 0, 0.06); }

/* First AI item is the autocomplete slot — slightly heavier so the eye lands */
.sbu-ai-item.sbu-ai-autofill { font-weight: 700; color: #111827; }
.sbu-ai-item.sbu-ai-autofill svg { color: var(--b-brand); }

/* Loading placeholder while AI fetches */
.sbu-ai-loading {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  font-size: 0.92rem; color: var(--b-muted);
  font-style: italic;
}
.sbu-ai-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(153, 0, 0, 0.18);
  border-top-color: var(--b-brand);
  border-radius: 50%;
  animation: sbu-ai-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes sbu-ai-spin { to { transform: rotate(360deg); } }

/* Subtle "AI unavailable" note when Primo fallback shows */
.sbu-fallback-note {
  font-size: 0.7rem; font-weight: 500;
  color: #94a3b8; text-transform: none; letter-spacing: 0;
  margin-left: 6px; font-style: italic;
}

/* --- EMPTY/ERROR ADVANCED SEARCH LINK --- */
.sbu-empty-actions {
  display: flex; align-items: flex-start; gap: 24px; margin-top: 10px; flex-wrap: wrap; justify-content: center;
}
.sbu-advanced-link {
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.95rem; font-weight: 700; color: var(--b-brand);
  margin-top: 10px; transition: color 0.2s;
}
.sbu-empty-actions .sbu-advanced-link { margin-top: 0; }
.sbu-advanced-link:hover { color: var(--b-brand-dark); text-decoration: underline; }
.sbu-link-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--b-muted); font-style: italic; margin-top: 2px; border-bottom: 1px dashed var(--b-brand); }

/* --- ASK A LIBRARIAN BANNER --- */
.sbu-ask-banner {
  background: #fff; border-radius: 12px; border: 1px solid var(--b-line);
  max-width: 1200px; margin: 0 auto 40px; padding: 24px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  animation: sbuSlideUp 0.4s ease both;
}
.sbu-ask-content {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
}
.sbu-ask-content strong { font-size: 1.1rem; color: var(--b-ink); }
.sbu-ask-content p { margin: 6px 0 0; color: var(--b-muted); font-size: 0.95rem; line-height: 1.5; }
.sbu-ask-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--b-brand); color: #fff !important; font-weight: 700; font-size: 0.95rem;
  padding: 12px 32px; border-radius: 50px; white-space: nowrap;
  transition: background 0.2s; text-decoration: none;
}
.sbu-ask-btn:hover { background: var(--b-brand-dark); color: #fff !important; }

/* --- CATALOG SUB-FILTER OPTIONS --- */
.sbu-catalog-filters {
  display: flex; align-items: center; justify-content: flex-start; gap: 16px;
  max-width: 900px; margin: 0px auto 30px auto; flex-wrap: wrap;
  padding-left: 24px;
}
.sbu-cat-opt {
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer; font-size: 0.9rem; font-weight: 500;
  color: var(--b-panel-muted); white-space: nowrap;
  transition: color 0.15s;
}
.sbu-cat-opt:hover { color: var(--b-brand); }
.sbu-cat-opt input[type="radio"] {
  accent-color: var(--b-brand);
  width: 15px; height: 15px;
  margin: 0; cursor: pointer;
}
@media (max-width: 768px) {
  .sbu-catalog-filters { gap: 10px; }
  .sbu-cat-opt { font-size: 0.82rem; }
}

/* --- HELP TEXT ADVANCED LINK --- */
#sbu-context-chips:has(.sbu-help-text) {
  display: flex; flex-direction: column; align-items: center;
}
.sbu-help-links {
  display: inline-flex; align-items: flex-start; gap: 32px; margin-top: 10px; justify-content: center;
}
.sbu-help-advanced {
  display: inline-flex; flex-direction: column; color: var(--b-brand);
  font-size: 1rem; font-weight: 700; margin-top: 8px;
  border-bottom: none;
  transition: all 0.2s;
}
.sbu-help-links .sbu-help-advanced { margin-top: 0; }
.sbu-help-advanced + .sbu-help-advanced:not(.sbu-help-links .sbu-help-advanced) { margin-left: 24px; }
.sbu-help-advanced:hover { color: var(--b-brand-dark); text-decoration: underline; }
.sbu-help-sub { display: block; font-size: 0.8rem; font-weight: 400; color: var(--b-panel-muted); margin-top: 2px; font-style: italic; border-bottom: 1px dashed var(--b-brand); }

/* --- WHAT'S NOT INCLUDED --- */
.sbu-not-included {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--b-line);
  max-width: 1200px;
  margin: 30px auto 40px;
  padding: 32px 40px;
  animation: sbuSlideUp 0.4s ease both;
}
.sbu-not-included h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--b-ink);
  margin: 0 0 8px;
}
.sbu-not-included > p {
  font-size: 0.95rem;
  color: var(--b-muted);
  line-height: 1.6;
  margin: 0 0 20px;
}
.sbu-ni-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}
.sbu-ni-col h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--b-ink);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.8rem;
}
.sbu-ni-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sbu-ni-col ul li {
  margin-bottom: 8px;
}
.sbu-ni-col ul li a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--b-brand);
  transition: color 0.2s;
}
.sbu-ni-col ul li a:hover {
  color: var(--b-brand-dark);
  text-decoration: underline;
}
@media (max-width: 768px) {
  .sbu-not-included { padding: 24px 20px; }
  .sbu-ni-columns { grid-template-columns: 1fr; gap: 20px; }
}

/* --- THUMBNAIL (MIT-style book covers) --- */
/* Float-right so the body content (title, meta, availability, buttons) wraps
   around the cover and reclaims the full card width below the thumb's bottom. */
.sbu-item-thumb { display: block; }
.sbu-item-thumb::after { content: ''; display: table; clear: both; }
.sbu-item-body { min-width: 0; }
.sbu-thumb {
  width: 64px !important;   /* !important to beat theme img { height: auto } reset */
  height: 84px !important;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--b-line);
  background: #f8fafc;
  float: right;
  margin: 0 0 6px 12px;
}

/* --- COLLAPSE ALL / EXPAND ALL --- */
.sbu-card.sbu-collapsed .sbu-card-body,
.sbu-card.sbu-collapsed .desc { display: none; }
.sbu-card.sbu-collapsed { min-height: auto; }


.sbu-collapse-all {
  background: none;
  border: 1px solid #9ca3af;
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  font-family: inherit;
  margin-left: auto;
  transition: all 0.15s;
  white-space: nowrap;
}
.sbu-collapse-all:hover { background: #eef2ff; border-color: var(--b-brand); color: var(--b-brand); }

/* --- LOAD MORE BUTTON (inline with "See all") --- */
.sbu-load-more {
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--b-brand);
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px dashed var(--b-line);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.sbu-load-more:hover { background: #fee2e2; border-color: var(--b-brand); color: var(--b-brand); }
.sbu-load-more:disabled { opacity: 0.6; cursor: wait; }

/* --- SOURCE HINT (e.g. "via JSTOR") --- */
.sbu-source-hint {
  font-size: 0.9em;
  color: var(--b-ink);
  font-weight: 600;
  opacity: 1;
}

/* --- EXCERPT (Website & Guides) --- */
.sbu-excerpt {
  font-size: 0.875rem;
  color: var(--b-muted);
  line-height: 1.5;
  margin-top: 4px;
}

/* --- GLOBAL EMPTY STATE (all blocks 0 results) --- */
.sbu-global-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--b-line);
  border-radius: var(--b-radius);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}
.sbu-global-empty svg { color: var(--b-muted); opacity: 0.4; }
.sbu-global-empty-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--b-ink);
}
.sbu-global-empty-hint {
  font-size: 1rem;
  color: var(--b-muted);
  line-height: 1.6;
}
.sbu-global-empty-actions {
  display: flex; align-items: flex-start; gap: 24px; margin-top: 10px; flex-wrap: wrap; justify-content: center;
}
.sbu-global-empty-actions a {
  font-size: 0.95rem; font-weight: 700; color: var(--b-brand);
  display: inline-flex; flex-direction: column; align-items: center; gap: 2px;
  transition: color 0.2s;
}
.sbu-global-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--b-muted); font-style: italic; margin-top: 2px; border-bottom: 1px dashed var(--b-brand); }
.sbu-global-empty-actions a:hover { color: var(--b-brand-dark); text-decoration: underline; }

/* --- HSL SEARCH SHORTCODE --- */
.sbu-hsl-heading {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; margin-bottom: 22px; text-align: center;
}
.sbu-hsl-title {
  font-family: inherit; font-size: 1.55rem; font-weight: 800;
  letter-spacing: -0.02em; color: var(--b-ink);
  margin: 0; line-height: 1.2;
}
.sbu-hsl-tagline {
  font-size: 0.9rem; font-weight: 400; color: #000;
  letter-spacing: 0.01em;
}
@media (max-width: 767px) {
  .sbu-hsl-title { font-size: 1.25rem; }
  .sbu-hsl-tagline { font-size: 0.82rem; }
}
.sbu-hsl-form .sbu-search-input { border: none; outline: none; }
.sbu-hsl-form .sbu-search-input:focus { border: none; outline: none; box-shadow: none; }
/* HSL Top Resources header row (label left, quick links right) */
.sbu-hsl-res-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin-top: 22px; padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.sbu-hsl-links {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sbu-hsl-links a {
  font-size: 1rem; font-weight: 500; color: #374151;
  text-decoration: none; line-height: 1.3;
  transition: color 0.15s ease;
}
.sbu-hsl-links a:hover { color: var(--b-brand); text-decoration: underline; }
.sbu-hsl-sep { color: #D1D5DB; font-size: 1rem; user-select: none; line-height: 1.3; }
@media (max-width: 700px) {
  .sbu-hsl-res-header { justify-content: flex-start; }
}

/* --- HSL Top Resources (quiet utility grid) --- */
.sbu-hsl-res-heading {
  margin: 0;
  font-size: 0.875rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #4B5563;
  text-align: left; line-height: 1.3;
}
.sbu-hsl-res {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 4px;
}
.sbu-hsl-res-chip {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 10px;
  padding: 10px 12px;
  background: transparent; border: none; border-radius: 6px;
  color: #1F2937; font-size: 15px; font-weight: 500;
  line-height: 1.2; white-space: nowrap; text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  overflow: hidden; text-overflow: ellipsis;
}
.sbu-hsl-res-chip:hover {
  background: rgba(153,0,0,0.06);
  color: var(--b-brand);
}
.sbu-hsl-res-chip:focus-visible {
  outline: 2px solid var(--b-brand);
  outline-offset: 2px;
}
.sbu-hsl-res-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  color: #6B7280;
  flex-shrink: 0;
  transition: color 0.15s ease;
}
.sbu-hsl-res-chip:hover .sbu-hsl-res-ic { color: var(--b-brand); }
.sbu-hsl-res-nm { line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) {
  .sbu-hsl-res { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .sbu-hsl-res { grid-template-columns: repeat(2, 1fr); }
}

/* --- PER-RESULT QUALITY FLAGS (Peer Reviewed / Open Access / Availability) --- */
.sbu-flags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 4px 0 6px;
}
.sbu-flag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  letter-spacing: 0.02em; line-height: 1.4;
  border: 1px solid transparent;
}
.sbu-flag svg { flex-shrink: 0; }
.sbu-flag-pr     { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.sbu-flag-oa     { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.sbu-flag-avail  { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
.sbu-flag-print  { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }

/* --- PER-ITEM ACTIONS (Show abstract / Cite) --- */
.sbu-item-actions {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  margin-top: 8px;
}
.sbu-item .sbu-item-action {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  border: 1px solid #e2e8f0;
  color: #475569;
  font: inherit; font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0; text-transform: none; text-decoration: none;
  padding: 3px 7px; border-radius: 4px;
  cursor: pointer; line-height: 1.4;
  box-shadow: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.sbu-item .sbu-item-action:hover {
  background: #f1f5f9; border-color: #cbd5e1; color: #1e293b;
}
.sbu-item .sbu-item-action:focus-visible {
  outline: 2px solid var(--b-brand); outline-offset: 2px;
}

/* "More like this" loading state — fitz-ollama suggest-query in flight */
.sbu-item .sbu-more-like-loading {
  cursor: progress; opacity: 0.85;
  display: inline-flex; align-items: center; gap: 6px;
}
.sbu-more-like-loading .sbu-btn-spin {
  width: 10px; height: 10px; border-width: 2px;
  border-color: rgba(71,85,105,0.3); border-top-color: #475569;
}

/* Physical availability line for catalog items */
.sbu-avail-line {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px;
  font-size: 0.88rem; font-weight: 600; line-height: 1.4;
  color: #166534;
  text-decoration: none;
}
.sbu-avail-line:hover { color: #14532d; }
.sbu-avail-line:hover .sbu-avail-loc { text-decoration: underline; }
.sbu-avail-line svg { flex-shrink: 0; color: #1e3a8a; }
.sbu-avail-line .sbu-avail-chev { color: #166534; opacity: 0.7; }
.sbu-avail-loc { color: #15803d; font-weight: 500; }

/* Abstract preview panel */
.sbu-abstract {
  margin-top: 8px; padding: 10px 14px;
  background: #f8fafc;
  border-left: 3px solid var(--b-brand);
  border-radius: 4px;
  font-size: 0.88rem; color: #334155; line-height: 1.55;
  white-space: pre-wrap;
}

/* Cite popover */
.sbu-cite-wrap { position: relative; display: inline-flex; }
.sbu-cite-popover {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 240px; max-width: 320px; z-index: 20;
  background: #fff;
  border: 1px solid #cbd5e1; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  padding: 4px;
  box-sizing: border-box;
}
.sbu-cite-popover.open { display: block; }
/* Right-anchored variant: applied via JS when left-anchored would overflow the card */
.sbu-cite-popover.sbu-cite-popover-right { left: auto; right: 0; }

/* Promote the parent card's stacking order while the cite popover is open so
   the popover paints above sibling cards rendered later in the DOM. Sibling
   .sbu-card elements paint in source order by default; without this, a 320px
   popover dropping into the next grid row would fall behind those cards. */
.sbu-card.sbu-card-cite-open { position: relative; z-index: 30; }
.sbu-cite-popover .sbu-cite-option {
  appearance: none; -webkit-appearance: none;
  display: block; width: 100%;
  background: transparent; border: none;
  color: #1e293b; font: inherit; font-size: 0.85rem; font-weight: 500;
  letter-spacing: 0; text-transform: none; text-decoration: none;
  padding: 7px 10px; border-radius: 4px;
  text-align: left; cursor: pointer; line-height: 1.3;
  box-shadow: none;
  transition: background-color 0.1s;
}
.sbu-cite-popover .sbu-cite-option:hover { background: #f1f5f9; }
.sbu-cite-popover .sbu-cite-option:focus-visible {
  outline: 2px solid var(--b-brand); outline-offset: -2px;
}

/* Section labels: "Citation style" / "Export" */
.sbu-cite-section-label {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b;
  padding: 8px 10px 4px;
}
.sbu-cite-section-label + .sbu-cite-section-label,
.sbu-cite-styles + .sbu-cite-section-label {
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
}

/* Citation style list */
.sbu-cite-styles { list-style: none; margin: 0 0 4px; padding: 0; }
.sbu-cite-style { margin: 0; }
.sbu-cite-style-btn {
  appearance: none; -webkit-appearance: none;
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: transparent; border: none;
  color: #1e293b; font: inherit; font-size: 0.85rem; font-weight: 500;
  letter-spacing: 0; text-transform: none; text-decoration: none;
  padding: 7px 10px; border-radius: 4px;
  text-align: left; cursor: pointer; line-height: 1.3;
  box-shadow: none;
  transition: background-color 0.1s;
}
.sbu-cite-style-btn:hover { background: #f1f5f9; }
.sbu-cite-style-btn:focus-visible {
  outline: 2px solid var(--b-brand); outline-offset: -2px;
}
.sbu-cite-caret {
  display: inline-block; width: 10px;
  color: #64748b; font-size: 0.7rem;
  flex: 0 0 auto;
}
.sbu-cite-style.open > .sbu-cite-style-btn { background: #f1f5f9; color: var(--b-brand); }

/* Inline preview body */
.sbu-cite-style-body { padding: 2px 10px 10px 26px; }
.sbu-cite-preview {
  font-size: 0.8rem; line-height: 1.5;
  color: #1e293b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.sbu-cite-preview em { font-style: italic; }
.sbu-cite-preview a {
  color: var(--b-brand); text-decoration: underline;
  word-break: break-all;
}
.sbu-cite-copy {
  appearance: none; -webkit-appearance: none;
  background: var(--b-brand); color: #fff; border: none;
  font: inherit; font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0; text-transform: none;
  padding: 5px 14px; border-radius: 4px;
  cursor: pointer; box-shadow: none;
  transition: background-color 0.15s;
}
.sbu-cite-copy:hover { background: var(--b-brand-dark); }
.sbu-cite-copy:focus-visible {
  outline: 2px solid var(--b-brand); outline-offset: 2px;
}

/* On narrow screens, anchor popover to right so it doesn't overflow */
@media (max-width: 600px) {
  .sbu-cite-popover { left: auto; right: 0; min-width: 260px; max-width: 92vw; }
}

/* --- IDENTIFIER MODE: collapse grid to single full-width card --- */
.sbu-bento-grid.sbu-id-mode { grid-template-columns: 1fr; }
.sbu-bento-grid.sbu-id-mode .sbu-card { grid-column: 1 / -1; max-width: none; margin: 0; width: 100%; }

/* --- IDENTIFIER DETECTED BANNER (DOI / ISBN / PMID / ISSN / PMCID / arXiv) --- */
.sbu-id-detected {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: -8px auto 18px; padding: 8px 14px;
  max-width: 900px; width: fit-content;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  color: #1e3a8a; font-size: 0.85rem; line-height: 1.4;
}
.sbu-id-detected .sbu-id-icon { display: inline-flex; color: #1e40af; flex-shrink: 0; }
.sbu-id-detected .sbu-id-icon svg { width: 14px; height: 14px; }
.sbu-id-detected .sbu-id-label { font-weight: 700; color: #1e40af; }
.sbu-id-detected .sbu-id-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem; font-weight: 700;
  background: #fff; border: 1px solid #bfdbfe;
  padding: 2px 8px; border-radius: 4px;
  color: #1e3a8a; letter-spacing: 0;
}
/* Primary CTA — high-specificity to beat theme button reset (hello-elementor) */
.sbu-id-detected button.sbu-id-action {
  appearance: none; -webkit-appearance: none;
  background: #1e40af;
  border: 1px solid #1e40af;
  color: #fff;
  font: inherit; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.02em; text-transform: none; text-decoration: none;
  padding: 5px 14px; border-radius: 14px;
  cursor: pointer;
  margin-left: auto;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(30,64,175,0.15);
  transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}
.sbu-id-detected button.sbu-id-action:hover {
  background: #1e3a8a; border-color: #1e3a8a;
  box-shadow: 0 2px 4px rgba(30,64,175,0.25);
}
.sbu-id-detected button.sbu-id-action:active { transform: translateY(1px); }
.sbu-id-detected button.sbu-id-action:focus-visible {
  outline: 2px solid #1e40af; outline-offset: 2px;
}

@media (max-width: 600px) {
  .sbu-id-detected { width: auto; max-width: 100%; }
  .sbu-id-detected button.sbu-id-action { margin-left: 0; flex-basis: 100%; text-align: center; }
}
