/*
 * Audiences: Pagefind article search (pagefind-searchbox) and directory filter chips (#filter-search-shortcut).
 * Contract: stone palette; no lime/accent focus ring on the search field; selection is fill only (outline none).
 */
pagefind-searchbox {
  --pf-searchbox-max-width: 100%;
  --pf-input-height: 2.5rem; /* sm:h-10 */
  --pf-input-font-size: 0.875rem;
  --pf-border-radius: 0.375rem; /* rounded-md */
  --pf-text: #1c1917; /* stone-900 */
  --pf-text-secondary: #57534e; /* stone-600 */
  --pf-text-muted: #78716c; /* stone-500 */
  --pf-background: #ffffff;
  --pf-border: #d6d3d1; /* stone-300 */
  --pf-border-focus: var(--pf-border);
  --pf-hover: #f5f5f4; /* stone-100 */
  --pf-selected: var(--pf-hover);
  --pf-mark: #65a30d; /* lime-600 — excerpt highlights only */
  --pf-outline-focus: var(--pf-border);
}

@media (max-width: 639px) {
  pagefind-searchbox {
    --pf-input-height: 3rem; /* h-12 */
    --pf-input-font-size: 1rem;
  }
}

@media (prefers-color-scheme: dark) {
  pagefind-searchbox {
    --pf-text: #ffffff;
    --pf-text-secondary: #d6d3d1;
    --pf-text-muted: #a8a29e;
    --pf-background: rgba(255, 255, 255, 0.05);
    --pf-border: rgba(255, 255, 255, 0.1);
    --pf-border-focus: var(--pf-border);
    --pf-hover: #292524; /* stone-800 */
    --pf-selected: #44403c; /* stone-700 */
    --pf-mark: #84cc16; /* lime-500 — excerpt highlights only */
    --pf-outline-focus: var(--pf-border);
  }
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result[data-pf-selected] {
  outline: none;
  background: var(--pf-selected);
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-input,
:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-input:focus,
:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-input:focus-visible {
  border-color: transparent;
  outline: none;
  box-shadow: none;
  background-color: transparent;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox.open .pf-searchbox-input {
  border-bottom-color: transparent;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-input-wrapper {
  background-color: var(--pf-background);
  border-radius: var(--pf-border-radius);
  outline: 1px solid var(--pf-border);
  outline-offset: -1px;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox.open .pf-searchbox-input-wrapper {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-dropdown {
  background: var(--pf-background);
  border-color: var(--pf-border);
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result.pf-searchbox-result--has-image {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result-thumb-wrap {
  width: 4.5rem;
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 0.125rem;
  background-color: #fafaf9;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result-thumb {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
}

:is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result-text {
  min-width: 0;
  flex: 1 1 auto;
}

#filter-search-shortcut.pf-trigger-shortcut {
  --pf-border: #d6d3d1; /* stone-300 */
  --pf-hover: #f5f5f4; /* stone-100 */
  --pf-text-secondary: #57534e; /* stone-600 */
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

#filter-search-shortcut .pf-trigger-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  border-radius: 3px;
  border: 1px solid var(--pf-border);
  background: var(--pf-hover);
  color: var(--pf-text-secondary);
  font-family: inherit;
}

#filter-search:focus ~ #filter-search-shortcut {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-dropdown {
    background: #1c1917;
  }

  :is(*, #\#):is(*, #\#):is(*, #\#) .pf-searchbox-result-thumb-wrap {
    background-color: #292524;
  }

  #filter-search-shortcut.pf-trigger-shortcut {
    --pf-border: rgba(255, 255, 255, 0.1);
    --pf-hover: rgba(255, 255, 255, 0.05);
    --pf-text-secondary: #d6d3d1; /* stone-300 */
  }
}
