/* Search overlay — Cmd+K command palette atop a dimmed dashboard. */

.aq-search-stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--aq-page-grad), var(--aq-page);
  overflow: hidden;
}

/* Faked dashboard underneath, dimmed + blurred ────────── */
.aq-search-under {
  position: absolute; inset: 0;
  filter: blur(2px) saturate(0.85) brightness(0.6);
  transform: scale(1.005);
  transform-origin: center;
  pointer-events: none;
  z-index: 1;
}
.aq-search-scrim {
  position: absolute; inset: 0;
  background: rgba(8, 9, 11, 0.62);
  backdrop-filter: blur(2px);
  z-index: 2;
}

/* Modal positioning ───────────────────────────────────── */
.aq-search-modal {
  position: absolute;
  z-index: 3;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  width: 880px;
  max-width: min(880px, calc(100vw - 40px));
  max-height: calc(100% - 160px);
  background: var(--aq-surface-grad), var(--aq-surface);
  border: 1px solid var(--aq-line-bright);
  border-radius: 12px;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.05) inset,
    0 36px 80px -24px rgba(0,0,0,0.7),
    0 8px 24px -8px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: aq-search-drop var(--aq-d-2) var(--aq-ease) both;
}
.aq-search-scrim {
  animation: aqModalFade 160ms ease both;
}
@media (prefers-reduced-motion: reduce) {
  .aq-search-modal { animation: none; }
  .aq-search-scrim { animation: none; }
}

/* Input row ───────────────────────────────────────────── */
.aq-search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--aq-line);
}
.aq-search-icon {
  color: var(--aq-text-faint);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.aq-search-input {
  flex: 1;
  display: flex;
  align-items: center;
  font-family: var(--aq-ff-display);
  font-size: 18px;
  letter-spacing: -0.012em;
  color: var(--aq-text);
  font-weight: 450;
}
.aq-search-input .aq-search-typed { color: var(--aq-text); }
.aq-search-input .aq-search-ghost { color: var(--aq-text-faint); }
.aq-search-input .aq-search-caret {
  width: 1px; height: 18px;
  background: var(--aq-accent);
  margin: 0 1px;
  animation: aq-search-blink 1s steps(2,end) infinite;
}
@keyframes aq-search-blink { to { opacity: 0; } }

.aq-search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.aq-search-count {
  font-family: var(--aq-ff-mono);
  font-size: 11px;
  color: var(--aq-text-faint);
  letter-spacing: 0.04em;
}
.aq-search-count b { color: var(--aq-text-dim); font-weight: 500; }
.aq-search-esc {
  font-family: var(--aq-ff-mono);
  font-size: 10.5px;
  color: var(--aq-text-faint);
  padding: 3px 7px;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-line);
  border-radius: 5px;
  letter-spacing: 0.04em;
}

/* Scope chips ─────────────────────────────────────────── */
.aq-search-scopes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--aq-line);
  background: rgba(255,255,255,0.012);
}
.aq-search-scope {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--aq-text-dim);
  font-size: 11.5px;
  font-weight: 450;
  cursor: pointer;
  transition: background 120ms;
}
.aq-search-scope:hover { background: var(--aq-surface-2); }
.aq-search-scope.is-active {
  background: var(--aq-surface-2);
  border-color: var(--aq-line-strong);
  color: var(--aq-text);
}
.aq-search-scope-count {
  font-family: var(--aq-ff-mono);
  font-size: 10px;
  color: var(--aq-text-faint);
  letter-spacing: 0.02em;
}
.aq-search-scope.is-active .aq-search-scope-count { color: var(--aq-text-dim); }
.aq-search-scope-kbd {
  margin-left: 4px;
  font-family: var(--aq-ff-mono);
  font-size: 9.5px;
  padding: 1px 5px;
  background: var(--aq-surface-3);
  color: var(--aq-text-faint);
  border-radius: 3px;
  letter-spacing: 0.04em;
}

