/* search.css — storyarc Search screen, design screen 08 / §6c.
 *
 * Layers on top of following.css (which provides the .follow-row pattern
 * the related-stories list reuses). What's specific here:
 *   - Page header + search input field with leading magnifier icon.
 *   - Stats line that summarises result counts.
 *   - Tinted "Top match · Story" exact-match card with a horizontal
 *     chapter-count spine.
 *   - Compact article rows for the secondary section below stories.
 *   - Section labels above each result group.
 *
 * Reads only tokens.css custom properties — no raw colour here.
 */

/* ── Page frame ──────────────────────────────────────────────────── */

.search {
  max-width: 600px;
  margin-inline: auto;
  padding: 20px 20px 24px;
}

.search__head {
  padding-bottom: 14px;
}

.search__title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-top: 6px;
  color: var(--text-1);
}

/* ── Search input field ──────────────────────────────────────────── */

.search__form {
  margin: 6px 0 4px;
}

.search__field {
  position: relative;
  display: flex;
  align-items: center;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  background: var(--bg);
  padding: 10px 12px;
  gap: 10px;
  transition: border-color 120ms ease;
}

.search__field:focus-within {
  border-color: var(--accent-2);
}

.search__icon {
  color: var(--text-3);
  flex-shrink: 0;
  display: inline-flex;
}

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text-1);
  padding: 4px 0;
}

.search__input::placeholder {
  color: var(--text-3);
  font-style: italic;
}

/* Strip the WebKit search-clear pseudo so the only clear affordance is
 * the OS-native one; nothing here looks broken if the UA hides it. */
.search__input::-webkit-search-decoration,
.search__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* ── Tabs (STORIES / ARTICLES filter) ────────────────────────────── */

.search__tabs {
  display: flex;
  gap: 6px;
  margin-top: 18px;
  border-bottom: 1px solid var(--rule);
}

.search__tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 10px 14px 11px;
  margin-bottom: -1px;            /* overlap the rule so the active line meets it */
  border: 0;
  border-bottom: 1.5px solid transparent;
  background: transparent;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.search__tab.is-active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
}

.search__tab:disabled {
  opacity: 0.5;
  cursor: default;
}

.search__tab-count {
  font-size: 0.625rem;
  color: var(--text-3);
}

.search__tab.is-active .search__tab-count {
  color: var(--accent-ink);
}

/* Panel wrapper — keeps the section spacing consistent whether stories
 * or articles is visible. Articles panel reuses the existing article-row
 * styles; only the top margin matters here. */
.search__panel {
  margin-top: 16px;
}

/* ── Exact-match card ────────────────────────────────────────────── */

.search__exact {
  margin-top: 0;
}

/* Top match card — same surface treatment as Today's Lead Story latest-
 * article callout: warm card surface with a 2px accent stripe on the
 * left. The full pink fill we had originally read as too loud once both
 * surfaces sat in the same app. */
.search-exact {
  display: block;
  padding: 16px 18px 18px;
  background: var(--surface-1);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  color: inherit;
  transition: background-color 120ms ease;
}

.search-exact:active {
  background: var(--surface-2);
}

@media (hover: hover) {
  .search-exact:hover {
    background: var(--surface-2);
  }
}

.search-exact__eyebrow {
  color: var(--accent-ink);
}

.search-exact__title {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.18;
  letter-spacing: -0.015em;
  color: var(--text-1);
  text-wrap: balance;
}

/* Horizontal chapter spine — N evenly-spaced dots on a thin rule. The
 * dot count is set inline by search.js from `chapter_count` (capped). */
.search-exact__spine {
  position: relative;
  height: 12px;
  margin-top: 14px;
}

.search-exact__line {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 1px;
  background: var(--accent);
  opacity: 0.6;
}

.search-exact__dots {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-exact__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  border: 1px solid var(--bg);
}

.search-exact__span {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.search-exact__stats {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

/* ── Section labels ──────────────────────────────────────────────── */

.search__section {
  margin-top: 28px;
}

.search__section-label {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Related-stories list reuses .follow-row from following.css; only its
 * top-margin needs to be reset since the section label is right above. */
.search__list {
  margin-top: 0;
}

/* ── Article rows ────────────────────────────────────────────────── */

.search__articles {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-row {
  border-top: 1px solid var(--rule);
}

.article-row:last-of-type {
  border-bottom: 1px solid var(--rule);
}

.article-row__link {
  display: block;
  padding: 14px 0 16px;
  transition: background-color 120ms ease;
}

.article-row__link:active {
  background: var(--surface-1);
}

@media (hover: hover) {
  .article-row__link:hover {
    background: var(--surface-1);
  }
}

.article-row__eyebrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.article-row__source {
  color: var(--accent-ink);
}

.article-row__time {
  color: var(--text-3);
  flex-shrink: 0;
  text-align: right;
}

.article-row__title {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text-1);
  text-wrap: balance;
}

/* ── Status line (typing / no-results / error) ───────────────────── */

.search__status {
  margin-top: 24px;
  padding: 6px 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.search__status:empty {
  display: none;
}
