/* ============================================================================
   /search/ — a command workspace on the 2026 visual system.  (brief §16)
   ============================================================================

   One hero field, the things the product can answer as chips beneath it, then
   every result kind in one list on one surface. Rows, not cards: a result list
   is scanned, not browsed, and the 92px glass card with its hover lift cost
   four times the height to say the same thing. The accent rail on a row doubles
   as the keyboard model's `is-active` mark (static/js/search-page.js).

   The field, the chips, the panels, the section heads and the states are all
   static/css/am-system.css. What is left in this sheet is the result row, the
   group head's own parts, and the answers to the four site-wide sheets that
   reach this route by selector.

   Cascade note, because this sheet loads *before* bundle-shell.css and
   therefore loses every tie: anything that has to beat brand.css,
   app-shell.css, page-unification.css or am-system.css is written at
   `body.page-global_search …`, which is one class more specific than the rules
   there. Where those sheets use `!important` the override says so and says
   which rule it is answering. Nothing here restyles a `.c-*` primitive or a
   bare canvas class -- those belong to canvas-2026.css and are used as-is.
   ============================================================================ */

/* --- Head ---------------------------------------------------------------- */

/* The query is the title. It must not be typeset like a slogan -- the shared
   PageHeader already sizes it -- and it wraps rather than overflowing, with
   `overflow-wrap: anywhere` because a 60-character ticker paste has no spaces
   in it. */
body.page-global_search .sq-masthead {
  margin-block: var(--c-space-2) var(--c-space-5);
}

body.page-global_search .sq-masthead__title {
  overflow-wrap: anywhere;
}

body.page-global_search .sq-lead {
  margin-block-end: var(--c-space-6);
}


/* --- The field ----------------------------------------------------------- */

/* 46rem was the old width and it is still the right one: a search field wider
   than the results it produces reads as a feature rather than as a control.
   The cap is on the wrapper rather than on the form, which was originally a
   way round workspaces.css setting `width: 100%; max-width: none` on
   `.sq-form` from the last stylesheet in the document. That rule is gone
   (2026-09-18) along with the rest of the dead `/search/` block it sat in;
   the wrapper keeps the cap because a block-level form fills it either way
   and the measure belongs to the row, not to the control. */
body.page-global_search .sq-hero {
  inline-size: min(100%, 46rem);
  margin-block: 0;
}

/* The bare input inside the pill used to be defended here, with nine
   `!important` declarations, against `form input[type="search"]` (and its
   `:focus`) in dashboard.css and the bare `input { min-height: 42px }` in
   brand.css -- neither of which can be answered by adding a name to a
   `:not()` list, because neither names a class. That block is
   `.am-search .am-search__input` in am-system.css now, at (0,2,0) and
   (0,3,0) and with no `!important` at all, so every route that adopts the
   field gets it. /crypto-volume/ had a second copy of the same block.
   --------------------------------------------------------------------------- */

/* brand.css sets `min-height: 46px` on `.page-global_search form[role="search"]
   button` -- written for the old 54px pill-shaped submit -- and below 760px it
   also sets `width: 100% !important` on the same selector. Both reach the round
   go button inside the field and turn it into a full-width oval. Answered at
   one class more specific, with the component's own resting and touch sizes.
   `!important` only on the declaration that is answering an `!important`. */
body.page-global_search .sq-form .am-search__submit {
  inline-size: 34px !important;
  block-size: 34px;
  min-block-size: 34px;
}



/* --- Suggestions --------------------------------------------------------- */

/* Metadata weight, one label per row, wrapping. These were six filled pills
   inside a bordered panel -- more visual weight than the results underneath
   them. */
body.page-global_search .sq-suggest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--c-space-2) var(--c-space-3);
  margin-block-end: var(--c-space-4);
}

body.page-global_search .sq-suggest__label {
  flex: 0 0 auto;
  min-inline-size: 7rem;
  margin: 0;
  color: var(--c-text-muted);
  font-size: var(--c-t-label);
  font-weight: var(--c-w-medium);
}

body.page-global_search .sq-suggest__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--c-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

/* brand.css draws *every* anchor inside a `<section>` on this route as glass:

     .page-global_search section a { background: var(--glass-bg) !important;
       border-color: var(--glass-border) !important;
       border-radius: var(--c-r-feature) !important }

   and page-unification.css and app-shell.css both repaint `.search-chip` with
   `!important` on top of that. Three sheets, one component, and the chip is
   already a solved shape -- so this restates the component's own three
   declarations at one class more specific rather than inventing a fourth
   drawing. Every value below is the one `.am-chip` declares. */
