/* ═══════════════════════════════════════════════════════════════
   XODE SEARCH — the nav overlay and the Great Wall's inline box
   ═══════════════════════════════════════════════════════════════ */

/* ── The magnifier in the nav bar ─────────────────────────────── */
.nav-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-1);
  color: var(--text-2);
  cursor: pointer;
  transition: color .14s, border-color .14s, background .14s;
  flex-shrink: 0;
}
.nav-search-btn svg { width: 17px; height: 17px; }
.nav-search-btn:hover {
  color: var(--text-0);
  border-color: var(--border-2);
  background: color-mix(in srgb, var(--violet) 10%, transparent);
}

/* ── Overlay ─────────────────────────────────────────────────── */
.xs-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(8, 8, 10, .72);
  backdrop-filter: blur(7px);
  display: flex;
  justify-content: center;
  padding: clamp(60px, 12vh, 140px) 18px 24px;
  animation: xs-fade .16s ease;
}
@keyframes xs-fade { from { opacity: 0 } to { opacity: 1 } }

.xs-panel {
  width: 100%;
  max-width: 620px;
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(var(--shadow-rgb), .62);
  overflow: hidden;
  animation: xs-rise .2s cubic-bezier(.22, .68, 0, 1.2);
  display: flex;
  flex-direction: column;
  max-height: min(72dvh, 640px);
}
@keyframes xs-rise { from { transform: translateY(-10px); opacity: 0 } to { transform: none; opacity: 1 } }

.xs-field {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.xs-field > svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }

.xs-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-0);
  font-family: var(--font-body);
  font-size: 15.5px;
}
.xs-input::placeholder { color: var(--text-3); }
/* The browser's own clear button fights the styling. */
.xs-input::-webkit-search-cancel-button { display: none; }

.xs-close {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg-4);
  border: 1px solid var(--border-2);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  cursor: pointer;
}
.xs-close:hover { color: var(--text-1); }

/* ── Results ─────────────────────────────────────────────────── */
.xs-results {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
}
.xs-results:not(.open) { display: none; }

.xs-group-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 10px 6px;
}

.xs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-body);
}
.xs-row:hover { background: var(--bg-3); text-decoration: none; }

.xs-row-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--bg-4);
  border: 1px solid var(--border-1);
  color: var(--violet-ink);
}
.xs-row-icon svg { width: 16px; height: 16px; }

.xs-row-text { min-width: 0; flex: 1; display: block; }
.xs-row-title {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xs-row-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.xs-row mark {
  background: color-mix(in srgb, var(--amber) 30%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

/* A locked row still shows what matched — it just cannot be opened. */
.xs-row.locked { cursor: pointer; }
.xs-row.locked .xs-row-title,
.xs-row.locked .xs-row-sub { filter: blur(3.5px); user-select: none; }
.xs-row.locked .xs-row-icon { color: var(--text-3); }
.xs-lock { flex-shrink: 0; color: var(--text-3); display: grid; place-items: center; }
.xs-lock svg { width: 15px; height: 15px; }

.xs-gate {
  margin: 10px 6px 4px;
  padding: 16px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--violet) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--violet) 26%, transparent);
  text-align: center;
}
.xs-gate-count { font-size: 14px; font-weight: 800; color: var(--text-0); margin-bottom: 4px; }
.xs-gate-sub { font-size: 12px; color: var(--text-2); line-height: 1.6; margin-bottom: 12px; }
.xs-gate-btn { width: auto; padding: 9px 18px; }

.xs-empty {
  padding: 30px 18px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-2);
}
.xs-empty strong { color: var(--text-0); }
.xs-empty span { display: block; font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ── Inline box on the Great Wall ────────────────────────────── */
.gw-search {
  position: relative;
  max-width: 560px;
  margin: 26px auto 0;
}
.gw-search-field {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 13px;
  transition: border-color .14s, box-shadow .14s;
}
.gw-search-field:focus-within {
  border-color: var(--violet-ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 20%, transparent);
}
.gw-search-field > svg { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.gw-search-hint {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 2px 6px;
}
#gw-search-clear {
  flex-shrink: 0; background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}
#gw-search-clear:hover { color: var(--text-0); }

/* The dropdown hangs over the gallery rather than pushing it down. */
#gw-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 13px;
  box-shadow: 0 22px 60px rgba(var(--shadow-rgb), .6);
  max-height: min(60dvh, 460px);
}

@media (max-width: 600px) {
  .gw-search-hint { display: none; }
  .xs-overlay { padding-top: 70px; }
  .xs-panel { max-height: 80dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .xs-overlay, .xs-panel { animation: none; }
}
