/* ===== Tokens ===== */
:root {
  --bg: #f7f5ff;
  --surface: #ffffff;
  --surface-2: #f1eefc;
  --text: #1a1633;
  --muted: #625d7d;
  --border: #e4e0f5;
  --brand-1: #6d28d9;
  --brand-2: #db2777;
  --brand-3: #f59e0b;
  --gradient: linear-gradient(120deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  --shadow: 0 10px 30px -12px rgba(76, 29, 149, .25);
  --radius: 18px;
  --warn-bg: #fff7e0;
  --warn-text: #7a4b00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0c1f;
    --surface: #1a1630;
    --surface-2: #231e3f;
    --text: #f1eeff;
    --muted: #a9a3c9;
    --border: #2f2850;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
    --warn-bg: #3a2c05;
    --warn-text: #ffd97a;
  }
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
a { color: var(--brand-1); }
@media (prefers-color-scheme: dark) { a { color: #c4b5fd; } }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.grad-text { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 1.25rem; text-decoration: none; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-badge { background: var(--gradient); color: #fff; border-radius: 10px; padding: 2px 8px; font-size: .9rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: .95rem;
  padding: 8px 12px; border-radius: 999px; transition: background .2s, color .2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--gradient); color: #fff; }

/* ===== Demo banner ===== */
.demo-banner { background: var(--warn-bg); color: var(--warn-text); font-size: .9rem; padding: 8px 0; text-align: center; }

/* ===== Hero ===== */
.hero {
  position: relative; overflow: hidden;
  background: var(--gradient); color: #fff;
  border-radius: 28px; margin: 24px 0; padding: 48px 32px;
  box-shadow: var(--shadow);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(10px); opacity: .35; background: #fff;
}
.hero::before { width: 280px; height: 280px; right: -60px; top: -80px; }
.hero::after { width: 180px; height: 180px; right: 180px; bottom: -90px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin: 0 0 12px; position: relative; }
.hero p { font-size: 1.1rem; max-width: 560px; margin: 0; opacity: .95; position: relative; }
.countdown { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; position: relative; }
.countdown .unit {
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35);
  border-radius: 16px; padding: 12px 16px; min-width: 84px; text-align: center; backdrop-filter: blur(6px);
}
.countdown .num { font-size: 2rem; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.countdown .lbl { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.countdown-note { font-size: .85rem; margin-top: 10px; opacity: .85; position: relative; }

/* ===== Sections ===== */
.section { margin: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-size: 1.6rem; }
.section-head a { font-weight: 700; text-decoration: none; }
.page-title { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 32px 0 8px; }
.page-intro { color: var(--muted); max-width: 680px; margin: 0 0 24px; }

/* ===== Cards ===== */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
}
a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover { transform: translateY(-4px); }

.cand-card { position: relative; overflow: hidden; }
.cand-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--c); }
.avatar {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem; color: #fff; background: var(--c);
  box-shadow: 0 8px 20px -8px var(--c);
}
.avatar { overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; }
.photo-credit { font-size: .78rem; color: var(--muted); margin: -12px 0 24px; }
.photo-credit a { color: var(--muted); }
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; border-radius: 24px; }
.cand-card h3 { margin: 14px 0 2px; font-size: 1.2rem; }
.cand-card .parti { color: var(--muted); font-size: .95rem; }

