/* modernize.css – non destructif (scopé) */
:root {
    --bg: #ffffff;
    --fg: #111827;
    --muted: #6b7280;
    --card: #f9fafb;
    --accent: #2563eb;
    --accent-fg: #ffffff;
    --ring: rgba(37, 99, 235, .35);
    --radius: 14px;
    --shadow: 0 6px 20px rgba(0, 0, 0, .08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0f17;
        --fg: #e5e7eb;
        --muted: #9ca3af;
        --card: #111827;
        --accent: #60a5fa;
        --accent-fg: #0b0f17;
        --ring: rgba(96, 165, 250, .35);
        --shadow: 0 8px 24px rgba(0, 0, 0, .45);
    }
}

/* Tout est sous .modern pour ne pas perturber l’existant */
body.modern {
    color: var(--fg);
    background: var(--bg);
    font: 400 clamp(15px, 1.25vw + 0.5rem, 18px)/1.6 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    margin: 0;
}

body.modern :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--ring);
}

/* Conteneur max width sans casser tes largeurs existantes */
body.modern .container,
body.modern main,
body.modern #content {
    max-width: 1100px;
    margin-inline: auto;
    padding-inline: clamp(12px, 3vw, 24px);
}

/* Titres + rythme vertical safe via :where (faible spécificité) */
body.modern :where(h1, h2, h3) {
    line-height: 1.2;
    margin: 0.6em 0 0.4em;
    letter-spacing: -0.015em;
    font-weight: 700;
}

body.modern h1 {
    font-size: clamp(28px, 2.2vw + 1rem, 40px);
}

body.modern h2 {
    font-size: clamp(22px, 1.5vw + .8rem, 30px);
}

body.modern h3 {
    font-size: clamp(18px, 1.2vw + .6rem, 24px);
}

/* Liens */
body.modern a {
    color: var(--accent);
    text-decoration: none;
}

body.modern a:hover {
    text-decoration: underline;
}

/* Boutons génériques */
body.modern .btn,
body.modern button,
body.modern input[type="submit"] {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: var(--accent);
    color: var(--accent-fg);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}

body.modern .btn:hover,
body.modern button:hover {
    transform: translateY(-1px);
}

body.modern .btn:active,
body.modern button:active {
    transform: translateY(0);
}

/* Cartes pour listes/sections */
body.modern .card {
    background: var(--card);
    border-radius: var(--radius);
    padding: clamp(12px, 2.2vw, 20px);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, .06);
}

/* Grille responsive pour des listes de liens/ressources */
body.modern .grid {
    display: grid;
    gap: clamp(10px, 2.5vw, 20px);
    grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
}

@media (max-width: 640px) {
    body.modern .grid {
        grid-template-columns: 1fr;
    }
}

/* Tables plus lisibles sans casser les anciennes */
body.modern table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

body.modern th,
body.modern td {
    padding: .7rem .8rem;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

body.modern th {
    text-align: left;
    background: var(--card);
}

/* Formulaires */
body.modern input,
body.modern select,
body.modern textarea {
    font: inherit;
    color: inherit;
    background: var(--bg);
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 10px;
    padding: .6rem .75rem;
    width: 100%;
    max-width: 100%;
}

body.modern label {
    display: block;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--muted);
}

/* Barre de nav (si tu as un <nav>) */
body.modern nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(180%) blur(8px);
    background: color-mix(in oklab, var(--bg) 85%, transparent);
    border-bottom: 1px solid rgba(0, 0, 0, .06);
}

body.modern nav .inner {
    display: flex;
    align-items: center;
    gap: .8rem;
    justify-content: space-between;
    padding: .6rem clamp(12px, 3vw, 24px);
}

/* Liens « carte » (utile pour une liste de chapitres/activités) */
body.modern .card-link {
    display: block;
    border-radius: var(--radius);
    background: var(--card);
    padding: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, .06);
    transition: transform .08s ease, box-shadow .2s ease;
}

body.modern .card-link:hover {
    transform: translateY(-2px);
}

/* Images auto-ratio */
body.modern img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

/* Réduction animation si demandé */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Impression clean */
@media print {
    body.modern {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    body.modern nav,
    body.modern .btn {
        display: none !important;
    }

    body.modern a {
        text-decoration: underline;
        color: #000;
    }
}