/* ==========================================================================
   Site search (every page: the header box; /search: the results page)
   The box is a normal form; search.js adds the suggestions panel and the
   ghost-text word completion. Styled through tokens.css.
   ========================================================================== */

/* --- Search box: shared by the header popup and the results page --------- */

.ssx-field { position: relative; }
.ssx input[type="search"]::-webkit-search-decoration,
.ssx input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.ssx input[type="search"] { -webkit-appearance: none; appearance: none; position: relative; z-index: 1; background: transparent; }

/* Ghost text: the typed part is invisible, the completion shows faintly behind it.
   search.js copies the input's font and padding onto it so the two line up. */
.ssx-ghost {
  position: absolute; z-index: 0; pointer-events: none; white-space: pre; overflow: hidden;
  color: currentColor; opacity: .38;
}
.ssx-ghost:empty { display: none; }
.ssx-ghost .ssx-typed { visibility: hidden; }

/* Suggestions panel */
.ssx-panel {
  position: absolute; inset-inline: 0; top: calc(100% + 10px); z-index: 30;
  max-height: min(56vh, 400px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--d-card); color: var(--d-text); border: 1px solid var(--d-line); border-radius: 8px;
  box-shadow: 0 24px 48px -20px rgba(1, 30, 48, .45), 0 2px 8px rgba(1, 30, 48, .08);
  text-align: start; font: 400 14px/1.4 var(--d-body); text-transform: none;
}
.ssx-panel[hidden] { display: none; }
.ssx-group + .ssx-group { border-top: 1px solid var(--d-line); }
.ssx-group__title {
  position: sticky; top: 0; z-index: 1; background: var(--d-card);
  margin: 0; padding: 10px 16px 4px;
  font: 600 10.5px/1.2 var(--d-display); letter-spacing: .16em; text-transform: uppercase; color: var(--d-muted);
}
[dir="rtl"] .ssx-group__title { letter-spacing: 0; }
.ssx-list { list-style: none; margin: 0; padding: 0 6px 4px; }

.ssx-opt {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 6px;
  color: var(--d-ink); cursor: pointer; text-decoration: none;
}
.ssx-opt:hover, .ssx-opt.is-active { background: var(--d-tint); color: var(--d-ink); text-decoration: none; }
.ssx-opt.is-active { box-shadow: inset 3px 0 0 var(--d-gold); }
[dir="rtl"] .ssx-opt.is-active { box-shadow: inset -3px 0 0 var(--d-gold); }

/* Word suggestions: magnifier, the typed part plain, the rest bold */
.ssx-opt--term > i { width: 16px; text-align: center; color: var(--d-muted); font-size: 13px; }
.ssx-opt--term span { font-size: 14.5px; }
.ssx-opt--term b { font-weight: 700; }
.ssx-opt--term .ssx-fill { margin-inline-start: auto; color: var(--d-muted); font-size: 13px; opacity: 0; }
.ssx-opt--term:hover .ssx-fill, .ssx-opt--term.is-active .ssx-fill { opacity: 1; }

