/*
 * GridHue agency index, 19 November 2026: search and filters, the index table, the capability matrix on phones,
 * and the page head's top padding. Loaded after gridhue.css; every value is one of its tokens.
 */

/* Page heads: 96 px above the crumbs on desktop instead of 144, so the headline sits closer to the header. */
.gh-page-head { padding-top: min(var(--gh-section), var(--space-8)); }

/* The index block: filters, results bar, table, pager and the A to Z list on one 16 px rhythm. */
.gh-index { display: grid; gap: var(--space-3); min-width: 0; }
.gh-index > * { min-width: 0; margin: 0; }
.gh-index [hidden] { display: none !important; }
.gh-index > :is(.gh-pager, .gh-empty, .gh-az-index) { margin-top: var(--space-2); }

/* Filters: one framed panel. Search and sort on top, every other filter in an even grid, the signals below. */
.gh-filters {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 1px var(--grid-line);
}
.gh-filters .gh-filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3) var(--gutter); }
.gh-filters .gh-field { min-width: 0; }
.gh-filters .gh-field--search { flex: 1 1 360px; grid-column: auto; }
.gh-filters .gh-field--sort { flex: 0 1 280px; }
.gh-filters .gh-field--search #gh-filter-q {
  padding-left: 46px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23120E0E' stroke-width='2' stroke-linecap='square'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 16px 50%;
  background-size: 18px 18px;
}
.gh-filters .gh-field--search #gh-filter-q::placeholder { color: var(--ink-muted); opacity: 1; }
.gh-filters select { text-overflow: ellipsis; }
.gh-filter-panel { display: grid; gap: var(--space-4); }
.gh-filter-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3) var(--gutter); }
.gh-filter-group { display: contents; }
.gh-filters .gh-toggle-set { gap: var(--space-2) var(--space-5); padding-top: var(--space-3); box-shadow: inset 0 1px 0 var(--grid-line); }
.gh-filters .gh-toggle-set label { min-height: 40px; font-size: 14px; line-height: 20px; }
.gh-filters .gh-toggle-set input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }

/* The Filters button opens the grid on phones; elsewhere the grid is always open. */
.gh-filter-more { display: none; }
.gh-filter-n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--ink); color: var(--surface); font-family: var(--font-text); font-size: 12px; line-height: 1; font-weight: 600;
}
.gh-filter-n:empty { display: none; }
@media (min-width: 768px) {
  .gh-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .gh-filter-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .gh-filters { gap: var(--space-3); padding: var(--space-3); }
  .gh-filters .gh-field--search { flex-basis: 100%; }
  .gh-filters.is-collapsible .gh-field--sort { flex: 1 1 0; }
  .gh-filters.is-collapsible .gh-filter-more {
    display: inline-flex; flex: none; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: 48px; padding: 12px 18px; border: 0; border-radius: 0; background: var(--surface); color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink); font-family: var(--font-text); font-size: 15px; line-height: 20px; font-weight: 700; cursor: pointer;
  }
  .gh-filters.is-collapsible .gh-filter-more[aria-expanded="true"] { background: var(--ink); color: var(--surface); }
  .gh-filters.is-collapsible .gh-filter-more[aria-expanded="true"] .gh-filter-n { background: var(--surface); color: var(--ink); }
  .gh-filters.is-collapsible:not(.is-open) .gh-filter-panel { display: none; }
  .gh-filters .gh-toggle-set { gap: 0 var(--space-4); }
}
@media (min-width: 480px) and (max-width: 767.98px) {
  .gh-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Results bar: the count on the left, Reset on the right. */
.gh-results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-3); min-height: 40px; }
.gh-index .gh-counter { margin: 0; }
.gh-counter strong { color: var(--ink); font-weight: 600; }
.gh-reset {
  min-height: 40px; padding: 8px 16px; border: 0; border-radius: 0; background: transparent; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink); font-family: var(--font-text); font-size: 14px; line-height: 20px; font-weight: 600;
  cursor: pointer;
}
.gh-reset:hover, .gh-reset:focus-visible { background: var(--ink); color: var(--surface); }

/* The A to Z list opens and closes with a plus and a minus. */
.gh-index .gh-az-index summary { justify-content: space-between; gap: var(--space-3); list-style: none; }
.gh-index .gh-az-index summary::-webkit-details-marker { display: none; }
.gh-index .gh-az-index summary::after { content: "+"; flex: none; font-size: 18px; line-height: 1; }
.gh-index .gh-az-index[open] summary::after { content: "\2212"; }

