/* ====================================================================
   VIEWER.CSS - Main Viewer Interface Stylesheet

   Modular CSS structure for the documentation viewer interface.
   Imports all viewer component stylesheets in the correct order.
   ==================================================================== */

/* 1. Theme and Fonts */
/* ---- inlined from theme.css ---- */
/* ====================================================================
   THEME - Color Scheme and Design Tokens

   Central definition of all color values, spacing units, and visual
   design tokens used throughout the documentation viewer.
   ==================================================================== */

:root {
  /* ===== COLOR PALETTE ===== */

  /* Primary Brand Colors */
  --color-primary: #17a2b8;
  --color-primary-dark: #138496;
  --color-primary-light: rgba(23, 162, 184, 0.1);
  /* Accent for TEXT on light backgrounds. --color-primary-dark is only ~4.0:1
     on white and fails WCAG AA for body-size text; this deeper tone clears it
     (~5.7:1 on the light teal wash, ~6.4:1 on white). Use it for accent text,
     not for fills. */
  --color-primary-deep: #0e6975;

  /* Text Colors */
  --color-text: #111111;
  --color-text-secondary: #444444;
  --color-text-muted: #666666;
  --color-heading: #2c3e50;

  /* Background Colors */
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F8F8F8;
  --color-bg-hover: #f0f8f7;
  --color-bg-alt: #fafafa;

  /* Brand Slate - the DARK ground shared by the topbar, the landing hero and
     the landing footer bar. Kept separate from the sidebar palette below so the
     sidebar can be light without turning the hero/footer light too. */
  --color-brand-slate: #2c3e50;
  --color-brand-slate-deep: #081e33;

  /* Viewer Interface Colors */
  --color-topbar-bg: #34495e;
  --color-topbar-text: #ecf0f1;
  --color-topbar-hover: #2c3e50;
  --color-topbar-active: #081e33;

  /* Sidebar - a LIGHT surface (dark topbar + light sidebar + light content).
     For a dark sidebar again, set bg to var(--color-brand-slate) and text to
     #ecf0f1; the sidebar rules read only from these tokens. */
  --color-sidebar-bg: #ffffff;
  --color-sidebar-surface: #f7f9fa;
  --color-sidebar-text: #2c3e50;
  --color-sidebar-muted: #7d8b97;
  --color-sidebar-border: #e6ebee;
  --color-sidebar-hover: #f0f8f7;
  --color-sidebar-button: #eef2f5;
  --color-sidebar-button-hover: #dfe6ea;
  --color-sidebar-scrollbar: #d5dee3;
  --color-sidebar-scrollbar-hover: #bcc9d1;

  /* Table Component Colors */
  --color-table-header: #34495e;
  --color-table-header-gradient: linear-gradient(180deg, #34495e 0%, #2c3e50 100%);
  --color-table-border: #e8ecef;
  --color-table-row-even: #f8f9fa;
  --color-table-row-odd: #ffffff;
  --color-table-hover: #e8f4f8;

  /* Focus Box Colors */
  --color-focus-bg: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
  --color-focus-border: #2c5aa0;
  --color-focus-accent: linear-gradient(135deg, #2c5aa0 0%, #4a7bc8 100%);

  /* Cross-Reference Colors
     -section (orange) marks referenced SECTION headings; -content (blue) marks
     referenced CONTENT: tables, figures, equations, citations.
     These two are for the small "referenced" DOT indicators (decorative fills).
     For xref accent TEXT (caption labels like "Table 1", citation numbers) use
     -content-deep: the #3498db above is only 3.2:1 on white and fails WCAG AA
     for body-size text, while -content-deep clears it at 5.5:1. */
  --color-xref-section: #e67e22;
  --color-xref-content: #3498db;
  --color-xref-content-deep: #1c6ea4;

  /* Citation Colors */
  --color-citation-border: #16a085;
  --color-citation-bg: #fafafa;
  --color-citation-hover: #f0f8f7;
  --color-citation-target: #e8f6f3;

  /* Search Colors */
  --color-search-highlight: #5fecff;
  --color-search-result-active: #e3f2fd;
  --color-search-button-close: #c0392b;
  --color-search-button-close-hover: #a93226;

  /* Neutral Grays */
  --color-gray-light: #f5f5f5;
  --color-gray-lighter: #f8f9fa;
  --color-gray-border: #eeeeee;
  --color-gray-border-medium: #dee2e6;
  --color-gray-border-dark: #cccccc;
  --color-gray-border-darker: #DDDDDD;
  --color-gray-text: #888888;
  --color-gray-text-medium: #495057;
  --color-gray-darker: #333;

  /* Additional UI Colors */
  --color-white: #ffffff;
  --color-border-subtle: #e0e0e0;
  --color-citation-border-hover: #138d75;
  --color-table-header-border: #1a252f;
  --color-topbar-input-hover: #1a252f;
  --color-link-blue: #2980b9;
  --color-error: #EE9999;


  /* ===== SHAPE =====
     The viewer uses a ROUND design language: soft rounded corners on every
     element (book bar, nav buttons, sidebar rows, cards, tables, code blocks).
     These three tokens drive it everywhere - change them here to restyle the
     whole viewer; set them all to 0 for an edgy/square look instead.
     (--border-radius-large matches --home-radius on the landing pages.) */
  --border-radius-small: 8px;
  --border-radius: 10px;
  --border-radius-large: 14px;
  --border-radius-pill: 999px;

  /* Box Shadows */
  --box-shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --box-shadow-medium: 0 2px 12px rgba(0, 0, 0, 0.08);
  --box-shadow-hover: 0 5px 15px rgba(44, 90, 160, 0.25);
  --box-shadow-strong: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Spacing Scale */
  --spacing-xs: 0.3em;
  --spacing-sm: 0.6em;
  --spacing-md: 1em;
  --spacing-lg: 1.5em;
  --spacing-xl: 2em;
  --spacing-xxl: 3em;

  /* Specific Spacing */
  --topbar-padding: 10px 20px;
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 40px;
  --sidebar-width-max: 600px;

  /* ===== ANIMATION ===== */

  /* Transition Durations */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
  --transition-slow: 0.6s ease-in-out;
}

/* ---- inlined from fonts.css ---- */
/* ====================================================================
   FONTS - Typography Configuration

   Font family definitions, sizes, and text rendering settings.
   ==================================================================== */

:root {
  /* Font Families */
  --font-family-base: Arial, Helvetica, sans-serif;
  --font-family-serif: 'Times New Roman', serif;
  --font-family-mono: "Courier New", monospace;

  /* Font Sizes */
  --font-size-base: 1em;
  --font-size-small: 0.9em;
  --font-size-smaller: 0.85em;
  --font-size-tiny: 0.8em;
  --font-size-large: 1.1em;
  --font-size-xlarge: 1.2em;
  --font-size-heading: 1.6em;

  /* Line Heights */
  --line-height-base: 1.6;
  --line-height-tight: 1.4;
  --line-height-loose: 1.8;
}


/* 2. Layout Structure */
/* ---- inlined from viewer-layout.css ---- */
/* ====================================================================
   VIEWER LAYOUT - Main Layout Structure

   Global layout setup for the documentation viewer including flexbox
   structure and overflow handling.
   ==================================================================== */

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overflow-x: hidden;
  font-family: var(--font-family-base);
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

/* Main content area */
.main {
  display: flex;
  flex: 1;
  overflow: hidden;
  overflow-x: hidden;
  min-width: 0;
}

/* Content frame container */
.content {
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  overflow-x: hidden;
  background-color: transparent;
  position: relative;
}

iframe {
  width: 100%;
  max-width: 100%;
  height: calc(100% - 60px);
  border: none;
  background-color: white;
  display: block;
}

/* HOME page only: drop the chapter chrome so the page reads as a standalone
   front page rather than a chapter of the docs. Per-book landings do NOT get
   this class - they keep the sidebar (see `viewer-book-landing` below). Both
   classes are toggled per-file in file-navigator.js -> updateLandingChrome. */
body.viewer-landing .sidebar,
body.viewer-landing .resizer,
body.viewer-landing .nav-buttons {
  display: none !important;
}

body.viewer-landing iframe {
  height: 100%;
}

/* Per-book landing ("Overview"): the sidebar stays visible so readers can
   navigate the book. The prev/next bar is redundant on an overview page, so
   hide just that and let the landing use the full content height. */
body.viewer-book-landing .nav-buttons {
  display: none !important;
}
body.viewer-book-landing iframe {
  height: 100%;
}

/* Hide chapter data elements */
.chapter-list {
  display: none;
}

.sidebar .chapter-list {
  display: block;
}

.content .chapter-list,
.nav-buttons .chapter-list,
body > .chapter-list {
  display: none !important;
}

.content .chapter,
.content div.chapter {
  display: none !important;
}


/* 3. Interface Components */
/* ---- inlined from viewer-topbar.css ---- */
/* ====================================================================
   TOPBAR - Header Navigation Bar

   Top bar with home button, book navigation, and search functionality.
   ==================================================================== */

.topbar {
  background-color: var(--color-topbar-bg);
  color: var(--color-topbar-text);
  display: flex;
  align-items: center;
  padding: var(--topbar-padding);
  flex-shrink: 0;
  min-width: 0;
  overflow-x: hidden;
}

/* ETH logo (corporate design: top-left, links to ethz.ch). The mark is black
   on transparent and the topbar is dark, so it sits on its own white chip
   rather than being recolored - ETH's own guidelines prohibit recoloring the
   logo, a background plate leaves the artwork untouched. */
.eth-logo-link {
  display: flex;
  align-items: center;
  background-color: var(--color-white);
  border-radius: var(--border-radius-small);
  padding: 5px 10px;
  margin-right: 14px;
  flex-shrink: 0;
}

.eth-logo-link img {
  display: block;
  height: 20px;
  width: auto;
}

/* Book Navigation Buttons (the ◀ ▶ scrollers) */
.book-nav-btn {
  background: none;
  border: none;
  border-radius: var(--border-radius-pill);
  color: var(--color-topbar-text);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 20px;
  flex-shrink: 0;
  transition: background-color var(--transition-fast);
  display: none;
}

.book-nav-btn:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.12);
}

