#search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: flex-start;
  padding-top: 15vh;
}

#search-overlay.active {
  display: flex;
}

#search-modal {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  width: 90%;
  max-width: 560px;
  max-height: 70vh;
  overflow-y: auto;
  padding: 1.2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] #search-modal {
  background: #1a1a2e;
  border-color: #444;
  color: #e0e0e0;
}

[data-theme="dark"] #search-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* Pagefind UI overrides */
#search-modal .pagefind-ui__search-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: #333;
}

[data-theme="dark"] #search-modal .pagefind-ui__search-input {
  background: #16213e;
  border-color: #555;
  color: #e0e0e0;
}

#search-modal .pagefind-ui__search-clear {
  color: #999;
}

#search-modal .pagefind-ui__result-link {
  color: #333;
  text-decoration: none;
  font-weight: 600;
}

#search-modal .pagefind-ui__result-link:hover {
  text-decoration: underline;
}

[data-theme="dark"] #search-modal .pagefind-ui__result-link {
  color: #8ab4f8;
}

#search-modal .pagefind-ui__result-excerpt {
  font-size: 0.85rem;
  color: #666;
}

[data-theme="dark"] #search-modal .pagefind-ui__result-excerpt {
  color: #aaa;
}

/* Sidebar search hint */
.search-hint {
  font-size: 0.78rem;
  color: #999;
  cursor: pointer;
  margin-top: 0.8rem;
}

.search-hint:hover {
  color: #555;
}

[data-theme="dark"] .search-hint {
  color: #777;
}

[data-theme="dark"] .search-hint:hover {
  color: #bbb;
}

.search-hint kbd {
  display: inline-block;
  padding: 0 0.35em;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.85em;
  font-family: inherit;
  background: #f7f7f7;
}

[data-theme="dark"] .search-hint kbd {
  border-color: #555;
  background: #2a2a4a;
}