/* Results: icon tile, title with marks, kind and date */
.ssx-opt--doc { align-items: center; }
.ssx-opt__icon {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: var(--d-surface); color: var(--d-blue); font-size: 13px;
}
.ssx-opt.is-active .ssx-opt__icon, .ssx-opt:hover .ssx-opt__icon { background: var(--d-gold); color: var(--d-on-gold); }
.ssx-opt__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
/* One line per result keeps the panel short; the full title is on the results page. */
.ssx-opt__title { font: 600 13.5px/1.35 var(--d-display); color: var(--d-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ssx-opt__meta { font-size: 11.5px; line-height: 1.3; color: var(--d-muted); }

.ssx-opt--all { flex: none; gap: 8px; padding: 6px 10px; font: 600 13px/1.3 var(--d-display); color: var(--d-blue); }
.ssx-opt--all i { transition: transform .2s; }
.ssx-opt--all:hover i, .ssx-opt--all.is-active i { transform: translateX(3px); }
[dir="rtl"] .ssx-opt--all i { transform: scaleX(-1); }

.ssx-empty { margin: 0; padding: 16px 18px; color: var(--d-muted); }
/* Footer pinned to the bottom of the panel: "See all results" and keyboard hints */
.ssx-foot {
  position: sticky; bottom: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap;
  padding: 6px 8px 6px 6px; background: var(--d-surface); border-top: 1px solid var(--d-line);
}
.ssx-foot .ssx-opt--all:hover, .ssx-foot .ssx-opt--all.is-active { background: var(--d-tint); }
.ssx-hint { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding-inline-end: 8px; font-size: 11.5px; color: var(--d-muted); }
.ssx-hint span { display: inline-flex; align-items: center; gap: 5px; }
.ssx-hint .is-tab[hidden] { display: none; }
.ssx-hint kbd { padding: 1px 6px; border: 1px solid var(--d-line); border-bottom-width: 2px; border-radius: 4px; background: var(--d-surface); font: 600 11px/1.4 var(--d-body); color: var(--d-ink); }

.ssx mark, .srx mark { background: rgba(241, 196, 43, .38); color: inherit; padding: 0 1px; border-radius: 2px; }

/* --- Header popup ------------------------------------------------------- */
/* The theme centres the popup and draws a thin underlined line of text.
   Here: a solid search bar near the top, with the panel attached below it and
   sized to the screen, so results never run off the bottom. */

.mfp-content.search-popup { vertical-align: top; }
#search-header.ssx--popup { width: min(780px, calc(100vw - 32px)); height: auto; margin: 13vh auto 0; text-align: start; }

#search-header .ssx-field {
  display: flex; align-items: center; gap: 4px; height: 60px; padding-inline: 20px 6px;
  background: var(--d-card); border-radius: 12px;
  box-shadow: 0 30px 60px -24px rgba(0, 10, 20, .6), 0 0 0 1px rgba(255, 255, 255, .08);
}
#search-header .ssx-field:focus-within { box-shadow: var(--d-focus), 0 30px 60px -24px rgba(0, 10, 20, .6); }
#search-header .ssx-lead { flex: none; font-size: 20px; color: var(--d-gold-ink); }
#search-header .search-input {
  flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 14px;
  border: 0; border-radius: 0; background: transparent;
  font: 400 19px/60px var(--d-body); letter-spacing: 0; text-transform: none; color: var(--d-ink);
}
#search-header .search-input::placeholder { color: var(--d-muted); opacity: 1; }
#search-header .search-input:focus { outline: none; }
#search-header .ssx-ghost { color: var(--d-ink); }
#search-header .ssx-submit {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; border-radius: 9px; background: var(--d-gold); color: var(--d-on-gold); font-size: 18px; cursor: pointer;
  transition: background .2s;
}
#search-header .ssx-submit:hover { background: #e2b51d; }

#search-header .ssx-panel {
  top: calc(100% + 10px); border: 0; border-radius: 14px;
  max-height: min(calc(87vh - 60px - 40px), 420px);
  box-shadow: 0 30px 60px -24px rgba(0, 10, 20, .6);
}

@media (max-width: 767px) {
  #search-header.ssx--popup { margin-top: 84px; }
  #search-header .ssx-field { height: 56px; padding-inline: 14px 6px; border-radius: 12px; }
  #search-header .search-input { font-size: 17px; line-height: 56px; padding: 0 10px; }
  #search-header .ssx-submit { width: 44px; height: 44px; }
  #search-header .ssx-panel { max-height: calc(100vh - 84px - 56px - 24px); }
}

/* --- Results page -------------------------------------------------------- */

.srx { font-family: var(--d-body); color: var(--d-text); }
.srx h1, .srx h2 { font-family: var(--d-display); color: var(--d-ink); }

