/* ==========================================================================
   Search
   --------------------------------------------------------------------------
   A facet rail and a results column. The rail is a form of links, not of
   checkboxes: every state is a URL, so a narrowed search is something a reader
   can send to a colleague. Checkboxes would need a script to do the same thing
   and would stop working when it failed.
   ========================================================================== */

.fame-pagehero--search { padding-block: var(--s-7) var(--s-6); }

.fame-bigsearch {
  display: flex;
  gap: var(--s-2);
  max-width: 640px;
  margin-top: var(--s-5);
}

.fame-bigsearch__input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding-inline: var(--s-5);
  border: 1px solid var(--border-hair);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .06);
  font: inherit;
  font-size: 16px;              /* 16px or iOS zooms the page on focus */
  color: var(--on-dark);
}

.fame-bigsearch__input::placeholder { color: var(--on-dark-mute); }

.fame-bigsearch__input:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
  background: rgba(255, 255, 255, .1);
}

.fame-bigsearch__submit {
  height: 52px;
  padding-inline: var(--s-6);
  border: 0;
  border-radius: var(--r-md);
  background: var(--cyan);
  color: var(--ink);
  font: inherit;
  font-weight: var(--w-bold);
  cursor: pointer;
}

.fame-bigsearch__submit:hover { filter: brightness(1.1); }

.fame-bigsearch__count {
  margin: var(--s-4) 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  color: var(--on-dark-2);
}

.fame-bigsearch__clear { color: var(--cyan-l); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.fame-searchlayout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
}

.fame-facets {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
  max-height: calc(100vh - var(--header-h) - var(--s-7));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.fame-facet + .fame-facet {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

.fame-facet__head {
  margin: 0 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--muted);
}

.fame-facet__note {
  margin: -6px 0 var(--s-3);
  font-size: var(--t-xs);
  line-height: 1.45;
  color: var(--muted);
}

.fame-facet__list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --------------------------------------------------------------------------
   Facet chip — one facet value, on or off

   Named .fame-facet__chip, not .fame-chip. It used to be the latter, which is
   also the metadata pill on the evidence database — and because this file loads
   after components.css, a control on the search page was silently repainting
   every method and sector chip on the database white. Two components with
   different jobs sharing a class name is a collision waiting for the cascade to
   decide which one wins.
   -------------------------------------------------------------------------- */

.fame-facet__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: var(--t-xs);
  line-height: 1.2;
  text-decoration: none;
  color: inherit;
  transition: border-color .14s ease, background-color .14s ease;
}

.fame-facet__chip:hover { border-color: var(--brand-300); background: var(--brand-50); }

/* Selected. Marked by fill and by a leading tick, so the state is not carried
   by colour alone — the rail is read at a glance and often in greyscale print. */
.fame-facet__chip.is-on {
  border-color: var(--brand-700);
  background: var(--brand-700);
  color: var(--paper);
  font-weight: var(--w-medium);
}

.fame-facet__chip.is-on::before { content: "✓"; font-size: 11px; }
.fame-facet__chip.is-on:hover   { background: var(--brand-800); border-color: var(--brand-800); }

.fame-facet__count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  opacity: .7;
}

/* --------------------------------------------------------------------------
   Year range
   -------------------------------------------------------------------------- */

.fame-range {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}

.fame-range__field {
  flex: 1;
  min-width: 0;
}

.fame-range__field span {
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.fame-range__field input {
  width: 100%;
  height: 40px;
  padding-inline: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.fame-btn--small {
  min-height: 38px;
  padding-inline: var(--s-4);
  font-size: var(--t-xs);
}

/* --------------------------------------------------------------------------
   Results
   -------------------------------------------------------------------------- */

.fame-results__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.fame-result {
  padding: var(--s-5) 0;
  border-bottom: 1px solid var(--line);
}

.fame-result__type {
  margin: 0 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--accent-text);
}

.fame-result__title {
  margin: 0 0 var(--s-2);
  font-size: 19px;
  font-weight: var(--w-medium);
  letter-spacing: var(--tr-head);
  line-height: 1.3;
}

.fame-result__title a {
  color: inherit;
  text-decoration: none;
}

.fame-result__title a:hover {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: .18em;
}

.fame-result__sub,
.fame-result__snip {
  max-width: 76ch;
  margin: var(--s-2) 0 0;
  font-size: var(--t-sm);
  line-height: var(--lh-body);
  color: var(--muted);
}

/* The assignment's identifying facts, as a definition list rather than a
   sentence: this is a record, and a reader scanning thirty of them is comparing
   the same field down the column. */
.fame-result__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-6);
  margin: var(--s-3) 0 0;
}

.fame-result__meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.fame-result__meta dd {
  margin: 2px 0 0;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   No results
   -------------------------------------------------------------------------- */

.fame-empty {
  padding: var(--s-8) 0;
  text-align: left;
}

.fame-empty h2 { margin: 0 0 var(--s-3); }

.fame-empty p {
  max-width: 62ch;
  color: var(--muted);
}

.fame-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.fame-pagination { margin-top: var(--s-7); }

.fame-pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fame-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  color: inherit;
}

.fame-pagination .page-numbers:hover { border-color: var(--indigo-300); background: var(--indigo-50); }

.fame-pagination .page-numbers.current {
  border-color: var(--indigo-600);
  background: var(--indigo-600);
  color: var(--paper);
}

/* --------------------------------------------------------------------------
   Narrow
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .fame-searchlayout { grid-template-columns: 1fr; gap: var(--s-6); }

  /* Unsticks and drops above the results. A rail pinned to the viewport on a
     phone eats the screen the results are supposed to occupy. */
  .fame-facets {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: var(--s-5);
    border-bottom: 1px solid var(--line);
  }

  .fame-bigsearch { flex-wrap: wrap; }
  .fame-bigsearch__input { flex-basis: 100%; }
  .fame-bigsearch__submit { flex: 1; }
}
