/* ---------------------------------------------------------------------------
 * Header search window, look A "Quick list" (theme 0.5.26, Treyson 12-01).
 * Markup: inc/gem-site-search.php. Behavior: assets/gem-site-search.js.
 * Black text, gold accents, cream hover; no navy, no maroon blocks, no small
 * capital labels. "See all results" is the site's main gold button
 * (.btn.btn-gold in gem-h.css), the same one as "Shop medals" on the home page.
 * ------------------------------------------------------------------------- */

dialog.gem-search {
  --gs-ink: #01010C; --gs-grey: #61616B; --gs-line: #EBEBED; --gs-line-2: #DADAE0;
  --gs-cream: #F7F3EC; --gs-well: #F5F5F8; --gs-gold: #D39700; --gs-gold-text: #8A6200; --gs-mark: #FBEFC9;
  position: fixed; inset: 16px auto auto 50%; transform: translateX(-50%);
  box-sizing: border-box; width: min(720px, calc(100vw - 32px)); max-width: none;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  margin: 0; padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: #fff; color: var(--gs-ink); box-shadow: 0 20px 60px rgba(1, 1, 12, .3);
  font-family: "Quasimoda", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; line-height: 1.35;
}
dialog.gem-search[open] { display: flex; flex-direction: column; }
dialog.gem-search::backdrop { background: rgba(1, 1, 12, .45); }
html.gem-search-open { overflow: hidden; }
.gem-search *, .gem-search *::before, .gem-search *::after { box-sizing: border-box; }
.gem-search [hidden] { display: none !important; }

