/* Advanced search of the Arena Wiki (templates/wiki/search.html, static/wiki/search.js), loaded after wiki.css on that
   page only. Classes are prefixed wk-find-. The wiki's look: gunmetal sheets, gold headings, --j-* tokens.
   What is picked and what matched (owner, 25 Nov 2026, from side-by-side versions): a picked tag in the picker and the
   chosen All/Any button have a thin outline in the ArenaSweats red (fixed values, as the red line under the wiki's
   headers is: themes rename the red tokens), with no fill; the picked tags above the results are gold plates; a
   result's matched tags have a silver outline; the words a tag was read from stay gold; the search box is silver.
   Chromium 108 safe: no color-mix(), no nesting, no :has(). */

/* ---------- Header: title on the left, what is searched on the right ---------- */

.wk-find-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
}

.wk[data-wiki] .wk-hero--find {
  padding-bottom: 0;
}

.wk-find-hero > div:first-child {
  padding-bottom: 16px;
}

.wk-find-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wk-find-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  background: none;
  font-family: "JourneyDisplayBold", var(--j-display);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.wk-find-tab b {
  font-family: var(--j-display);
  font-weight: 400;
  font-size: 14px;
  color: var(--j-gold-200);
}

.wk-find-tab.is-active {
  color: var(--j-gold-50);
  background: linear-gradient(180deg, rgba(166, 75, 68, 0), rgba(166, 75, 68, 0.2));
}

.wk-find-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 3px;
  background: linear-gradient(90deg, #a64b44, #d9665a, #a64b44);
}

.wk-find-tab[disabled] {
  color: var(--j-dim);
}

.wk-find-soon {
  padding: 2px 6px 1px;
  border: 1px solid var(--j-line-mid);
  border-radius: 3px;
  background: rgba(var(--j-ink-rgb), 0.5);
  font-family: var(--j-sans);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--j-muted);
}

/* ---------- Layout: the tag picker beside the results ---------- */

.wk-find {
  display: grid;
  grid-template-columns: minmax(0, 712px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  margin-top: 16px;
  margin-bottom: 56px;
}

.wk-find .j-head {
  margin-bottom: 10px;
}

/* .j-panel (journey.css, loaded later) is position: relative; the picker stays in view beside a long list. */
.wk-find .wk-find__filters {
  position: sticky;
  top: calc(var(--j-topbar-h) + 12px);
  max-height: calc(100vh - var(--j-topbar-h) - 24px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* Shown where the picker is above the results (below). */
.wk-find-jump {
  display: none;
}

.wk-find__results {
  scroll-margin-top: calc(var(--j-topbar-h) + 12px);
}

.wk-find-text {
  display: flex;
  align-items: center;
  height: 38px;
  margin-bottom: 7px;
  border: 1px solid var(--j-line-mid);
  background: rgba(var(--j-ink-rgb), 0.82);
  box-shadow: inset 0 2px 5px rgba(var(--j-shadow-rgb), 0.6);
}

.wk-find-text:focus-within {
  border-color: rgba(var(--j-plat-rgb), 0.8);
}

.wk-find-text .j-i {
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0 4px 0 14px;
  color: var(--j-silver-500);
}

.wk-find-text:focus-within .j-i {
  color: var(--j-silver-100);
}

.wk-find-text input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 14.5px;
  color: var(--j-text);
}

/* The box's border shows the focus; the site's focus ring (journey.css :focus-visible) would put a gold halo on the
   input inside it. */
.wk-find-text input:focus {
  outline: none;
  box-shadow: none;
}

.wk-find-text input::placeholder {
  color: var(--j-dim);
}

.wk-find-note {
  margin: 8px 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--j-muted);
}

.wk-find-group {
  border: 1px solid var(--j-line-soft);
  background: rgba(var(--j-ink-rgb), 0.3);
}

.wk-find-group + .wk-find-group,
.wk-find-grouprow {
  margin-top: 4px;
}

.wk-find-grouprow {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 5px;
}

.wk-find-grouprow .wk-find-group {
  margin-top: 0;
}

.wk-find-group__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 12px 0;
}

.wk-find-group__name {
  font-family: "JourneyDisplayBold", var(--j-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--j-gold-100);
}

