/* ========== Variables ========== */
:root {
    --bg: #04192f;
    --ink: #eef2f6;
    --muted: #00c6ba;
    --mutedlight: #00c6ba30;
    --card-bg: #151822;
    --card-br: #2a2f3a;
    --card-hover: #1e2230;
    --accent: #fff7d6;
    --link: #3a7bd5;

    /* Couleurs par parti */
    --ps: #d94141;
    --mr: #3a7bd5;
    --ecolo: #2e8b57;
    --cdh: #f39c12;
    --engages: #f39c12;
    --cdnv: #f39c12;
    --cvp: #f39c12;
    --vooruit: #d94141;
    --spa: #d94141;
    --nva: #ebd513;
    --openvld: #3a7bd5;
    --autres: #7f8c8d;

    /* Tokens */
    --token-neutral: var(--ink);
    --token-brd: #d1d5db;
    --token-ink: #111;
    --token-ink-on-color: #fff;

    --maxw: 1100px;
    --gutter: clamp(16px, 3vw, 28px);
    --token-radius: 10px;
    --token-w: clamp(160px, 22vw, 260px);
}

/* ========== Base ========== */
* {
    box-sizing: border-box;
}
html, body {
    height: 100%;
    margin: 0;
    font-family:
        Poppins,
        system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Ubuntu,
        Arial,
        sans-serif;
}
body {
    background-color: var(--bg);
    color: var(--ink);
    font:
        Poppins,
        400 16px/1.5 system-ui,
        -apple-system,
        Segoe UI,
        Roboto,
        Ubuntu,
        Arial,
        sans-serif;
}
a {
    color: var(--muted);
}
hr {
    border-top: 1px solid var(--muted);
    border-bottom: 0;
    width: 50%;
}
.party-tag {
    padding: 0px 3px;
    margin-right: 5px;
    color: white;
    display: inline-block;
    width: max-content;
    margin-bottom: 0.2em;
}
.text img {
    display: block;
    margin: 1em auto 0;
    max-width: 100%;
}
.author i {
    max-width: 32ch;
    display: block;
    margin: 0 auto;
    font-size: 0.75em;
}

/* Sticky Navigation */
.sticky-nav {
    position: fixed;
    top: 0;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background-color: whitesmoke;
    max-height: 50px;
    width: 100%;
}

.nav-links {
    display: flex;
    justify-content: start;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links a {
    text-decoration: none;
    margin: 0 20px;
}
.share-links li {
    margin: 0 20px;
}

.share-links {
    display: flex;
    justify-content: start;
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    left: 50%;
    transform: translate(-50%);
    pointer-events: all;
    bottom: 8dvh;
}

.share-links a {
    color: var(--muted);
    font-weight: bold;
    font-size: 1.2rem;
    transition: color var(--transition-speed);
    text-decoration: none;
    width: 45px;
    height: 45px;
    display: block;
}

.share-links svg {
    fill: var(--muted);
    background: white;
    padding: 7px;
    border-radius: 25px;
}

.logo {
    height: 25px;
}

.logo img:hover {
    background: none;
    filter: drop-shadow(0 0 5px var(--muted));
}

/* ========== Cloud (fixe) ========== */
#cloud-stage {
    position: fixed;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    pointer-events: auto;
    top: 1vh;
}
#tokens {
    position: relative;
    width: min(1200px, 90vw);
    height: min(50vh, 600px);
}
.token {
    position: absolute;
    transform: translate3d(0, 0, 0);
    background: var(--token-neutral);
    border: 0;
    width: var(--token-w);
    max-width: 20ch;
    height: 3em;
    font-weight: 400;
    font-size: clamp(12px, 1.5vw, 18px);
    text-align: center;
    overflow-wrap: anywhere;
    line-height: 1.2;
    cursor: pointer;
    user-select: none;
    color: var(--token-ink);
    will-change:
        transform,
        background-color,
        border-color,
        color,
        filter,
        opacity;
    opacity: 0.95;
    font-family: Poppins, sans-serif;
    border-radius: 3px;
    box-shadow: 0 0 6px rgb(0 0 0 / 0.3);
}
.token:hover {
    background: white;
    opacity: 1;
    z-index: 9;
    box-shadow: 0 0 6px rgb(0 0 0 / 0.9);
}
.token:focus-visible {
    outline: 2px solid var(--link);
}

