/* assets/search.css — AGENT D
   Styles for the client-search RESULTS panel + states. The `.s-input` field itself
   is styled by styles.css (topbar). We only own the dropdown/panel/results/highlight.
   Consumes design tokens from styles.css (--bg --fg --muted --card --border --accent,
   domain colours --d-*). No token redefinition — inherits dark mode via those vars. */

/* Results panel: floats under the search input (host is position:relative). */
.s-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(70vh, 30rem);
  overflow-y: auto;
  background: var(--card, var(--bg, #fff));
  color: var(--fg, #111);
  border: 1px solid var(--border, #ddd);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.12);
  padding: 4px;
  font-size: 0.9rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.s-results[hidden] {
  display: none;
}

/* Result groups (Concepts / Quizzes). */
.s-group + .s-group {
  border-top: 1px solid var(--border, #e5e5e5);
  margin-top: 4px;
  padding-top: 4px;
}
.s-group-head {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #888);
  padding: 6px 10px 4px;
}

/* A single hit row (an anchor). */
.s-hit {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title meta"
    "snippet snippet";
  gap: 2px 10px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.s-hit:hover,
.s-hit.is-active {
  background: color-mix(in srgb, var(--accent, #4f46e5) 14%, transparent);
}
.s-hit.is-active {
  outline: 1px solid color-mix(in srgb, var(--accent, #4f46e5) 45%, transparent);
  outline-offset: -1px;
}

.s-hit-title {
  grid-area: title;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.s-hit-meta {
  grid-area: meta;
  align-self: center;
  font-size: 0.72rem;
  color: var(--muted, #888);
  white-space: nowrap;
  flex: none;
}
.s-hit-snippet {
  grid-area: snippet;
  font-size: 0.8rem;
  color: var(--muted, #777);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Domain colour dot — resolves --d-<colour>; falls back to --border. */
.s-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--border, #ccc);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06) inset;
}

/* Quiz hits get a subtle accent tint on the meta label. */
.s-hit--quiz .s-hit-meta {
  color: var(--accent, #4f46e5);
}

/* Matched-term highlight inside titles/snippets. */
.s-mark {
  background: color-mix(in srgb, var(--accent, #4f46e5) 28%, transparent);
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
  font-weight: 700;
}

/* Empty state. */
.s-empty {
  padding: 14px 12px;
  color: var(--muted, #888);
  font-size: 0.85rem;
  text-align: center;
}

/* Narrow screens: let the panel breathe full width of the search host. */
@media (max-width: 640px) {
  .s-hit-snippet {
    -webkit-line-clamp: 3;
  }
}
