/* ============================================================
   QUESTIONFINDER — Lead Magnet
   Dark by default, light toggle. Plus Jakarta Sans. Green accent.
   ============================================================ */

:root {
  /* Base tokens — dark theme (default) */
  --bg: #0b0d0f;
  --bg-2: #111417;
  --surface-1: #14181c;
  --surface-2: #181d22;
  --surface-3: #1f252b;
  --outline-1: #1d2329;
  --outline-2: #2a3138;
  --outline-3: #384049;

  --text-1: #f2f4f6;
  --text-2: #c1c8cf;
  --text-3: #7b8590;
  --text-4: #5a636b;

  --brand: #69c554;
  --brand-hover: #78d363;
  --brand-fg: #0b0d0f;
  --brand-soft: rgba(105, 197, 84, 0.14);
  --brand-line: rgba(105, 197, 84, 0.32);

  --warn: #eab308;
  --warn-soft: rgba(234, 179, 8, 0.14);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);

  --container: 1120px;
}

html[data-theme="light"] {
  --bg: #f7f8fa;
  --bg-2: #ffffff;
  --surface-1: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eff1f4;
  --outline-1: #ebeef2;
  --outline-2: #d9dee4;
  --outline-3: #c1c8d0;

  --text-1: #0e1418;
  --text-2: #384049;
  --text-3: #67717a;
  --text-4: #99a2ab;

  --brand: #4fae3d;
  --brand-hover: #43982f;
  --brand-fg: #ffffff;
  --brand-soft: rgba(79, 174, 61, 0.10);
  --brand-line: rgba(79, 174, 61, 0.28);

  --shadow-sm: 0 1px 3px rgba(15, 20, 25, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 20, 25, 0.08);
  --shadow-lg: 0 24px 60px rgba(15, 20, 25, 0.12);
}

/* ========== Base ========== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text-1);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }

/* ========== Header ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--outline-1);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  line-height: 0;
}
.logo-img {
  height: 32px;
  width: auto;
  display: block;
}
/* Show the dark-theme logo by default (dark theme is default) */
.logo-img-light { display: none; }
.logo-img-dark { display: block; }
html[data-theme="light"] .logo-img-dark { display: none; }
html[data-theme="light"] .logo-img-light { display: block; }
.header-nav {
  display: flex;
  gap: 24px;
  margin-left: auto;
  margin-right: 8px;
}
.nav-link {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--text-1); }

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--outline-2);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="light"] .theme-icon-moon { display: none; }