/* Timeline */
#timeline {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

#timeline .rule {
    position: absolute;
    width: 2px;
    height: 500px;
    background: linear-gradient(to bottom, transparent, #4a5568, transparent);
}
#timeline .labels {
    position: absolute;
    list-style: none;
    margin: 0;
    padding: 0;
    font-weight: 700;
    color: #cbd5e1;
    pointer-events: none;
}
#timeline .labels li {
    position: absolute;
    transform: translateY(-50%);
    font-weight: 700;
    color: #cbd5e1;
}

#timeline .counts {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    pointer-events: none;
}
#timeline .counts .count {
    position: absolute;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--accent);
    font-size: 1.55rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.rule::before {
    content: "Décennie";
    position: absolute;
    top: -3em;
    left: -5em;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* ========== Hero ========== */
.hero {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
    background-image: url(desktop.jpg);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: bottom;
}

.author {
    text-align: center;
    padding: 5px 15px;
    max-width: fit-content;
    z-index: 99;
    position: relative;
    width: min(800px, 90vw);
    margin: 2.5em auto 0;
    background: rgb(14 15 18 / 0.95);
    border: 1px solid var(--muted);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
    pointer-events: none;
}
.hero .wrap {
    max-width: var(--maxw);
    padding: 25px var(--gutter) 50vh;
    position: relative;
}
.hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(35px, 8vw, 90px);
    font-weight: 900;
    line-height: 1.25em;
}
.hero h1 span {
    color: var(--muted);
}
.hero .kicker {
    margin: 0 0 30vh;
    font-size: clamp(20px, 2.2vw, 28px);
    color: var(--accent);
    top: -10px;
    position: relative;
}
.kicker i {
    font-size: 0.5em;
    line-height: 1em;
    display: block;
}
.hero .hint {
    position: absolute;
    bottom: 8vh;
    inset-inline: 0;
    width: max-content;
    margin-inline: auto;
    font-size: 0.9rem;
    background: var(--muted);
    padding: 10px 20px;
    border-radius: 50px;
    color: white;
    animation: downup 1.1s ease-in-out infinite;
    text-align: center;
    z-index: 5;
}

@keyframes downup {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(15px);
    }
}

.laugh1 {
    animation: laugh1 0.75s ease-in-out infinite;
    display: inline-block;
}
.laugh2 {
    animation: laugh2 0.75s ease-in-out infinite 0.35s;
    display: inline-block;
}
.laugh3 {
    animation: laugh3 0.75s ease-in-out infinite;
    display: inline-block;
}

@keyframes laugh1 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5) rotate(-10deg);
    }
}

@keyframes laugh2 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5);
    }
}

@keyframes laugh3 {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.5) rotate(10deg);
    }
}
/* ========== Chapters ========== */
#chapters {
    position: relative;
    z-index: 3;
    pointer-events: none;
}
.chapter {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: end center;
    pointer-events: none;
}
.chapter .text {
    width: min(800px, 90vw);
    margin: 0 auto;
    background: rgb(14 15 18 / 0.95);
    border: 1px solid var(--autres);
    border-radius: 18px;
    padding: clamp(16px, 3vw, 28px);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
    pointer-events: none;
    font-size: 1.2em;
}
.chapter .text :is(a, button, input, select, textarea, [role="button"]) {
    pointer-events: auto;
}
.chapter .text h2 {
    font-size: clamp(24px, 3.2vw, 36px);
    margin: 0.2rem 0;
}
.chapter .text p {
    margin: 0.2rem 0;
}
.outro {
    align-items: center;
}
.outro li {
	margin-bottom: 1.5em;
}
.chapter.outro.end::after {
    content: "Le Vif - Septembre 2025";
    border-top: 1px solid var(--muted);
    width: 60%;
    text-align: center;
    padding-top: 1em;
    position: absolute;
    bottom: 2dvh;
}

