/*
 * /search — the site search page. Added 2026-09-04.
 *
 * Every colour, space and measure here is a design-system token
 * (docs/04_ICE_DESIGN_SYSTEM.md). Nothing is a literal, so the page follows
 * light and dark without a second rule set: the graphite dark theme moved the
 * accent inks in August 2026 and any hard-coded colour here would have had to
 * move with it by hand.
 *
 * Scoped under .page-search throughout. AGENTS.md's UI evidence gate bans broad
 * element selectors that can leak into shared chrome, and a page whose whole
 * job is an <input> and a <ul> is exactly where that mistake gets made.
 */

/* ⚠️ NO SECOND CONTAINER. This declared `max-width: var(--ice-container)` and
   `margin-inline: auto`, and `--ice-container` is 1280px while the managed
   shell is 1360px with 32px gutters (edulibrary-brand.css). At any viewport
   wide enough to reach the cap, the shell gives its column 1,296px and this
   rule then took 1,280 of them and centred it — so the h1, the input and every
   result card on /search sat 8px inside the brand mark, the rail and the footer
   directly above and below them, on this route and no other (D-01, T-08). The
   shell is the only thing that decides this page's width now. */
.page-search .search-page {
  padding-inline: 0;
  padding-block: 24px;
}

/* ── the box ───────────────────────────────────────────────────────────── */

.page-search .search-head {
  max-width: var(--ice-measure-prose-wide);
}

.page-search .search-head h1 {
  font-family: var(--ice-font-display);
  margin-block-end: var(--ice-space-3);
}

.page-search .search-lede {
  max-width: var(--ice-measure-lede);
  color: var(--ice-color-text-muted);
  margin-block-end: var(--ice-space-7);
}

.page-search .search-coverage {
  margin:0 0 var(--ice-space-5);
  border-block:var(--ice-rule-width) solid var(--ice-color-hairline);
}
.page-search .search-coverage > summary { padding-block:11px; color:var(--ice-color-text); font-size:.875rem; font-weight:650; cursor:pointer; }
.page-search .search-coverage > summary:focus-visible { outline:var(--ice-rule-width-active) solid var(--ice-color-action); outline-offset:2px; }
.page-search .search-coverage__rows { display:grid; gap:0; margin:0; border-top:var(--ice-rule-width) solid var(--ice-color-hairline); }

.page-search .search-coverage__rows > div {
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:var(--ice-space-3);
  padding-block:10px;
}

.page-search .search-coverage__rows > div + div { border-top:var(--ice-rule-width) solid var(--ice-color-hairline); }
.page-search .search-coverage dt { color:var(--ice-color-text-muted); font-size:.875rem; }
.page-search .search-coverage dd { margin:0; color:var(--ice-color-text); font-size:.875rem; font-weight:650; font-variant-numeric:tabular-nums; text-align:right; }
.page-search .search-scope { max-width:var(--ice-measure-lede); margin:0; padding:10px 0 13px; border-top:var(--ice-rule-width) solid var(--ice-color-hairline); color:var(--ice-color-text-muted); font-size:.875rem; line-height:1.55; }
.page-search .search-scope strong { color:var(--ice-color-text); }

.page-search .search-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ice-gap-inline);
  align-items: stretch;
  margin-block-end: var(--ice-space-4);
}

/* Visible label rather than a placeholder doing the work. A placeholder
   disappears the moment someone types, which is when a person who needed the
   prompt still needs it. */
.page-search .search-form__label {
  flex: 1 0 100%;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ice-color-text-muted);
  margin-block-end: var(--ice-space-1);
}

.page-search .search-form__input {
  flex: 1 1 22rem;
  min-height: var(--ice-control-min);
  padding-inline: var(--ice-control-pad-inline);
  font: inherit;
  font-size: 1.0625rem;
  color: var(--ice-color-text);
  background: var(--ice-color-surface);
  border: var(--ice-rule-width) solid var(--ice-color-border);
  border-radius: var(--ice-radius-control);
}

.page-search .search-form__input::placeholder {
  color: var(--ice-color-text-muted);
  opacity: 0.75;
}

.page-search .search-form__input:focus-visible {
  outline: var(--ice-rule-width-active) solid var(--ice-color-action);
  outline-offset: 2px;
  border-color: var(--ice-color-action);
}

.page-search .search-form__submit {
  min-height: var(--ice-control-min);
  min-width: var(--ice-cta-min);
  padding-inline: var(--ice-control-pad-inline);
  font: inherit;
  font-weight: 600;
  color: var(--ice-color-on-action);
  background: var(--ice-color-action);
  border: var(--ice-rule-width) solid transparent;
  border-radius: var(--ice-radius-control);
  cursor: pointer;
  transition: opacity var(--ice-duration-action) var(--ice-ease);
}

.page-search .search-form__submit:hover { opacity: 0.9; }

.page-search .search-form__submit:focus-visible {
  outline: var(--ice-rule-width-active) solid var(--ice-color-action);
  outline-offset: 2px;
}

/* ── section filters ───────────────────────────────────────────────────── */

.page-search .search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ice-space-2);
  margin-block-end: var(--ice-space-3);
}

.page-search .search-filter {
  min-height:44px;
  padding-inline: var(--ice-space-3);
  font: inherit;
  font-size: 0.875rem;
  color: var(--ice-color-text-muted);
  background: transparent;
  border: var(--ice-rule-width) solid var(--ice-color-border);
  border-radius: var(--ice-radius-control);
  cursor: pointer;
  transition:
    color var(--ice-duration-fast) var(--ice-ease),
    border-color var(--ice-duration-fast) var(--ice-ease),
    background-color var(--ice-duration-fast) var(--ice-ease);
}

