:root {
    --paper: #F3EFE7;
    --paper-2: #FBF9F4;
    --ink: #17150F;
    --muted: #6B665A;
    --line: #D9D2C3;
    --accent: #B4441F;
    --ok: #1F6B45;
    --warn: #B7791F;
    --off: #8A8478;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box
}

html {
    -webkit-text-size-adjust: 100%
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased
}

img {
    display: block;
    max-width: 100%
}

h1,
h2,
h3,
h4,
p {
    margin: 0
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px
}

.wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px
}

/* ---------- Bandeau haut ---------- */
.topbar {
    border-bottom: 1px solid var(--ink)
}

.topbar .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px
}

.brand {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase
}

.status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--off)
}

.status.is-open {
    color: var(--ok)
}

.status.is-open::before {
    background: var(--ok);
    animation: pulse 2s infinite
}

.status.is-soon {
    color: var(--warn)
}

.status.is-soon::before {
    background: var(--warn)
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgb(31 107 69/.5)
    }

    70% {
        box-shadow: 0 0 0 8px rgb(31 107 69/0)
    }

    100% {
        box-shadow: 0 0 0 0 rgb(31 107 69/0)
    }
}

/* ---------- Hero ---------- */
.hero {
    padding: 44px 0 36px
}

.eyebrow {
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px
}

.hero h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(2.3rem, 8vw, 5.4rem);
    line-height: 1.02;
    letter-spacing: -.02em;
    max-width: 14ch
}

.hero .lead {
    margin-top: 20px;
    max-width: 56ch;
    color: var(--muted);
    font-size: 1.05rem
}

.facts {
    display: grid;
    grid-template-columns: 1fr;
    margin-top: 36px;
    border-top: 1px solid var(--ink)
}

.fact {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px
}

.fact dt {
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted)
}

.fact dd {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: right
}

/* ---------- Titre de section ---------- */
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 28px 0 18px;
    border-top: 1px solid var(--ink)
}

.section-head h2 {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 600
}

.section-head span {
    font-size: .85rem;
    color: var(--muted)
}

/* ---------- Candidats (mobile : lignes compactes) ---------- */
.list {
    display: grid;
    gap: 14px;
    padding-bottom: 56px
}

.card {
    display: grid;
    grid-template-columns: 104px 1fr;
    gap: 0 16px;
    background: var(--paper-2);
    border: 1px solid var(--line);
    padding: 12px;
    position: relative;
    transition: border-color .2s, transform .2s
}

.card:hover {
    border-color: var(--ink)
}

.card .media {
    position: relative;
    aspect-ratio: 3/4;
    background: var(--line);
    overflow: hidden
}

.card .media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    transition: transform .5s
}

.card:hover .media img {
    transform: scale(1.04)
}

.card .media .initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 600;
    color: #fff
}

.card .bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px
}

.card .num {
    display: none
}

.card .body {
    display: flex;
    flex-direction: column;
    min-width: 0
}

.card .party {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase
}

.card h3 {
    font-family: var(--serif);
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.15;
    margin-top: 4px
}

.card .slogan {
    margin-top: 8px;
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.4
}

.card .actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line)
}

.link {
    background: none;
    border: 0;
    padding: 6px 0;
    font-weight: 600;
    font-size: .92rem;
    border-bottom: 1px solid var(--ink)
}

.link:hover {
    color: var(--accent);
    border-color: var(--accent)
}

.btn {
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--ink);
    padding: 11px 20px;
    font-weight: 600;
    font-size: .92rem;
    letter-spacing: .02em;
    transition: background .2s, border-color .2s
}

.btn:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent)
}

.btn:disabled {
    background: transparent;
    color: var(--off);
    border-color: var(--line);
    cursor: not-allowed
}

.empty {
    border: 1px solid var(--line);
    background: var(--paper-2);
    padding: 56px 24px;
    text-align: center;
    margin-bottom: 56px
}

.empty h2 {
    font-family: var(--serif);
    font-size: 1.5rem
}

.empty p {
    color: var(--muted);
    margin-top: 6px
}

.foot {
    border-top: 1px solid var(--ink);
    padding: 22px 0 30px;
    font-size: .84rem;
    color: var(--muted)
}

/* ---------- Fiche programme (panneau) ---------- */
dialog.sheet {
    border: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    width: 100%;
    max-width: 100%;
    margin: auto 0 0 0;
    max-height: 92vh;
    border-radius: 14px 14px 0 0;
    overflow: hidden
}

dialog.sheet[open] {
    display: flex;
    flex-direction: column;
    animation: up .28s ease
}

dialog.sheet::backdrop {
    background: rgb(23 21 15/.6);
    backdrop-filter: blur(2px)
}

@keyframes up {
    from {
        transform: translateY(30px);
        opacity: 0
    }

    to {
        transform: none;
        opacity: 1
    }
}

.sheet-head {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--paper-2)
}

.sheet-head .avatar {
    width: 64px;
    height: 80px;
    flex: none;
    overflow: hidden;
    background: var(--line)
}

.sheet-head .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%
}

.sheet-head .avatar .initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1.4rem
}

.sheet-head h3 {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.15
}

.sheet-head .party {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-top: 2px
}

.sheet-head .close {
    margin-left: auto;
    background: none;
    border: 1px solid var(--line);
    padding: 8px 14px;
    font-size: .85rem;
    font-weight: 600
}

