/* =========================================================
   TCF Gratuit — feuille de style principale
   ========================================================= */

:root {
    --red:        #C8102E;
    --red-dark:   #A10D25;
    --red-soft:   #FBE9EC;
    --navy:       #1B2A41;
    --navy-soft:  #4A5A72;
    --paper:      #FAF8F5;
    --white:      #FFFFFF;
    --line:       #E6E1DA;
    --green:      #1E7B4F;
    --green-soft: #E6F3EC;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

    --radius-sm: 6px;
    --radius:    12px;
    --max:       1120px;
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--navy);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
}

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

a { color: var(--red); }
a:hover { color: var(--red-dark); }

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

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); font-variation-settings: 'opsz' 144; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-variation-settings: 'opsz' 72; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

.container {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 20px;
}

.small { font-size: 0.875rem; }
.muted { color: var(--navy-soft); }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 2px solid var(--red);
    border-radius: var(--radius-sm);
    background: var(--red);
    color: var(--white);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }

.btn-ghost {
    background: transparent;
    color: var(--navy);
    border-color: var(--navy);
}
.btn-ghost:hover { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ---------- En-tête ---------- */
.site-header {
    background: var(--white);
    border-bottom: 1px solid var(--line);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 68px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--navy);
    text-decoration: none;
    letter-spacing: -0.02em;
}
.logo:hover { color: var(--navy); }
.logo span { color: var(--red); }
.logo svg { width: 24px; height: 24px; fill: var(--red); }

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav a {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--navy);
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
}
.nav a:hover { background: var(--paper); color: var(--red); }
.nav a.is-active { color: var(--red); }
.nav .btn { margin-left: 8px; padding: 8px 16px; color: var(--white); }
.nav .btn:hover { color: var(--white); background: var(--red-dark); }

/* ---------- Contenu ---------- */
main.container { padding-top: 48px; padding-bottom: 72px; }

/* ---------- Pied de page ---------- */
.site-footer {
    background: var(--navy);
    color: #C9D2DE;
    padding: 40px 0;
}
.site-footer p { margin: 0 0 6px; }
.site-footer a { color: var(--white); }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
    .site-header .container {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding-top: 12px;
    }
    .nav {
        overflow-x: auto;
        padding: 8px 0 10px;
        margin: 0 -20px;
        padding-left: 20px;
        padding-right: 20px;
        scrollbar-width: none;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav a { white-space: nowrap; }
    main.container { padding-top: 32px; }
}

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

/* =========================================================
   Page d'accueil
   ========================================================= */

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 56px;
    align-items: center;
    padding-bottom: 72px;
}
.hero h1 { max-width: 13ch; }
.hero-lead {
    max-width: 46ch;
    font-size: 1.15rem;
    color: var(--navy-soft);
    margin-bottom: 28px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Carte « question du jour » */
.try-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 4px solid var(--red);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: 0 18px 40px -24px rgba(27, 42, 65, 0.35);
}
.try-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 0.875rem;
    color: var(--navy-soft);
}
.try-card-head strong { color: var(--navy); font-weight: 600; }
.level-pill {
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--paper);
    border: 1px solid var(--line);
    font-weight: 600;
    color: var(--navy);
}
.try-doc {
    margin: 0 0 16px;
    padding: 14px 16px;
    background: var(--paper);
    border-left: 3px solid var(--navy);
    font-size: 0.95rem;
    line-height: 1.55;
}
.try-question { font-weight: 600; margin-bottom: 12px; }

.options { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    padding: 11px 14px;
    background: var(--white);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.95rem;
    color: var(--navy);
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.option:hover:not(:disabled) { border-color: var(--navy); }
.option:disabled { cursor: default; }
.option-letter {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}
.option.is-correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.option.is-wrong   { border-color: var(--red);   background: var(--red-soft);   color: var(--red-dark); }

.try-feedback {
    margin: 14px 0 0;
    font-size: 0.925rem;
    min-height: 1.5em;
}
.try-feedback[hidden] { display: none; }

/* ---------- Les quatre épreuves ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section-intro { max-width: 60ch; color: var(--navy-soft); margin-bottom: 32px; }

.epreuves {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--white);
    overflow: hidden;
}
.epreuve {
    display: grid;
    grid-template-columns: 2.2fr 1.6fr 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 1px solid var(--line);
}
.epreuve:last-child { border-bottom: 0; }
.epreuve h3 { margin: 0 0 2px; }
.epreuve p { margin: 0; font-size: 0.95rem; color: var(--navy-soft); }
.epreuve-format { font-size: 0.95rem; }
.epreuve-time {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1;
}
.epreuve-time small {
    display: block;
    margin-top: 4px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--navy-soft);
}
.epreuve-link {
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.epreuve-link:hover { text-decoration: underline; }

/* ---------- Bandeau examen blanc ---------- */
.exam-band {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 32px;
    align-items: center;
    padding: 40px;
    border-radius: var(--radius);
    background: var(--navy);
    color: var(--white);
}
.exam-band h2 { color: var(--white); margin-bottom: 8px; }
.exam-band p { margin: 0; color: #C9D2DE; max-width: 56ch; }

/* ---------- Pourquoi gratuit ---------- */
.why {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}
.why p { color: var(--navy-soft); }

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; gap: 36px; padding-bottom: 48px; }
    .try-card { padding: 22px; }
    .section { padding: 48px 0; }
    .epreuve { grid-template-columns: 1fr auto; gap: 8px 16px; padding: 20px; }
    .epreuve-main { grid-column: 1 / -1; }
    .epreuve-format { grid-column: 1 / -1; }
    .exam-band { grid-template-columns: 1fr; padding: 28px; }
    .why { grid-template-columns: 1fr; gap: 0; }
}

