/* Search page layout. Scoped to .sr-* so it cannot reach any other page, and it
   defines no design tokens of its own — colours and spacing come from the
   shared token sheet. */

.sr-form { margin: 14px 0 6px; }
.sr-field { display: flex; gap: 8px; align-items: center; }
.sr-field input[type="search"] {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-size: 15px;
}
.sr-field input[type="search"]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}

/* Tabs */
.sr-tabs { display: flex; gap: 6px; margin: 12px 0 4px; border-bottom: 1px solid var(--line); }
.sr-tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 9px 14px; margin-bottom: -1px; border-radius: 8px 8px 0 0;
  color: var(--text-3); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.sr-tab:hover { color: var(--text); background: var(--panel); }
.sr-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); }
.sr-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sr-tab .sr-count { margin-left: 6px; font-weight: 500; color: var(--text-3); font-size: 12px; }

.sr-panel { padding: 6px 0 2px; }
.sr-panel:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 8px; }
.sr-panel[hidden] { display: none; }

/* Result rows */
.sr-list { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 0; padding: 0; list-style: none; }
.sr-row {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px;
  border-radius: 12px; color: inherit; text-decoration: none; border: 1px solid transparent;
}
.sr-row:hover { background: var(--panel); }
.sr-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.sr-row .avatar { flex: 0 0 auto; }
.sr-body { min-width: 0; flex: 1; }
.sr-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sr-handle { font-size: 13px; color: var(--text-3); }
.sr-sub { font-size: 13px; color: var(--text-3); margin-top: 2px;
  overflow-wrap: anywhere; word-break: break-word; }
.sr-snippet { font-size: 14px; line-height: 1.45; margin-top: 2px;
  overflow-wrap: anywhere; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.sr-badge {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text-3);
}

/* Tag rows read as tags, not as people */
.sr-row.sr-tagrow { align-items: center; }
.sr-tagmark {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel); border: 1px solid var(--line);
  font-weight: 800; font-size: 16px; color: var(--text-3);
}

/* Music rows carry two destinations — the track and its artist — so the row is a
   div, not an anchor (an <a> inside an <a> is invalid). The title link is stretched
   over the whole row so it still reads as one target, and the artist handle is
   lifted above that overlay so it stays independently clickable. */
.sr-row.sr-trackrow { position: relative; align-items: center; }
.sr-cover {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 8px; object-fit: cover;
  background: var(--panel); border: 1px solid var(--line);
}
.sr-cover-ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--text-3);
}
.sr-tracktitle { color: inherit; text-decoration: none; }
.sr-tracktitle::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.sr-tracktitle:focus-visible { outline: none; }
.sr-tracktitle:focus-visible::after { outline: 2px solid var(--brand); outline-offset: -2px; }
.sr-artist { position: relative; z-index: 1; }
.sr-artistlink { color: var(--text-3); text-decoration: none; }
.sr-artistlink:hover { color: var(--text); text-decoration: underline; }
.sr-artistlink:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* States */
.sr-state { padding: 22px 12px; color: var(--text-3); font-size: 14px; line-height: 1.55; }
.sr-state strong { color: var(--text); font-weight: 700; }
#srResults[hidden], #srSuggest[hidden] { display: none; }

/* The no-match state: a mark, the sentence naming the term, and a way out. The
   term is rendered inside .sr-empty-q, which must be able to break anywhere —
   a long pasted query cannot be allowed to widen the page. */
.sr-empty { display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 30px 14px; text-align: center;
  border: 1px dashed var(--line); border-radius: 14px; }
.sr-empty-mark { display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 15px; line-height: 1; color: var(--text-3); }
.sr-empty-line { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--text);
  max-width: 34ch; overflow-wrap: anywhere; word-break: break-word; }
.sr-empty-q { font-weight: 700; }
.sr-empty-next { margin: 0; font-size: 13px; color: var(--text-3); max-width: 40ch; }
.sr-empty-link { color: var(--brand, var(--text)); font-weight: 700; text-decoration: none; }
.sr-empty-link:hover { text-decoration: underline; }
.sr-empty-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

/* Pre-query suggestions */
.sr-suggest { padding: 4px 0 2px; }
.sr-sugsec + .sr-sugsec { margin-top: 18px; }
.sr-sugh { margin: 10px 2px 2px; font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); }

/* Tag view header */
.sr-taghead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sr-taghead h2 { margin: 0; font-size: 20px; }
.sr-taghead .sr-meta { margin: 0; }
.sr-back { font-size: 13px; color: var(--text-3); }