/* ========== Hero ========== */
.hero {
  padding: 72px 24px 40px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -20% -20% auto -20%;
  height: 480px;
  background: radial-gradient(
    ellipse at 50% 0%,
    color-mix(in srgb, var(--brand) 18%, transparent),
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}
.hero-inner {
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
}

.hero-title {
  font-size: clamp(38px, 6.5vw, 66px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 20px 0 20px;
  color: var(--text-1);
}
.hero-accent { color: var(--brand); }

.hero-sub {
  font-size: 18px;
  color: var(--text-2);
  line-height: 1.6;
  max-width: 620px;
  margin: 0 auto 36px;
}

.search-form {
  max-width: 660px;
  margin: 0 auto;
}
.search-fields {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s;
}
.search-fields:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow-md);
}
.search-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.search-input {
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}
.search-input::placeholder { color: var(--text-3); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  background: var(--brand);
  color: var(--brand-fg);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--brand-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

.search-hint {
  margin-top: 14px;
  color: var(--text-3);
  font-size: 13px;
}

.sources-strip {
  margin-top: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sources-label {
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-2);
  border: 1px solid var(--outline-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
}

/* ========== Loading ========== */
.loading {
  padding: 48px 24px;
  text-align: center;
}
.loading-inner {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--outline-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  color: var(--text-2);
  font-size: 14px;
}

/* ========== Results ========== */
.results {
  padding: 48px 24px 24px;
}
.results-inner {
  max-width: var(--container);
  margin: 0 auto;
}
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.results-eyebrow {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.results-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  letter-spacing: -0.02em;
}
.results-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-chip {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--outline-2);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.stat-chip strong { color: var(--text-1); font-weight: 700; }

/* ---- Results table ---- */
.results-table-wrap {
  position: relative;
  background: var(--surface-1);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  /* When unlocked with 100 questions we cap the height so the page stays
     scannable; the table itself scrolls internally with a sticky thead. */
  max-height: 640px;
  overflow-y: auto;
}
/* When the gate is showing we DON'T let the table scroll internally —
   the absolutely positioned gate needs a stable, non-scrolling parent. */
.results-table-wrap.has-gate {
  max-height: none;
  overflow: hidden;
}

/* Scrollbar styling for the results wrap */
.results-table-wrap::-webkit-scrollbar { width: 10px; }
.results-table-wrap::-webkit-scrollbar-track { background: transparent; }
.results-table-wrap::-webkit-scrollbar-thumb {
  background: var(--outline-2);
  border-radius: 999px;
  border: 2px solid var(--surface-1);
}
.results-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* When the gate is showing, add a soft fade over the locked rows to help the
   card feel like it's floating on top of the blur, and disable table hover on
   the locked section. */
.results-table-wrap.has-gate::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-1) 0%, transparent) 0%,
    color-mix(in srgb, var(--surface-1) 55%, transparent) 40%,
    color-mix(in srgb, var(--surface-1) 85%, transparent) 100%
  );
  z-index: 1;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.results-table thead {
  background: var(--surface-2);
}
.results-table th {
  padding: 12px 16px;
  text-align: left;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  border-bottom: 1px solid var(--outline-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
}

/* Sortable header styling */
.results-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.results-table th.sortable:hover {
  color: var(--text-1);
  background: var(--surface-3);
}
.th-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.th-inner-right {
  justify-content: flex-end;
  width: 100%;
}
.sort-chev {
  font-size: 11px;
  line-height: 1;
  color: var(--text-4);
  transition: color 0.15s;
  font-weight: 700;
}
.sort-chev.is-active {
  color: var(--brand);
}
.results-table th.sortable:hover .sort-chev { color: var(--text-2); }
.results-table th.sortable:hover .sort-chev.is-active { color: var(--brand); }
.th-num { width: 40px; text-align: center; }
.th-vol, .th-kd { width: 110px; text-align: right; }
.th-signal { width: 130px; }

.results-table td {
  padding: 14px 16px;
  color: var(--text-1);
  border-bottom: 1px solid var(--outline-1);
  vertical-align: middle;
}
.results-table tbody tr:last-child td { border-bottom: none; }
.results-table tbody tr {
  transition: background 0.15s;
}
.results-table tbody tr:hover { background: var(--surface-2); }

.td-num {
  text-align: center;
  color: var(--text-3);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.td-q {
  color: var(--text-1);
  font-weight: 500;
}

/* Subtle badge shown when we consolidated N near-duplicate phrasings into
   this row. Small, brand-green, not attention-grabbing. */
.variant-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  border-radius: 999px;
  vertical-align: middle;
  letter-spacing: 0.02em;
  cursor: help;
}
.td-vol, .td-kd {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.td-vol { color: var(--text-1); }
.kd-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}
.kd-easy   { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line); }
.kd-med    { background: var(--warn-soft); color: var(--warn); border: 1px solid rgba(234, 179, 8, 0.32); }
.kd-hard   { background: var(--surface-3); color: var(--text-3); border: 1px solid var(--outline-2); }

.signal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.signal-track {
  flex: 1;
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  min-width: 40px;
}
.signal-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
}
.signal-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 22px;
  text-align: right;
}

/* ---- Locked rows ---- */
.results-table tbody tr.locked td {
  color: transparent;
  text-shadow: 0 0 12px var(--text-3);
  user-select: none;
  pointer-events: none;
}
.results-table tbody tr.locked .kd-pill,
.results-table tbody tr.locked .signal-bar {
  filter: blur(5px);
  opacity: 0.6;
}
.results-table tbody tr.locked .td-num {
  color: var(--text-4);
  text-shadow: none;
}

/* ========== Gate (overlays the blurred rows) ========== */
.gate {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* Positioned dynamically in JS to sit on top of the first locked row */
  top: 0;
  width: min(560px, calc(100% - 32px));
  z-index: 3;
  pointer-events: none; /* let the card itself accept pointer events */
}
.gate-card {
  pointer-events: auto;
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  box-shadow:
    0 20px 40px -12px rgba(0, 0, 0, 0.55),
    0 8px 20px -8px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--brand-line);
}
html[data-theme="light"] .gate-card {
  box-shadow:
    0 24px 44px -12px rgba(15, 23, 42, 0.22),
    0 10px 24px -10px rgba(15, 23, 42, 0.16),
    0 0 0 1px var(--brand-line);
}
.gate-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  background: var(--brand-soft);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
}
.gate-body { flex: 1; min-width: 0; }
.gate-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.gate-sub {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 18px;
}
.gate-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.gate-input {
  flex: 1;
  min-width: 220px;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius);
  color: var(--text-1);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
