/* Identité visuelle : blanc, gris très clair, encre presque noire, accents dorés discrets.
   Titres : Fraunces (usage parcimonieux). Texte : Atkinson Hyperlegible Next, conçue pour la lisibilité. */

@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces.woff") format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/fonts/atkinson.woff") format("woff"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("/fonts/atkinson-italic.woff") format("woff"); font-weight: 200 800; font-style: italic; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #ffffff;
  --canvas: #f5f5f2;
  --ink: #151515;
  --ink-2: #3a3b3f;
  --muted: #66686d;
  --line: #e3e3de;
  --line-strong: #cfcfc8;
  --gold: #b48d3e;
  --gold-ink: #85651f;
  --gold-soft: #f7f0e1;
  --ok: #1d7448;
  --ok-soft: #e7f4ec;
  --ko: #b42318;
  --ko-soft: #fdecea;
  --warn: #9a5b06;
  --warn-soft: #fdf3e2;
  --taxi: #1d7448;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 4px 16px rgba(20, 20, 20, .04);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Atkinson Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--ink); text-decoration-color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--gold-ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; font-optical-sizing: auto; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 1.9rem); }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.eyebrow { font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* Gabarit */
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.wrap.narrow { max-width: 760px; }
main { padding-block: 32px 72px; min-height: 60vh; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid > *, .grid-2 > * { min-width: 0; }

/* En-tête */
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--paper); z-index: 30; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.01em; font-size: 1.05rem; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.brand-mark span { width: 12px; height: 12px; border-radius: 3px; border: 2.5px solid var(--gold); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; color: var(--ink-2); }
.nav a:hover, .nav a[aria-current="page"] { background: var(--canvas); color: var(--ink); }
.nav .btn { margin-left: 6px; }
.menu-toggle { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--paper); border-bottom: 1px solid var(--line);
         flex-direction: column; align-items: stretch; padding: 8px var(--gutter) 16px; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; }
  .menu-toggle { display: inline-flex; }
  .site-header.open .nav { display: flex; }
}

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--ink); color: #fff; font: inherit; font-weight: 700; font-size: .98rem; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #000; color: #fff; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1b1407; }
.btn.gold:hover { background: #a37d31; border-color: #a37d31; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding-inline: 10px; }
.btn.ghost:hover { background: var(--canvas); }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.danger { background: var(--paper); color: var(--ko); border-color: #e9b4ae; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); cursor: pointer; }

/* Surfaces */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; }
.card.tight { padding: 16px 18px; }
.card.link { text-decoration: none; display: block; transition: border-color .15s, box-shadow .15s; }
.card.link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: inherit; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel > .panel-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--line); text-decoration: none; }
.panel > .panel-row:first-child { border-top: 0; }
a.panel-row:hover { background: #fafaf8; color: inherit; }
.rule-gold { height: 2px; width: 48px; background: var(--gold); border: 0; margin: 0; }

/* Lettre d'épreuve (repère propre à l'examen) */
.letter {
  flex: none; width: 42px; height: 42px; border-radius: 9px; border: 2px solid var(--ink);
  display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; background: var(--paper);
}
.letter.spec { background: var(--ink); color: #fff; }
.letter.local { background: var(--ink); color: #fff; box-shadow: inset 0 -4px 0 var(--taxi); }

/* Pastilles */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; border: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
.tag.vtc::before, .tag.taxi::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.tag.taxi::before { background: var(--taxi); }
.tag.gold { background: var(--gold-soft); border-color: #ead9b2; color: var(--gold-ink); }
.tag.ok { background: var(--ok-soft); border-color: #bfe0cc; color: var(--ok); }
.tag.ko { background: var(--ko-soft); border-color: #f4c3bd; color: var(--ko); }
.tag.warn { background: var(--warn-soft); border-color: #f1d6a8; color: var(--warn); }
.tag.plain { color: var(--muted); }

/* Alertes */
.alert { padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); display: flex; gap: 10px; align-items: flex-start; }
.alert.ok { background: var(--ok-soft); border-color: #bfe0cc; }
.alert.error { background: var(--ko-soft); border-color: #f4c3bd; }
.alert.info { background: var(--gold-soft); border-color: #ead9b2; }
.alert.warn { background: var(--warn-soft); border-color: #f1d6a8; }
.pending-banner { background: var(--warn-soft); border-bottom: 1px solid #f1d6a8; font-size: .86rem; padding: 8px 0; color: var(--warn); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-weight: 700; font-size: .94rem; }
.field .hint { font-size: .85rem; color: var(--muted); }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  font: inherit; font-size: 16px; width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--ink); flex: none; }
.form-card { max-width: 480px; margin: 0 auto; }

/* Accueil */
.hero { padding-block: 40px 16px; display: grid; gap: 32px; grid-template-columns: 1.25fr 1fr; align-items: center; }
.hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 38ch; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 16px; } }
.choice { display: grid; gap: 12px; }
.choice-card { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 20px; border-radius: var(--radius-lg); background: var(--paper); border: 1.5px solid var(--line); text-decoration: none; }
.choice-card:hover { border-color: var(--ink); color: inherit; }
.choice-card .arrow { font-size: 1.3rem; color: var(--muted); }
.lamp { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .8rem; letter-spacing: .04em; background: var(--ink); color: #fff; }
.lamp.taxi { background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: inset 0 -5px 0 var(--taxi); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts > div { padding: 18px 16px 18px 0; }
.facts strong { display: block; font-family: var(--display); font-size: 1.6rem; font-weight: 600; }
.section-head { display: flex; flex-direction: column; gap: 8px; max-width: 62ch; }

/* Tableau des épreuves */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: #fafaf8; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Quiz */
.quiz-top { display: flex; align-items: center; gap: 12px; }
.progress { flex: 1; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ink); width: 0; transition: width .25s; }
.qcount { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; }
.question-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(18px, 4vw, 32px); display: flex; flex-direction: column; gap: 20px; }
.qmeta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qtext { font-size: clamp(1.12rem, 1rem + .6vw, 1.32rem); font-weight: 700; line-height: 1.4; }
.qcontext { background: var(--canvas); border-radius: var(--radius); padding: 14px 16px; font-size: .97rem; white-space: pre-line; border-left: 3px solid var(--line-strong); }
.qhint { font-size: .88rem; color: var(--muted); }
.options { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; border: 0; }
.option { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.option:hover { border-color: var(--line-strong); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .key { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: var(--canvas); border: 1.5px solid transparent; }
.option .otext { padding-top: 5px; min-width: 0; }
.option.selected { border-color: var(--ink); }
.option.selected .key { background: var(--ink); color: #fff; }
.option.correct { border-color: var(--ok); background: var(--ok-soft); }
.option.correct .key { background: var(--ok); color: #fff; }
.option.wrong { border-color: var(--ko); background: var(--ko-soft); }
.option.wrong .key { background: var(--ko); color: #fff; }
.option.missed { border-color: var(--ok); border-style: dashed; }
.option[aria-disabled="true"] { cursor: default; }
.option .why { grid-column: 2; font-size: .92rem; color: var(--ink-2); margin-top: 4px; }
.verdict { display: flex; gap: 10px; align-items: center; font-weight: 800; font-size: 1.05rem; }
.verdict .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .9rem; }
.verdict.ok .dot { background: var(--ok); }
.verdict.ko .dot { background: var(--ko); }
.correction { border-top: 1px solid var(--line); padding-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.correction h3 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.correction .block { display: flex; flex-direction: column; gap: 6px; }
.tip { background: var(--gold-soft); border: 1px solid #ead9b2; border-radius: var(--radius); padding: 12px 14px; }
.sources { font-size: .9rem; display: flex; flex-direction: column; gap: 6px; padding: 0; margin: 0; list-style: none; }
.sources li { padding-left: 14px; border-left: 2px solid var(--gold); }
.qactions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.fav[aria-pressed="true"] { color: var(--gold-ink); border-color: var(--gold); }

/* Résultats */
.score-big { font-family: var(--display); font-size: clamp(3rem, 2rem + 4vw, 4.6rem); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.score-big small { font-size: .4em; color: var(--muted); font-family: var(--body); font-weight: 700; }
.bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--ink); border-radius: 99px; }
.bar > i.ok { background: var(--ok); } .bar > i.ko { background: var(--ko); } .bar > i.warn { background: var(--gold); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-2); }
.subject-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 14px; align-items: center; }
.subject-row .meta { min-width: 0; display: flex; flex-direction: column; gap: 6px; }

/* Chronomètre d'examen */
.timer { font-variant-numeric: tabular-nums; font-weight: 800; padding: 6px 12px; border-radius: 8px; background: var(--ink); color: #fff; letter-spacing: .02em; }
.timer.low { background: var(--ko); }
.exam-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.exam-nav button { width: 38px; height: 38px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--paper); font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; font-variant-numeric: tabular-nums; }
.exam-nav button.answered { background: var(--canvas); border-color: var(--line-strong); }
.exam-nav button.current { border-color: var(--ink); background: var(--ink); color: #fff; }
.exam-nav button.flagged { box-shadow: inset 0 -3px 0 var(--gold); }
.sticky-bar { position: sticky; bottom: 0; background: rgba(245,245,242,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); margin-top: 24px; z-index: 10; }

/* Prix */
.price { font-family: var(--display); font-size: 2.6rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.price small { font-family: var(--body); font-size: .95rem; font-weight: 700; color: var(--muted); }
.price-ref { color: var(--muted); font-size: .92rem; }
.plan { display: flex; flex-direction: column; gap: 16px; }
.plan.featured { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.plan ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Sélecteur de département */
.dept-list { max-height: 420px; overflow-y: auto; }
.dept-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; }
.dept-code { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }

/* Prose (fiches, pages légales) */
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 14px; }
.prose h2 { margin-top: 18px; }
.prose h3 { margin-top: 10px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.prose .todo { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; font-weight: 700; }
.prose table { font-size: .93rem; }

/* Administration */
.admin-nav { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.admin-nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .92rem; }
.admin-nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.status-brouillon { color: var(--muted); }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi strong { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.choice-editor { display: grid; grid-template-columns: 60px 1fr; gap: 10px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.choice-editor > * { min-width: 0; }

/* Pied de page */
.site-footer { background: var(--paper); border-top: 1px solid var(--line); padding-block: 36px calc(36px + env(safe-area-inset-bottom, 0px)); font-size: .92rem; }
.site-footer .cols { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.site-footer ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.site-footer a { text-decoration: none; color: var(--ink-2); }
.site-footer a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
@media print { .site-header, .site-footer, .sticky-bar { display: none; } }

/* Correctifs de spécificité */
.btn.menu-toggle { display: none; }
@media (max-width: 860px) { .btn.menu-toggle { display: inline-flex; } }
.nav a.btn, .nav a.btn:hover { color: #fff; background: var(--ink); }
.stack > .tag, .stack > .btn.small { align-self: flex-start; }
code { overflow-wrap: anywhere; font-size: .9em; }
