/* ============================================================
   Sarath Search — Design System
   Tokens are the literal spec from UI/UX Brief §2. Do not
   reinterpret values here; change the brief first.
   ============================================================ */

/* ---------- Color tokens (UI/UX Brief §2 · Color) ---------- */
:root {
  --bg: #F6F8F7;
  --surface: #FFFFFF;
  --ink: #16211D;
  --ink-muted: #5B6B64;
  --accent-gold: #C6862B;
  --accent-teal: #0F6B5C;
  --border: #E3E8E5;

  /* derived, non-spec helpers */
  --gold-soft: rgba(198, 134, 43, 0.10);
  --gold-ring: rgba(198, 134, 43, 0.32);
  --teal-soft: rgba(15, 107, 92, 0.09);
  --shadow-sm: 0 1px 2px rgba(22, 33, 29, 0.05);
  --shadow-md: 0 4px 16px rgba(22, 33, 29, 0.08);
  --shadow-lg: 0 10px 34px rgba(22, 33, 29, 0.10);

  /* Layout: corner radius soft but restrained, 10–14px */
  --r-card: 12px;
  --r-box: 14px;
  --r-pill: 999px;
  --r-chip: 10px;

  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: #0B1210;
  --surface: #121D19;
  --ink: #EDF3F0;
  --ink-muted: #9BB0A8;
  --accent-gold: #E8A33D;
  --accent-teal: #3FBFA6;
  --border: #22322C;

  --gold-soft: rgba(232, 163, 61, 0.13);
  --gold-ring: rgba(232, 163, 61, 0.36);
  --teal-soft: rgba(63, 191, 166, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 34px rgba(0, 0, 0, 0.55);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  /* Inter for UI/body Latin; Noto Sans Devanagari for Hindi/mixed-script */
  font-family: 'Inter', 'Noto Sans Devanagari', system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  font-size: 15px; /* Brief: 15px base, never smaller */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Wordmark / display face — used sparingly, never body text */
.display {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
}

img, svg { display: block; }
button { font: inherit; color: inherit; }

/* `hidden` must win over the component `display` rules below
   (e.g. .searchbox__clear sets display:inline-grid). */
[hidden] { display: none !important; }

/* Data / metadata — tabular figures where numbers appear */
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Focus: visible ring on every interactive element,
             using --accent-gold (Brief §4) ---------- */
:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--r-card) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Wheel mark ---------- */
.wheel { display: block; flex: none; }

/* The one animated moment: rotates while a query is in flight,
   settles the instant results are ready (Brief §2 · Motion). */
@keyframes wheel-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.wheel--spinning .wheel__spokes {
  transform-origin: 50% 50%;
  animation: wheel-spin 1.15s linear infinite;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.theme-toggle:hover {
  border-color: var(--gold-ring);
  color: var(--accent-gold);
}
.theme-toggle:active { transform: scale(0.94); }

/* ============================================================
   SearchBox — one component, two sizes (hero / compact)
   ============================================================ */
.searchbox { position: relative; width: 100%; }

.searchbox__form {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 160ms ease, border-color 160ms ease;
}
.searchbox__form:focus-within {
  border-color: var(--gold-ring);
  box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow-md);
}

.searchbox--hero .searchbox__form { padding: 6px 8px 6px 20px; }
.searchbox--compact .searchbox__form { padding: 4px 6px 4px 16px; }

.searchbox__input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  padding: 0;
}
.searchbox__input:focus { outline: none; }
.searchbox__input::placeholder { color: var(--ink-muted); opacity: 1; }

.searchbox--hero .searchbox__input {
  font-size: 18px;
  padding: 14px 0;
}
.searchbox--compact .searchbox__input {
  font-size: 15px;
  padding: 9px 0;
}

