/* Site search — homepage header (modern bar + pill filters) */
.site-header .header-search {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 0 1rem;
}

[data-theme="dark"] .site-header .header-search {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.site-header .header-search button {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.site-header .header-search__svg {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.header-search__wrap {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Quick links */
.header-search__quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.78rem;
}

.header-search__quick a {
  color: #64748b;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.header-search__quick a:hover {
  color: #16a34a;
}

.header-search__dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

[data-theme="dark"] .header-search__quick a {
  color: #94a3b8;
}

[data-theme="dark"] .header-search__quick a:hover {
  color: #4ade80;
}

/* Scope pills */
.header-search__modes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.header-search__mode {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.4rem 0.95rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  line-height: 1.2;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.header-search__mode:hover {
  border-color: #86efac;
  color: #15803d;
}

.header-search__mode.is-active {
  background: linear-gradient(135deg, #16a34a, #059669);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
}

.header-search__mode.is-active::after {
  display: none;
}

[data-theme="dark"] .header-search__mode {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

[data-theme="dark"] .header-search__mode.is-active {
  background: linear-gradient(135deg, #22c55e, #14b8a6);
  color: #0f172a;
}

/* Search bar — one row */
.header-search__form {
  position: relative;
}

.header-search__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0.35rem 0.35rem 0.35rem 0.85rem;
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search__bar:focus-within {
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12), 0 8px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .header-search__bar {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .header-search__bar:focus-within {
  border-color: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.15);
}

.header-search__lead {
  display: flex;
  align-items: center;
  color: #94a3b8;
  flex-shrink: 0;
}

.header-search__input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.45rem 0;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #0f172a;
}

.header-search__input:focus {
  outline: none;
}

.header-search__input::placeholder {
  color: #94a3b8;
}

[data-theme="dark"] .header-search__input {
  color: #f1f5f9;
}

.header-search__gallery,
.header-search__submit {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}

.header-search__gallery {
  background: #f1f5f9;
  color: #475569;
}

.header-search__gallery:hover {
  background: #ecfdf5;
  color: #15803d;
}

.header-search__submit {
  background: linear-gradient(135deg, #16a34a 0%, #059669 100%);
  color: #fff;
  padding: 0.55rem 1.1rem;
}

.header-search__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(22, 163, 74, 0.35);
}

[data-theme="dark"] .header-search__gallery {
  background: #334155;
  color: #e2e8f0;
}

/* Results dropdown */
.header-search__results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 400;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
  max-height: 320px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0.4rem;
}

.header-search__results[hidden] {
  display: none !important;
}

[data-theme="dark"] .header-search__results {
  background: #1e293b;
  border-color: #334155;
}

.header-search__result {
  display: block;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.header-search__result:hover,
.header-search__result.is-focused {
  background: #f0fdf4;
}

[data-theme="dark"] .header-search__result:hover,
[data-theme="dark"] .header-search__result.is-focused {
  background: rgba(74, 222, 128, 0.1);
}

.header-search__result-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
}

[data-theme="dark"] .header-search__result-title {
  color: #f1f5f9;
}

.header-search__result-meta {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 0.1rem;
}

.header-search__empty {
  padding: 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: #64748b;
}

@media (max-width: 768px) {
  .site-header .header-search {
    padding: 0.6rem 0 0.85rem;
  }

  .header-search__quick {
    display: none;
  }

  .header-search__modes {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.15rem;
  }

  .header-search__modes::-webkit-scrollbar {
    display: none;
  }

  .header-search__mode {
    flex-shrink: 0;
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
  }

  .header-search__bar {
    min-height: 48px;
    padding-left: 0.65rem;
    gap: 0.35rem;
  }

  .header-search__lead {
    display: none;
  }

  .header-search__input {
    font-size: 0.95rem;
  }

  .header-search__btn-label {
    display: none;
  }

  .header-search__gallery,
  .header-search__submit {
    padding: 0.5rem 0.65rem;
    border-radius: 10px;
  }
}

@media (max-width: 400px) {
  .header-search__input {
    font-size: 0.9rem;
  }

  .header-search__results {
    max-height: 50vh;
  }
}