/* Body — split: results list + preview pane ───────────── */
.aq-search-body {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  flex: 1;
  min-height: 0;
}
.aq-search-results {
  border-right: 1px solid var(--aq-line);
  overflow: auto;
  min-height: 0;
}

.aq-search-group {
  padding: 8px 0 4px;
}
.aq-search-group + .aq-search-group {
  border-top: 1px solid var(--aq-line);
}
.aq-search-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px 6px 16px;
  font-family: var(--aq-ff-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aq-text-faint);
}
.aq-search-group-head b { color: var(--aq-text-dim); font-weight: 500; }
.aq-search-group-more {
  font-family: var(--aq-ff-mono);
  font-size: 9.5px;
  color: var(--aq-text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.aq-search-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 100ms;
}
.aq-search-row:hover { background: var(--aq-surface-2); }
.aq-search-row.is-active {
  background: var(--aq-accent-soft);
  position: relative;
}
.aq-search-row.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 2px;
  background: var(--aq-accent);
  border-radius: 0 2px 2px 0;
}

.aq-search-row-icon {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-line);
  color: var(--aq-text-dim);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--aq-ff-mono);
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
}
.aq-search-row.is-active .aq-search-row-icon { color: var(--aq-text); }
.aq-search-row-icon-thumb {
  width: 100%; height: 100%;
  background-size: cover;
  background-position: center;
}