.badge {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.badge.declare { background: #dcfce7; color: #166534; }
.badge.pressenti { background: #fef3c7; color: #92400e; }
.badge.retire { background: #fee2e2; color: #991b1b; }
.badge.exemple { background: var(--warn-bg); color: var(--warn-text); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* ===== Declarations ===== */
.decl { border-left: 5px solid var(--c); display: flex; flex-direction: column; gap: 10px; }
.decl-top { display: flex; align-items: center; gap: 10px; }
.decl-top .avatar { width: 40px; height: 40px; font-size: .9rem; border-radius: 12px; }
.decl-who { font-weight: 700; text-decoration: none; color: var(--text); }
.decl-meta { font-size: .85rem; color: var(--muted); }
.decl blockquote { margin: 0; font-size: 1.05rem; font-weight: 500; }
.decl blockquote::before { content: "« "; color: var(--c); font-weight: 800; }
.decl blockquote::after { content: " »"; color: var(--c); font-weight: 800; }
.decl-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; }
.source-link { font-weight: 600; }
.list { display: grid; gap: 14px; }

/* ===== Filters ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: all .2s;
}
.chip:hover { border-color: var(--brand-1); }
.chip.on { background: var(--gradient); color: #fff; border-color: transparent; }
select.chip { appearance: auto; }

/* ===== Candidate page ===== */
.profile { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin: 32px 0 8px; }
.profile h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); }

/* ===== Comparator ===== */
.theme-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 16px; }
.theme-tabs .chip { white-space: nowrap; }
.pos-card { border-top: 6px solid var(--c); }
.pos-card .who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pos-card .who .avatar { width: 40px; height: 40px; font-size: .9rem; border-radius: 12px; }
.pos-empty { color: var(--muted); font-style: italic; }

.badge.primaire { background: #e0e7ff; color: #3730a3; }

/* ===== Programmes ===== */
.synth-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-bottom: 32px; }
.synth { position: relative; overflow: hidden; }
.synth::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--gradient); }
.synth h3 { margin: 0 0 8px; font-size: 1.05rem; }
.synth p { margin: 0; color: var(--muted); font-size: .95rem; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface); }
.prog { border-collapse: collapse; width: 100%; min-width: 960px; font-size: .9rem; }
.prog th, .prog td { padding: 14px; vertical-align: top; text-align: left; border-bottom: 1px solid var(--border); }
.prog thead th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; position: sticky; top: 0; }
.prog tbody th { position: sticky; left: 0; background: var(--surface); border-left: 5px solid var(--c); min-width: 190px; z-index: 1; }
.prog tbody tr:hover td { background: color-mix(in srgb, var(--c) 6%, transparent); }
.prog ul { margin: 0; padding-left: 18px; }
.prog li { margin-bottom: 6px; }
.prog .src { font-size: .78rem; font-weight: 600; white-space: nowrap; }
.prog-cand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.prog-cand .avatar { width: 38px; height: 38px; font-size: .85rem; border-radius: 11px; flex: none; }
.prog-cand small { display: block; color: var(--muted); font-weight: 500; }
.legend { color: var(--muted); font-size: .85rem; margin-top: 12px; }

