/* ==========================================================================
   Suche -- Header-Icon + Overlay-Formular (search/search.php), Autocomplete
   (js/search.js) und Ergebnisseite (results.php).
   ========================================================================== */

.site-search__opener {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-accent);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.site-search__opener svg,
.site-search__submit svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Overlay legt sich ueber den kompletten Header, exakt in dessen Hoehe
   (--site-header-height, siehe style.css) -- .site-header ist per
   position:sticky bereits das naechste positionierte Element, dient hier
   als Bezugsrahmen fuer top:0/left:0/right:0. overflow:hidden nur im
   geschlossenen Zustand (kollabiert den Inhalt); offen muss overflow
   sichtbar sein, sonst wuerde die Autocomplete-Liste, die unterhalb der
   festen Hoehe herausragt, abgeschnitten. */
.site-search__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--color-charcoal);
  height: var(--site-header-height);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.site-search__overlay.is-open {
  max-height: var(--site-header-height);
  overflow: visible;
  opacity: 1;
  pointer-events: auto;
}

.site-search__inner {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.site-search__field {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  outline: none;
  color: var(--color-on-charcoal);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--space-1) 0;
}

@media (min-width: 768px) {
  .site-search__field {
    font-size: 17px;
  }
}

.site-search__field::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.site-search__submit,
.site-search__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
}

.site-search__submit {
  color: var(--color-accent);
}

.site-search__close {
  color: var(--color-on-charcoal);
  font-size: 24px;
  line-height: 1;
}

.site-search__suggestions {
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  top: 100%;
  margin: 0;
  padding: var(--space-1) 0;
  list-style: none;
  background: var(--color-charcoal);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  max-height: 260px;
  overflow-y: auto;
}

.site-search__suggestion {
  padding: var(--space-1) var(--space-2);
  color: var(--color-on-charcoal);
  font-size: 14px;
  cursor: pointer;
}

.site-search__suggestion.is-active,
.site-search__suggestion:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-accent);
}

/* --------------------------------------------------------------------
   Ergebnisseite (results.php)
   -------------------------------------------------------------------- */

.search-results-page {
  /* Abstand nach unten, egal ob mit oder ohne Pagination am Ende --
     sonst klebt die letzte Zeile (Ergebnis oder Pagination) direkt am
     Footer. */
  padding-bottom: var(--space-5);
}

.search-results-title {
  padding-top: var(--space-4);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.search-results-title h1 {
  font-family: var(--font-headline);
  font-size: 24px;
  margin: 0;
}

.search-results-empty {
  color: var(--color-text-muted);
  padding: var(--space-4) 0 var(--space-5);
}

.search-results-meta {
  color: var(--color-text-muted);
  font-size: 13px;
  margin: 0 0 var(--space-3);
}

.search-results-list {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.search-result__title {
  font-size: 18px;
  margin: 0 0 4px;
}

.search-result__title a {
  color: var(--color-charcoal);
}

.search-result__title a:hover {
  color: var(--color-accent);
}

.search-result__url {
  display: block;
  font-size: 12px;
  color: var(--color-accent);
  margin-bottom: var(--space-1);
  word-break: break-all;
}

.search-result__description {
  color: var(--color-text);
  margin: 0 0 4px;
}

.search-result__snippet {
  color: var(--color-text-muted);
  font-size: 14px;
  margin: 0;
}

.search-result__snippet mark {
  background: rgba(254, 79, 0, 0.18);
  color: var(--color-text);
  padding: 0 2px;
}

.search-result__score {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--color-text-muted);
}

.search-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.search-pagination__list {
  list-style: none;
  display: flex;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
}

.search-pagination__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

a.search-pagination__page:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.search-pagination__page.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}

.search-pagination__link {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 13px;
}
