/*
 * srchfor's own rules. The design tokens, fonts, window, form, table, badge and app bar styles come
 * from onlyati-ui (served under /static/ui/); only what is specific to searching and reading
 * documentation lives here.
 */

.hint {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

/* ---------- login ---------- */
.mock-user-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.mock-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-control);
  background: var(--bg-canvas);
}

/* ---------- search ---------- */
.search-form {
  display: flex;
  flex-direction: row;
  gap: var(--sp-2);
  align-items: flex-end;
}

.search-form .field {
  flex: 1;
  min-width: 0;
}

.search-form .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.search-form.scoped {
  margin-bottom: var(--sp-2);
}

.result-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--highlight-yellow);
  color: var(--text-primary);
  font-size: 0.82rem;
  text-decoration: none;
}

.chip:hover {
  background: var(--highlight-peach);
}

.results-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}

.facets h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: var(--sp-3) 0 var(--sp-1);
}

.facets ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.facets li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: 2px 0;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.facets a[aria-current="true"] {
  font-weight: 700;
  color: var(--text-primary);
}

.facets .count {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.hits {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
}

.hit {
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-muted);
}

.hit h3 {
  margin: 0 0 var(--sp-1);
  font-size: 1.1rem;
}

.hit-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.hit-heading {
  margin: var(--sp-1) 0;
  font-weight: 700;
  font-size: 0.93rem;
}

.hit-heading-mark {
  color: var(--text-secondary);
  margin-right: var(--sp-1);
}

.snippet {
  margin: var(--sp-1) 0;
  font-size: 0.93rem;
  max-width: 75ch;
  overflow-wrap: anywhere;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-block: var(--sp-4);
}

/* ---------- catalog ---------- */
.version-list,
.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.book-list {
  gap: var(--sp-1);
  margin-top: var(--sp-1);
  padding-left: var(--sp-4);
}

.version-head {
  display: flex;
  gap: var(--sp-3);
  align-items: baseline;
}

/* ---------- table of contents (rows are the library's .nav-row) ---------- */
.toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-row.toc-ancestor {
  color: var(--text-primary);
}

.nav-row.toc-more {
  font-style: italic;
}

.toc-l1 { padding-left: calc(var(--sp-2) + 12px); }
.toc-l2 { padding-left: calc(var(--sp-2) + 24px); }
.toc-l3 { padding-left: calc(var(--sp-2) + 36px); }
.toc-l4 { padding-left: calc(var(--sp-2) + 48px); }
.toc-l5 { padding-left: calc(var(--sp-2) + 60px); }
.toc-l6 { padding-left: calc(var(--sp-2) + 72px); }

.toc-foot {
  margin: var(--sp-3) 0 0;
  font-size: 0.85rem;
}

.reader-meta {
  border-top: 1px solid var(--border-muted);
  padding-top: var(--sp-3);
}

/* ---------- marks of a search in a page ---------- */
mark.hl {
  scroll-margin-top: 140px;
}

mark.hl.hl-current {
  background: var(--highlight-peach);
  outline: 2px solid var(--status-warning);
  outline-offset: 1px;
}

.hl-bar {
  position: sticky;
  top: 72px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-control);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  font-size: 0.9rem;
}

.hl-actions {
  display: inline-flex;
  gap: var(--sp-1);
}

.hl-position {
  margin-left: var(--sp-2);
  color: var(--text-secondary);
}

/* clip (not hidden) keeps the rounded corners without making the window a scroll container, which
   would stop the match bar from sticking to the top while a long page scrolls */
.split-main {
  overflow: clip;
}

/* the sidebar is a <details>: browsers wrap its content in an anonymous box that is not a flex
   item, so the library's capped height never reaches .window-body and the TOC would not scroll */
.split-side::details-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

@media (max-width: 760px) {
  .results-layout {
    grid-template-columns: 1fr;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-form .field {
    flex-basis: 100%;
  }
}
