/* ============================================================
   3WHY Site Search — Lupen-Icon in Nav + Modal mit Pagefind UI
   ============================================================ */

/* Lupen-Button in Nav */
.nav-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  margin-right: .25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #666660;
  cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.nav-search:hover,
.nav-search:focus-visible {
  color: #2D5A27;
  background: #EEF4EC;
  border-color: #DDD9D2;
  outline: none;
}
.nav-search svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-search-kbd {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 10px;
  color: #B8B8B4;
  margin-left: 6px;
  padding: 2px 5px;
  border: 1px solid #DDD9D2;
  border-radius: 3px;
  letter-spacing: 0;
}
@media (max-width: 720px) {
  .nav-search-kbd { display: none; }
}

/* Modal-Overlay */
.search-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(2rem, 8vh, 6rem) 1rem 2rem;
}
.search-modal.open { display: flex; }
.search-modal-inner {
  width: 100%;
  max-width: 640px;
  background: #FFFFFF;
  border: 1px solid #DDD9D2;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  overflow: hidden;
  animation: search-pop .18s ease-out;
}
@keyframes search-pop {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #DDD9D2;
  background: #F9F8F6;
}
.search-modal-title {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1A1A1A;
}
.search-modal-close {
  background: none;
  border: none;
  color: #666660;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 4px;
}
.search-modal-close:hover { color: #1A1A1A; background: #EAE6DF; }

.search-modal-body {
  padding: 16px 18px 22px;
}

/* Pagefind UI Theme an 3why-Designsystem anpassen */
#pagefind-search {
  --pagefind-ui-scale: .85;
  --pagefind-ui-primary: #2D5A27;
  --pagefind-ui-text: #1A1A1A;
  --pagefind-ui-background: #FFFFFF;
  --pagefind-ui-border: #DDD9D2;
  --pagefind-ui-tag: #F0EDE8;
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: 8px;
  --pagefind-ui-image-border-radius: 6px;
  --pagefind-ui-image-box-ratio: 3 / 2;
  --pagefind-ui-font: 'DM Sans', system-ui, sans-serif;
}
#pagefind-search .pagefind-ui__form::before {
  background-color: #2D5A27;
}
#pagefind-search .pagefind-ui__result-title a {
  font-family: 'Libre Baskerville', Georgia, serif;
  color: #1A1A1A;
  text-decoration: none;
}
#pagefind-search .pagefind-ui__result-title a:hover {
  color: #2D5A27;
}
#pagefind-search mark {
  background: #EEF4EC;
  color: #2D5A27;
  font-weight: 600;
  padding: 0 2px;
}
#pagefind-search .pagefind-ui__message,
#pagefind-search .pagefind-ui__result-excerpt {
  color: #4a4a4a;
}