.end p {
    position: absolute;
    top: 10dvh;
    left: 50%;
    transform: translate(-50%);
    background: var(--muted);
    color: black;
    padding: 0.5em 1em;
    border-radius: var(--token-radius);
    width: max-content;
}

.big {
    font-size: 1.3em;
    font-weight: 700;
    text-align: center;
}

.number {
    display: block;
    text-align: center;
    background: var(--accent);
    color: black;
    width: min-content;
    margin: 0 auto 0.5em;
    padding: 0 1em;
    border-radius: 50px;
}

.laughter .syll,
.laughter .pun {
    display: inline-block;
    transform-origin: 50% 60%;
}

span.ps {
    background: var(--ps);
    padding: 0px 5px;
}

span.mr {
    background: var(--mr);
    padding: 0px 5px;
}

/* ========== Modale ========== */
dialog#modal {
    border: none;
    border-radius: 20px;
    padding: 15px;
    background: white;
    color: black;
    width: min(640px, 92vw);
    box-shadow: 0 20px 60px rgb(0 0 0 / 0.6);
}
.modal-image img {
    max-width: 160px;
    float: left;
    margin-right: 10px;
}
.consequences {
    background: var(--mutedlight);
    padding: 1em;
    border-radius: 15px;
    margin: 1em 0 0;
}

#modal::backdrop {
    background: rgb(0 0 0 / 0.85);
}
#modal .close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    color: #717171;
    font-size: 28px;
    cursor: pointer;
}
.modal-image {
    float: left;
    margin: 0 5px 10px 0;
}
#modal h3 {
    margin: 0.2rem 0 0.4rem;
    font-size: 1.35rem;
}
#modal .meta {
    margin: 0.2rem 0 0.8rem;
    color: #717171;
    font-size: 0.95rem;
}
#modal .summary {
    margin: 0;
    clear: both;
}

@media screen and (max-width: 500px) {
    :root {
        --token-w: clamp(
            70px,
            18vw,
            90px
        ); /* Légèrement plus large pour lisibilité */
        --token-radius: 6px;
    }

    .hero {
        background-image: url(mobile.jpg);
    }
    .hero .wrap {
        padding: 60px var(--gutter) 50vh;
    }

    #cloud-stage {
        width: 100%; /* jamais plus large que l’écran */
        max-width: 100vw; /* force la limite */
        overflow: hidden; /* coupe ce qui dépasse à droite/gauche */
    }
    #tokens {
        position: relative;
        width: 100%;
        max-width: 100%;
    }

    /* Tokens plus petits mais lisibles */
    .token {
        font-size: clamp(0.6rem, 2.1vw, 0.75rem); /* Taille responsive */
        padding: 2px 3px; /* Plus de padding que 1px */
        line-height: 1;
        max-height: 4em; /* Hauteur maximum */

        /* Gestion du texte qui déborde */
        text-overflow: ellipsis;
        overflow: hidden;
        word-wrap: break-word; /* Permet la coupure de mots */
        word-break: break-word; /* Force la coupure si nécessaire */
        hyphens: auto; /* Césures automatiques */

        display: flex;
        align-items: center;
        justify-content: center;
    }

    .chapter .text {
        font-size: 0.85em;
        width: 95vw;
        padding: 4px 7px;
    }

    #timeline .labels {
        font-size: 0.85rem;
    }

    #timeline .counts .count {
        display: none;
    }

    .hero .hint {
        font-size: 0.8rem;
        padding: 8px 16px;
    }
    dialog#modal {
        padding: 0.7rem;
    }
    #modal .summary {
        margin: 0;
        font-size: 0.9em;
        line-height: 1.25em;
    }
    #modal .consequences {
        margin: 1em 0 0;
        font-size: 0.9em;
        line-height: 1.25em;
    }
    #modal h3 {
        margin: 0.2rem 0 0.4rem;
        font-size: 1.1rem;
    }
    #modal .meta {
        margin: 0.2rem 0 0.8rem;
        font-size: 0.75rem;
    }
    #modal img {
        max-width: 100px;
        margin-right: 5px;
    }
}