.book-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.book-nav-btn.visible {
  display: block;
}

/* Book Buttons Wrapper */
.book-buttons-wrapper {
  flex: 1;
  overflow: hidden;
  min-width: 0;
  margin: 0 10px;
}

.book-buttons {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  gap: 10px;
  padding: 2px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.book-buttons::-webkit-scrollbar {
  display: none;
}

/* Book Buttons - round "pill" tabs. The active book uses the teal accent that
   the sidebar and the landing pages share, so the current book is obvious. */
.topbar .book-button {
  background: none;
  border: none;
  border-radius: var(--border-radius-pill);
  color: var(--color-topbar-text);
  padding: 8px 16px;
  cursor: pointer;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.topbar .book-button:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.topbar .book-button.active {
  background-color: var(--color-primary);
  color: var(--color-white);
  font-weight: 600;
}

.topbar .book-button.active:hover {
  background-color: var(--color-primary-dark);
}

/* ---- inlined from viewer-sidebar.css ---- */
/* ====================================================================
   SIDEBAR - Table of Contents Navigation

   Collapsible sidebar with chapter list, hierarchy, and navigation.

   Design: a LIGHT, airy surface (dark topbar + light sidebar + light
   content), with the round corners and teal accent used by the landing
   pages. Colours come from the --color-sidebar-* tokens in theme.css, so
   the sidebar can be re-skinned (even back to dark) from there alone.

   TWEAK POINTS - local tokens on `.sidebar` drive spacing/shape; change a
   value here rather than hunting through the rules:
     --sb-radius  row corner rounding      --sb-accent  active / accent colour
     --sb-gap     space between rows
   ==================================================================== */

.sidebar {
  /* --- local design tokens (edit these to restyle) --- */
  --sb-accent: var(--color-primary);              /* teal, matches landings   */
  --sb-radius: var(--border-radius-small);
  --sb-gap: 2px;

  width: var(--sidebar-width);
  min-width: var(--sidebar-width-collapsed);
  max-width: var(--sidebar-width-max);
  background-color: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  border-right: 1px solid var(--color-sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 12px;
  box-sizing: border-box;
  transition: none;
  position: relative;
  flex-shrink: 0;
}

/* BASEMENT/BASEdoc link - either the in-shell home book or, when there is
   none, a plain link out to the BASEMENT website (configure_home_button()
   in html_processor.py decides which). Sits above the "Chapters" heading. */
.home-button {
  display: flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  margin: 4px 0 16px 8px;
}

.home-button img {
  height: 30px;
  margin-right: 10px;
}

.home-button span {
  font-size: 18px;
  font-weight: bold;
}

/* Eyebrow-style section heading ("Chapters"), matching .home-eyebrow. */
.sidebar h2 {
  margin: 2px 0 12px;
  padding: 0 34px 12px 8px;   /* right pad clears the collapse button */
  border: 0;
  border-bottom: 1px solid var(--color-sidebar-border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-sidebar-muted);
}

/* ---- slim, modern scrollbar ---- */
.sidebar { scrollbar-width: thin; scrollbar-color: var(--color-sidebar-scrollbar) transparent; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--color-sidebar-scrollbar);
  border-radius: var(--border-radius-small);
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--color-sidebar-scrollbar-hover); background-clip: padding-box; }

/* Collapse Button */
.collapse-btn {
  position: absolute;
  top: 12px;
  right: 10px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--border-radius-small);
  background-color: var(--color-sidebar-button);
  color: var(--color-sidebar-text);
  font-size: 14px;
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.collapse-btn:hover {
  background-color: var(--color-sidebar-button-hover);
  transform: translateY(-1px);
}

/* Collapsed State */
.sidebar.collapsed {
  min-width: var(--sidebar-width-collapsed);
  width: var(--sidebar-width-collapsed) !important;
  padding: 10px 5px;
  overflow: hidden;
}

.sidebar.collapsed .collapse-btn {
  right: 6px;
  left: 6px;
  margin: 0 auto;
}

.sidebar.collapsed > *:not(.collapse-btn) {
  display: none !important;
  visibility: hidden;
}

.sidebar.collapsed ul,
.sidebar.collapsed .search-container,
.sidebar.collapsed .chapter-list,
.sidebar.collapsed li {
  display: none !important;
}

/* Chapter List Styling */
.sidebar ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sb-gap);
}

