/* ============================================================
   Chartres Élections — Feuille de style
   Palette : bleu républicain · tricolore · sobre
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bitter:wght@400;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  --blue:     #003189;
  --blue-mid: #1a4db8;
  --red:      #ED2939;
  --gold:     #C8A951;
  --dark:     #0d1422;
  --surface:  #f4f4ef;
  --card:     #ffffff;
  --border:   #ddddd5;
  --text:     #1a1a2e;
  --muted:    #6b7280;
  --shadow:   0 2px 16px rgba(0,0,0,.07);
  --r:        8px;
  --font:     'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --serif:    'Bitter', Georgia, serif;
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html  { font-size:16px; scroll-behavior:smooth; }
body  { font-family:var(--font); background:var(--surface); color:var(--text); line-height:1.6; min-height:100vh; display:flex; flex-direction:column; }
a     { color:var(--blue); }

/* ── HEADER ── */
.site-header { background:var(--dark); border-bottom:3px solid var(--red); position:sticky; top:0; z-index:1000; }
.header-inner { max-width:1280px; margin:0 auto; padding:.7rem 1.5rem; display:flex; align-items:center; justify-content:space-between; gap:1rem; }

.logo { display:flex; align-items:center; gap:.6rem; text-decoration:none; color:#fff; font-size:1.1rem; }
.logo strong { color:var(--gold); }
.logo-icon { font-size:1.4rem; }

.main-nav { display:flex; align-items:center; gap:.2rem; }
.nav-link  { color:rgba(255,255,255,.75); text-decoration:none; padding:.4rem .85rem; border-radius:5px; font-size:.9rem; cursor:pointer; user-select:none; transition:all .15s; }
.nav-link:hover, .nav-link.active { background:rgba(255,255,255,.12); color:#fff; }

.nav-dropdown { position:relative; }
.dropdown-menu { position:absolute; top:calc(100% + .4rem); right:0; background:var(--dark); border:1px solid rgba(255,255,255,.1); border-radius:var(--r); min-width:150px; max-height:300px; overflow-y:auto; display:none; flex-direction:column; box-shadow:0 8px 28px rgba(0,0,0,.35); }
.nav-dropdown:hover .dropdown-menu { display:flex; }
.dropdown-menu a { color:rgba(255,255,255,.75); text-decoration:none; padding:.45rem 1rem; font-size:.88rem; transition:background .1s; }
.dropdown-menu a:hover { background:rgba(255,255,255,.08); color:#fff; }

/* ── MAIN ── */
.main-content { flex:1; }

/* ── HERO ── */
.hero { background:linear-gradient(135deg,var(--dark) 0%,#1a2a50 55%,#0a1835 100%); color:#fff; padding:4rem 1.5rem 3rem; position:relative; overflow:hidden; }
.hero::before { content:''; position:absolute; inset:0; background:url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4z' fill='%23ffffff' fill-opacity='.025'/%3E%3C/svg%3E"); }
.hero-inner { max-width:1280px; margin:0 auto; position:relative; }
.hero-title  { font-family:var(--serif); font-size:clamp(2rem,5vw,3.2rem); font-weight:700; line-height:1.2; margin-bottom:.65rem; }
.hero-title em { color:var(--gold); font-style:normal; }
.hero-sub    { color:rgba(255,255,255,.6); font-size:1.1rem; margin-bottom:2.5rem; }
.hero-stats  { display:flex; gap:2.5rem; flex-wrap:wrap; }
.hstat-n { display:block; font-size:2.5rem; font-weight:700; color:var(--gold); line-height:1; }
.hstat-l { font-size:.75rem; text-transform:uppercase; letter-spacing:.08em; color:rgba(255,255,255,.45); }

/* ── SECTIONS ── */
.section         { padding:2.5rem 1.5rem; }
.section--grey   { background:#ebebE6; }
.section-inner   { max-width:1280px; margin:0 auto; }
.section-title   { font-family:var(--serif); font-size:1.5rem; font-weight:700; color:var(--blue); margin-bottom:1.2rem; padding-bottom:.5rem; border-bottom:2px solid var(--blue); }
.block-title     { font-size:1.1rem; font-weight:600; color:var(--blue); margin-bottom:.85rem; }

/* ── CARDS ── */
.card        { background:var(--card); border:1px solid var(--border); border-radius:var(--r); box-shadow:var(--shadow); padding:1.5rem; margin-bottom:1.5rem; }
.card--grow  { flex:1; }
.card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem; }
.card-header h3 { font-size:.95rem; font-weight:600; }

.split-grid { display:grid; grid-template-columns:1fr 1fr; gap:1.5rem; }
@media(max-width:768px){ .split-grid{ grid-template-columns:1fr; } }

/* ── YEAR SELECTOR ── */
.year-selector { display:flex; flex-wrap:wrap; gap:.5rem; }
.year-btn      { padding:.45rem 1.1rem; border-radius:4px; background:var(--card); border:1px solid var(--border); color:var(--text); text-decoration:none; font-weight:500; font-size:.88rem; transition:all .15s; }
.year-btn:hover, .year-btn--active { background:var(--blue); color:#fff; border-color:var(--blue); }

/* ── YEAR NAV BAR ── */
.year-nav-bar   { background:var(--card); border-bottom:1px solid var(--border); padding:.65rem 1.5rem; position:sticky; top:50px; z-index:900; }
.year-nav-inner { max-width:1280px; margin:0 auto; display:flex; align-items:center; gap:.75rem; }
.year-nav-btn   { padding:.3rem .8rem; border-radius:4px; background:var(--blue); color:#fff; text-decoration:none; font-size:.82rem; white-space:nowrap; }
.year-pills     { display:flex; flex-wrap:wrap; gap:.3rem; flex:1; }
.year-pill      { padding:.2rem .65rem; border-radius:20px; background:var(--surface); border:1px solid var(--border); color:var(--text); text-decoration:none; font-size:.78rem; transition:all .1s; }
.year-pill:hover, .year-pill--active { background:var(--blue); color:#fff; font-weight:700; }

/* ── YEAR HERO ── */
.year-hero  { background:var(--dark); padding:1.75rem 1.5rem 0; color:#fff; }
.year-title { max-width:1280px; margin:0 auto; font-family:var(--serif); font-size:3rem; font-weight:700; color:var(--gold); padding-bottom:.65rem; }
.year-tabs  { max-width:1280px; margin:0 auto; display:flex; gap:.2rem; }
.tab-btn    { padding:.45rem 1.2rem; border:none; background:transparent; color:rgba(255,255,255,.55); cursor:pointer; font-family:var(--font); font-size:.88rem; border-bottom:3px solid transparent; transition:all .15s; }
.tab-btn:hover { color:#fff; }
.tab-btn--active { color:#fff; border-bottom-color:var(--gold); font-weight:600; }

/* ── RESULTS LAYOUT ── */
.results-layout { display:grid; grid-template-columns:370px 1fr; gap:1.5rem; align-items:start; padding:1.5rem 0; }
@media(max-width:900px){ .results-layout{ grid-template-columns:1fr; } }

.tour-block          { margin-bottom:2rem; }
.tour-block--second  { padding-top:1.25rem; border-top:2px dashed var(--border); }
.tour-title          { display:flex; align-items:center; gap:.85rem; font-size:.95rem; font-weight:600; color:var(--blue); margin-bottom:.9rem; flex-wrap:wrap; }
.participation-badge { background:var(--blue); color:#fff; font-size:.75rem; padding:.2rem .55rem; border-radius:20px; font-weight:400; }

.stats-row { display:flex; gap:.75rem; flex-wrap:wrap; margin-bottom:.85rem; }
.stat-box  { background:var(--surface); border-radius:6px; padding:.55rem .85rem; text-align:center; min-width:85px; }
.stat-n    { display:block; font-size:1.25rem; font-weight:700; color:var(--blue); }
.stat-l    { font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); }

/* ── RESULTS TABLE ── */
.results-table { width:100%; border-collapse:collapse; font-size:.88rem; }
.results-table th  { background:var(--surface); text-align:left; padding:.55rem .75rem; font-size:.72rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); border-bottom:2px solid var(--border); }
.results-table td  { padding:.55rem .75rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.results-table tr:hover td { background:rgba(0,49,137,.03); }
.results-table .num    { text-align:right; font-variant-numeric:tabular-nums; }
.results-table .center { text-align:center; }
.row--elu td { background:rgba(0,49,137,.04); }

.parti-stripe  { display:inline-block; width:4px; height:30px; border-radius:2px; margin-right:.5rem; vertical-align:middle; }
.liste-nom     { font-weight:500; }
.tete-liste    { color:var(--muted); }
.badge-fusion  { display:inline-block; margin-left:.4rem; padding:.1rem .4rem; background:#f0f0e8; border:1px solid var(--border); border-radius:3px; font-size:.7rem; color:var(--muted); }

.pct-row  { display:flex; align-items:center; gap:.4rem; }
.pct-bar  { height:7px; border-radius:3px; min-width:2px; }

.parti-badge     { display:inline-block; padding:.12rem .4rem; border-radius:4px; color:#fff; font-size:.72rem; font-weight:700; letter-spacing:.03em; }
.parti-badge-sm  { display:inline-block; padding:.08rem .32rem; border-radius:3px; color:#fff; font-size:.68rem; font-weight:700; }
.parti-fullname  { font-size:.78rem; color:var(--muted); margin-left:.35rem; }
.elu-check       { display:inline-block; background:#22c55e; color:#fff; border-radius:50%; width:20px; height:20px; text-align:center; line-height:20px; font-size:.72rem; }

/* ── DEMI-CERCLE ── */
.semicircle-wrap   { display:flex; flex-direction:column; align-items:center; gap:.85rem; }
.semicircle-legend { display:flex; flex-wrap:wrap; gap:.35rem .75rem; justify-content:center; }
.legend-item       { display:flex; align-items:center; gap:.3rem; font-size:.78rem; }
.legend-dot        { width:11px; height:11px; border-radius:50%; flex-shrink:0; }

/* ── CARTE ── */
.leaflet-map { height:440px; border-radius:6px; overflow:hidden; border:1px solid var(--border); }
.map-legend  { display:flex; flex-wrap:wrap; gap:.4rem .9rem; padding:.65rem 0 0; }

/* ── MAIRES ── */
.maires-timeline { display:flex; flex-wrap:wrap; gap:.85rem; }
.maire-card      { background:var(--card); border-radius:var(--r); border:1px solid var(--border); border-left-width:4px; padding:.9rem 1.1rem; min-width:155px; box-shadow:var(--shadow); }
.maire-annee     { font-size:.7rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); }
.maire-nom       { font-size:.95rem; font-weight:700; margin:.15rem 0; }
.maire-parti     { font-size:.78rem; font-weight:600; }

/* ── BLOCS ── */
.blocs-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:1.2rem; }
.bloc-card  { background:var(--card); border:1px solid var(--border); border-radius:var(--r); padding:1.2rem; box-shadow:var(--shadow); display:flex; gap:.75rem; }
.bloc-color { width:10px; border-radius:4px; flex-shrink:0; }
.bloc-body  { flex:1; }
.bloc-label { font-weight:700; font-size:.9rem; margin-bottom:.65rem; }
.bloc-bar-item { display:flex; align-items:center; gap:.5rem; margin-bottom:.3rem; font-size:.78rem; }
.bloc-year     { width:32px; color:var(--muted); flex-shrink:0; }
.bloc-bar-bg   { flex:1; height:6px; background:var(--surface); border-radius:3px; overflow:hidden; }
.bloc-bar-fill { height:100%; border-radius:3px; }
.bloc-pct      { width:38px; text-align:right; color:var(--text); font-weight:600; }

/* ── ÉLUS ── */
.elus-grid        { display:grid; grid-template-columns:repeat(auto-fill,minmax(295px,1fr)); gap:1.5rem; }
.elus-group       { }
.elus-group-title { font-size:.82rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:.6rem; }
.elu-card         { background:var(--card); border:1px solid var(--border); border-left-width:4px; border-radius:6px; padding:.7rem .95rem; margin-bottom:.45rem; }
.elu-name         { font-weight:600; font-size:.92rem; }
.elu-fonction     { font-size:.78rem; color:var(--muted); margin:.1rem 0; }
.elu-parti        { font-size:.76rem; display:flex; align-items:center; gap:.35rem; flex-wrap:wrap; }

.sexe-badge { display:inline-block; padding:.04rem .32rem; border-radius:3px; font-size:.65rem; background:var(--surface); color:var(--muted); margin-left:.3rem; }
.sexe-dot   { display:inline-block; width:7px; height:7px; border-radius:50%; margin-right:.25rem; }
.sexe-h     { background:#3b82f6; }
.sexe-f     { background:#ec4899; }

/* ── ÉLUS TABLE ── */
.page-header  { margin-bottom:1.5rem; }
.page-title   { font-family:var(--serif); font-size:2rem; color:var(--blue); }
.page-sub     { color:var(--muted); margin-top:.2rem; }

.filter-bar   { display:flex; flex-wrap:wrap; align-items:center; gap:.35rem; margin-bottom:1rem; }
.filter-label { font-size:.8rem; color:var(--muted); margin-right:.25rem; }
.filter-btn   { padding:.28rem .65rem; border-radius:20px; background:var(--card); border:1px solid var(--border); color:var(--text); text-decoration:none; font-size:.78rem; transition:all .1s; }
.filter-btn:hover, .filter-btn--active { background:var(--blue); color:#fff; border-color:var(--blue); }

.year-block       { margin-bottom:2.5rem; }
.year-block-title { font-family:var(--serif); font-size:1.6rem; color:var(--blue); margin-bottom:.75rem; padding-bottom:.4rem; border-bottom:2px solid var(--border); display:flex; align-items:center; gap:1rem; }
.year-block-link  { font-size:.82rem; color:var(--blue); text-decoration:none; font-family:var(--font); font-weight:400; }

.elus-section       { margin-bottom:1.25rem; }
.elus-section-title { font-size:.8rem; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); margin-bottom:.45rem; }
.elus-table-wrap    { overflow-x:auto; }
.elus-table         { width:100%; border-collapse:collapse; font-size:.85rem; }
.elus-table th      { background:var(--surface); padding:.48rem .7rem; text-align:left; font-size:.7rem; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); border-bottom:2px solid var(--border); }
.elus-table td      { padding:.5rem .7rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.elus-table tr:hover td { background:rgba(0,49,137,.025); }
.elu-name-cell      { font-weight:500; white-space:nowrap; }
.row--inactif td    { opacity:.55; }

/* ── PARTIS PAGE ── */
.famille-bloc  { margin-bottom:2rem; padding-left:1rem; }
.famille-title { font-family:var(--serif); font-size:1.2rem; font-weight:700; margin-bottom:.65rem; }
.partis-row    { display:flex; flex-wrap:wrap; gap:.5rem; }
.parti-tag     { display:flex; align-items:center; gap:.45rem; background:var(--card); border:1px solid var(--border); border-radius:6px; padding:.45rem .75rem; font-size:.85rem; }
.parti-tag-color { width:12px; height:12px; border-radius:3px; flex-shrink:0; }

.blocs-detail-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:1.2rem; }
.mini-table         { width:100%; border-collapse:collapse; font-size:.83rem; }
.mini-table th      { background:var(--surface); padding:.35rem .5rem; font-size:.7rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); border-bottom:1px solid var(--border); }
.mini-table td      { padding:.35rem .5rem; border-bottom:1px solid var(--border); vertical-align:middle; }
.mini-table .num    { text-align:right; }

/* ── BADGES ── */
.badge        { display:inline-block; padding:.13rem .5rem; border-radius:20px; font-size:.7rem; font-weight:600; }
.badge--green { background:#dcfce7; color:#166534; }
.badge--grey  { background:var(--surface); color:var(--muted); }

/* ── ALERTS ── */
.alert      { padding:.9rem 1.1rem; border-radius:var(--r); margin-bottom:1.2rem; font-size:.88rem; }
.alert-info    { background:#dbeafe; border:1px solid #93c5fd; color:#1e40af; }
.alert-success { background:#dcfce7; border:1px solid #86efac; color:#166534; }

/* ── MISC ── */
.empty-state { padding:2.5rem; text-align:center; color:var(--muted); font-style:italic; }
.btn-sm      { padding:.28rem .75rem; font-size:.8rem; background:var(--blue); color:#fff; border-radius:4px; text-decoration:none; }

/* ── CANTON ── */
.canton-card h4 { font-size:.95rem; color:var(--blue); font-weight:700; margin-bottom:.85rem; }
.canton-card h5 { font-size:.85rem; color:var(--muted); margin-bottom:.5rem; }

/* ── FOOTER ── */
.site-footer  { background:var(--dark); color:rgba(255,255,255,.35); padding:1.4rem; font-size:.8rem; border-top:1px solid rgba(255,255,255,.05); }
.footer-inner { max-width:1280px; margin:0 auto; text-align:center; }
.footer-inner a { color:rgba(255,255,255,.5); }
.footer-sub   { margin-top:.2rem; font-size:.72rem; }

/* ── RESPONSIVE ── */
@media(max-width:600px){
  .header-inner { flex-wrap:wrap; }
  .hero { padding:2rem 1rem 1.5rem; }
  .section { padding:1.5rem 1rem; }
  .results-layout { grid-template-columns:1fr; }
  .year-title { font-size:2rem; }
}

/* ── COMMUNES AGGLO ── */
.communes-agglo-grid { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.75rem; }
.commune-tag { background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:.4rem .75rem; font-size:.82rem; }
.commune-tag strong { display:block; }
.commune-tag span { color:var(--muted); font-size:.75rem; }

/* ── CIRC NOTE ── */
.circ-note { color:var(--muted); font-size:.85rem; margin-bottom:.75rem; font-style:italic; }
.note-liste { color:var(--muted); font-size:.75rem; font-style:italic; }
