/* Site search (WIAB-13). Results reuse the episode index rows from site.css (.index: number, art, title, date);
   this file adds the search form, the status line, the matched words and the header search box. Only the
   site's own colour variables. Spacing on the 4px grid. */

/* The /search/ page */
.search-page h1 { font-size: 40px; margin: 32px 0 24px; }
.search-form label { display: block; color: var(--muted); margin-bottom: 8px; }
.search-row { display: flex; gap: 12px; max-width: 640px; }
.search-row input {
  flex: 1; min-width: 0; font: 400 18px/1.4 var(--body); color: var(--ink); background: var(--bg);
  border: 1px solid var(--muted); border-radius: 6px; padding: 12px 16px;
}
.search-row input:focus-visible { border-color: var(--acc); }
.search-row button {
  font: 500 16px/1 var(--body); background: var(--acc); color: var(--bg); border: 0; border-radius: 6px;
  padding: 0 24px; cursor: pointer;
}
.search-status { color: var(--muted); margin: 32px 0 8px; min-height: 1.6em; }
.search-results a { align-items: start; }
.search-results .num { padding-top: 4px; }
.search-results .tx { display: block; }
.search-results .t { display: block; }
/* The words around the match, two lines at most; the matched words in full ink. */
.search-results .x {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  color: var(--muted); font-size: 15px; line-height: 1.5; margin-top: 4px;
}
.search-results mark { background: none; color: var(--ink); font-weight: 500; }
.search-results .d { padding-top: 4px; }
.search-more { margin: 24px 0 0; }
.search-more button {
  font: 500 16px/1.6 var(--body); color: var(--ink); background: none; border: 0; padding: 8px 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--acc); text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.search-more button:hover { text-decoration-thickness: 2px; }

/* Header search box (partials/search-box.njk). Hidden on /search/, which has its own. */
.search-box { display: flex; align-items: center; border: 1px solid var(--muted); border-radius: 6px; }
.search-box:focus-within { border-color: var(--acc); }
.search-box input { width: 168px; font: 400 15px/1.4 var(--body); color: var(--ink); background: transparent; border: 0; padding: 8px 12px; }
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder, .search-row input::placeholder { color: var(--muted); opacity: 1; }
/* With the box in the header, the menu sits beside it on the right instead of drifting to the middle. */
body:not(.search) .site-header:has(.search-box) nav { margin-left: auto; margin-right: 8px; }
.search-box button { display: flex; color: var(--ink); background: none; border: 0; border-radius: 0 6px 6px 0; padding: 8px 12px; cursor: pointer; }
.search-box button:focus-visible { outline-offset: -2px; }
body.search .search-box { display: none; }

@media (max-width: 720px) {
  .search-page h1 { font-size: 32px; }
  .search-row input { font-size: 16px; }
  .search-results .x { font-size: 14px; }
  /* The header box gets its own row under the logo and menu. */
  .site-header:has(.search-box) { flex-wrap: wrap; }
  .search-box { flex: 1 1 100%; }
  .search-box input { flex: 1; width: auto; min-width: 0; font-size: 16px; }
}