.wk-find-group__hint {
  font-size: 11.5px;
  color: var(--j-muted);
}

.wk-find-group__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 7px;
}

.wk-find-sub {
  flex: 0 0 100%;
  margin: 2px 2px -2px;
  font-size: 9.5px;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--j-muted);
}

.wk-find-sub:first-child {
  margin-top: 0;
}

/* ---------- Tags: in the picker, picked, and on a result ---------- */

.wk-find-chip {
  --tint: var(--j-gold-300);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 7px;
  border: 1px solid var(--j-line-mid);
  border-radius: 2px;
  background: rgba(var(--j-ink-rgb), 0.55);
  font-family: var(--j-sans);
  font-size: 12.5px;
  line-height: 1;
  color: var(--j-text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--j-dur-fast) var(--j-ease-std), background-color var(--j-dur-fast) var(--j-ease-std), color var(--j-dur-fast) var(--j-ease-std);
}

.wk-find-chip::before,
.wk-find-tag::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--tint);
  opacity: 0.85;
}

.wk-find-chip i {
  font-style: normal;
  font-size: 11px;
  color: var(--j-dim);
}

.wk-find-chip:hover {
  border-color: var(--j-gold-500);
  background: rgba(var(--j-gold-rgb), 0.08);
  color: var(--j-gold-50);
}

.wk-find-chip:focus-visible,
.wk-find-tag:focus-visible,
.wk-find-mode button:focus-visible,
.wk-find-btn:focus-visible,
.wk-find-try button:focus-visible {
  outline: 2px solid var(--j-gold-300);
  outline-offset: 1px;
}

/* Picked in the picker: a red outline with no fill, and a check mark in place of the diamond. The check is as wide as
   the diamond, so picking a tag does not move its neighbours. */
.wk-find-chip.is-on {
  border-color: #d9665a;
  background: rgba(var(--j-ink-rgb), 0.55);
  color: #ffe9e4;
}

.wk-find-chip.is-on i {
  color: rgba(239, 146, 132, 0.85);
}

.wk-find-chip.is-on::before {
  box-sizing: content-box;
  width: 3.5px;
  height: 7px;
  margin-top: -3px;
  border: solid #d9665a;
  border-width: 0 1.5px 1.5px 0;
  background: none;
  opacity: 1;
}

.wk-find-chip.is-empty:not(.is-on) {
  opacity: 0.45;
}

.wk-find-g-trigger { --tint: var(--j-gold-300); }
.wk-find-g-scale { --tint: var(--j-magic); }
.wk-find-g-effect { --tint: var(--j-up-color); }
.wk-find-g-cc { --tint: var(--j-rose); }
.wk-find-t-r_prismatic { --tint: var(--j-p1); }
.wk-find-t-r_gold { --tint: var(--j-p2); }
.wk-find-t-r_silver { --tint: var(--j-p4); }

/* The picked tags above the results: gold plates with the diamond of the tag's group; not buttons (the cross is). */
.wk-find-chip--picked,
.wk-find-chip--picked:hover {
  height: 28px;
  padding-right: 4px;
  border-color: rgba(var(--j-gold-rgb), 0.75);
  background: linear-gradient(180deg, rgba(var(--j-gold-rgb), 0.24), rgba(var(--j-gold-rgb), 0.1));
  box-shadow: inset 0 1px 0 rgba(var(--j-light-rgb), 0.18);
  color: var(--j-gold-100);
  cursor: default;
}

.wk-find-chip--picked::before {
  opacity: 1;
}

.wk-find-chip--picked button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgba(var(--j-gold-rgb), 0.14);
  color: var(--j-gold-100);
  cursor: pointer;
}

.wk-find-chip--picked button:hover {
  background: rgba(var(--j-gold-rgb), 0.3);
}

.wk-find-chip--picked .j-i {
  width: 10px;
  height: 10px;
  stroke-width: 2.4;
}

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

.wk-find-bar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 30px;
  margin-bottom: 10px;
}

.wk-find-picked {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.wk-find-picked__none {
  font-size: 13px;
  line-height: 28px;
  color: var(--j-muted);
}

.wk-find-joiner {
  font-family: "JourneyDisplayBold", var(--j-display);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--j-gold-300);
}