.srx-hero {
  position: relative; z-index: 5; overflow: visible; /* the suggestions panel hangs below the hero */
  padding: 180px 0 64px; color: var(--d-on-blue);
  background: radial-gradient(110% 100% at 100% 0%, #0a6ea6 0%, var(--d-blue) 42%, var(--d-blue-night) 100%);
}
.srx-hero h1 { color: var(--d-on-blue); font-size: 40px; font-weight: 600; margin: 0 0 26px; }
.srx-hero h1::after { content: ""; display: block; width: 56px; height: 4px; background: var(--d-gold); border-radius: 3px; margin-top: 16px; }
.srx-hero .ssx { max-width: 820px; }
.srx-hero .ssx-field {
  display: flex; align-items: center; gap: 4px; height: 58px; padding-inline: 20px 6px;
  background: var(--d-card); border-radius: 12px; box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .6);
}
.srx-hero .ssx-field:focus-within { box-shadow: var(--d-focus), 0 20px 40px -24px rgba(0, 0, 0, .6); }
.srx-hero .ssx-input {
  flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0 8px; border: 0; background: transparent;
  font: 400 18px/58px var(--d-body); color: var(--d-ink);
}
.srx-hero .ssx-input::placeholder { color: var(--d-muted); opacity: 1; }
.srx-hero .ssx-input:focus { outline: none; }
.srx-hero .ssx-ghost { color: var(--d-ink); }
.srx-hero .ssx-submit {
  flex: none; display: grid; place-items: center; width: 46px; height: 46px; margin: 0;
  border: 0; border-radius: 9px; background: var(--d-gold); color: var(--d-on-gold); font-size: 17px; cursor: pointer;
}
.srx-hero .ssx-submit:hover { background: #e2b51d; }

.srx-body { position: relative; z-index: 1; padding: 44px 0 100px; background: var(--d-bg); }
.srx-body .container > * { max-width: 820px; }
.srx-lead { font-size: 17px; }

.srx-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.srx-tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  font: 600 13px/1 var(--d-display); color: var(--d-ink); text-decoration: none;
  border: 1px solid var(--d-line); border-radius: 99px; background: var(--d-bg);
}
.srx-tabs a i { color: var(--d-gold-ink); }
.srx-tabs a span { padding: 3px 7px; border-radius: 99px; background: var(--d-surface); color: var(--d-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.srx-tabs a:hover { border-color: var(--d-blue); color: var(--d-blue); text-decoration: none; }
.srx-tabs a.is-on { background: var(--d-blue); border-color: var(--d-blue); color: var(--d-on-blue); }
.srx-tabs a.is-on i { color: var(--d-gold); }
.srx-tabs a.is-on span { background: rgba(255, 255, 255, .18); color: var(--d-on-blue); }

.srx-count { margin: 0 0 6px; font-size: 14px; color: var(--d-muted); }
.srx-dym { margin: 12px 0 0; font-size: 17px; color: var(--d-ink); }
.srx-dym a { font-weight: 600; font-style: italic; color: var(--d-blue); }

.srx-list { list-style: none; margin: 18px 0 0; padding: 0; }
.srx-item { padding: 26px 0; border-top: 1px solid var(--d-line); }
.srx-item__meta { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; font-size: 12.5px; color: var(--d-muted); }
.srx-type { display: inline-flex; align-items: center; gap: 7px; font: 600 11.5px/1 var(--d-display); letter-spacing: .08em; text-transform: uppercase; color: var(--d-blue); }
.srx-type i { color: var(--d-gold-ink); font-size: 13px; }
[dir="rtl"] .srx-type { letter-spacing: 0; }
.srx-item__title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; }
.srx-item__title a { color: var(--d-ink); text-decoration: none; }
.srx-item__title a:hover { color: var(--d-blue); text-decoration: underline; text-decoration-color: var(--d-gold); text-underline-offset: 4px; }
.srx-item__path { margin: 6px 0 0; font-size: 12.5px; color: var(--d-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }
.srx-item__text { margin: 10px 0 0; font-size: 15px; line-height: 1.7; }

.srx-pages { margin-top: 36px; }
.srx-pages .page-link { color: var(--d-blue); border-color: var(--d-line); }
.srx-pages .page-item.active .page-link { background: var(--d-blue); border-color: var(--d-blue); color: var(--d-on-blue); }

.srx-empty { margin-top: 18px; padding: 28px; border: 1px dashed var(--d-line); border-radius: 8px; }
.srx-empty p { margin: 0 0 16px; }
.srx-empty ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.srx-empty a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 99px; background: var(--d-surface); color: var(--d-ink); font: 600 13px/1 var(--d-display); text-decoration: none; }
.srx-empty a i { color: var(--d-gold-ink); }
.srx-empty a:hover { background: var(--d-blue); color: var(--d-on-blue); }

@media (max-width: 767px) {
  .srx-hero { padding: 130px 0 44px; }
  .srx-hero h1 { font-size: 30px; }
  .srx-hero .ssx-field { height: 54px; padding-inline: 14px 5px; }
  .srx-hero .ssx-input { font-size: 17px; line-height: 54px; }
  .srx-hero .ssx-submit { width: 44px; height: 44px; }
  .srx-item__title { font-size: 18px; }
}
@media (hover: none) {
  .ssx-hint { display: none; }   /* no keyboard to hint at on touch screens */
}
@media (prefers-reduced-motion: reduce) {
  .ssx-opt--all i, #search-header .ssx-submit { transition: none; }
}