/* Empty state and pager. */
.gh-index .gh-empty:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.gh-index .gh-empty p { margin: 0; }
.gh-index .gh-pager { align-items: center; }

/* The index table. From 1200 px: seven columns that fit the frame without sideways scrolling, and a header row
   that stays under the site header. Narrower: it scrolls sideways inside its frame with the agency column pinned. */
.gh-agency-wrap .gh-matrix { table-layout: fixed; min-width: 1000px; }
.gh-agency-wrap .gh-matrix :is(th, td) { padding: 14px 12px; }
.gh-agency-wrap .gh-matrix :is(th, td):first-child { padding-left: 16px; }
.gh-agency-wrap .gh-matrix :is(th, td):last-child { padding-right: 16px; }
.gh-agency-wrap :is(td, th) { white-space: normal; }
.gh-agency-wrap .gh-col-rank { width: 64px; }
.gh-agency-wrap .gh-col-agency { width: 28%; }
.gh-agency-wrap .gh-col-score { width: 156px; }
.gh-agency-wrap .gh-col-signals { width: 150px; }
.gh-agency-wrap .gh-col-cmp { width: 120px; }
.gh-agency-wrap .gh-agency-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.gh-agency-loc, .gh-agency-wrap .gh-cred, .gh-agency-wrap .gh-focus, .gh-agency-wrap .gh-meta-line {
  display: block; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--font-text); font-size: 12px; line-height: 16px; color: var(--ink-muted);
}
.gh-agency-loc { color: var(--ink); }
.gh-agency-tz { color: var(--ink-muted); }
.gh-rank--inline { display: none; }
.gh-agency-wrap .gh-stack-name { overflow-wrap: anywhere; }
.gh-agency-wrap .gh-score--row { gap: var(--space-2); }
.gh-signals { display: grid; gap: 6px; justify-items: start; }
.gh-floor { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 18px; }
.gh-floor--none { color: var(--ink-muted); }
.gh-agency-wrap .gh-col-cmp { text-align: right; }
.gh-agency-wrap .gh-cmp-btn { white-space: nowrap; }
@media (min-width: 1200px) {
  .gh-agency-wrap { overflow: visible; }
  .gh-agency-wrap .gh-matrix thead th { position: sticky; top: var(--header-height); left: auto; z-index: 4; box-shadow: inset 0 -1px 0 var(--grid-line); }
  .gh-agency-wrap .gh-matrix td:is(.gh-col-rank, .gh-col-agency) { position: static; box-shadow: none; }
}
@media (max-width: 1199.98px) {
  .gh-agency-wrap .gh-col-agency { width: 280px; min-width: 0; max-width: none; }
  .gh-agency-wrap .gh-matrix { min-width: 1100px; }
}
@media (max-width: 767.98px) {
  .gh-agency-wrap .gh-matrix { min-width: 900px; }
  .gh-agency-wrap .gh-matrix :is(th, td) { padding: 12px 10px; }
  .gh-agency-wrap .gh-matrix :is(th, td).gh-col-rank { display: none; }
  .gh-agency-wrap .gh-matrix :is(th, td).gh-col-agency { left: 0; width: 176px; padding-left: 12px; }
  .gh-agency-wrap .gh-agency-name { font-size: 15px; line-height: 20px; }
  .gh-rank--inline { display: block; margin-bottom: 2px; font-family: var(--font-text); font-size: 11px; line-height: 14px; color: var(--ink-muted); }
  .gh-agency-tz { display: none; }
}

/* The capability matrix folds away on phones behind a button; the leaders' corner shows first when it opens. */
.gh-quad-toggle { display: none; }
@media (max-width: 767.98px) {
  .gh-quad-card { padding: var(--space-3); }
  .gh-quad-card.gh-quad-js .gh-quad-head { flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 0; }
  .gh-quad-card.gh-quad-js.is-open .gh-quad-head { margin-bottom: var(--space-3); }
  .gh-quad-card.gh-quad-js .gh-quad-title { flex: 1 1 100%; min-width: 0; }
  .gh-quad-card.gh-quad-js .gh-quad-note { order: 2; flex-basis: 100%; }
  .gh-quad-card.gh-quad-js:not(.is-open) :is(.gh-quad-scroll, .gh-quad-legend, .gh-quad-note) { display: none; }
  .gh-quad-card.gh-quad-js .gh-quad-toggle {
    display: inline-flex; flex: none; align-items: center; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 0;
    background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-family: var(--font-text);
    font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer; order: 1;
  }
  .gh-quad-card.gh-quad-js .gh-quad-toggle[hidden] { display: none; }
  .gh-quad-svg { min-width: 720px; }
}
