/* ===== Global search — ambient + interactive layer (gsx-*) =================
   design_handoff_global_search. Dark base + `html.si-light` overrides (the
   mock's light values are the spec: ink #101418 alphas, panel #f4f5f7).
   Replaces the old .nav-global-search-input / -results dropdown styles. */

@keyframes gsx-caret { 0%, 45% { opacity: 1; } 55%, 100% { opacity: 0; } }
@keyframes gsx-ring {
  0% { transform: scale(0.6); opacity: 0.8; }
  70% { transform: scale(2); opacity: 0; }
  100% { transform: scale(2); opacity: 0; }
}
@keyframes gsx-drop {
  from { opacity: 0; transform: translate(-50%, -6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .gsx-caret, .gsx-dot i, .gsx-panel { animation: none !important; }
  .gsx-row { transition: none !important; }
}

/* ---- input box ---- */
.gsx-box {
  position: relative; display: flex; align-items: center; height: 40px;
  padding: 0 12px; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px; background: transparent;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.gsx-box.is-open {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}
.gsx-icon { flex: none; margin-right: 9px; color: rgba(255, 255, 255, 0.55); }
.gsx-field {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center;
}
.gsx-input {
  width: 100%; border: none !important; background: transparent !important;
  font-family: inherit; font-size: 13.6px; color: #fff !important;
  padding: 0 !important; margin: 0 !important; height: auto !important;
  min-height: 0 !important; box-shadow: none !important; outline: none !important;
}
.gsx-type, .gsx-ghost {
  position: absolute; left: 0; top: 0; bottom: 0;
  display: flex; align-items: center; pointer-events: none;
  font-size: 13.6px; white-space: pre; overflow: hidden; max-width: 100%;
}
.gsx-type { color: rgba(255, 255, 255, 0.65); }
.gsx-caret {
  display: inline-block; width: 1px; height: 15px; margin-left: 1px;
  background: rgba(255, 255, 255, 0.65);
  animation: gsx-caret 1.1s step-end infinite;
}
.gsx-ghost-q { color: transparent; }
.gsx-ghost-rest { color: rgba(255, 255, 255, 0.35); }
.gsx-key {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 8px;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 5px;
  font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, 0.5);
}

/* ---- panel ---- */
.gsx-panel {
  position: absolute; top: 48px; left: 50%; transform: translateX(-50%);
  width: min(600px, calc(100vw - 24px)); z-index: 1002;
  border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 14px;
  background: #171b20; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  padding: 8px 0 0; max-height: min(560px, calc(100vh - 90px)); overflow-y: auto;
  animation: gsx-drop 0.22s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
.gsx-scrim {
  position: fixed; left: 0; right: 0; top: var(--nav-height, 65px); bottom: 0;
  z-index: 1001; background: rgba(0, 0, 0, 0.35);
}

/* ---- section kickers ---- */
.gsx-kick {
  display: flex; align-items: center; gap: 9px; padding: 8px 18px 5px;
}
.gsx-kick > span:not(.gsx-dot):not(.gsx-kick-rule) {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.6);
}
.gsx-kick-rule { flex: 1; height: 1px; background: rgba(255, 255, 255, 0.2); }
.gsx-dot { position: relative; width: 6px; height: 6px; flex: none; }
.gsx-dot i {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid #fff; animation: gsx-ring 2.4s ease-out infinite;
}
.gsx-dot b { position: absolute; inset: 0; border-radius: 50%; background: #fff; }
.gsx-dot.is-green i { border-color: #4ade80; animation-delay: 0.6s; }
.gsx-dot.is-green b { background: #4ade80; }
.gsx-dot.is-green { width: 5px; height: 5px; }

/* ---- rows (trending + results) — wipe spotlight ---- */
.gsx-row {
  display: flex; align-items: center; gap: 11px; padding: 8px 18px;
  cursor: pointer;
  background-image: linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.07));
  background-repeat: no-repeat; background-size: 0% 100%;
  transition: background-size 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.gsx-row.is-hl { background-size: 100% 100%; }
.gsx-rank {
  width: 16px; text-align: center; font-size: 13px; font-weight: 850;
  color: rgba(255, 255, 255, 0.3); font-variant-numeric: tabular-nums; flex: none;
}
.gsx-row-name {
  flex: 1; min-width: 0; font-size: 13.5px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gsx-row-name b {
  font-weight: 850; text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35); text-underline-offset: 2px;
}
.gsx-row-body {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px;
}
.gsx-row-body .gsx-row-name { flex: none; font-weight: 400; }
.gsx-row-meta { font-size: 10.5px; font-weight: 600; color: rgba(255, 255, 255, 0.5); }
.gsx-rate {
  flex: none; font-size: 10px; font-weight: 800; letter-spacing: 0.6px;
  font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.45);
}
.gsx-rate.is-up { color: #4ade80; }
.gsx-rate.is-down { color: #f87171; }

/* row art */
.gsx-art {
  width: 24px; height: 24px; flex: none;
  background-size: contain; background-repeat: no-repeat; background-position: center;
}
.gsx-art.is-round {
  border-radius: 50%; background-size: cover;
  border: 1px solid rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.08);
}
.gsx-art.is-initials {
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 800; color: rgba(255, 255, 255, 0.65);
}
.gsx-glyph {
  width: 24px; height: 24px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.7);
}
.gsx-glyph svg, .gsx-jump svg {
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---- recent chips ---- */
.gsx-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 18px 4px; }
.gsx-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 6px 5px 12px; border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}
.gsx-chip-name {
  font-size: 11.5px; font-weight: 700; color: rgba(255, 255, 255, 0.75); cursor: pointer;
}
.gsx-chip-name:hover { color: #fff; }
.gsx-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; font-size: 10px;
  color: rgba(255, 255, 255, 0.45); cursor: pointer;
}
.gsx-chip-x:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* ---- quick jumps ---- */
.gsx-jumps { display: flex; flex-wrap: wrap; gap: 7px; padding: 2px 18px 12px; }
.gsx-jump {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 999px;
  font-size: 11.5px; font-weight: 700; color: #fff !important;
  cursor: pointer; text-decoration: none;
}
.gsx-jump:hover { border-color: rgba(255, 255, 255, 0.7); background: rgba(255, 255, 255, 0.04); }

/* ---- empty result / footer ---- */
.gsx-none {
  padding: 22px 18px; text-align: center; font-size: 12.5px;
  color: rgba(255, 255, 255, 0.55);
}
.gsx-none b { color: #fff; }
.gsx-foot {
  display: flex; align-items: center; gap: 9px; margin-top: 4px;
  padding: 9px 18px; border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.gsx-foot-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.6px;
  text-transform: uppercase; color: rgba(255, 255, 255, 0.5);
}
.gsx-foot-keys {
  margin-left: auto; font-size: 10px; font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
}
@media (max-width: 720px) { .gsx-foot-keys { display: none; } }

/* ============================= LIGHT MODE ================================ */
html.si-light .gsx-box { border-color: rgba(16, 20, 24, 0.3); }
html.si-light .gsx-box.is-open {
  border-color: rgba(16, 20, 24, 0.6); box-shadow: 0 4px 18px rgba(16, 20, 24, 0.1);
}
html.si-light .gsx-icon { color: rgba(16, 20, 24, 0.55); }
html.si-light .gsx-input { color: #101418 !important; }
html.si-light .gsx-type { color: rgba(16, 20, 24, 0.65); }
html.si-light .gsx-caret { background: rgba(16, 20, 24, 0.65); }
html.si-light .gsx-ghost-rest { color: rgba(16, 20, 24, 0.35); }
html.si-light .gsx-key { border-color: rgba(16, 20, 24, 0.25); color: rgba(16, 20, 24, 0.5); }
html.si-light .gsx-panel {
  border-color: rgba(16, 20, 24, 0.45); background: #f4f5f7;
  box-shadow: 0 18px 48px rgba(16, 20, 24, 0.16);
}
html.si-light .gsx-scrim { background: rgba(16, 20, 24, 0.14); }
html.si-light .gsx-kick > span:not(.gsx-dot):not(.gsx-kick-rule) { color: rgba(16, 20, 24, 0.6); }
html.si-light .gsx-kick-rule { background: rgba(16, 20, 24, 0.2); }
html.si-light .gsx-dot i { border-color: #101418; }
html.si-light .gsx-dot b { background: #101418; }
html.si-light .gsx-dot.is-green i { border-color: #16a34a; }
html.si-light .gsx-dot.is-green b { background: #16a34a; }
html.si-light .gsx-row {
  background-image: linear-gradient(rgba(16, 20, 24, 0.06), rgba(16, 20, 24, 0.06));
}
html.si-light .gsx-rank { color: rgba(16, 20, 24, 0.3); }
html.si-light .gsx-row-name { color: #101418; }
html.si-light .gsx-row-name b { text-decoration-color: rgba(16, 20, 24, 0.35); }
html.si-light .gsx-row-meta { color: rgba(16, 20, 24, 0.5); }
html.si-light .gsx-rate { color: rgba(16, 20, 24, 0.45); }
html.si-light .gsx-rate.is-up { color: #16a34a; }
html.si-light .gsx-rate.is-down { color: #dc2626; }
html.si-light .gsx-art.is-round {
  border-color: rgba(16, 20, 24, 0.2); background-color: rgba(16, 20, 24, 0.08);
}
html.si-light .gsx-art.is-initials {
  border-color: rgba(16, 20, 24, 0.2); background: rgba(16, 20, 24, 0.08);
  color: rgba(16, 20, 24, 0.65);
}
html.si-light .gsx-glyph { color: rgba(16, 20, 24, 0.7); }
html.si-light .gsx-chip { border-color: rgba(16, 20, 24, 0.25); }
html.si-light .gsx-chip-name { color: rgba(16, 20, 24, 0.75); }
html.si-light .gsx-chip-name:hover { color: #101418; }
html.si-light .gsx-chip-x { color: rgba(16, 20, 24, 0.45); }
html.si-light .gsx-chip-x:hover { background: rgba(16, 20, 24, 0.1); color: #101418; }
html.si-light .gsx-jump { border-color: rgba(16, 20, 24, 0.25); color: #101418 !important; }
html.si-light .gsx-jump:hover { border-color: #101418; background: rgba(16, 20, 24, 0.03); }
html.si-light .gsx-none { color: rgba(16, 20, 24, 0.55); }
html.si-light .gsx-none b { color: #101418; }
html.si-light .gsx-foot { border-top-color: rgba(16, 20, 24, 0.16); }
html.si-light .gsx-foot-label { color: rgba(16, 20, 24, 0.5); }
html.si-light .gsx-foot-keys { color: rgba(16, 20, 24, 0.45); }