.gate-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.gate-input::placeholder { color: var(--text-3); }
.gate-fine {
  margin-top: 12px;
  color: var(--text-3);
  font-size: 12px;
}

/* Global hidden override — html5 hidden attr should always win */
[hidden] { display: none !important; }

.results-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.unlocked-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  color: var(--brand);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

/* ---- Content ideas: primary CTA button ---- */
.btn-ideas {
  gap: 8px;
  position: relative;
}
.btn-ideas[disabled] {
  opacity: 0.75;
  cursor: progress;
}
.btn-ideas-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: qf-spin 0.7s linear infinite;
}
[data-theme="light"] .btn-ideas-spinner {
  border-color: rgba(0, 0, 0, 0.2);
  border-top-color: #0a0a0a;
}
@keyframes qf-spin {
  to { transform: rotate(360deg); }
}

/* Status banner shown while ideas job is running */
.ideas-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 10px;
  color: var(--fg-2);
  font-size: 14px;
}
.ideas-status-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--brand-line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: qf-spin 0.7s linear infinite;
  flex-shrink: 0;
}
.ideas-status-text {
  line-height: 1.4;
}

/* ---- Content ideas: expandable toggle chip in table row ---- */
.ideas-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 3px 9px 3px 10px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: 999px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  vertical-align: middle;
  font-family: inherit;
}
.ideas-toggle:hover {
  background: color-mix(in oklab, var(--brand-soft), var(--brand) 12%);
  border-color: var(--brand);
}
.ideas-toggle svg {
  transition: transform 0.2s ease;
}
.ideas-toggle.is-open svg {
  transform: rotate(180deg);
}

/* ---- Per-row "Generate ideas" trigger button ---- */
.row-ideas-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 10px;
  padding: 3px 10px 3px 8px;
  background: transparent;
  border: 1px dashed var(--brand-line);
  border-radius: 999px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, border-style 0.15s;
  vertical-align: middle;
  font-family: inherit;
  white-space: nowrap;
}
.row-ideas-btn:hover {
  background: var(--brand-soft);
  border-color: var(--brand);
  border-style: solid;
}
.row-ideas-btn svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.row-ideas-btn:hover svg {
  opacity: 1;
}

/* ---- Per-row loading state (replaces button while a job is in flight) ---- */
.row-ideas-loading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 3px 10px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}
.row-ideas-spinner {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in oklab, var(--text-2), transparent 65%);
  border-top-color: var(--brand);
  animation: qf-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ---- Content ideas: expanded panel row ---- */
.ideas-panel-row td {
  padding: 0 !important;
  background: color-mix(in oklab, var(--surface-1), var(--brand) 3%);
  border-bottom: 1px solid var(--outline-1);
}
.ideas-panel {
  padding: 14px 22px 22px;
  transition: opacity 0.2s ease;
}
.ideas-panel.is-regenerating .ideas-panel-grid {
  opacity: 0.4;
  pointer-events: none;
}

/* Panel header: label on left, Regenerate button on right */
.ideas-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in oklab, var(--outline-1), transparent 40%);
}
.ideas-panel-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-2);
}

/* Regenerate button */
.ideas-regen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 10px;
  background: transparent;
  border: 1px solid var(--outline-1);
  border-radius: 999px;
  color: var(--fg-1);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.ideas-regen-btn:hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}
.ideas-regen-btn:disabled {
  cursor: wait;
  color: var(--fg-2);
}
.ideas-regen-btn svg {
  flex-shrink: 0;
  transition: transform 0.4s ease;
}
.ideas-regen-btn:hover:not(:disabled) svg {
  transform: rotate(180deg);
}
.ideas-regen-spinner {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in oklab, var(--fg-2), transparent 65%);
  border-top-color: var(--brand);
  animation: qf-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Grid of idea cards */
.ideas-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  transition: opacity 0.2s ease;
}
.idea-card {
  background: var(--surface-2);
  border: 1px solid var(--outline-1);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.idea-card:hover {
  border-color: var(--brand-line);
}
.idea-headline {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--fg-1);
  line-height: 1.35;
  margin-bottom: 6px;
}
.idea-angle {
  font-size: 12.5px;
  color: var(--fg-2);
  line-height: 1.5;
}

/* Small responsive: on narrow screens use single-column ideas panel */
@media (max-width: 640px) {
  .ideas-panel {
    padding: 12px 14px 18px;
  }
  .ideas-panel-grid {
    grid-template-columns: 1fr;
  }
  .ideas-toggle {
    margin-top: 6px;
    margin-left: 0;
  }
  .ideas-panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* ========== How ========== */
.how {
  padding: 80px 24px;
  border-top: 1px solid var(--outline-1);
}
.how-inner {
  max-width: var(--container);
  margin: 0 auto;
}
.how-eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 12px;
}
.how-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin: 0 0 40px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.how-card {
  padding: 28px;
  background: var(--surface-1);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius-lg);
}
.how-num {
  font-size: 12px;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.how-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.how-card-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.6;
  margin: 0;
}