.sidebar li {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--sb-radius);
  position: relative;
  text-align: left;
  line-height: 1.35;
  color: var(--color-sidebar-text);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar li:hover {
  background-color: var(--color-sidebar-hover);
}

/* Active row: a soft teal wash with a solid accent bar on the left - the
   light-mode counterpart of a selected card on the landing pages. */
.sidebar li.active {
  background-color: var(--color-primary-light);
  color: var(--color-primary-deep);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sb-accent);
}

.sidebar li.active:hover {
  background-color: var(--color-primary-light);
}

/* Scroll Spy Animation */
@keyframes scrollSpyPulse {
  0% { box-shadow: inset 3px 0 0 rgba(23, 162, 184, 0); }
  50% { box-shadow: inset 3px 0 0 var(--color-primary-dark); }
  100% { box-shadow: inset 3px 0 0 var(--sb-accent); }
}

.sidebar li.active.scroll-spy-update {
  animation: scrollSpyPulse var(--transition-slow);
}

/* Chapter Hierarchy */
.sidebar li[data-level="1"],
.sidebar li[data-level="2"] {
  font-weight: 600;
}

.sidebar li .collapse-indicator {
  display: inline-block;
  width: 16px;
  font-size: var(--font-size-tiny);
  cursor: pointer;
  user-select: none;
  color: var(--color-sidebar-muted);
}