/* Search bar */
.gem-search .gem-search-bar { display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--gs-line); }
.gem-search .gem-search-field { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; height: 56px; padding: 0 16px; border: 2px solid var(--gs-ink); border-radius: 999px; background: #fff; }
.gem-search .gem-search-field:focus-within { box-shadow: 0 0 0 3px rgba(211, 151, 0, .35); }
.gem-search .gem-search-ico { flex: none; width: 20px; height: 20px; color: var(--gs-ink); }
.gem-search input.gem-search-input { flex: 1; min-width: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent; color: var(--gs-ink); font-family: inherit; font-size: 19px; font-weight: 500; line-height: 1.2; -webkit-appearance: none; appearance: none; }
.gem-search input.gem-search-input::placeholder { color: var(--gs-grey); opacity: 1; }
.gem-search input.gem-search-input::-webkit-search-cancel-button, .gem-search input.gem-search-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.gem-search .gem-search-clear { flex: none; min-height: 40px; margin: 0; padding: 0 4px; border: 0; background: none; box-shadow: none; color: var(--gs-grey); font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.gem-search .gem-search-clear:hover { color: var(--gs-ink); background: none; }
.gem-search .gem-search-close { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 8px 14px; border: 1px solid var(--gs-line); border-radius: 999px; background: #fff; box-shadow: none; color: var(--gs-ink); font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1; cursor: pointer; }
.gem-search .gem-search-close:hover { border-color: var(--gs-ink); background: #fff; color: var(--gs-ink); }
.gem-search .gem-search-close svg { width: 20px; height: 20px; }
/* The field shows its own gold ring; site-wide and cart focus outlines stay out. */
dialog.gem-search input.gem-search-input:is(:focus, :focus-visible) { outline: none; border: 0; box-shadow: none; background: transparent; }
dialog.gem-search :is(button, a):focus-visible { outline: 2px solid var(--gs-ink); outline-offset: 3px; border-radius: 999px; }
dialog.gem-search a.gem-search-opt:focus-visible { border-radius: 12px; }

/* Body */
.gem-search .gem-search-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 20px 10px; }
.gem-search .gem-search-h { margin: 0 0 6px; padding: 0; color: var(--gs-ink); font-family: inherit; font-size: 17px; font-weight: 700; line-height: 1.3; letter-spacing: 0; text-transform: none; }
.gem-search .gem-search-msg { margin: 0 0 18px; color: var(--gs-ink); font-size: 16px; line-height: 1.45; }
.gem-search .gem-search-msg b { font-weight: 700; }
.gem-search .gem-search-msg span { display: block; margin-top: 4px; color: var(--gs-grey); }
.gem-search .gem-search-results { margin-bottom: 14px; }
.gem-search.is-loading .gem-search-list { opacity: .55; transition: opacity .15s; }

.gem-search ul.gem-search-list { list-style: none; margin: 0; padding: 0; }
.gem-search .gem-search-list li { margin: 0; padding: 0; list-style: none; }
.gem-search a.gem-search-opt { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: 16px; margin: 0 -8px; padding: 10px 8px; border-radius: 12px; color: var(--gs-ink); text-decoration: none; }
.gem-search a.gem-search-opt.is-active { background: var(--gs-cream); }
.gem-search .gem-search-ph { position: relative; display: block; width: 72px; height: 72px; border-radius: 10px; background: var(--gs-well); overflow: hidden; }
.gem-search .gem-search-ph img { position: absolute; inset: 6%; width: 88%; height: 88%; max-width: none; object-fit: contain; mix-blend-mode: multiply; }
.gem-search .gem-search-txt { min-width: 0; }
.gem-search .gem-search-name { display: block; font-size: 17px; font-weight: 700; line-height: 1.3; }
.gem-search .gem-search-name mark { padding: 0 2px; border-radius: 3px; background: var(--gs-mark); color: inherit; }
.gem-search .gem-search-meta { display: block; margin-top: 4px; color: var(--gs-grey); font-size: 15px; }
.gem-search .gem-search-meta b { color: var(--gs-ink); font-weight: 700; }
.gem-search .gem-search-star { color: var(--gs-gold); }
.gem-search .gem-search-go { color: var(--gs-gold-text); font-size: 15px; font-weight: 700; white-space: nowrap; }

/* "Browse the shop" shortcuts */
.gem-search ul.gem-search-kinds { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 8px 0 8px; padding: 0; }
.gem-search .gem-search-kinds li { margin: 0; padding: 0; list-style: none; }
.gem-search .gem-search-kinds a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border: 1px solid var(--gs-line-2); border-radius: 999px; background: #fff; color: var(--gs-ink); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.gem-search .gem-search-kinds a:hover { border-color: var(--gs-ink); }

/* Footer: "See all results" */
.gem-search .gem-search-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px 18px; border-top: 1px solid var(--gs-line); background: #fff; }
.gem-search .gem-search-hint { margin: 0; color: var(--gs-grey); font-size: 15px; }
.gem-search a.gem-search-all { flex: none; border-radius: 999px; text-decoration: none; }

.gem-search .gem-search-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Phone: the window fills the screen. */
@media (max-width: 600px) {
  dialog.gem-search { inset: 0; transform: none; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .gem-search .gem-search-bar { gap: 8px; padding: 12px; }
  .gem-search .gem-search-field { height: 52px; padding: 0 14px; gap: 10px; }
  .gem-search input.gem-search-input { font-size: 17px; }
  .gem-search .gem-search-close { justify-content: center; width: 48px; height: 48px; padding: 0; }
  .gem-search .gem-search-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .gem-search .gem-search-body { padding: 14px 16px 8px; }
  .gem-search a.gem-search-opt { grid-template-columns: 64px 1fr; gap: 14px; }
  .gem-search .gem-search-ph { width: 64px; height: 64px; }
  .gem-search .gem-search-go { display: none; }
  .gem-search .gem-search-foot { flex-direction: column; align-items: stretch; padding: 12px 16px 16px; }
  .gem-search .gem-search-hint { order: 2; text-align: center; }
  .gem-search a.gem-search-all { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .gem-search.is-loading .gem-search-list { transition: none; }
}
