:root {
  --ink: #1c2430;
  --muted: #5a6575;
  --line: #d7dde6;
  --paper: #f5f7fa;
  --card: #ffffff;
  --navy: #143a5a;
  --navy-deep: #0d2a42;
  --accent: #c45c26;
  --pour: #1f7a4c;
  --contre: #b42318;
  --abstention: #8a6d1f;
  --nonvotant: #6b7280;
  --shadow: 0 10px 30px rgba(20, 40, 70, 0.08);
  --radius: 14px;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9e6f4 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #f0e6dc 0%, transparent 50%),
    var(--paper);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

.wrap {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin-bottom: 2rem;
  animation: rise .6s ease both;
}
.brand-kicker {
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.02em;
  color: var(--navy-deep);
  line-height: 1.1;
}
.brand p {
  margin: .4rem 0 0;
  color: var(--muted);
  max-width: 40rem;
}

.search-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  animation: rise .7s ease both .05s;
}
.search-panel form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .75rem;
}
.search-panel input[type="search"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .95rem 1rem;
  font: inherit;
  font-size: 1.05rem;
  background: #fbfcfe;
  color: var(--ink);
}
.search-panel input:focus {
  outline: 2px solid color-mix(in srgb, var(--navy) 35%, white);
  border-color: var(--navy);
}
button, .btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: .95rem 1.25rem;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
button:hover, .btn:hover { background: var(--navy-deep); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #eef3f8; color: var(--navy-deep); }

.hint {
  margin: .85rem 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  margin: 1.5rem 0 0;
  color: var(--muted);
  font-size: .92rem;
  animation: rise .7s ease both .1s;
}
.stats strong { color: var(--ink); font-weight: 700; }

.results {
  margin-top: 1.75rem;
  display: grid;
  gap: .75rem;
  animation: rise .6s ease both;
}
.card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 1rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 14px rgba(20,40,70,.04);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.card:hover {
  border-color: color-mix(in srgb, var(--navy) 35%, var(--line));
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}
.card img, .avatar {
  width: 64px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: #e8eef5;
}
.avatar {
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}
.card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
}
.meta { color: var(--muted); font-size: .92rem; margin-top: .15rem; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .7rem;
  font-size: .85rem;
  color: var(--muted);
  white-space: nowrap;
}

.profile {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
  animation: rise .55s ease both;
}
.profile img {
  width: 110px;
  height: 138px;
  object-fit: cover;
  border-radius: 12px;
  background: #e8eef5;
  box-shadow: var(--shadow);
}
.profile h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  color: var(--navy-deep);
  line-height: 1.15;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0 1.25rem;
}
.filters a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-size: .9rem;
  font-weight: 600;
}
.filters a.active, .filters a:hover {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.summary .box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem 1rem;
}
.summary .n {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}
.summary .l { color: var(--muted); font-size: .85rem; margin-top: .35rem; }
.box.pour .n { color: var(--pour); }
.box.contre .n { color: var(--contre); }
.box.abstention .n { color: var(--abstention); }
.box.non-votant .n { color: var(--nonvotant); }

.votes {
  display: grid;
  gap: .7rem;
}
.vote {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  display: grid;
  gap: .55rem;
}
.vote-top {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .85rem;
  align-items: center;
  justify-content: space-between;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .28rem .7rem;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.badge.pour { background: #e7f6ee; color: var(--pour); }
.badge.contre { background: #fdecec; color: var(--contre); }
.badge.abstention { background: #f8f1d8; color: var(--abstention); }
.badge.non-votant { background: #eef0f3; color: var(--nonvotant); }
.vote h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.35;
}
.vote-meta {
  color: var(--muted);
  font-size: .9rem;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
}
.empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.5);
}
.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}
.foot {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}
.nav-back { display: inline-block; margin-bottom: 1.25rem; font-weight: 600; text-decoration: none; }
.amd-box {
  background: #f3f6fa;
  border-left: 3px solid var(--navy);
  border-radius: 0 10px 10px 0;
  padding: .75rem .9rem;
  display: grid;
  gap: .45rem;
}
.amd-expose, .amd-dispositif {
  margin: 0;
  font-size: .92rem;
  color: #2a3442;
  line-height: 1.45;
}
.amd-dispositif { color: #3a4452; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .search-panel form { grid-template-columns: 1fr; }
  .card { grid-template-columns: 52px 1fr; }
  .card .pill { display: none; }
  .profile { grid-template-columns: 84px 1fr; }
  .profile img { width: 84px; height: 105px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