.sidebar li.active .collapse-indicator { color: var(--color-primary-deep); }

/* Level-based Indentation (data-level attribute) */
.sidebar li[data-level="2"] {
  padding-left: 22px;
}

.sidebar li[data-level="3"] {
  padding-left: 36px;
  font-size: 0.95em;
  color: var(--color-sidebar-muted);
}

.sidebar li[data-level="4"] {
  padding-left: 50px;
  font-size: var(--font-size-small);
  color: var(--color-sidebar-muted);
}

.sidebar li[data-level="5"] {
  padding-left: 64px;
  font-size: var(--font-size-smaller);
  color: var(--color-sidebar-muted);
}

.sidebar li[data-level="6"] {
  padding-left: 78px;
  font-size: var(--font-size-tiny);
  color: var(--color-sidebar-muted);
}

/* Deeper rows regain full-strength text when hovered/active. */
.sidebar li:hover { color: var(--color-sidebar-text); }
.sidebar li.active { color: var(--color-primary-deep); }

/* Class-based Indentation (level-N classes) */
.sidebar li.level-1,
.chapter-list li.level-1 {
  padding-left: 12px;
}

.sidebar li.level-2,
.chapter-list li.level-2 {
  padding-left: 22px;
}

.sidebar li.level-3,
.chapter-list li.level-3 {
  padding-left: 36px;
  font-size: 0.95em;
}

