/* Parcours par objectifs : texte lisible et retours accessibles sur téléphone. */

:root {
    color-scheme: dark;
    font-family: Roboto, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #fff7ed;
    background: #1a1410;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-image: linear-gradient(#ffffff08 1px, transparent 1px), linear-gradient(90deg, #ffffff08 1px, transparent 1px);
    background-size: 40px 40px;
}

.objectives-shell {
    width: min(100% - 32px, 1000px);
    margin: auto;
    padding-bottom: 48px;
}

.objectives-header,
.essential-heading,
.essential-audio {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.objectives-header {
    padding: 22px 0;
}

.objectives-brand {
    color: #fff7ed;
    font-size: 2rem;
    font-weight: 900;
    text-decoration: none;
}

.objectives-brand span {
    color: #ff8b32;
}

h1,
h2 {
    line-height: 1.25;
}

h1 {
    font-size: clamp(1.7rem, 5vw, 2.8rem);
    margin: 26px 0 18px;
    overflow-wrap: anywhere;
}

h2 {
    margin: 0;
    font-size: 1.4rem;
}

.objectives-intro {
    max-width: 740px;
}

.objectives-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.objectives-navigation a,
button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid #bb8358;
    border-radius: 14px;
    background: #33251b;
    color: #fff7ed;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.objectives-list {
    display: grid;
    gap: 16px;
    margin-top: 30px;
}

.objective-choice {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 22px;
    gap: 16px;
    align-items: center;
    padding: 24px;
    border: 1px solid #b98963;
    border-radius: 22px;
    background: #2d2119;
    color: #fff7ed;
    text-decoration: none;
}

.objective-choice strong,
.objective-choice small {
    display: block;
}

.objective-choice small {
    margin-top: 6px;
    color: #e6cbb4;
    font-size: 1rem;
}

.objective-number {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--level-color, #ff8b32);
    color: #20160e;
    font-weight: 900;
}

.essential-panel {
    padding: clamp(22px, 4vw, 38px);
    border-radius: 24px;
    background: #fffaf2;
    color: #211a15;
    overflow-wrap: anywhere;
}

.essential-heading {
    margin-bottom: 20px;
}

.essential-audio button {
    border-color: #8b613e;
    background: #ffead2;
    color: #211a15;
}

#essentialContent p {
    margin: 0 0 20px;
}

#essentialContent p:last-child {
    margin-bottom: 0;
}

.essential-figure {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 24px auto 0;
}

.objective-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
    gap: 18px;
    margin-top: 24px;
}

.objective-actions a {
    padding: 28px;
    border-radius: 22px;
    background: var(--level-color, #ff8b32);
    color: #211a15;
    text-decoration: none;
}

.objective-actions strong,
.objective-actions span {
    display: block;
}

.objective-actions strong {
    font-size: 1.3rem;
    margin-bottom: 8px;
}

.bottom-navigation {
    margin-top: 28px;
}

.objective-report {
    margin-bottom: 20px;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid #69dcf1;
    outline-offset: 4px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 480px) {
    .objectives-shell {
        width: calc(100% - 20px);
    }

    .objective-choice {
        grid-template-columns: 40px minmax(0, 1fr) 18px;
        padding: 20px 16px;
        gap: 10px;
    }
}


/* Le cours facultatif reprend la même source que les objectifs. */
.course-toolbar {
    margin: 24px 0;
}

.course-document {
    padding: clamp(22px, 4vw, 42px);
    border-radius: 22px;
    background: white;
    color: #211a15;
}

.course-objective {
    margin-top: 36px;
}

.course-document h2,
.course-document h3 {
    line-height: 1.3;
}

/* Les schémas restent lisibles sans occuper toute la hauteur de l’écran. */
.course-document .essential-figure {
    width: auto;
    max-width: min(100%, 620px);
    max-height: min(360px, 55vh);
    object-fit: contain;
}

.course-figure-link {
    display: block;
    margin: 24px auto;
    color: #305b72;
    text-align: center;
    text-decoration: none;
    cursor: zoom-in;
}

.course-figure-link .essential-figure {
    margin-top: 0;
}

.figure-zoom {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    text-decoration: underline;
}

.course-document h2 {
    margin-top: 30px;
}

.course-document h3 {
    font-size: 1.05rem;
}

@media print {
    @page {
        size: A4;
        margin: 18mm;
    }

    :root,
    body {
        background: white;
        color: #0000ff;
        font-family: Arial, sans-serif;
        font-size: 11pt;
        line-height: 1.3;
    }

    .objectives-header,
    .objectives-navigation,
    .objective-report,
    .figure-zoom,
    .course-toolbar {
        display: none;
    }

    .objectives-shell {
        width: 100%;
        padding: 0;
    }

    .course-document {
        padding: 0;
        color: #0000ff;
    }

    .course-document h1,
    .course-document h2,
    .course-document h3 {
        color: black;
        font-size: 11pt;
        font-weight: bold;
        break-after: avoid;
    }

    .course-document p,
    .course-document li {
        orphans: 3;
        widows: 3;
    }

    .course-document b,
    .course-document strong {
        color: #ff0000;
        font-weight: bold;
    }

    .course-objective {
        margin-top: 18pt;
    }

    .course-document .essential-figure {
        max-width: 140mm;
        max-height: 65mm;
        break-inside: avoid;
    }

    .course-figure-link {
        margin: 12pt auto;
        break-inside: avoid;
    }
}


@media print {
    html,
    body {
        color-scheme: light !important;
        background: white !important;
        background-image: none !important;
    }

    .course-objective {
        break-before: page;
    }

    .course-objective:first-of-type {
        break-before: auto;
    }
}