.page-search .search-filter:hover {
  color: var(--ice-color-text);
  border-color: var(--ice-color-border-strong);
}

.page-search .search-filter.is-active {
  color: var(--ice-color-on-action);
  background: var(--ice-color-action);
  border-color: var(--ice-color-action);
}

.page-search .search-filter:focus-visible {
  outline: var(--ice-rule-width-active) solid var(--ice-color-action);
  outline-offset: 2px;
}

.page-search .search-status {
  font-size: 0.875rem;
  color: var(--ice-color-text-muted);
  margin-block-end: var(--ice-space-6);
  /* Reserved, so the results list does not jump up and down by one line every
     time the count changes under the cursor. */
  min-height: 1.5em;
  /* The count line repeats the query, and a query is whatever was pasted into
     the box. A 300-character run with no space in it had nothing to break on
     and ran straight out of the column at every width. */
  overflow-wrap: anywhere;
}

/* ── results ───────────────────────────────────────────────────────────── */

.page-search .search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap:0;
}

/* [hidden] must win. A plain `display: grid` on the element above beats the UA
   sheet's `[hidden] { display: none }`, which is the exact selector trap that
   shipped six visibly-broken states on /staff. */
.page-search .search-results[hidden],
.page-search .search-empty[hidden],
.page-search .search-fallback[hidden] { display: none; }

/* "Show more results" had no space above it: the <ul> carries `margin: 0` and
   site-search.js inserts the button as its next sibling, so the control sat
   flush against the bottom edge of the last result card.
   Colour, border and the 44px target for `.search-more` belong to
   edulibrary-brand.css; only the gap is this sheet's. */
.page-search .search-more { margin-block-start: var(--ice-space-4); }

.page-search .search-result { margin: 0; }

.page-search .search-result__link {
  display: grid;
  gap: var(--ice-space-1);
  padding:18px 0;
  color: inherit;
  text-decoration: none;
  background:transparent;
  border:0;
  border-top:var(--ice-rule-width) solid var(--ice-color-hairline);
  border-radius:0;
  transition:
    border-color var(--ice-duration-fast) var(--ice-ease),
    transform var(--ice-duration-fast) var(--ice-ease);
}

.page-search .search-result__link:hover {
  border-color:var(--ice-color-action);
  background:color-mix(in srgb,var(--ice-color-text-action) 4%,transparent);
}

.page-search .search-result__link:focus-visible {
  outline: var(--ice-rule-width-active) solid var(--ice-color-action);
  outline-offset: 2px;
}

.page-search .search-result__section {
  font-size:0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ice-color-text-accent);
}

.page-search .search-result__meta { display:flex; flex-wrap:wrap; align-items:center; gap:7px 10px; }
.page-search .search-result__state {
  padding:3px 7px;
  border:var(--ice-rule-width) solid var(--ice-color-hairline);
  border-radius:999px;
  color:var(--ice-color-text-muted);
  background:var(--ice-color-surface-field);
  font-size:.8125rem;
  font-weight:700;
  line-height:1.2;
}

.page-search .search-result__title {
  font-family: var(--ice-font-display);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ice-color-text);
}

.page-search .search-result__path {
  font-size: 0.8125rem;
  color: var(--ice-color-text-muted);
  word-break: break-word;
}

.page-search .search-result__snippet {
  margin: var(--ice-space-1) 0 0;
  /* 16px, not 15. D-12 sets the floor for reading text and this is the reading
     text of a result. edulibrary-brand.css already forced it to 16px from
     outside; the two sheets agree now instead of one correcting the other
     (T-08), so `body.edu .search-result__snippet { font-size: 16px }` there is
     redundant and can go when task 03 next touches that file. */
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ice-color-text-muted);
  max-width: var(--ice-measure-prose);
}

/* ── the three honest failure states ───────────────────────────────────── */

.page-search .search-empty,
.page-search .search-fallback,
.page-search .search-noscript {
  max-width: var(--ice-measure-prose);
  padding: var(--ice-space-5);
  background:var(--ice-color-surface-field);
  border:0;
  border-top:2px solid var(--ice-color-action);
  border-bottom:var(--ice-rule-width) solid var(--ice-color-hairline);
  border-radius:0;
}

.page-search .search-empty h2,
.page-search .search-fallback h2 {
  font-family: var(--ice-font-display);
  margin-block: 0 var(--ice-space-2);
}

.page-search .search-empty p,
.page-search .search-fallback p,
.page-search .search-noscript { color: var(--ice-color-text-muted); }

.page-search .search-empty p + p,
.page-search .search-fallback p + p { margin-block-start: var(--ice-space-3); }

/* Same reason as `.search-status`: this echoes the query verbatim, inside a
   bordered panel that a long unbroken run would otherwise overflow. */
.page-search .search-empty [data-search-echo] { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) {
  .page-search .search-result__link,
  .page-search .search-filter,
  .page-search .search-form__submit { transition: none; }
}

.page-search .search-start { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:0 24px; margin-top:clamp(28px,5vw,54px); border-top:1px solid var(--ice-color-hairline); }
.page-search .search-start a { display:grid; gap:5px; min-height:96px; padding:18px 0; border-bottom:1px solid var(--ice-color-hairline); color:var(--ice-color-text); text-decoration:none; }
.page-search .search-start a:hover strong { color:var(--ice-color-text-action); text-decoration:underline; }
.page-search .search-start strong { font-size:16px; }
.page-search .search-start span { color:var(--ice-color-text-muted); font-size:14px; line-height:1.5; }

@media (max-width: 520px) {
  .page-search .search-coverage__rows > div { grid-template-columns:minmax(0, 1fr); gap:2px; }
  .page-search .search-coverage dd { text-align:left; }
  .page-search .search-start { grid-template-columns:minmax(0,1fr); margin-top:28px; }
}