.wk-find-tools {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.wk-find-mode {
  display: inline-flex;
  border: 1px solid var(--j-line-mid);
  background: rgba(var(--j-ink-rgb), 0.6);
}

.wk-find-mode button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  background: none;
  font-family: var(--j-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--j-muted);
  white-space: nowrap;
  cursor: pointer;
}

.wk-find-mode button + button {
  border-left: 1px solid var(--j-line-mid);
}

.wk-find-mode button.is-on {
  box-shadow: inset 0 0 0 1px #d9665a;
  color: #ffe9e4;
}

.wk-find-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--j-line-mid);
  background: rgba(var(--j-ink-rgb), 0.6);
  font-family: var(--j-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--j-gold-100);
  white-space: nowrap;
  cursor: pointer;
}

.wk-find-btn:hover {
  border-color: var(--j-gold-500);
  color: var(--j-gold-50);
}

.wk-find-btn .j-i {
  width: 13px;
  height: 13px;
}

.wk-find-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

.wk-find-try[hidden] {
  display: none;
}

.wk-find-try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 9px 12px;
  border: 1px solid rgba(var(--j-gold-rgb), 0.22);
  background: linear-gradient(90deg, rgba(var(--j-gold-rgb), 0.09), rgba(var(--j-gold-rgb), 0.02));
}

.wk-find-try__label {
  margin-right: 4px;
  font-family: "JourneyDisplayBold", var(--j-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--j-gold-100);
}

.wk-find-try button {
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(var(--j-gold-rgb), 0.35);
  border-radius: 2px;
  background: rgba(var(--j-ink-rgb), 0.55);
  font-family: var(--j-sans);
  font-size: 12.5px;
  color: var(--j-gold-100);
  cursor: pointer;
}

.wk-find-try button:hover {
  border-color: var(--j-gold-300);
  background: rgba(var(--j-gold-rgb), 0.1);
  color: var(--j-gold-50);
}

.wk-find-results {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wk-find-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 2px 13px;
  padding: 9px 12px 10px 9px;
  border: 1px solid var(--j-line-soft);
  background: rgba(var(--j-ink-rgb), 0.35);
  transition: border-color var(--j-dur-fast) var(--j-ease-std), background-color var(--j-dur-fast) var(--j-ease-std);
}

.wk-find-row:hover {
  border-color: var(--j-gold-500);
  background-color: rgba(var(--j-gold-rgb), 0.06);
}

/* Has every picked tag, but in separate parts of its text: listed dimmer, under the full matches. */
.wk-find-row--apart {
  border-style: dashed;
  background: rgba(var(--j-ink-rgb), 0.2);
}

.wk-find-row--apart .wk-find-row__link,
.wk-find-row--apart .wk-find-snip {
  color: var(--j-muted);
}

/* The whole row opens the article; the tags and the article link sit above that. */
.wk-find-row__link::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.wk-find-row__icon {
  grid-row: 1 / span 3;
  align-self: start;
}

.wk-find-row__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}

.wk-find-row__link {
  font-family: var(--j-display);
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--j-gold-50);
}

.wk-find-row:hover .wk-find-row__link {
  color: var(--j-gold-100);
}

.wk-find-row__kind {
  font-size: 10.5px;
  letter-spacing: var(--j-track-label);
  text-transform: uppercase;
  color: var(--j-muted);
}

.wk-find-k-prismatic { color: var(--j-p1); }
.wk-find-k-gold { color: var(--j-p2); }
.wk-find-k-silver { color: var(--j-p4); }

.wk-find-row__open {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: var(--j-track-label);
  text-transform: uppercase;
  color: var(--j-dim);
}

.wk-find-row:hover .wk-find-row__open {
  color: var(--j-gold-200);
}

.wk-find-row__tags {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 3px 0 2px;
}

.wk-find-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px 0 6px;
  border: 1px solid var(--j-line);
  border-radius: 2px;
  background: rgba(var(--j-ink-rgb), 0.5);
  font-family: var(--j-sans);
  font-size: 11.5px;
  line-height: 1;
  color: var(--j-muted);
  white-space: nowrap;
  cursor: pointer;
}

