/* Election SERP Tracker — News Flashboard-family styling */
:root {
  --purple: #622fdb;
  --purple-dark: #4c21b0;
  --cyan: #00a5eb;
  --series-you: #622fdb;   /* spotlight publisher */
  --series-rivals: #0089c4; /* comparison series (validated pair) */
  --ink: #363636;
  --ink-soft: #6b6b6b;
  --ink-muted: #9a9a9a;
  --line: #e4e4e4;
  --bg: #fafafa;
  --card: #ffffff;
  --good: #1ca757;
  --bad: #e02f55;
  --chip: #f1edfc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

/* ---------- header ---------- */
.hero {
  background: linear-gradient(120deg, var(--purple) 0%, var(--purple-dark) 100%);
  color: #fff;
  padding: 40px 24px 32px;
}
.hero-inner, .wrap { max-width: 1060px; margin: 0 auto; }
.hero .brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.brand-left { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand-left .bolt { font-size: 1.2rem; }
.brand-right { font-size: 0.85rem; opacity: 0.92; display: inline-flex; align-items: center; }
.brand-right a { color: #fff; }
.nd-logo { height: 34px; width: auto; display: block; }
@media (max-width: 640px) { .nd-logo { height: 26px; } }
.hero h1 { font-size: 2rem; line-height: 1.2; margin-bottom: 6px; }
.hero .tagline { font-size: 1.05rem; opacity: 0.92; margin-bottom: 18px; }
.hero .intro { max-width: 760px; font-size: 0.95rem; opacity: 0.88; }

.hero .pilot-note {
  max-width: 760px; margin-top: 14px; font-size: 0.82rem; line-height: 1.5;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px; padding: 10px 14px; opacity: 0.95;
}
.hero .stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 24px; }
.stat { min-width: 130px; }
.stat .num { font-size: 1.7rem; font-weight: 800; line-height: 1.15; }
.stat .lbl { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.85; }

/* ---------- layout ---------- */
main { padding: 28px 24px 48px; }
section.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 22px;
}
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.sec-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--purple); color: #fff; font-weight: 700; font-size: 0.9rem;
  display: inline-flex; align-items: center; justify-content: center;
  align-self: center;
}
.sec-head h2 { font-size: 1.15rem; }
.sec-sub { color: var(--ink-soft); font-size: 0.88rem; margin: 2px 0 16px 40px; max-width: 820px; }
.badge {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: 999px; vertical-align: 2px;
}
.badge.live { background: #e4f7ec; color: var(--good); }
.badge.sample { background: #fdeef1; color: var(--bad); }

/* ---------- controls ---------- */
.controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 18px 40px; }
.controls label { font-size: 0.85rem; color: var(--ink-soft); }
.controls select {
  font: inherit; font-size: 0.9rem; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}

/* ---------- share of voice leaderboard ---------- */
.sov-row { display: grid; grid-template-columns: 26px 190px 1fr 108px; gap: 10px; align-items: center; padding: 7px 0; }
.sov-rank { color: var(--ink-muted); font-weight: 700; font-size: 0.85rem; }
.sov-domain { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sov-domain.spot { color: var(--purple); }
.sov-track { display: block; background: #f1f1f1; border-radius: 4px; height: 18px; position: relative; }
.sov-fill { display: block; height: 100%; border-radius: 4px; background: var(--purple); min-width: 2px; }
.sov-row.is-spot .sov-fill { background: var(--purple); }
.sov-row:not(.is-spot) .sov-fill { background: #b39ce8; }
.sov-val { font-size: 0.85rem; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
.sov-val b { color: var(--ink); }

/* ---------- chart ---------- */
.chart-box { margin-left: 40px; position: relative; }
.chart-box svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 8px; }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.tooltip {
  position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--line);
  border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,0.1); padding: 8px 10px;
  font-size: 0.78rem; display: none; z-index: 5; min-width: 150px;
}
.tooltip .t-time { color: var(--ink-muted); margin-bottom: 3px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .t-row .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.delta { font-size: 0.85rem; margin-top: 8px; color: var(--ink-soft); }
.delta .up { color: var(--good); font-weight: 700; }
.delta .down { color: var(--bad); font-weight: 700; }

/* ---------- horizontal bar lists (ranking types, AIO) ---------- */
.bars { margin-left: 40px; }
.bar-row { display: grid; grid-template-columns: 190px 1fr 64px; gap: 10px; align-items: center; padding: 6px 0; }
.bar-label { font-size: 0.88rem; }
.bar-track { display: block; background: #f1f1f1; border-radius: 4px; height: 14px; }
.bar-fill { display: block; height: 100%; border-radius: 4px; background: var(--purple); min-width: 2px; }
.bar-fill.aio { background: var(--series-rivals); }
.bar-val { font-size: 0.83rem; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- live rankings ---------- */
.rank-grid { margin-left: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rank-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fff; }
.rank-card .rt {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--purple); background: var(--chip); border-radius: 999px; padding: 2px 8px; margin-bottom: 8px;
}
.rank-card h3 { font-size: 0.92rem; line-height: 1.35; margin-bottom: 8px; }
.rank-card h3 a { color: var(--ink); text-decoration: none; }
.rank-card h3 a:hover { color: var(--purple); }
.rank-card .meta { font-size: 0.78rem; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rank-card .kw { color: var(--purple); font-weight: 600; }

/* ---------- keyword chips ---------- */
.chips { margin-left: 40px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--chip); color: var(--purple-dark); font-size: 0.85rem; padding: 5px 12px; border-radius: 999px; }

.note { margin: 14px 0 0 40px; font-size: 0.8rem; color: var(--ink-muted); }
.empty { margin-left: 40px; color: var(--ink-muted); font-size: 0.9rem; padding: 10px 0; }

/* ---------- ND-mode extras ---------- */
.delta-inline { font-size: 0.78rem; font-weight: 600; }
.delta-inline.up { color: var(--good); }
.delta-inline.down { color: var(--bad); }
.aio-headline { font-size: 1.02rem; margin-bottom: 14px; }
.aio-headline b { color: var(--purple); font-size: 1.25rem; }
.aio-caveat { font-size: 0.82rem; color: var(--ink-muted); margin: -8px 0 14px; }
.aio-chips { margin-left: 0; }
.chip-aio { background: #e7f4fb; color: #045f87; }
.chip-aio b { font-weight: 700; }
.chip-dim { background: #f3f3f3; color: var(--ink-muted); }
.kw-head {
  grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px;
}
.kw-head .kw { color: var(--purple); font-weight: 700; font-size: 0.95rem; }
.kw-head .kw-meta { font-size: 0.75rem; color: var(--ink-muted); }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding: 26px 24px 40px; text-align: center; color: var(--ink-soft); font-size: 0.85rem; background: #fff; }
footer a { color: var(--purple); font-weight: 600; }
footer .cta {
  display: inline-block; margin-bottom: 12px; background: var(--purple); color: #fff;
  padding: 10px 22px; border-radius: 8px; text-decoration: none; font-weight: 700;
}
footer .cta:hover { background: var(--purple-dark); }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .sov-row { grid-template-columns: 22px 110px 1fr 96px; }
  .bar-row { grid-template-columns: 120px 1fr 56px; }
  .sec-sub, .chart-box, .bars, .rank-grid, .chips, .controls, .note, .empty { margin-left: 0; }
}