.searchbox__submit {
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  border-radius: var(--r-pill);
  background: var(--accent-gold);
  color: #fff;
  transition: filter 140ms ease, transform 140ms ease;
}
html[data-theme='dark'] .searchbox__submit { color: #14100A; }
.searchbox__submit:hover { filter: brightness(1.06); }
.searchbox__submit:active { transform: scale(0.95); }

.searchbox--hero .searchbox__submit { width: 46px; height: 46px; }
.searchbox--compact .searchbox__submit { width: 34px; height: 34px; }

.searchbox__clear {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--r-pill);
  cursor: pointer;
}
.searchbox__clear:hover { color: var(--ink); background: var(--bg); }

/* Autocomplete panel — UI is shipped, data source is not wired yet.
   See /about for why it stays inert until /suggest exists. */
.ac-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 6px;
}
.ac-panel[hidden] { display: none; }

.ac-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 1.5;
}
.ac-note code {
  font-size: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
}

/* Bang detection hint — surfaces before submit (App Flow §5) */
.bang-hint {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--gold-ring);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
  padding: 11px 14px;
  font-size: 13px;
  color: var(--ink-muted);
}
.bang-hint[hidden] { display: none; }
.bang-hint strong { color: var(--ink); }

/* ============================================================
   Home page
   ============================================================ */
.home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.home__top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 18px 22px;
}

.home__main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 22px 64px;
}

.home__inner {
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Homepage → results transition is a quick fade/slide, <250ms */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.home__inner > * { animation: rise-in 220ms ease both; }

.logo-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}
.logo-lockup__word {
  margin: 0; /* it's an <h1> — drop the UA heading margin */
  font-size: 44px; /* Brief: 34/44px homepage wordmark */
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--ink);
}
.logo-lockup__word em {
  font-style: normal;
  color: var(--accent-gold);
}

.home__tagline {
  margin: 0 0 30px;
  color: var(--ink-muted);
  font-size: 15px;
  text-align: center;
}

.lang-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 18px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}
.lang-pill {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  padding: 6px 15px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}
.lang-pill:hover { color: var(--ink); }
.lang-pill[aria-pressed='true'] {
  background: var(--teal-soft);
  color: var(--accent-teal);
  font-weight: 600;
}

.trending {
  margin-top: 34px;
  width: 100%;
  text-align: center;
}
.trending__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
}
.trending__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.chip:hover {
  border-color: var(--gold-ring);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.chip__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-gold);
  flex: none;
}

.trust-line {
  margin-top: 40px;
  color: var(--ink-muted);
  font-size: 13px;
  text-align: center;
  max-width: 470px;
  line-height: 1.6;
}
/* Icon sits inline with the first line of copy so the block stays
   optically centred instead of the icon floating beside it. */
.trust-line svg {
  display: inline-block;
  vertical-align: -3px;
  margin-right: 7px;
  color: var(--accent-teal);
}
.trust-line a { color: var(--accent-teal); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  padding: 22px;
  border-top: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 13px;
}
.site-footer a {
  color: var(--ink-muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent-teal); text-decoration: underline; }
.site-footer__sep { opacity: 0.4; }

/* ============================================================
   Results page
   ============================================================ */
.results-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Compact top bar that never leaves the viewport (Brief §2 · Layout) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(4px)) {
  .topbar { background: var(--bg); }
}

.topbar__row {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 22px;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}
.topbar__word {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.topbar__word em { font-style: normal; color: var(--accent-gold); }

.topbar__search {
  flex: 1 1 auto;
  max-width: 640px;
  min-width: 0;
}
.topbar__actions { flex: none; margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Tabs — horizontally scrollable row on mobile (App Flow §8) */
.tabbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 15px 13px;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}
.tab:hover { color: var(--ink); }
.tab[aria-current='page'] {
  color: var(--accent-teal);
  border-bottom-color: var(--accent-teal);
  font-weight: 600;
}
.tab__soon {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px 6px;
}

/* Layout: single-column list + right rail at ≥1024px */
.results-layout {
  flex: 1 1 auto;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 22px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
@media (min-width: 1024px) {
  .results-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

.results-main { min-width: 0; animation: rise-in 200ms ease both; }

.results-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--ink-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---------- AI Answer card ----------
   Distinct treatment so it is never mistaken for an organic result. */
.ai-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--r-card);
  padding: 18px 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.ai-card__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.ai-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-gold);
}
.ai-card__confidence {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  padding: 2px 9px;
}
.ai-card__body {
  font-size: 15px;
  line-height: 1.62;
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
}
.ai-card__citations {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
/* Citation chips scroll-link down to the matching result */
.cite-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-muted);
  text-decoration: none;
  transition: border-color 140ms ease, color 140ms ease;
}
.cite-chip:hover { border-color: var(--gold-ring); color: var(--ink); }
.cite-chip__n {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--accent-gold);
  font-size: 10.5px;
  font-weight: 700;
}

