/* Global Search: command-palette popup + unified suggestions dropdown. */
.ph-search-wrap { position: relative; }

/* --- Overlay shell (overrides theme.css base) --- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9998;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 1rem 1rem;
  background: rgba(10, 37, 53, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.search-overlay.active { display: flex; }
.search-overlay-box {
  width: 100%;
  max-width: 640px;
  display: block;
  padding: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  overflow: hidden;
  animation: phPaletteIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes phPaletteIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* --- Palette header row --- */
.ph-palette-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid #eef2f2;
  position: relative;
  flex-wrap: wrap;
}
.ph-palette-head .ph-search-wrap { flex: 1; min-width: 0; display: flex; align-items: center; }
.ph-palette-icon { display: flex; color: #1a6b6b; flex-shrink: 0; }
.ph-palette-icon svg { width: 20px; height: 20px; }
.search-overlay-box .ph-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 1.05rem;
  padding: 10px 4px;
  color: #111827;
}
.search-overlay-box .ph-search-input::placeholder { color: #9ca3af; }
.search-overlay-box .ph-palette-clear {
  border: 0;
  background: #f3f4f6;
  color: #6b7280;
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: 4px;
  padding: 0;
}
.search-overlay-box .ph-palette-clear:hover { background: #e5e7eb; color: #111827; }
.search-overlay-box .ph-palette-clear.hidden { display: none; }
.ph-palette-esc {
  font: 600 0.68rem/1 Inter, sans-serif;
  letter-spacing: 0.06em;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-bottom-width: 2px;
  background: #f9fafb;
  border-radius: 6px;
  padding: 5px 8px;
  flex-shrink: 0;
}
.search-overlay-box .ph-search-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: #1a6b6b;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.search-overlay-box .ph-search-close:hover { background: #115252; }

/* --- Default panel: popular + browse --- */
.ph-palette-default { padding: 16px 16px 14px; }
.ph-palette-default.is-hidden { display: none; }
.ph-palette-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}
.ph-palette-label:not(:first-child) { margin-top: 16px; }
.ph-palette-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ph-palette-pills a {
  font-size: 0.82rem;
  font-weight: 500;
  color: #115252;
  background: #eef8f8;
  border: 1px solid #d4f0f0;
  border-radius: 9999px;
  padding: 6px 12px;
  text-decoration: none;
}
.ph-palette-pills a:hover { background: #d4f0f0; border-color: #a0dede; }
.ph-palette-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph-palette-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #eef2f2;
  border-radius: 12px;
  text-decoration: none;
  color: #111827;
  background: #fff;
}
.ph-palette-card:hover { border-color: #a0dede; background: #f6fbfb; }
.ph-palette-card svg { width: 18px; height: 18px; color: #1a6b6b; flex-shrink: 0; }
.ph-palette-card strong { font-size: 0.83rem; font-weight: 600; }
.ph-palette-foot {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid #eef2f2;
  background: #f9fafb;
  font-size: 0.75rem;
  color: #6b7280;
}
.ph-palette-foot kbd {
  font: 600 0.68rem/1 Inter, sans-serif;
  border: 1px solid #e5e7eb;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  padding: 3px 6px;
  margin-right: 4px;
}

/* --- Suggestions dropdown (shared: overlay + hero + results page) --- */
.ph-search-suggest {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  text-align: left;
}
.ph-search-suggest.is-open { display: block; }
/* Inside palette the dropdown becomes an inline full-width row under the input. */
.search-overlay .ph-search-wrap { width: 100%; flex: 1; min-width: 0; flex-wrap: wrap; }
.search-overlay .ph-palette-head .ph-search-suggest {
  flex: 1 1 100%;
  position: static;
  border: 0;
  border-top: 1px solid #eef2f2;
  border-radius: 0;
  box-shadow: none;
  max-height: min(52vh, 380px);
  overflow-y: auto;
  margin: 4px -12px -12px -16px;
  width: auto;
}
.search-overlay .ph-search-suggest.is-open + .ph-palette-default,
.search-overlay.has-results .ph-palette-default { display: none; }
.ph-suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  border-bottom: 1px solid #f3f4f6;
}
.ph-suggest-item:last-of-type { border-bottom: 0; }
.ph-suggest-item:hover, .ph-suggest-item.is-active { background: #eef8f8; }
.ph-suggest-thumb {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #d4f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1a6b6b;
  font-size: 1rem;
}
.ph-suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ph-suggest-main { flex: 1; min-width: 0; }
.ph-suggest-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ph-suggest-title mark { background: #fef3c7; color: inherit; border-radius: 3px; padding: 0 1px; }
.ph-suggest-meta {
  display: block;
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ph-suggest-type {
  flex-shrink: 0;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1a6b6b;
  background: #eef8f8;
  border-radius: 9999px;
  padding: 3px 10px;
}
.ph-suggest-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: #1a6b6b;
}
.ph-suggest-all:hover { background: #115252; }
.ph-suggest-empty { padding: 18px 16px; font-size: 0.85rem; color: #6b7280; text-align: center; }

/* Hero variant keeps the glass look; dropdown stays white. */
.ph-hero-search .ph-search-suggest { color: #111827; }

/* Tabs: horizontal scroll on small screens, no layout break. */
.ph-tabs { scrollbar-width: thin; }
.ph-tabs::-webkit-scrollbar { height: 6px; }
.ph-tabs::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 9999px; }

@media (max-width: 560px) {
  .search-overlay { padding-top: 8vh; }
  .search-overlay-box { border-radius: 14px; }
  .ph-palette-grid { grid-template-columns: repeat(2, 1fr); }
  .ph-palette-esc, .ph-palette-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .search-overlay-box { animation: none; }
}
