/* Guide search (guide-search.js). Colours come from the site navigation tokens in
   site-common.css, which every guide loads, so the panel matches the site header and the
   contact dialog in both themes. A guide can restyle its open button through its own class. */

.gs-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--nav-rule, #c9c4b8);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 600 .78rem/1 Karla, Arial, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.gs-open svg { width: 16px; height: 16px; flex: none; }
.gs-open:hover { border-color: currentColor; color: var(--nav-accent, #126e65); }
.gs-open:focus-visible { outline: 3px solid var(--nav-accent, #126e65); outline-offset: 2px; }
@media (max-width: 620px) {
  .gs-open .gs-open-rest { display: none; }
}
/* Phones: the magnifier alone. The button keeps its name ("Search the" and the guide name) for screen readers. */
@media (max-width: 480px) {
  .gs-open .gs-open-label { display: none; }
  .gs-open { justify-content: center; min-width: 40px; padding: 0 10px; }
}
/* The same search at the top of a Contents drawer (GuideSearch.drawerButton): full width,
   touch height, and it keeps its words at every width. A guide sets its colours. */
.gs-open.gs-open-drawer {
  display: flex;
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  padding: 0 12px;
  font-size: .95rem;
}
.gs-open.gs-open-drawer .gs-open-label { display: inline; }

.gs-dialog {
  width: min(720px, 100% - 24px);
  max-height: min(680px, 100% - 48px);
  margin: 6vh auto auto;
  padding: 0;
  border: 1px solid var(--nav-rule, #c9c4b8);
  border-radius: 10px;
  background: var(--nav-panel, #fffdf7);
  color: var(--nav-text, #182824);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .38);
  overflow: hidden;
  font: 400 1rem/1.45 Karla, Arial, sans-serif;
}
.gs-dialog[open] { display: flex; flex-direction: column; }
.gs-dialog::backdrop { background: rgba(5, 8, 7, .72); backdrop-filter: blur(3px); }
@media (max-width: 620px) {
  .gs-dialog { margin-top: 12px; max-height: calc(100% - 24px); }
}

.gs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 6px;
}
.gs-title {
  margin: 0;
  color: inherit;
  font: 600 1.25rem/1.2 Fraunces, Georgia, serif;
  letter-spacing: -.01em;
}
.gs-close {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--nav-rule, #c9c4b8);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.gs-close svg { width: 18px; height: 18px; }
.gs-close:hover, .gs-close:focus-visible { color: var(--nav-accent, #126e65); border-color: currentColor; }
.gs-close:focus-visible { outline: 3px solid var(--nav-accent, #126e65); outline-offset: 2px; }

.gs-form { padding: 8px 20px 0; }
.gs-label {
  display: block;
  margin-bottom: 6px;
  color: var(--site-text-secondary, #43514c);
  font: 600 .68rem/1.3 'IBM Plex Mono', monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.gs-input {
  box-sizing: border-box;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--nav-rule, #c9c4b8);
  border-radius: 6px;
  background: color-mix(in srgb, var(--nav-panel, #fffdf7) 92%, var(--nav-text, #182824));
  color: var(--nav-text, #182824);
  font: 400 1.05rem/1.4 Karla, Arial, sans-serif;
}
.gs-input::placeholder { color: var(--site-text-muted, #59645f); opacity: 1; }
.gs-input:focus { outline: 3px solid var(--nav-accent, #126e65); outline-offset: 2px; border-color: var(--nav-accent, #126e65); }

/* Filters (opts.filters): a row of radio buttons under the search box. */
.gs-filters { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 10px 0 0; padding: 0; border: 0; min-width: 0; }
.gs-filters-legend { float: left; width: 100%; margin: 0 0 4px; padding: 0; color: var(--site-text-secondary, #43514c); font: 600 .68rem/1.3 'IBM Plex Mono', monospace; letter-spacing: .06em; text-transform: uppercase; }
.gs-filter { position: relative; display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 12px; border: 1px solid var(--nav-rule, #c9c4b8); border-radius: 999px; color: var(--nav-text, #182824); font: 500 .92rem/1.2 Karla, Arial, sans-serif; cursor: pointer; }
.gs-filter-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.gs-filter:has(.gs-filter-input:checked) { border-color: var(--nav-accent, #126e65); background: color-mix(in srgb, var(--nav-accent, #126e65) 14%, transparent); font-weight: 700; }
.gs-filter:has(.gs-filter-input:focus-visible) { outline: 3px solid var(--nav-accent, #126e65); outline-offset: 2px; }
@media (forced-colors: active) { .gs-filter:has(.gs-filter-input:checked) { outline: 2px solid Highlight; } }

.gs-status {
  margin: 10px 20px 6px;
  color: var(--site-text-secondary, #43514c);
  font-size: .9rem;
}

.gs-results {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 12px 6px;
  overflow-y: auto;
  list-style: none;
  overscroll-behavior: contain;
}
.gs-result {
  display: grid;
  gap: 3px;
  margin: 0 0 4px;
  padding: 10px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.gs-result[aria-selected="true"] {
  border-color: var(--nav-accent, #126e65);
  background: color-mix(in srgb, var(--nav-accent, #126e65) 12%, transparent);
}
.gs-r-title { font-weight: 700; font-size: 1rem; }
.gs-r-context {
  color: var(--site-text-secondary, #43514c);
  font: 600 .66rem/1.35 'IBM Plex Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.gs-r-excerpt { color: var(--site-text-secondary, #43514c); font-size: .9rem; }
.gs-dialog mark {
  padding: 0 1px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--nav-accent, #126e65) 22%, transparent);
  color: var(--nav-text, #182824);
  font-weight: 700;
}

.gs-hint {
  margin: 0;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--nav-rule, #c9c4b8);
  color: var(--site-text-muted, #59645f);
  font-size: .82rem;
}

/* A heading search scrolled to. A guide with fixed bars sets --gs-offset to their height. */
.gs-target { scroll-margin-top: var(--gs-offset, 0px); }

/* The section a result opened, marked for a moment so the reader can see where they are. */
.gs-hit { outline: 3px solid var(--nav-accent, #126e65); outline-offset: 6px; border-radius: 2px; }
.gs-hit:focus:not(:focus-visible) { outline: 3px solid var(--nav-accent, #126e65); }

@media print {
  .gs-open, .gs-dialog { display: none !important; }
}