.aq-search-row-body { min-width: 0; }
.aq-search-row-title {
  font-size: 13px;
  color: var(--aq-text);
  font-weight: 450;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.005em;
}
.aq-search-row-title em {
  font-style: normal;
  background: color-mix(in srgb, var(--aq-accent) 24%, transparent);
  color: var(--aq-text);
  padding: 0 1px;
  border-radius: 2px;
}
.aq-search-row-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--aq-text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aq-search-row-sub .aq-sep { opacity: 0.5; }
.aq-search-row-sub .aq-mono {
  font-family: var(--aq-ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.aq-search-row-tail {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.aq-search-row-tag {
  font-family: var(--aq-ff-mono);
  font-size: 9.5px;
  color: var(--aq-text-faint);
  padding: 2px 6px;
  border: 1px solid var(--aq-line);
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.aq-search-row-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.aq-search-row-status-dot.is-online { background: var(--aq-success); box-shadow: 0 0 4px var(--aq-success); }
.aq-search-row-status-dot.is-warn { background: var(--aq-warn, #d4a14a); }
.aq-search-row-status-dot.is-offline { background: var(--aq-text-faint); }

.aq-search-row-action-kbd {
  font-family: var(--aq-ff-mono);
  font-size: 10px;
  color: var(--aq-text-faint);
  padding: 2px 6px;
  background: var(--aq-surface-3);
  border-radius: 4px;
  letter-spacing: 0.04em;
}
.aq-search-row.is-active .aq-search-row-action-kbd {
  color: var(--aq-text);
  background: rgba(255,255,255,0.08);
}

/* Action row (jump to / commands) */
.aq-search-row.is-cmd .aq-search-row-icon {
  background: var(--aq-accent-soft);
  border-color: var(--aq-accent-line);
  color: var(--aq-accent);
}

/* Preview pane ────────────────────────────────────────── */
.aq-search-preview {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.aq-search-preview-hero {
  position: relative;
  height: 140px;
  background:
    linear-gradient(180deg, transparent 40%, rgba(10,11,13,0.85)),
    linear-gradient(135deg, oklch(0.30 0.06 220), oklch(0.18 0.04 240));
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--aq-line);
  display: flex;
  align-items: flex-end;
  padding: 14px 18px;
}
.aq-search-preview-hero-tag {
  font-family: var(--aq-ff-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}
.aq-search-preview-body {
  padding: 16px 18px 18px;
  flex: 1;
}
.aq-search-preview-title {
  font-family: var(--aq-ff-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--aq-text);
  letter-spacing: -0.012em;
  margin: 0 0 2px;
  text-wrap: pretty;
}
.aq-search-preview-title em {
  font-style: italic;
  color: var(--aq-text-dim);
  font-weight: 400;
  margin-left: 6px;
  font-size: 13.5px;
}
.aq-search-preview-sub {
  font-family: var(--aq-ff-mono);
  font-size: 11px;
  color: var(--aq-text-faint);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.aq-search-preview-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--aq-line);
  border: 1px solid var(--aq-line);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 14px;
}
.aq-search-preview-stat {
  background: var(--aq-surface);
  padding: 10px 12px;
}
.aq-search-preview-stat-label {
  font-family: var(--aq-ff-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aq-text-faint);
  margin-bottom: 4px;
}
.aq-search-preview-stat-value {
  font-family: var(--aq-ff-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--aq-text);
  letter-spacing: -0.008em;
  line-height: 1;
}
.aq-search-preview-stat-value small {
  font-size: 11px;
  color: var(--aq-text-faint);
  font-weight: 400;
  margin-left: 4px;
  font-family: var(--aq-ff-mono);
  letter-spacing: 0.02em;
}

.aq-search-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--aq-line);
  font-size: 12px;
  color: var(--aq-text-dim);
}
.aq-search-preview-row:first-of-type { border-top: 0; padding-top: 4px; }
.aq-search-preview-row b { color: var(--aq-text); font-weight: 500; }
.aq-search-preview-row-label {
  font-family: var(--aq-ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--aq-text-faint);
}

.aq-search-preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.aq-search-preview-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--aq-text-dim);
  padding: 2px 7px;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-line);
  border-radius: 4px;
}

.aq-search-preview-actions {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.aq-search-preview-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  background: var(--aq-surface-2);
  border: 1px solid var(--aq-line);
  border-radius: 6px;
  color: var(--aq-text-dim);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: color var(--aq-d-1) var(--aq-ease), border-color var(--aq-d-1) var(--aq-ease), background var(--aq-d-1) var(--aq-ease);
}
.aq-search-preview-action:hover { color: var(--aq-text); border-color: var(--aq-line-strong); }
.aq-search-preview-action.is-primary {
  background: var(--aq-accent);
  border-color: var(--aq-accent);
  color: var(--aq-accent-ink);
  font-weight: 500;
}
.aq-search-preview-action .aq-search-row-action-kbd { background: rgba(0,0,0,0.18); color: rgba(255,255,255,0.7); }

/* Footer ──────────────────────────────────────────────── */
.aq-search-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-top: 1px solid var(--aq-line);
  background: var(--aq-surface-2);
  font-family: var(--aq-ff-mono);
  font-size: 10.5px;
  color: var(--aq-text-faint);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.aq-search-foot-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.aq-search-foot-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.aq-search-foot-kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.aq-search-foot-kbd span {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: var(--aq-surface-3);
  border: 1px solid var(--aq-line);
  border-radius: 3px;
  color: var(--aq-text-dim);
  font-size: 10px;
}
.aq-search-foot-power {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--aq-text-faint);
}
.aq-search-foot-power b {
  color: var(--aq-text-dim);
  font-weight: 500;
  font-family: var(--aq-ff-display);
  letter-spacing: -0.008em;
}

/* Inline thumbnails inside row icons (species etc.) */
.aq-search-thumb-fish { background: linear-gradient(135deg, oklch(0.55 0.10 30), oklch(0.30 0.06 25)); }
.aq-search-thumb-ray  { background: linear-gradient(135deg, oklch(0.40 0.08 220), oklch(0.22 0.05 250)); }
.aq-search-thumb-shark{ background: linear-gradient(135deg, oklch(0.45 0.04 240), oklch(0.22 0.02 260)); }
.aq-search-thumb-turtle{ background: linear-gradient(135deg, oklch(0.50 0.10 145), oklch(0.30 0.06 165)); }
.aq-search-thumb-coral{ background: linear-gradient(135deg, oklch(0.65 0.16 25), oklch(0.40 0.08 10)); }
