/* ── Global Search Modal (⌘K) ──────────────────────────────────────
   Uses design tokens from tokens.css — dark mode works automatically.
──────────────────────────────────────────────────────────────────── */

#gsr-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(3rem, 12vh, 7rem);
  /* Modal IS the full-screen overlay — avoids stacking-context issues
     that arise when a child with backdrop-filter creates its own context */
  background: rgba(0, 0, 0, 0.5);
}

#gsr-modal.gsr-open {
  display: flex;
}

/* Transparent click-capture layer — no backdrop-filter to prevent
   stacking-context interference with .gsr-dialog */
#gsr-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.gsr-dialog {
  position: relative;
  z-index: 1;           /* Stay above the transparent #gsr-backdrop */
  width: 100%;
  max-width: 640px;
  margin: 0 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: gsr-in 140ms var(--ease-out);
}

@keyframes gsr-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ── Input row ─────────────────────────────────────────────────── */

.gsr-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.gsr-search-icon {
  font-size: 1.1rem;
  color: var(--text-muted);
  flex-shrink: 0;
  pointer-events: none;
}

#gsr-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  min-width: 0;
}

#gsr-input::placeholder { color: var(--text-muted); }

/* Browsers add their own clear button for type=search; hide it for cleanliness */
#gsr-input::-webkit-search-cancel-button { display: none; }

.gsr-esc {
  font-size: 0.68rem;
  padding: 0.2em 0.55em;
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

/* ── Results ───────────────────────────────────────────────────── */

#gsr-results {
  max-height: 420px;
  overflow-y: auto;
  padding: 0.375rem 0;
}

.gsr-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.gsr-group { margin-bottom: 0.125rem; }

.gsr-group-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-accent);
  padding: 0.5rem 1rem 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.gsr-item {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 1rem;
  text-decoration: none;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background var(--duration-fast) var(--ease-default),
              border-color var(--duration-fast) var(--ease-default);
}

.gsr-item:hover,
.gsr-item.gsr-active {
  background: var(--bg-sunken);
  border-left-color: var(--border-accent);
}

.gsr-item-title {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gsr-item-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Highlight matched text */
.gsr-item mark {
  background: none;
  color: var(--text-accent);
  font-weight: 600;
  padding: 0;
}

/* ── Footer hints ──────────────────────────────────────────────── */

.gsr-footer {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  padding: 0.45rem 1rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  color: var(--text-disabled);
}

.gsr-footer kbd {
  font-size: 0.62rem;
  padding: 0.15em 0.45em;
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ── Skeleton results (shown while fetch is in flight) ────────── */

.gsr-skeleton-item {
  padding: 0.45rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gsr-skeleton-title {
  height: 0.8rem;
  width: 62%;
}

.gsr-skeleton-sub {
  height: 0.65rem;
  width: 38%;
}

/* ── Navbar trigger button ─────────────────────────────────────── */

#gsr-nav-btn {
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.85;
  transition: opacity var(--duration-fast);
}

#gsr-nav-btn:hover { opacity: 1; }