/* ===== Quiz ===== */
.quiz { max-width: 760px; padding: 28px; }
.quiz-top { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); font-size: .9rem; }
.quiz-bar { height: 6px; background: var(--surface-2); border-radius: 99px; margin: 10px 0 24px; overflow: hidden; }
.quiz-bar span { display: block; height: 100%; background: var(--gradient); transition: width .3s; }
.quiz-quote { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 700; line-height: 1.35; margin: 0; }
.quiz-quote::before { content: "« "; color: var(--brand-2); }
.quiz-quote::after { content: " »"; color: var(--brand-2); }
.quiz-when { margin: 8px 0 20px; }
.quiz-choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.quiz-choice {
  display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; font-weight: 700; color: var(--text);
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; padding: 10px 14px; cursor: pointer; transition: border-color .2s, transform .15s;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--c); transform: translateY(-2px); }
.quiz-choice .avatar { width: 44px; height: 44px; font-size: .9rem; border-radius: 12px; }
.quiz-choice:disabled { cursor: default; opacity: .55; }
.quiz-choice.good { border-color: #16a34a; background: color-mix(in srgb, #16a34a 12%, var(--surface)); opacity: 1; }
.quiz-choice.bad { border-color: #dc2626; background: color-mix(in srgb, #dc2626 12%, var(--surface)); opacity: 1; }
.quiz-answer { margin-top: 18px; box-shadow: none; display: grid; gap: 6px; }
.quiz-answer.ok { border-left: 5px solid #16a34a; }
.quiz-answer.ko { border-left: 5px solid #dc2626; }
.quiz-answer p { margin: 0; }
.btn {
  display: inline-block; margin-top: 10px; border: 0; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 700;
  background: var(--gradient); color: #fff; cursor: pointer; text-decoration: none;
}
.btn-ghost { background: var(--surface-2); color: var(--text); }
.quiz-end { text-align: center; }
.quiz-score { font-size: 4.5rem; font-weight: 800; line-height: 1; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.quiz-score small { font-size: 2rem; }
.quiz-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.quiz-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.quiz-cta h2 { margin: 0 0 4px; font-size: 1.3rem; }
.quiz-cta p { margin: 0; color: var(--muted); }

/* ===== Quiz des partis ===== */
.qp-question { font-size: clamp(1.2rem, 3vw, 1.5rem); margin: 4px 0 18px; }
.qp-options { display: grid; gap: 10px; }
.qp-option {
  text-align: left; font: inherit; font-weight: 600; color: var(--text); background: var(--surface);
  border: 2px solid var(--border); border-radius: 14px; padding: 14px 16px; cursor: pointer; transition: border-color .2s, transform .15s;
}
.qp-option:hover { border-color: var(--brand-1); transform: translateY(-2px); }
.qp-skip { color: var(--muted); font-weight: 500; border-style: dashed; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; color: var(--brand-1); cursor: pointer; }
.qp-winner { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 20px; text-align: left; margin: 8px 0 16px; }
.qp-winner .quiz-score { font-size: 3.5rem; }
.qp-winner h2 { margin: 4px 0 0; }
.qp-winner p { margin: 0; color: var(--muted); }
.qp-bars { display: grid; gap: 8px; margin-bottom: 20px; }
.qp-bar { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 8px; border-radius: 12px; }
.qp-bar:hover { background: var(--surface-2); }
.qp-bar .avatar { width: 40px; height: 40px; font-size: .85rem; border-radius: 12px; }
.qp-bar-body { flex: 1; min-width: 0; }
.qp-bar-label { font-size: .9rem; margin-bottom: 4px; }
.qp-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.qp-track span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.qp-pct { min-width: 3.2em; text-align: right; white-space: nowrap; }
.qp-donut { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; margin: 12px 0 28px; }
.qp-donut svg { width: 200px; height: 200px; flex: none; }
.qp-seg { transition: stroke-width .15s; cursor: default; }
.qp-seg:hover { stroke-width: 40; }
.qp-donut-big { font-size: 34px; font-weight: 800; fill: var(--text); }
.qp-donut-small { font-size: 11px; fill: var(--muted); }
.qp-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; flex: 1; min-width: 220px; }
.qp-legend li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.qp-swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.qp-legend-pct { margin-left: auto; white-space: nowrap; }
@media (max-width: 600px) { .qp-donut { justify-content: center; } }
.qp-warning { background: var(--warn-bg); color: var(--warn-text); border-radius: 14px; padding: 14px 16px; margin: 20px 0; font-size: .92rem; }
.qp-warning a { color: inherit; }
.qp-disclaimer { background: var(--warn-bg); color: var(--warn-text); border-radius: 14px; padding: 12px 16px; margin: 0 0 20px; font-size: .92rem; max-width: 760px; }
.qp-details { margin-top: 12px; font-size: .9rem; }
.qp-details summary { cursor: pointer; font-weight: 700; }
.qp-src { margin-top: 12px; }
.qp-src ul { margin: 4px 0; padding-left: 18px; color: var(--muted); }

/* ===== Fiche candidat (pages statiques) ===== */
.pos-list { margin: 0; padding-left: 18px; }
.pos-list li { margin-bottom: 10px; }
.fiche-nav { font-size: .9rem; margin-top: 24px; }
.fiche-nav a { color: var(--muted); }
.autres { display: flex; flex-wrap: wrap; gap: 8px; }
.autres a { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px 4px 4px; font-weight: 600; font-size: .9rem; }
.autres .avatar { width: 28px; height: 28px; font-size: .7rem; border-radius: 50%; }

/* ===== Timeline ===== */
.timeline { position: relative; margin: 24px 0; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 4px; border-radius: 4px; background: var(--gradient); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before {
  content: ""; position: absolute; left: -27px; top: 22px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--brand-2);
}
.tl-item.past { opacity: .6; }
.tl-date { font-weight: 800; color: var(--brand-2); }

/* ===== Footer ===== */
.site-footer { margin-top: 64px; border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

.empty { color: var(--muted); padding: 24px; text-align: center; }
.prose { max-width: 720px; }
.prose h2 { margin-top: 32px; }

@media (max-width: 600px) {
  .hero { padding: 32px 20px; border-radius: 22px; }
  .countdown { gap: 8px; }
  .countdown .unit { min-width: 0; flex: 1; padding: 10px 4px; }
  .countdown .lbl { font-size: .65rem; }
  .countdown .num { font-size: 1.5rem; }
  .nav a { padding: 6px 10px; font-size: .9rem; }
}