.sheet-head .close:hover {
    border-color: var(--ink)
}

.sheet-body {
    padding: 22px 20px 28px;
    overflow-y: auto
}

.sheet-body h4 {
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px
}

.sheet-body section+section {
    margin-top: 26px
}

.sheet-body .bio {
    white-space: pre-line
}

.program h2 {
    font-family: var(--serif);
    font-size: 1.2rem;
    margin: 18px 0 6px
}

.program h3 {
    font-family: var(--serif);
    font-size: 1.05rem;
    margin: 14px 0 4px
}

.program ul {
    list-style: disc;
    padding-left: 1.2rem
}

.program ol {
    list-style: decimal;
    padding-left: 1.2rem
}

.program li {
    margin: 4px 0
}

.program p {
    margin: 8px 0
}

.program a,
.sheet-body .ext {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px
}

/* ---------- Tablette ---------- */
@media (min-width:720px) {
    .wrap {
        padding: 0 32px
    }

    .hero {
        padding: 72px 0 52px
    }

    .facts {
        grid-template-columns: repeat(3, 1fr);
        border-bottom: 1px solid var(--line)
    }

    .fact {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 20px 24px 20px 0;
        border-bottom: 0
    }

    .fact+.fact {
        padding-left: 24px;
        border-left: 1px solid var(--line)
    }

    .fact dd {
        text-align: left;
        font-size: 1.6rem
    }

    .list {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px
    }

    .card {
        display: flex;
        flex-direction: column;
        padding: 0
    }

    .card .media {
        aspect-ratio: 4/5
    }

    .card .num {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
        background: var(--paper);
        padding: 6px 12px 4px;
        font-family: var(--serif);
        font-weight: 600;
        font-size: 1.05rem;
        border-right: 1px solid var(--line);
        border-bottom: 1px solid var(--line)
    }

    .card .media .initials {
        font-size: 4rem
    }

    .card .body {
        padding: 20px 22px 0;
        flex: 1
    }

    .card h3 {
        font-size: 1.65rem
    }

    .card .slogan {
        font-size: 1rem
    }

    .card .actions {
        margin: 20px 22px 0;
        padding: 14px 0 20px
    }

    dialog.sheet {
        margin: auto;
        width: min(720px, calc(100% - 48px));
        max-height: 86vh;
        border-radius: 6px
    }

    .sheet-head {
        padding: 22px 28px
    }

    .sheet-head .avatar {
        width: 76px;
        height: 96px
    }

    .sheet-body {
        padding: 28px
    }
}

/* ---------- Bureau ---------- */
@media (min-width:1040px) {
    .list {
        grid-template-columns: repeat(3, 1fr);
        gap: 28px
    }
}

@media (prefers-reduced-motion:reduce) {
    * {
        animation: none !important;
        transition: none !important
    }
}

/* ---------- Messages ---------- */
.notice {
    margin-top: 24px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-left-width: 4px;
    background: var(--paper-2);
    font-size: .95rem
}

.notice.is-ok {
    border-left-color: var(--ok)
}

.notice.is-err {
    border-left-color: var(--accent)
}

/* ---------- Pastilles d'état ---------- */
.chip {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 9px 0
}

.chip.is-mine {
    color: var(--ok)
}

/* ---------- Formulaire de vote ---------- */
.vote-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden
}

.sheet-head .party {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase
}

.fields {
    display: grid;
    gap: 14px;
    margin: 22px 0
}

.field {
    display: grid;
    gap: 6px;
    font-size: .88rem;
    font-weight: 600
}

.field em {
    font-style: normal;
    font-weight: 400;
    color: var(--muted)
}

.field select {
    font: inherit;
    font-weight: 400;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--paper-2);
    color: var(--ink);
    border-radius: 0
}

.field select:focus {
    border-color: var(--ink)
}

.btn-block {
    width: 100%;
    padding: 14px 20px
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden
}

@media (min-width:720px) {
    .fields {
        grid-template-columns: 1fr 1fr
    }
}

/* ---------- Résultats publics ---------- */
.results {
    padding-bottom: 56px
}

.results .section-head {
    padding-top: 0
}

.results-empty {
    padding: 24px 0;
    color: var(--muted)
}

.bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 22px
}

.bar-meta {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px
}

.bar-rank {
    font-family: var(--serif);
    font-weight: 600;
    color: var(--muted)
}

.bar-name {
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.2;
    min-width: 0
}

.bar-name small {
    display: block;
    margin-top: 2px;
    font-family: var(--sans);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted)
}

.bar-figure {
    text-align: right;
    line-height: 1.2
}

.bar-figure strong {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 600
}

.bar-figure small {
    display: block;
    font-size: .8rem;
    color: var(--muted)
}

.bar-track {
    height: 14px;
    background: var(--line);
    overflow: hidden
}

.bar-fill {
    display: block;
    height: 100%;
    transform-origin: left;
    animation: grow .9s cubic-bezier(.2, .7, .2, 1) both
}

@keyframes grow {
    from {
        transform: scaleX(0)
    }

    to {
        transform: scaleX(1)
    }
}

.results-note {
    margin-top: 26px;
    font-size: .84rem;
    color: var(--muted)
}

@media (min-width:720px) {
    .bar-name {
        font-size: 1.3rem
    }

    .bar-track {
        height: 18px
    }
}