.wk-find-tag::before {
  width: 4px;
  height: 4px;
  opacity: 0.7;
}

.wk-find-tag:hover {
  border-color: var(--j-gold-500);
  color: var(--j-gold-50);
}

/* One of the picked tags: a silver outline, so the gold is left to the words in the sentences below. */
.wk-find-tag.is-hit {
  border-color: var(--j-silver-200);
  background: linear-gradient(180deg, rgba(var(--j-plat-rgb), 0.09), rgba(var(--j-plat-rgb), 0.03)), rgba(var(--j-ink-rgb), 0.5);
  font-weight: 600;
  color: var(--j-white);
}

.wk-find-tag.is-hit::before {
  opacity: 1;
}

.wk-find-tag--more {
  border-style: dashed;
  cursor: default;
}

.wk-find-tag--more::before {
  display: none;
}

.wk-find-snip {
  margin: 1px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--j-text-2);
  overflow-wrap: break-word;
}

.wk-find-snip + .wk-find-snip {
  margin-top: 3px;
}

.wk-find-snip mark {
  padding: 0 2px;
  border-radius: 1px;
  background: rgba(var(--j-gold-rgb), 0.17);
  box-shadow: inset 0 -1px 0 rgba(var(--j-gold-rgb), 0.75);
  font-weight: 600;
  color: var(--j-gold-100);
}

/* Words the visitor typed, apart from the words a tag was read from. */
.wk-find-row mark.wk-find-typed {
  padding: 0 2px;
  border-radius: 1px;
  background: rgba(134, 178, 236, 0.2);
  box-shadow: inset 0 -1px 0 rgba(134, 178, 236, 0.85);
  font-weight: 600;
  color: #dbe9ff;
}

.wk-find-snip--note {
  font-size: 12.5px;
  color: var(--j-muted);
}

.wk-find-src {
  margin-left: 8px;
  padding: 1px 5px;
  border: 1px solid var(--j-line);
  border-radius: 2px;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--j-muted);
  white-space: nowrap;
  vertical-align: 1px;
}

.wk-find-empty {
  padding: 34px 20px;
  border: 1px dashed var(--j-line-mid);
  text-align: center;
  color: var(--j-muted);
}

.wk-find-empty b {
  display: block;
  margin-bottom: 6px;
  font-family: var(--j-display);
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.04em;
  color: var(--j-gold-50);
}

.wk-find-elsewhere {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px dashed var(--j-line-mid);
  font-size: 13px;
  color: var(--j-text-2);
}

.wk-find-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  transform: translateX(-50%);
  padding: 8px 14px;
  border: 1px solid var(--j-gold-500);
  background: var(--j-coal-900);
  font-size: 13px;
  color: var(--j-gold-100);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--j-dur-fast) var(--j-ease-std);
}

.wk-find-toast.is-on {
  opacity: 1;
}

/* ---------- Narrow screens: the picker above the results ---------- */

@media (max-width: 1280px) {
  .wk-find {
    grid-template-columns: minmax(0, 1fr);
  }

  .wk-find .wk-find__filters {
    position: relative;
    top: 0;
    max-height: none;
    overflow: visible;
  }

  .wk-find-jump {
    position: sticky;
    bottom: 10px;
    z-index: 2;
    display: block;
    /* Short of the right edge, where the shell's pause button for the backdrop sits. */
    width: calc(100% - 36px);
    height: 40px;
    margin-top: 10px;
    border: 1px solid rgba(217, 102, 90, 0.95);
    background: linear-gradient(180deg, #8e3b34, #5a221e);
    box-shadow: inset 0 1px 0 rgba(255, 214, 190, 0.25), 0 6px 16px rgba(var(--j-shadow-rgb), 0.7);
    font-family: var(--j-sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffe9e4;
    cursor: pointer;
  }
}

@media (max-width: 760px) {
  .wk-find-bar {
    flex-direction: column;
  }

  .wk-find-tools {
    justify-content: flex-start;
  }

  .wk-find-grouprow {
    grid-template-columns: minmax(0, 1fr);
  }

  .wk-find-row__open {
    display: none;
  }

  .wk-find-tab {
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }
}