/* Collapsible after ~3 lines on small screens (App Flow §8) */
.ai-card__more {
  display: none;
  margin-top: 10px;
  background: transparent;
  border: 0;
  color: var(--accent-teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
@media (max-width: 700px) {
  .ai-card--clamped .ai-card__body {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .ai-card__more { display: inline-block; }
}

/* ---------- Organic result list ---------- */
.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result {
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-card);
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease,
    background 140ms ease;
  scroll-margin-top: 130px;
}
/* Cards lift 1–2px with a soft border-glow on hover */
.result:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.result:target {
  background: var(--surface);
  border-color: var(--gold-ring);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.result__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}
.favicon-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex: none;
  display: inline-grid;
  place-items: center;
  font-size: 9.5px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0;
}
.result__crumb {
  font-size: 12.5px;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result__title {
  margin: 0 0 5px;
  font-size: 17px; /* Brief: 17px result titles */
  font-weight: 600;
  line-height: 1.35;
}
.result__title a {
  color: var(--accent-teal);
  text-decoration: none;
}
.result__title a:hover { text-decoration: underline; }
.result__snippet {
  margin: 0;
  font-size: 15px;
  line-height: 1.5; /* generous 1.5 on snippets specifically */
  color: var(--ink-muted);
}

/* Language badge — renders the server-computed `lang` field verbatim */
.lang-badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
}
.lang-badge--en {
  color: var(--accent-teal);
  background: var(--teal-soft);
  border-color: color-mix(in srgb, var(--accent-teal) 26%, transparent);
}
.lang-badge--hi {
  color: var(--accent-gold);
  background: var(--gold-soft);
  border-color: var(--gold-ring);
  font-family: 'Inter', 'Noto Sans Devanagari', sans-serif;
}

.result__footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  opacity: 0;
  transition: opacity 140ms ease;
}
.result:hover .result__footer,
.result:focus-within .result__footer { opacity: 1; }
@media (hover: none) {
  .result__footer { opacity: 1; }
}

.feedback-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease;
}
.feedback-btn:hover { color: var(--accent-teal); border-color: var(--accent-teal); }
.feedback-btn[aria-pressed='true'] {
  color: var(--accent-teal);
  border-color: var(--accent-teal);
  background: var(--teal-soft);
}

