/* Pagefind UI — Digital Heroes theme override.
   Maps Pagefind's CSS custom properties to the moss/cream/amber palette.
   Pagefind's default UI uses CSS variables prefixed --pagefind-ui-*; redefining
   them here re-themes the entire search UI without touching the bundled CSS.
*/

:root {
  /* Default theme = dark (matches the rest of the site).
     CSS variable overrides — these override pagefind-ui.css defaults. */
  --pagefind-ui-scale: 0.95;
  --pagefind-ui-primary: #6fa37a;          /* moss-500 — buttons + accents */
  --pagefind-ui-text: rgba(245, 240, 232, 0.92);
  --pagefind-ui-background: rgba(15, 23, 19, 0.55);   /* glass-card bg */
  --pagefind-ui-border: rgba(111, 163, 122, 0.22);
  --pagefind-ui-tag: rgba(63, 107, 84, 0.35);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 12px;
  --pagefind-ui-image-border-radius: 8px;
  --pagefind-ui-image-box-ratio: 3 / 2;
  --pagefind-ui-font: "Inter", system-ui, sans-serif;
}

/* Light-mode variant — uses cream paper tokens. */
.light :root,
html.light {
  --pagefind-ui-text: #0f1713;
  --pagefind-ui-background: rgba(255, 253, 249, 0.92);
  --pagefind-ui-border: rgba(63, 107, 84, 0.30);
  --pagefind-ui-tag: rgba(111, 163, 122, 0.18);
}

/* Layout polish — wrap the entire search UI in a glass card */
.dh-search-wrap .pagefind-ui {
  font-family: 'Inter', system-ui, sans-serif;
}

/* Search input — match DH's tool-input pattern */
.dh-search-wrap .pagefind-ui__form {
  position: relative;
}
.dh-search-wrap .pagefind-ui__search-input {
  background: rgba(15, 23, 19, 0.55) !important;
  border: 1px solid rgba(63, 107, 84, 0.28) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  border-radius: 12px !important;
  /* Left padding clears Pagefind's default magnifier icon (positioned at
     left:19px, ends at ~36px when --pagefind-ui-scale is 0.95) plus a
     comfortable visual gap. 64px gives ~28px of breathing room between
     the icon's right edge and where placeholder text starts. */
  padding: 14px 50px 14px 64px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 15px !important;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  width: 100%;
  box-sizing: border-box;
}
/* Belt + suspenders: nudge the icon itself a hair right so it sits more
   centered in its left-pad column on our taller (14px vertical) input. */
.dh-search-wrap .pagefind-ui__form::before {
  left: 22px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
}
.dh-search-wrap .pagefind-ui__search-input::placeholder {
  color: rgba(255, 255, 255, 0.40) !important;
}
.dh-search-wrap .pagefind-ui__search-input:focus {
  outline: none !important;
  border-color: #6fa37a !important;
  box-shadow: 0 0 0 3px rgba(111, 163, 122, 0.18) !important;
}
.light .dh-search-wrap .pagefind-ui__search-input {
  background: rgba(255, 253, 249, 0.92) !important;
  border-color: rgba(63, 107, 84, 0.35) !important;
  color: #0f1713 !important;
}
.light .dh-search-wrap .pagefind-ui__search-input::placeholder {
  color: rgba(15, 23, 19, 0.35) !important;
}

/* Clear button (X to clear input) */
.dh-search-wrap .pagefind-ui__search-clear {
  background: transparent !important;
  color: rgba(255, 255, 255, 0.55) !important;
  font-size: 12px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  padding: 8px 14px !important;
  right: 8px !important;
}
.dh-search-wrap .pagefind-ui__search-clear:hover {
  color: #6fa37a !important;
}

/* Result count summary */
.dh-search-wrap .pagefind-ui__message {
  color: rgba(255, 255, 255, 0.60) !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 11px !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 18px 0 12px !important;
  border-bottom: 1px solid rgba(111, 163, 122, 0.15);
  margin-bottom: 12px;
}
.light .dh-search-wrap .pagefind-ui__message {
  color: rgba(15, 23, 19, 0.55) !important;
}