.sidebar li.level-4,
.chapter-list li.level-4 {
  padding-left: 50px;
  font-size: var(--font-size-small);
}

.sidebar li.level-5,
.chapter-list li.level-5 {
  padding-left: 64px;
  font-size: var(--font-size-smaller);
}

.sidebar li.level-6,
.chapter-list li.level-6 {
  padding-left: 78px;
  font-size: var(--font-size-tiny);
}

/* ---- inlined from viewer-resizer.css ---- */
/* ====================================================================
   RESIZER - Sidebar Resizing Handle

   Draggable handle between sidebar and content area for manual resizing.
   ==================================================================== */

.resizer {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  flex: 0 0 8px;
  width: 8px;
  cursor: col-resize;
  background: transparent;
  height: 100%;
  align-self: stretch;
  transition: background-color 0.12s;
  touch-action: none;
  pointer-events: auto;
}

.resizer:hover {
  background: var(--color-primary-light);
}

.resizer.dragging {
  background: var(--color-primary);
  z-index: 1000;
  pointer-events: auto;
}

/* Hide resizer when sidebar is collapsed */
.sidebar.collapsed + .resizer {
  cursor: default;
  pointer-events: none;
}

.sidebar.collapsed + .resizer:hover {
  background: transparent;
}

/* ---- inlined from viewer-navigation.css ---- */
/* ====================================================================
   NAVIGATION - Chapter Navigation Buttons

   Previous/Next chapter buttons and back button for cross-references.
   ==================================================================== */

.nav-buttons {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  z-index: 100;
  pointer-events: none;
}

.nav-buttons button,
.nav-buttons div {
  pointer-events: all;
  min-width: 100px;
}

/* Back Button (Center) */
.nav-buttons button.back {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: all;
  flex-shrink: 0;
  max-width: 120px;
}

/* Button Base Styling - light, round pills that float over the chapter page
   (rather than heavy dark slabs), matching the landing-page button language. */
.nav-buttons button {
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-pill);
  cursor: pointer;
  background-color: var(--color-bg);
  color: var(--color-heading);
  box-shadow: var(--box-shadow-light);
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* Button Hover States - lift and pick up the teal accent. */
.nav-buttons button:hover {
  background-color: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary-deep);
  box-shadow: 0 6px 16px rgba(44, 62, 80, 0.16);
  transform: translateY(-1px);
}

.nav-buttons button.back:hover {
  transform: translateX(-50%) translateY(-1px);
}

/* Disabled State */
.nav-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-subtle);
  color: var(--color-text-muted);
  box-shadow: none;
}

.nav-buttons button:disabled:hover {
  background-color: var(--color-bg-secondary);
  border-color: var(--color-border-subtle);
  color: var(--color-text-muted);
  box-shadow: none;
  transform: none;
}

.nav-buttons button.back:disabled:hover {
  transform: translateX(-50%);
}

/* ---- inlined from viewer-search.css ---- */
/* ====================================================================
   SEARCH - Search Interface Components

   Search input, button, results panel, and search result items.
   ==================================================================== */

/* Search Container */
.search-container {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search Input */
#searchInput {
  padding: 8px 12px;
  border: 1px solid var(--color-topbar-hover);
  border-radius: var(--border-radius-small);
  font-size: 14px;
  width: 250px;
  background: var(--color-topbar-text);
  color: var(--color-topbar-hover);
}

#searchInput:focus {
  outline: none;
  border-color: var(--color-topbar-text);
  background: var(--color-bg);
}