/* ========== Sources ========== */
.sources {
  padding: 20px 24px 80px;
}
.sources-panel {
  max-width: var(--container);
  margin: 0 auto;
  padding: 48px;
  background: var(--surface-1);
  border: 1px solid var(--outline-2);
  border-radius: var(--radius-xl);
}
.sources-copy { max-width: 720px; }
.sources-title {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin: 0 0 16px;
}
.sources-body {
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0 0 14px;
}
.sources-body:last-child { margin-bottom: 0; }

/* ========== Footer ========== */
.footer {
  border-top: 1px solid var(--outline-1);
  padding: 32px 24px;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 14px;
  line-height: 0;
}
.footer-logo .logo-img { height: 22px; }
.footer-tag {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 8px;
}
.footer-legal {
  color: var(--text-3);
  font-size: 12px;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--text-1);
  color: var(--bg);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ========== Responsive ========== */
@media (max-width: 720px) {
  .header-nav { display: none; }
  .hero { padding: 48px 20px 32px; }
  .hero-sub { font-size: 16px; }
  .search-fields {
    flex-direction: column;
    padding: 10px;
  }
  .btn-search { width: 100%; padding: 14px; }
  .results { padding: 32px 16px; }
  .results-table th, .results-table td { padding: 10px 12px; font-size: 13px; }
  .th-signal, .td-signal { display: none; }
  .gate-card {
    flex-direction: column;
    padding: 24px;
    gap: 16px;
  }
  .how-grid { grid-template-columns: 1fr; }
  .how { padding: 56px 20px; }
  .sources-panel { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .th-kd, .td-kd { display: none; }
  .hero-title { font-size: 36px; }
  .results-title { font-size: 22px; }
}

/* ============ BUYER INTENT COLUMN ============ */
.th-buyer { width: 128px; }
.td-buyer { text-align: right; padding-right: 20px !important; }

.buyer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: default;
}
.buyer-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}
.buyer-pill-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.buyer-pill-label {
  font-weight: 500;
  opacity: 0.85;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.buyer-pill-high {
  color: #0f7a2e;
  background: rgba(105, 197, 84, 0.14);
  border-color: rgba(105, 197, 84, 0.35);
}
.buyer-pill-med {
  color: #8a5a00;
  background: rgba(245, 179, 66, 0.14);
  border-color: rgba(245, 179, 66, 0.4);
}
.buyer-pill-low {
  color: #4b5563;
  background: rgba(107, 114, 128, 0.1);
  border-color: rgba(107, 114, 128, 0.25);
}

/* Dark mode variants — brand green/amber/gray at higher luminance */
[data-theme="dark"] .buyer-pill-high,
.dark .buyer-pill-high {
  color: #a3e39b;
  background: rgba(105, 197, 84, 0.16);
  border-color: rgba(105, 197, 84, 0.32);
}
[data-theme="dark"] .buyer-pill-med,
.dark .buyer-pill-med {
  color: #f5c26b;
  background: rgba(245, 179, 66, 0.14);
  border-color: rgba(245, 179, 66, 0.3);
}
[data-theme="dark"] .buyer-pill-low,
.dark .buyer-pill-low {
  color: #b5bdc9;
  background: rgba(180, 190, 210, 0.08);
  border-color: rgba(180, 190, 210, 0.2);
}

/* Header info icon + tooltip */
.th-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: currentColor;
  opacity: 0.55;
  cursor: help;
  margin-left: 2px;
  outline: none;
}
.th-info:hover,
.th-info:focus { opacity: 1; }
.th-info-tip {
  position: absolute;
  bottom: calc(100% + 8px);
  right: -8px;
  width: 260px;
  padding: 10px 12px;
  background: #0c0d0f;
  color: #f4f5f7;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
  z-index: 20;
  pointer-events: none;
  text-align: left;
  white-space: normal;
}
.th-info-tip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 12px;
  border: 6px solid transparent;
  border-top-color: #0c0d0f;
}
.th-info:hover .th-info-tip,
.th-info:focus .th-info-tip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Mobile: hide the buyer column so tables stay readable; the score still
   goes into the CSV export and shows on tablet/desktop. */
@media (max-width: 720px) {
  .th-buyer, .td-buyer { display: none; }
}