/* =========================================================
   Séries : liste
   ========================================================= */
.page-head { padding-bottom: 32px; }

.series-list {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--white); overflow: hidden;
}
.series-item {
    display: grid; grid-template-columns: 1fr auto auto;
    gap: 24px; align-items: center;
    padding: 20px 28px; border-bottom: 1px solid var(--line);
}
.series-item:last-child { border-bottom: 0; }
.series-title { font-size: 1.2rem; margin: 0 0 2px; }
.series-item p { margin: 0; font-size: 0.95rem; }
.series-count { font-size: 0.9rem; color: var(--navy-soft); white-space: nowrap; }

.empty-state {
    padding: 48px 32px; text-align: center;
    background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty-state p { color: var(--navy-soft); }

/* =========================================================
   Séries : passage
   ========================================================= */
.quiz { max-width: 820px; margin: 0 auto; }

.quiz-bar {
    position: sticky; top: 0; z-index: 5;
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: 14px 0; background: var(--paper); border-bottom: 1px solid var(--line);
}
.quiz-kicker { margin: 0; font-size: 0.875rem; color: var(--navy-soft); }
.quiz-title { font-size: 1.4rem; margin: 0; }
.quiz-timer { text-align: right; }
.quiz-timer-label { display: block; font-size: 0.8rem; color: var(--navy-soft); }
#timer {
    font-family: var(--font-display); font-size: 1.8rem; font-weight: 600;
    font-variant-numeric: tabular-nums; line-height: 1;
}
#timer.is-low { color: var(--red); }

.quiz-grid {
    display: grid; grid-template-columns: repeat(13, 1fr); gap: 6px;
    margin: 20px 0 24px;
}
.quiz-dot {
    aspect-ratio: 1; min-width: 0;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    background: var(--white); color: var(--navy-soft);
    font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.quiz-dot:hover { border-color: var(--navy); }
.quiz-dot.is-done { background: var(--navy); border-color: var(--navy); color: var(--white); }
.quiz-dot.is-current { outline: 2px solid var(--red); outline-offset: 1px; }

.question {
    margin: 0; padding: 28px; min-width: 0;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
}
.question[hidden] { display: none; }
.question-head {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    float: left; width: 100%; padding: 0; margin-bottom: 16px;
    font-size: 0.9rem; color: var(--navy-soft);
}
.question-head + * { clear: both; }
.question-image { width: 100%; height: auto; border-radius: var(--radius-sm); margin-bottom: 16px; }
.question-audio { width: 100%; margin-bottom: 16px; }
.question-doc {
    margin-bottom: 18px; padding: 16px 18px;
    background: var(--paper); border-left: 3px solid var(--navy);
    font-size: 0.975rem; line-height: 1.65;
}
.question-prompt { font-weight: 600; margin-bottom: 12px; }

/* Les options du quiz sont des labels avec un bouton radio caché */
label.option { position: relative; }
label.option input {
    position: absolute; opacity: 0; width: 1px; height: 1px;
}
label.option:has(input:checked) { border-color: var(--navy); background: var(--paper); }
label.option:has(input:checked) .option-letter { background: var(--navy); border-color: var(--navy); color: var(--white); }
label.option:has(input:focus-visible) { outline: 3px solid var(--red); outline-offset: 2px; }

.quiz-nav {
    display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap;
    margin-top: 20px;
}
.quiz-nav #finish { margin-left: auto; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-ghost:disabled:hover { background: transparent; color: var(--navy); }
.quiz-warning {
    margin-top: 14px; padding: 12px 16px;
    background: var(--red-soft); border-radius: var(--radius-sm);
    color: var(--red-dark); font-size: 0.95rem;
}
.quiz-warning[hidden] { display: none; }

/* =========================================================
   Résultat
   ========================================================= */
.result-head { max-width: 820px; }
.result-score {
    display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center;
    margin: 24px 0 12px; padding: 32px;
    background: var(--white); border: 1px solid var(--line);
    border-top: 4px solid var(--red); border-radius: var(--radius);
}
.result-number {
    display: block; font-family: var(--font-display);
    font-size: 4.5rem; font-weight: 700; line-height: 1;
}
.result-max { color: var(--navy-soft); }
.result-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; }
.result-facts dt { font-size: 0.85rem; color: var(--navy-soft); }
.result-facts dd { margin: 2px 0 0; font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; }