/* ---------- Right rail ---------- */
.rail {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 16px 17px;
}
.rail-card__title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.rail-card__row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.rail-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
}
.rail-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 13px;
}
.rail-card dt { color: var(--ink-muted); }
.rail-card dd { margin: 0; color: var(--ink); font-weight: 500; word-break: break-word; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-link {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  transition: border-color 140ms ease, color 140ms ease;
}
.page-link:hover { border-color: var(--gold-ring); color: var(--accent-gold); }
.page-link[aria-current='page'] {
  background: var(--gold-soft);
  border-color: var(--gold-ring);
  color: var(--accent-gold);
  font-weight: 700;
}
.page-link--muted { color: var(--ink-muted); pointer-events: none; opacity: 0.5; }

/* ============================================================
   States: empty / zero-result / error / coming-soon
   ============================================================ */
.state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-box);
  padding: 34px 30px;
  text-align: left;
  max-width: 620px;
}
.state--center { text-align: center; margin: 0 auto; }
.state__icon { margin-bottom: 16px; color: var(--accent-gold); }
.state__title {
  margin: 0 0 10px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.state__title q { font-style: normal; }
.state__body {
  margin: 0;
  color: var(--ink-muted);
  font-size: 14.5px;
  line-height: 1.6;
}
.state__list {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--ink-muted);
  font-size: 14.5px;
  line-height: 1.7;
}
.state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.state--error { border-left: 3px solid var(--accent-gold); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}
.btn:hover { border-color: var(--gold-ring); transform: translateY(-1px); }
.btn--primary {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
}
html[data-theme='dark'] .btn--primary { color: #14100A; }
.btn--primary:hover { filter: brightness(1.06); }

/* ============================================================
   Debug panel — provider/latency surface. Dev/debug view only,
   never shown to end users (opt-in via ?debug=1).
   ============================================================ */
.debug-bar {
  max-width: 1180px;
  margin: 0 auto 4px;
  padding: 0 22px;
}
.debug-panel {
  border: 1px dashed var(--gold-ring);
  border-radius: var(--r-chip);
  background: var(--gold-soft);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--ink);
}
.debug-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--accent-gold);
  margin-bottom: 8px;
}
.debug-panel__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.debug-kv {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  white-space: nowrap;
}
.debug-kv b { color: var(--accent-teal); font-weight: 600; }
.debug-panel__close {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 500;
}
.debug-panel__close:hover { color: var(--ink); text-decoration: underline; }

/* ============================================================
   Content pages (about / privacy / feedback / settings)
   ============================================================ */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 22px 72px;
  animation: rise-in 200ms ease both;
}
.page__title {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--ink);
}
.page__lede {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin: 0 0 34px;
}
.page h2 {
  font-size: 19px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--ink);
}
.page h3 {
  font-size: 15.5px;
  font-weight: 600;
  margin: 22px 0 8px;
  color: var(--ink);
}
.page p, .page li {
  font-size: 15px;
  line-height: 1.68;
  color: var(--ink-muted);
}
.page p { margin: 0 0 14px; }
.page ul, .page ol { margin: 0 0 14px; padding-left: 22px; }
.page li { margin-bottom: 7px; }
.page a { color: var(--accent-teal); }
.page strong { color: var(--ink); font-weight: 600; }
.page code {
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}

.table-wrap { overflow-x: auto; margin: 0 0 18px; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 420px;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table th {
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.data-table td { color: var(--ink-muted); }

.notice {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-teal);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 15px 17px;
  margin: 0 0 20px;
}
.notice p:last-child { margin-bottom: 0; }

/* Settings form controls — plain, no dark patterns */
.field {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.field__legend {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.field__hint {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 0 0 12px;
  line-height: 1.5;
}
.radio-row { display: flex; flex-direction: column; gap: 9px; }
.radio-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  color: var(--ink);
  cursor: pointer;
}
.radio-row input { accent-color: var(--accent-gold); width: 16px; height: 16px; }

.textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-chip);
}
.textarea:focus { outline: none; border-color: var(--gold-ring); box-shadow: 0 0 0 3px var(--gold-soft); }

.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;
}

/* ---------- Motion preference (Brief §2 · Motion) ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .wheel--spinning .wheel__spokes { animation: none !important; }
  .result:hover { transform: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .logo-lockup__word { font-size: 34px; } /* Brief: 34/44px wordmark */
  .home__main { padding-bottom: 40px; }
  .topbar__row { gap: 10px; padding: 10px 14px; }
  .topbar__word { display: none; }
  .tabbar { padding: 0 14px; }
  .results-layout { padding: 18px 14px 44px; gap: 26px; }
  .page { padding: 28px 16px 56px; }
  .page__title { font-size: 27px; }
  .result { padding: 12px 12px; }
  .debug-bar { padding: 0 14px; }
}