/* Search Button */
#searchButton {
  padding: 8px 16px;
  background: var(--color-topbar-hover);
  color: var(--color-topbar-text);
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  font-size: 14px;
}

#searchButton:hover {
  background: var(--color-topbar-input-hover);
}

#searchButton.search-close-mode {
  background: var(--color-search-button-close);
}

#searchButton.search-close-mode:hover {
  background: var(--color-search-button-close-hover);
}

/* Search Results Panel */
.search-results {
  position: absolute;
  top: 60px;
  right: 20px;
  width: 400px;
  max-height: 500px;
  background: var(--color-bg);
  border: 1px solid var(--color-gray-border-dark);
  border-radius: var(--border-radius-small);
  box-shadow: var(--box-shadow-strong);
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.search-results.active {
  display: block;
}

/* Search Results Header */
.search-book-header {
  padding: 8px 12px;
  background: var(--color-topbar-bg);
  color: var(--color-topbar-text);
  font-weight: bold;
  font-size: var(--font-size-small);
}

/* Search Result Items */
.search-result-item {
  padding: 12px;
  padding-left: 16px;
  border-bottom: 1px solid var(--color-gray-border);
  cursor: pointer;
  transition: background-color 0.15s;
}

.search-result-item:hover {
  background: var(--color-gray-light);
}

.search-result-item.active {
  background: var(--color-search-result-active);
}

.search-result-trail {
  font-size: var(--font-size-tiny);
  color: var(--color-gray-text);
  margin-bottom: 2px;
  font-weight: normal;
}

.search-result-title {
  font-weight: bold;
  color: var(--color-link-blue);
  margin-bottom: 2px;
}

.search-result-path {
  font-weight: bold;
  color: var(--color-link-blue);
  margin-bottom: 2px;
}

.search-result-context {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  line-height: var(--line-height-tight);
}

.search-result-context mark {
  background: var(--color-search-highlight);
  padding: 2px 4px;
  border-radius: var(--border-radius-small);
}

.search-no-results {
  padding: 20px;
  text-align: center;
  color: var(--color-text-muted);
}

/* Search Results Summary */
.search-results-summary {
  padding: 12px;
  background: var(--color-gray-lighter);
  border-bottom: 1px solid var(--color-gray-border-medium);
  font-size: var(--font-size-small);
  color: var(--color-gray-text-medium);
  font-weight: 500;
}

/* Show More Button */
.search-show-more {
  padding: 16px;
  text-align: center;
  border-top: 2px solid var(--color-gray-border-medium);
  background: var(--color-gray-lighter);
}

.search-show-more button {
  padding: 10px 20px;
  background: var(--color-topbar-bg);
  color: var(--color-topbar-text);
  border: none;
  border-radius: var(--border-radius-small);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}

.search-show-more button:hover {
  background: var(--color-topbar-hover);
}

/* ---- inlined from viewer-footer.css ---- */
/* ====================================================================
   SITE FOOTER - secondary/legal site links + version note

   The Website / User forum / Contributors / Licenses / Imprint / Contact /
   Data protection set, plus the version note. Content comes from
   BASEdoc/00_BASEdoc/home.md via configure_footer_links() (html_processor.py);
   this file only styles whatever lands in #footerLinks.

   Lives in its own shell-level bar below <main>, not the topbar: chapters
   render inside an iframe within the shell rather than replacing it, so a
   footer here is reachable from every view exactly like the topbar is - it
   just keeps these secondary links from competing with primary navigation
   (book tabs, search) for space in the topbar.
   ==================================================================== */

.site-footer {
  background-color: var(--color-brand-slate-deep);
  color: var(--color-topbar-text);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 20px;
  flex-shrink: 0;
  min-width: 0;
  overflow-x: auto;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-links a {
  color: var(--color-topbar-text);
  font-size: .85rem;
  text-decoration: none;
  opacity: .82;
  white-space: nowrap;
  transition: opacity var(--transition-fast);
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Muted version note, set off from the links by a hairline. */
.footer-links__label {
  padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, .16);
  color: var(--color-topbar-text);
  opacity: .6;
  font-size: .78rem;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .footer-links { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
}

