/* Blog-Suche (Pagefind Component UI) im Nachschein-Look. Nur Blog-Übersichten.
   Das Feld sitzt in der Kopfzeile von "Alle Beiträge" (rechts, über den Kategorie-Knöpfen),
   die Ergebnisse stehen darunter in voller Breite.
   Die Pagefind-Komponenten bringen ihre Stile mit hoher Spezifität mit (:is(*, #\#)-Trick),
   deshalb nutzen die Überschreibungen unten dieselbe Vorstufe. Rückbau: Link entfernen. */

.bm-search,
.bm-search-results {
  --pf-font: var(--bm-sans, "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif);
  --pf-text: #1f1814;
  --pf-text-secondary: #3d3530;
  --pf-text-muted: #6b6058;
  --pf-background: #fff;
  --pf-border: #857a70;
  --pf-border-focus: #1f1814;
  --pf-hover: #f6f3ef;
  --pf-mark: #1f1814;
  --pf-outline-focus: #c4006b;
  --pf-outline-width: 2px;
  --pf-border-radius: 999px;
  --pf-input-height: 42px;
  --pf-input-font-size: 15px;
  --pf-summary-font-size: 14px;
  --pf-result-title-font-size: clamp(1.15rem, 1.05rem + .5vw, 1.4rem);
  --pf-result-excerpt-font-size: 15.5px;
  --pf-results-gap: 0px;
}

/* Kopfzeile: Überschrift links, Suche über den Knöpfen rechts */
body.blog-modern .blog-listing-head.has-tools { align-items: flex-end; }
.bm-head-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; min-width: 0; }
.bm-head-tools .bm-filter { justify-content: flex-end; }
.bm-search { width: 340px; max-width: 100%; min-height: 42px; margin: 0; }
.bm-search pagefind-input { display: block; }
.bm-search-status { margin: 0; padding: 10px 0; color: var(--pf-text-muted); font: 500 14px/1.5 var(--pf-font); }
/* Das Label bleibt für Screenreader erhalten, sichtbar ist nur das Feld. */
.bm-search-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Ergebnisse: nur bei aktiver Suche sichtbar, flache Liste statt Karten */
.blog-listing:not(.is-searching) > .bm-search-results { display: none; }
.bm-search-results pagefind-summary { display: block; margin-bottom: 4px; }
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-card {
  padding: 22px 0; background: transparent; border: 0; border-radius: 0; box-shadow: none;
  border-bottom: 1px solid var(--bm-line, rgba(31, 24, 20, .12));
}
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-card:hover { border-color: var(--bm-line, rgba(31, 24, 20, .12)); box-shadow: none; }
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-title { font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-link:hover { text-decoration: underline; text-underline-offset: 3px; }
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-excerpt {
  margin-top: 8px; line-height: 1.6; white-space: normal; max-width: 72ch;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
:is(*, #\#):is(*, #\#):is(*, #\#):is(*, #\#) .bm-search-results .pf-result-excerpt mark {
  background: rgba(255, 212, 0, .38); color: #1f1814; font-weight: 600; border-radius: 2px; padding: 0 1px;
}

.bm-result-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 8px; font: 500 13px/1.2 var(--bm-sans, sans-serif); color: #6b6058; }
.bm-result-cat { display: inline-flex; align-items: center; gap: 7px; color: #3d3530; font-weight: 600; }
.bm-result-cat::before { content: ""; width: 8px; height: 8px; flex: none; background: #1ccfee; }
.bm-result-cat[data-kategorie="Ratgeber"]::before { background: #ffd400; }
.bm-result-cat[data-kategorie="Einordnung"]::before { background: #e6007e; }

/* Keine Treffer */
.bm-search-empty { margin: 8px 0 0; padding: 20px 22px; background: #f6f3ef; border-radius: 16px; color: #3d3530; font: 400 15.5px/1.6 var(--bm-sans, sans-serif); }
.bm-search-empty[hidden] { display: none; }
.bm-search-empty p { margin: 0 0 6px; }
.bm-search-empty-title { font-weight: 600; color: #1f1814; }
.bm-search-reset {
  margin-top: 8px; min-height: 44px; padding: 8px 18px; border: 1px solid #1f1814; border-radius: 999px;
  background: #1f1814; color: #f3ece2; font: 500 14px/1.2 var(--bm-sans, sans-serif); cursor: pointer;
}
.bm-search-reset:hover { background: #3d3530; }
.bm-search-reset:focus-visible { outline: 2px solid #c4006b; outline-offset: 3px; }

/* Bei aktiver Suche: Liste, Status und Seitenzahlen ausblenden. Die Kopfzeile mit Feld und Knöpfen bleibt. */
.blog-listing.is-searching > .blog-grid,
.blog-listing.is-searching > .blog-pagination-status,
.blog-listing.is-searching > .blog-pagination { display: none; }

@media (max-width: 699px) {
  body.blog-modern .blog-listing-head.has-tools { align-items: stretch; }
  .bm-head-tools { align-items: stretch; width: 100%; }
  .bm-head-tools .bm-filter { justify-content: flex-start; }
  .bm-search { width: 100%; }
}