/* Each search result card */
.dh-search-wrap .pagefind-ui__result {
  background: rgba(15, 23, 19, 0.55) !important;
  border: 1px solid rgba(111, 163, 122, 0.15) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 14px !important;
  padding: 18px 20px !important;
  margin-bottom: 12px !important;
  transition: border-color 180ms ease, transform 180ms ease;
}
.dh-search-wrap .pagefind-ui__result:hover {
  border-color: rgba(111, 163, 122, 0.40) !important;
  transform: translateY(-1px);
}
.light .dh-search-wrap .pagefind-ui__result {
  background: rgba(255, 253, 249, 0.92) !important;
  border-color: rgba(63, 107, 84, 0.18) !important;
}

/* Result title (links to the page) */
.dh-search-wrap .pagefind-ui__result-title {
  font-family: 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 600 !important;
  font-size: 17px !important;
  letter-spacing: -0.01em;
  margin-bottom: 6px !important;
}
.dh-search-wrap .pagefind-ui__result-link {
  color: rgba(255, 255, 255, 0.95) !important;
  text-decoration: none !important;
  transition: color 140ms ease;
}
.dh-search-wrap .pagefind-ui__result-link:hover {
  color: #6fa37a !important;
}
.light .dh-search-wrap .pagefind-ui__result-link {
  color: #0f1713 !important;
}
.light .dh-search-wrap .pagefind-ui__result-link:hover {
  color: #3f6b54 !important;
}

/* Excerpt text with highlighted match */
.dh-search-wrap .pagefind-ui__result-excerpt {
  font-family: 'Inter', system-ui, sans-serif !important;
  font-size: 13px !important;
  line-height: 1.65 !important;
  color: rgba(255, 255, 255, 0.65) !important;
  margin-top: 4px !important;
}
.light .dh-search-wrap .pagefind-ui__result-excerpt {
  color: rgba(15, 23, 19, 0.70) !important;
}
.dh-search-wrap .pagefind-ui__result-excerpt mark {
  background: rgba(205, 138, 75, 0.25) !important;   /* amber tint */
  color: inherit !important;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 500;
}

/* Sub-results — show which section of the article matched */
.dh-search-wrap .pagefind-ui__result-nested {
  border-left: 2px solid rgba(111, 163, 122, 0.30) !important;
  padding-left: 14px !important;
  margin-top: 12px !important;
  margin-left: 0 !important;
}
.dh-search-wrap .pagefind-ui__result-nested .pagefind-ui__result-title {
  font-size: 14px !important;
  font-weight: 500 !important;
}
.dh-search-wrap .pagefind-ui__result-nested .pagefind-ui__result-excerpt {
  font-size: 12px !important;
}

/* Filter pills (when filters are configured per-page) */
.dh-search-wrap .pagefind-ui__filter-pill {
  background: rgba(63, 107, 84, 0.30) !important;
  color: rgba(255, 255, 255, 0.85) !important;
  border-radius: 999px !important;
  font-family: 'JetBrains Mono', ui-monospace, monospace !important;
  font-size: 11px !important;
  letter-spacing: 0.05em;
  padding: 4px 10px !important;
}

/* "More results" button */
.dh-search-wrap .pagefind-ui__button {
  background: #3f6b54 !important;
  border: none !important;
  color: rgba(245, 240, 232, 0.95) !important;
  font-family: 'Space Grotesk', system-ui, sans-serif !important;
  font-weight: 600 !important;
  border-radius: 999px !important;
  padding: 10px 20px !important;
  font-size: 13px !important;
  cursor: pointer;
  transition: background 140ms ease;
  margin-top: 16px;
}
.dh-search-wrap .pagefind-ui__button:hover {
  background: #6fa37a !important;
}

/* Empty / loading states */
.dh-search-wrap .pagefind-ui__no-results,
.dh-search-wrap .pagefind-ui__suggestions {
  color: rgba(255, 255, 255, 0.55) !important;
  font-style: italic;
  padding: 24px 0;
  text-align: center;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 17px;
}
.light .dh-search-wrap .pagefind-ui__no-results,
.light .dh-search-wrap .pagefind-ui__suggestions {
  color: rgba(15, 23, 19, 0.55) !important;
}

/* Drawer / modal mode (in case we wire a global search modal later) */
.dh-search-wrap .pagefind-ui__drawer {
  background: rgba(10, 10, 26, 0.96);
  backdrop-filter: blur(18px);
}
.light .dh-search-wrap .pagefind-ui__drawer {
  background: rgba(245, 240, 232, 0.96);
}