body.page-global_search a.sq-chip {
  border-color: transparent !important;
  border-radius: var(--c-r-pill) !important;
  background: var(--c-inset) !important;
  color: var(--c-text-secondary) !important;
  box-shadow: none !important;
  transform: none !important;
}

/* brand.css also turns every such anchor brand-cyan on hover, with
   `!important`. In the light theme `--brand-cyan` measured 4.48:1 -- under AA,
   and below the rest state -- so pointing at a chip made it harder to read. */
body.page-global_search a.sq-chip:hover {
  border-color: var(--c-line-strong) !important;
  background: var(--c-surface-raised) !important;
  color: var(--c-text) !important;
}

body.page-global_search a.sq-chip:focus-visible {
  outline: 2px solid var(--c-evidence);
  outline-offset: 2px;
}


/* --- Count --------------------------------------------------------------- */

body.page-global_search .sq-count {
  margin: 0 0 var(--c-space-4);
  color: var(--c-text-muted);
  font-size: var(--c-t-meta);
  font-variant-numeric: tabular-nums;
}

body.page-global_search .sq-count strong {
  color: var(--c-text);
  font-weight: var(--c-w-semi);
}


/* --- Groups -------------------------------------------------------------- */

body.page-global_search .sq-set {
  margin-block-end: var(--c-space-5);
}

body.page-global_search .sq-set__head {
  flex-wrap: wrap;
  row-gap: var(--c-space-2);
}

/* The count is a number beside a heading, not a badge. app-shell.css draws
   `.search-count-pill` as a 999px filled pill 28px wide; the class stays in the
   markup because markets/tests/test_command_palette.py walks it. */
body.page-global_search .sq-set__count.search-count-pill {
  display: inline;
  min-width: 0;
  height: auto;
  padding-inline: 0;
  border-radius: 0;
  background: none;
  color: var(--c-text-muted);
  font-size: var(--c-t-meta);
  font-weight: var(--c-w-medium);
  font-variant-numeric: tabular-nums;
}

/* Measured 50x13 at 390. It is a control in a heading, not a link inside a
   sentence, so WCAG 2.5.8's inline exception does not apply to it: the target
   is padded to 24px while the ink stays where it was. */
body.page-global_search .sq-set__more {
  display: inline-flex;
  align-items: center;
  min-block-size: 24px;
  color: var(--c-text-secondary);
  font-size: var(--c-t-meta);
  font-weight: var(--c-w-medium);
  text-decoration: none;
}

/* The arrow is drawn here rather than written into the template because it is
   a *direction*, not a character: "→" is bidi-neutral, so in Arabic it gets
   pushed to the left of its label while still pointing right, which reads as
   "back". A pseudo-element can be swapped for the mirrored glyph. */
body.page-global_search .sq-set__more::after,
body.page-global_search .sq-row__go::after {
  content: " \2192";
  white-space: pre;
}

[dir="rtl"] body.page-global_search .sq-set__more::after,
[dir="rtl"] body.page-global_search .sq-row__go::after {
  content: " \2190";
}

/* `!important` because brand.css turns *every* anchor inside a `<section>` on
   this page brand-cyan on hover, with `!important`. That rule is (0,2,2) and
   this one is (0,3,1), so specificity is already on this side -- but an
   `!important` declaration beats a normal one whatever the specificity, so
   without a matching one the hover colour written here was never applied. */