.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-width: 820px; }
.review-item {
    padding: 22px 24px; background: var(--white);
    border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius-sm);
}
.review-item.is-ok { border-left-color: var(--green); }
.review-item.is-ko { border-left-color: var(--red); }
.review-head {
    display: flex; justify-content: space-between; gap: 12px;
    margin-bottom: 8px; font-size: 0.875rem; color: var(--navy-soft);
}
.is-ok .review-status { color: var(--green); font-weight: 600; }
.is-ko .review-status { color: var(--red); font-weight: 600; }
.review-options { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.review-options li {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.95rem;
}
.review-options li.is-correct { background: var(--green-soft); color: var(--green); }
.review-options li.is-wrong { background: var(--red-soft); color: var(--red-dark); }
.review-explain { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 0.95rem; color: var(--navy-soft); }
.review-transcript { margin-top: 10px; font-size: 0.95rem; }
.review-transcript summary { cursor: pointer; color: var(--red); font-weight: 600; }

@media (max-width: 860px) {
    .series-item { grid-template-columns: 1fr auto; padding: 18px 20px; }
    .series-item > div { grid-column: 1 / -1; }
    .quiz-grid { grid-template-columns: repeat(8, 1fr); }
    .question { padding: 20px; }
    .result-score { grid-template-columns: 1fr; gap: 20px; padding: 24px; }
    .result-facts { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
   Expression écrite
   ========================================================= */
.ee-tasks .epreuve { grid-template-columns: 1fr auto; }

.list-head {
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.list-head h2 { margin: 0; }

.breadcrumb { font-size: 0.9rem; color: var(--navy-soft); margin-bottom: 16px; }
.breadcrumb a { color: var(--navy-soft); }

.ee-task {
    max-width: 820px; margin-bottom: 20px; padding: 28px;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
}
.ee-task-head {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.ee-task-head h2 { font-size: 1.4rem; margin: 0; }
.ee-task-head h2 .muted { font-family: var(--font-body); font-size: 1rem; font-weight: 500; }
.ee-prompt { margin-bottom: 16px; font-weight: 500; }
.ee-docs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.ee-docs .question-doc { margin: 0; }

.ee-model { border-top: 1px solid var(--line); padding-top: 14px; }
.ee-model summary { cursor: pointer; color: var(--red); font-weight: 600; }
.ee-model-text {
    margin-top: 14px; padding: 18px 20px;
    background: var(--green-soft); border-radius: var(--radius-sm);
    line-height: 1.7;
}

/* Simulateur */
.sim { max-width: 900px; margin: 0 auto; }
.sim-tabs { display: flex; gap: 6px; margin: 20px 0 0; border-bottom: 1px solid var(--line); }
.sim-tab {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px 18px; margin-bottom: -1px;
    border: 1px solid transparent; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: none; font: inherit; font-weight: 600; color: var(--navy-soft); cursor: pointer;
}
.sim-tab.is-active { background: var(--white); border-color: var(--line); border-bottom-color: var(--white); color: var(--navy); }
.sim-tab-count { font-size: 0.8rem; font-weight: 500; color: var(--navy-soft); }

.sim-panel {
    padding: 24px; background: var(--white);
    border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius);
}
.sim-panel[hidden] { display: none; }
.sim-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.95rem; }
.sim-prompt, .sim-answer {
    display: block; width: 100%; margin-bottom: 16px; padding: 12px 14px;
    border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    font: inherit; font-size: 1rem; line-height: 1.65; color: var(--navy);
    background: var(--white); resize: vertical;
}
.sim-prompt { background: var(--paper); }
.sim-prompt:focus, .sim-answer:focus { outline: none; border-color: var(--navy); }
.sim-answer[readonly] { background: var(--paper); }

.sim-tools { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.accents { display: flex; flex-wrap: wrap; gap: 4px; }
.accent {
    min-width: 34px; height: 34px; padding: 0 6px;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: var(--paper); font: inherit; font-size: 1rem; cursor: pointer; color: var(--navy);
}
.accent:hover { border-color: var(--navy); }
.sim-count { margin: 0; font-size: 0.925rem; font-weight: 600; }
.sim-count.is-under { color: var(--navy-soft); }
.sim-count.is-ok    { color: var(--green); }
.sim-count.is-over  { color: var(--red); }
.sim-review { margin-top: 32px; }
.sim-review[hidden] { display: none; }

@media (max-width: 860px) {
    .ee-task { padding: 20px; }
    .ee-docs { grid-template-columns: 1fr; }
    .sim-panel { padding: 16px; }
    .sim-tab { padding: 8px 12px; }
}