/* Screen-reader-only live region */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (max-width: 560px) {
  /* Four tabs will not fit at 320px, so the tablist scrolls sideways rather than
     wrapping or squeezing the labels out of reach. */
  .sr-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sr-tabs::-webkit-scrollbar { display: none; }
  .sr-tab { padding: 9px 10px; font-size: 13px; flex: 0 0 auto; }
  .sr-row { padding: 10px 8px; }
  .sr-cover { width: 40px; height: 40px; }
}

/* ===========================================================================
   DISCOVERY BUILD — per-tab treatments (spec 02_SEARCH §3).
   OMNI SYSTEM tokens only (--surface*, --line*, --text*, --violet*, --r-*).
   Accent TEXT is --violet-2 (7.57:1 on surface); --violet is the FILL role.
   =========================================================================== */

/* ---- tab strip: accent underline on the active tab ---- */
.sr-tab { min-height: 44px; }
.sr-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--violet); }
.sr-tab:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.sr-count:not(:empty) {
  margin-left: 6px; padding: 2px 6px; border-radius: var(--r-pill, 999px);
  background: var(--surface-2); color: var(--text-3);
  font: 600 10px/1.4 var(--sans);
}

/* ---- People row: bio + Follow pill at the right ---- */
.sr-bio {
  display: block; color: var(--text-3);
  font: 500 12px/1.4 var(--sans);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-follow {
  flex: 0 0 auto; margin-left: auto; align-self: center;
  min-height: 32px; display: inline-flex; align-items: center;
  padding: 7px 15px; border-radius: var(--r-pill, 999px);
  border: 1px solid var(--violet); background: var(--violet-dim);
  color: var(--violet-2); font: 700 12px/1 var(--sans); white-space: nowrap;
}
.sr-row:hover .sr-follow { background: var(--violet); color: #fff; }

/* ---- Tracks row: artwork with a ▶ overlay ---- */
.sr-coverwrap { position: relative; flex: 0 0 auto; display: block; line-height: 0; }
.sr-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  border: 0; padding: 0; cursor: pointer; border-radius: var(--r-sm, 10px);
  background: rgba(0,0,0,.44); color: #fff;
  opacity: 1; transition: opacity var(--dur-1) var(--ease-out);
}
/* Visible at rest on touch — a hover-only control is unreachable on a phone. */
@media (hover: hover) and (pointer: fine) {
  .sr-play { opacity: 0; }
  .sr-coverwrap:hover .sr-play, .sr-play:focus-visible { opacity: 1; }
}
.sr-play-tri {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 50%; background: rgba(0,0,0,.55); font-size: 12px;
}
.sr-play:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

/* ---- Posts tab: a grid of tiles (search-by-post, first-class) ---- */
.sr-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.sr-grid-mini { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.sr-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 150px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .sr-tile:hover { border-color: var(--line-hi); transform: translateY(-2px); }
}
.sr-tile:active { transform: scale(.98); }
.sr-tile:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.sr-tile-line {
  margin: 0; font: 600 15px/1.4 var(--display); color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.sr-tile-foot { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.sr-tile-who { font: 600 12px/1 var(--sans); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-tile-meta { font: 500 11px/1 var(--sans); color: var(--text-3); }

/* ---- Top tab: stacked mini-blocks ---- */
.sr-topterm { font: 500 13px/1.4 var(--sans); color: var(--text-3); margin: 12px 2px 6px; }
.sr-topterm strong { color: var(--text); font-weight: 700; }
.sr-topblock { margin: 0 0 22px; }
.sr-topblock-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 6px; }
.sr-topblock-h {
  margin: 0; font: 700 11px/1 var(--sans); letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.sr-seeall {
  border: 0; background: none; padding: 6px 2px; cursor: pointer;
  color: var(--violet-2); font: 600 12px/1 var(--sans);
}
.sr-seeall:hover { text-decoration: underline; }
.sr-seeall:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; border-radius: var(--r-xs, 6px); }
.sr-chiprow { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px; }
.sr-chiprow .sr-tagrow {
  width: auto; min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-pill, 999px);
  background: var(--violet-dim);
}
.sr-chiprow .sr-tagrow .sr-meta { margin-left: 6px; }

@media (prefers-reduced-motion: reduce) {
  .sr-tile, .sr-play { transition: none; }
  .sr-tile:hover, .sr-tile:active { transform: none; }
}
@media (max-width: 640px) {
  .sr-grid, .sr-grid-mini { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sr-tile { min-height: 128px; padding: 12px; }
  .sr-tile-line { font-size: 13px; -webkit-line-clamp: 3; }
}