body.page-global_search .sq-set__more:hover {
  color: var(--c-text) !important;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

body.page-global_search .sq-set__more:focus-visible {
  outline: 2px solid var(--c-evidence);
  outline-offset: 3px;
}

/* The promoted match is one step louder than a group and no more: the same
   surface, with the evidence hairline that means "verified" on this site. */
body.page-global_search .sq-match {
  border-color: color-mix(in srgb, var(--c-evidence) 34%, var(--c-line));
}


/* --- Rows ---------------------------------------------------------------- */

/* The blanket answer to brand.css's glass rule, for the anchors whose *states*
   do not need the same four properties. Rows are deliberately not in this
   list: a row has hover, is-active and match states, and this selector is
   (0,3,2), so a state written at (0,3,1) would lose to *this* rule rather than
   to brand.css's -- leaving the row under the arrow keys with no rail and no
   ground. `.sq-row` answers brand.css on its own base rule below, at (0,2,1),
   which its own states then beat in the ordinary way. */
body.page-global_search .sq-set a.sq-actions__link,
body.page-global_search .sq-set a.sq-set__more {
  background: none !important;
  border-color: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.page-global_search .sq-rows {
  display: flex;
  flex-direction: column;
  padding-inline: clamp(20px, 1.7vw, 24px);
  padding-block-end: clamp(16px, 1.4vw, 20px);
}

/* A row is a line of text with a hit area, not a container. Grid rather than
   flex so the ticker column is the same width down the list and the eye has a
   straight edge to run along. */
body.page-global_search .sq-row {
  display: grid;
  /* The meta column is sized, not `auto`. Left to size itself it took its
     width from the longest source on the page and every other row's source was
     then clipped at eleven characters -- "The Motley ...", "Yahoo Fi..." -- for
     no reason. A fixed track gives the column a straight edge and leaves the
     source room to be read. */
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 15rem);
  /* Placed, not flowed. A news row has no ticker, so auto-placement put its
     title in the first (`auto`) track and its meta in the second -- which is
     how a 96-character source URL ended up sharing a track with a headline and
     printing on top of it. Naming the columns makes every row, ticker or not,
     use the same three rules. */
  align-items: baseline;
  gap: 0.35rem var(--c-space-3);
  min-block-size: 48px;
  padding: var(--c-space-3) var(--c-space-3);
  /* The rail lives in the border so an active row does not shift sideways. */
  border-inline-start: 2px solid transparent;
  border-radius: var(--c-r-chip);
  /* brand.css paints every anchor inside a section on this page as glass
     (`.page-global_search section a`): `background`, `border-color` and
     `border-radius`, all three `!important`. Answered here rather than in the
     blanket above, because these are exactly the properties the row's *states*
     need to change -- and each state rule below carries one more pseudo-class
     than this, so it wins in the ordinary way. The shadow is the row's own
     separator (see the next rule), so it is pinned here too. */
  background: transparent !important;
  border-inline-start-color: transparent !important;
  border-radius: var(--c-r-chip) !important;
  box-shadow: none !important;
  color: var(--c-text);
  text-decoration: none;
  transition: background-color var(--c-dur-state) var(--c-ease),
              border-color var(--c-dur-state) var(--c-ease);
}

/* The hairline between rows, drawn on the gap rather than on the row, so the
   last row does not need a rule to take one away and the rounded hover tint
   does not sit on top of a line. */
body.page-global_search .sq-row + .sq-row,
body.page-global_search .sq-row-actions + .sq-row {
  margin-block-start: 1px;
  box-shadow: 0 -1px 0 0 color-mix(in srgb, var(--c-line) 70%, transparent) !important;
}

body.page-global_search .sq-row:hover {
  background: var(--c-inset) !important;
  border-inline-start-color: var(--c-line-strong) !important;
  /* brand.css's `section a:hover` paints this brand-cyan with `!important`,
     which measured 4.48:1 in the light theme -- under AA and below the rest
     state, so pointing at a result made it harder to read. */
  color: var(--c-text) !important;
}

/* The row the arrow keys are sitting on (static/js/search-page.js). Two
   signals, because the brief forbids meaning carried by colour alone: the focus
   ring, which is the primary one, and the rail -- which stays visible when the
   ring is clipped by the sticky header the row scrolled under. */
body.page-global_search .sq-row.is-active,
body.page-global_search .sq-row:focus-visible {
  background: var(--c-inset) !important;
  border-inline-start-color: var(--c-evidence) !important;
  color: var(--c-text) !important;
}

body.page-global_search .sq-row:focus-visible {
  outline: 2px solid var(--c-evidence);
  outline-offset: -2px;
}

/* The ticker is the thing a reader is matching against, so it gets the mono
   face and the weight; it is not a badge, because a badge on every row is a
   pattern, not an emphasis. */
body.page-global_search .sq-row__code {
  grid-column: 1;
  min-inline-size: 4.5rem;
  color: var(--c-text);
  font-family: var(--c-mono);
  font-size: var(--c-t-meta);
  font-weight: var(--c-w-semi);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

body.page-global_search .sq-row__title {
  grid-column: 2;
  min-width: 0;
  max-inline-size: 72ch;
  color: var(--c-text);
  font-size: var(--c-t-body);
  font-weight: var(--c-w-medium);
  line-height: 1.45;
}

body.page-global_search .sq-row--asset .sq-row__title {
  color: var(--c-text-secondary);
  font-weight: var(--c-w-normal);
}

body.page-global_search .sq-row__meta {
  grid-column: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.2rem var(--c-space-3);
  /* The track is capped and the source truncates inside it; the date, which is
     the part that must stay whole, keeps its own nowrap. Measured on
     /search/?q=AAPL, row 4: one article's stored source was a 96-character
     Bloomberg URL, and as min-content it took the whole row. */
  min-width: 0;
  color: var(--c-text-muted);
  font-size: var(--c-t-meta);
}

body.page-global_search .sq-row__source {
  display: inline-block;
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

body.page-global_search .sq-row__date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* --- Best match ---------------------------------------------------------- */

/* Still a row, still one hit area, still in the same keyboard walk. The
   difference a reader has to see is that it leads somewhere specific, and that
   is carried by the words and by the evidence rail. */
body.page-global_search .sq-row--match {
  border-inline-start-color: var(--c-evidence) !important;
  background: var(--c-inset) !important;
  min-block-size: 56px;
}

body.page-global_search .sq-row--match .sq-row__code {
  font-size: var(--c-t-lead);
}

body.page-global_search .sq-row__go {
  grid-column: 3;
  color: var(--c-evidence);
  font-size: var(--c-t-meta);
  font-weight: var(--c-w-semi);
  white-space: nowrap;
  text-align: end;
}


/* --- Per-asset actions --------------------------------------------------- */

body.page-global_search .sq-row-actions > summary {
  padding-inline: var(--c-space-3);
}

body.page-global_search .sq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem var(--c-space-4);
  margin: 0 0 var(--c-space-2);
  /* Indented to the row's text column so it reads as belonging to the row
     above rather than as a sibling of it. */
  padding: 0.15rem var(--c-space-3) var(--c-space-2);
  list-style: none;
}

body.page-global_search .sq-actions__link {
  display: inline-flex;
  align-items: center;
  min-block-size: 30px;
  color: var(--c-text-muted);
  font-size: var(--c-t-meta);
  text-decoration: none;
  border-block-end: 1px solid transparent;
}

body.page-global_search .sq-actions__link:hover {
  color: var(--c-text) !important;
  border-block-end-color: var(--c-line-strong) !important;
}

body.page-global_search .sq-actions__link:focus-visible {
  outline: 2px solid var(--c-evidence);
  outline-offset: 3px;
  border-radius: 2px;
}


/* --- States -------------------------------------------------------------- */

/* includes/_state.html carries the vocabulary; this gives it a surface and a
   measure. The panel it replaces was 240px of centred whitespace around one
   sentence. */
body.page-global_search .sq-state {
  max-inline-size: 46rem;
  margin-block: var(--c-space-4) var(--c-space-6);
}

/* Inside a panel the state's own border and ground would be a box in a box. */
body.page-global_search .sq-state .am-state {
  max-inline-size: none;
  border: 0;
  background: none;
  padding: 0;
}

body.page-global_search .sq-state__chips {
  margin-block-start: var(--c-space-4);
}


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

@media (max-width: 767px) {
  body.page-global_search .sq-suggest__label {
    min-inline-size: 0;
    inline-size: 100%;
  }

  /* Two columns, not three: a date pushed onto the same line as a headline is
     what produced the overflow on the old rows. The meta drops under the title
     and aligns with it. */
  body.page-global_search .sq-row {
    grid-template-columns: auto minmax(0, 1fr);
    padding-inline: var(--c-space-2);
  }

  body.page-global_search .sq-row__meta,
  body.page-global_search .sq-row__go {
    grid-column: 1 / -1;
    justify-content: flex-start;
    text-align: start;
    white-space: normal;
  }

  /* Stacked under the title there is a full row to spend. */
  body.page-global_search .sq-row__source {
    max-inline-size: 100%;
  }

  body.page-global_search .sq-rows {
    padding-inline: var(--c-space-4);
  }

  /* The component grows its go button to 44px at this width; brand.css's
     `width: 100% !important` on the same button has to be answered again at
     the size a thumb needs. */
  body.page-global_search .sq-form .am-search__submit {
    inline-size: 44px !important;
    block-size: 44px;
    min-block-size: 44px;
  }

  /* Two controls the earlier sheet sized against WCAG 2.5.8's 24px floor. The
     floor on this programme is 44px at 767px and below, and both are a row of
     controls rather than a link inside a sentence, so neither takes 2.5.8's
     inline exception. The ink does not move; the box around it does. */
  body.page-global_search .sq-actions__link,
  body.page-global_search .sq-set__more {
    min-block-size: 44px;
  }

  body.page-global_search .sq-actions {
    gap: 0 var(--c-space-4);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-global_search .sq-row {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
   Forced colours (Windows High Contrast)
   ---------------------------------------------------------------------------
   The UA replaces every author colour with a system palette: `color`,
   `background-color` and `border-color` are all overridden, while `outline`,
   `text-decoration` and box geometry survive. Any state whose only cue is a
   colour -- a border colour included -- therefore goes silent.

   Measured with forced colours active, these two had no visible hover cue at
   all. A `text-decoration` is the cue that survives, so it is added here and
   only here: outside forced colours the designed treatment is unchanged.
   --------------------------------------------------------------------------- */

@media (forced-colors: active) {
  body.page-global_search .sq-actions__link:hover,
  body.page-global_search .sq-row:hover .sq-row__title {
    text-decoration: underline;
    text-underline-offset: 0.18em;
  }
}
