/* ==========================================================
   Pulsar VSAV — thème « fiche bilan » (chargé après app.css)
   Direction : précis, rassurant, opérationnel. Univers : la cellule
   sanitaire et la fiche bilan (blanc cassé, gris acier) ; nuit
   d’intervention en mode sombre. Un seul accent, le rouge engin,
   utilisé rarement. Les schémas animés et la correction du quiz
   portent la couleur ; le reste reste calme.
   Règles : méthode unslop (CC BY 4.0, Damir Sokolovsky, github.com/heydamir/unslop)
   et règles du site Révision FS2 : aucun emoji, aucun dégradé ni lueur,
   graisses 400 à 600, pas de majuscules espacées, grille de 4 px,
   survol sans déplacement, cibles de 44 px, contraste 4,5 : 1.
   ========================================================== */

/* ---------- polices hébergées sur le site (licence OFL) ---------- */
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/public-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/public-sans-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/public-sans-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

/* ---------- couleurs ---------- */
:root {
  --bg: #F6F6F4;            /* fond, blanc cassé à peine chaud */
  --bg2: #EEEEEB;           /* surface secondaire */
  --card: #FFFFFF;          /* cartes */
  --ink: #1B1F24;           /* texte principal */
  --ink2: #4A515B;          /* texte secondaire */
  --muted: #646B76;         /* texte discret (4,9 : 1 sur le fond) */
  --line: rgba(27, 31, 36, .1);
  --line-strong: rgba(27, 31, 36, .18);
  --accent: #B3261E;        /* rouge engin, l’unique accent */
  --accent-ink: #FFFFFF;
  --accent-text: #A1221B;   /* accent utilisé comme texte (6,6 : 1) */
  --accent-soft: #F7E9E7;
  --ok: #1B7A3E;  --ok-soft: #E6F2EA;
  --bad: #B3261E; --bad-soft: #F9E8E6;
  --warn: #8A5A00; --warn-soft: #F6EEDD;
  --info: #2A5B8F; --info-soft: #E8EEF5;
  --shadow: 0 1px 2px rgba(27, 31, 36, .05);
  --radius: 12px;
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --top-h: 56px;
}
[data-theme="dark"] {
  --bg: #0F1318;            /* nuit d’intervention */
  --bg2: #1A2028;
  --card: #151A21;
  --ink: #E7E9EC;
  --ink2: #B7BDC6;
  --muted: #8F97A3;
  --line: rgba(231, 233, 236, .09);
  --line-strong: rgba(231, 233, 236, .16);
  --accent: #F0675E;
  --accent-ink: #1A0D0B;    /* texte sombre sur l’accent clair */
  --accent-text: #F28A82;
  --accent-soft: #2A1A1A;
  --ok: #57C17F;  --ok-soft: #13261B;
  --bad: #F0675E; --bad-soft: #2C1716;
  --warn: #E2B04E; --warn-soft: #2A2112;
  --info: #84B1E0; --info-soft: #15212E;
  --shadow: none;
}

/* ---------- base ---------- */
body { font-family: var(--font); font-size: 16px; line-height: 1.6; font-variant-numeric: tabular-nums; }
a, [data-theme="dark"] a { color: var(--accent-text); text-underline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: 0; }
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 20px; margin: 32px 0 12px; }
h3 { font-size: 16px; }
b, strong, th { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { background: var(--ink); color: var(--bg); border-radius: 8px; }
mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- barre du haut : surface calme, sans dégradé ---------- */
.topbar { background: var(--card); background-image: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); }
.brand img { width: 28px; height: 28px; }
.brand-txt { font-size: 17px; letter-spacing: 0; font-weight: 600; }
.brand-txt b { color: var(--ink); font-weight: 600; }
.brand-txt small { text-transform: none; letter-spacing: 0; opacity: 1; color: var(--muted); font-weight: 400; font-size: 12px; }
.search > svg { color: var(--muted); }
.search input { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink); font-family: var(--font); }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--line-strong); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-pop { border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); }
.search-pop .sr-t, .search-pop .sr-all { font-weight: 600; }
.search-pop .sr-all { color: var(--accent-text); }
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); color: var(--ink2); border-radius: 10px; }
.icon-btn:hover { background: var(--bg2); }

/* ---------- onglets des parties : un point de couleur, le reste neutre ---------- */
.part-tabs { gap: 4px; padding: 6px 16px; }
.part-tabs a { min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink2); font-weight: 400; }
.part-tabs a:hover { background: var(--bg2); }
.part-tabs a .dot { width: 8px; height: 8px; }
.part-tabs a[aria-current="page"] { background: var(--bg2); color: var(--ink); border-color: var(--line); font-weight: 600; }
.part-tabs a[aria-current="page"] .dot { background: var(--pc); }

/* ---------- barre latérale ---------- */
.side-h { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; color: var(--muted); margin: 24px 10px 8px; }
.side-link { min-height: 36px; padding: 6px 10px; gap: 10px; border-radius: 8px; }
.side-link[aria-current="page"] { background: var(--bg2); box-shadow: none; font-weight: 600; }
.side-link .ic { width: 18px; height: 18px; color: var(--muted); }
.side-link[aria-current="page"] .ic { color: var(--ink); }
.side-link .st { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ic svg, svg.ic { stroke-width: 1.6; }

/* ---------- en-tête de page : plus de bandeau coloré ---------- */
.hero { background: none !important; background-color: transparent !important; color: var(--ink); box-shadow: none; border-radius: 0; padding: 8px 0 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); overflow: visible; }
.hero::after { display: none; }
.hero .hero-ic { display: none; }
.hero .crumb { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; color: var(--muted); opacity: 1; padding-right: 0; }
.hero .crumb a { color: var(--ink2); }
.hero h1 { color: var(--ink); text-shadow: none; padding-right: 0; font-size: 30px; margin: 4px 0 8px; }
.hero p { color: var(--ink2); opacity: 1; max-width: 680px; }
.hero .meta { gap: 6px; margin-top: 16px; }
/* signature : la référence de la fiche source, en étiquette à chasse fixe */
.hero .meta span, .ref { display: inline-block; font-family: var(--mono); font-size: 12px; font-weight: 400; line-height: 20px; padding: 2px 8px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--ink2); }

/* ---------- cartes, boutons, étiquettes ---------- */
.card, .sec, .q { border-color: var(--line); box-shadow: var(--shadow); }
.card { padding: 20px; }
.btn { min-height: 44px; padding: 8px 16px; border-radius: 10px; font-weight: 600; border-color: var(--line-strong); }
.btn:hover { border-color: var(--line-strong); background: var(--bg2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: none; background: color-mix(in srgb, var(--accent) 88%, #000); }
[data-theme="dark"] .btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.pill { font-weight: 600; border-radius: 6px; padding: 2px 8px; }
th { background: var(--bg2); }
.num, [data-theme="dark"] .num { font-weight: 600; color: var(--ink); }
.stat b { font-weight: 600; color: var(--ink); font-size: 28px; }
.score-big { font-weight: 600; color: var(--ink); }
.anim-readout, .gl-res, .tag-col, .who { font-weight: 600; }
.meter { height: 6px; }
.meter i { background: var(--ink2); }
.badge { font-weight: 600; }

/* ---------- accueil : tuiles sans bande colorée ---------- */
.tile .band { height: auto; margin: 0 0 8px; background: none !important; display: flex; align-items: center; gap: 8px; }
.tile .band::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pc); flex: none; }
.tile .band b { position: static; color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.tile .band .ic { display: none; }
.tile:hover, .chap-card:hover { transform: none; border-color: var(--line-strong); background: color-mix(in srgb, var(--bg2) 50%, var(--card)); }
.chap-card .ic { width: 36px; height: 36px; padding: 8px; border-radius: 8px; background: var(--bg2); color: var(--ink2); }
.chap-card .t { font-weight: 600; }

/* ---------- chapitre ---------- */
.chap-nav a { min-height: 36px; display: inline-flex; align-items: center; border-radius: 8px; font-weight: 400; }
.chap-nav a:hover { border-color: var(--line-strong); }
.sec { padding: 8px 24px 20px; }
.sec > h2 { font-size: 19px; }
.sec > h2 .h-ic { background: var(--bg2); color: var(--ink2); }
.sec > h2 .h-ic svg { stroke-width: 1.6; }
.sec .src { font-family: var(--mono); font-size: 12px; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 2px var(--line-strong); } 100% { box-shadow: var(--shadow); } }
/* encadré « Pourquoi » : surface calme, plus de barre colorée sur le côté */
.why { border-left: 0; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 12px 16px; }
.why b:first-child, [data-theme="dark"] .why b:first-child { color: var(--ink); font-weight: 600; }
.callout { border-radius: 10px; padding: 12px 16px; }
ul.check li::before { font-weight: 600; }
ul.trap li::before { font-weight: 600; background: transparent; color: var(--bad); border: 1.5px solid var(--bad); width: 16px; height: 16px; font-size: 11px; top: 4px; }
ol.steps > li { transform: none !important; }
ol.steps > li::before { font-weight: 600; border-width: 1.5px; }
ol.steps > li.on { background: var(--accent-soft); }
.cmd, [data-theme="dark"] .cmd { font-style: normal; color: var(--accent-text); font-weight: 600; }
figure.schema { border-radius: 12px; }
figure.schema .fig, .anim-host { background: var(--card); }
.anim-ctrl .seg button { min-height: 40px; font-weight: 600; }
.anim-ctrl .seg button[aria-pressed="true"] { background: var(--ink); color: var(--card); }

/* ---------- quiz : vert et rouge, toujours avec le texte ---------- */
.q .qh { font-weight: 600; }
.q .qn { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-weight: 400; font-size: 12px; }
.choice { min-height: 44px; border: 1px solid var(--line-strong); background: var(--card); font-family: var(--font); }
.choice:hover:not(:disabled) { border-color: var(--ink2); background: var(--bg2); }
.choice.right { border: 2px solid var(--ok); background: var(--ok-soft); }
.choice.wrong { border: 2px solid var(--bad); background: var(--bad-soft); }
.expl { background: var(--bg2); border: 1px solid var(--line); }

/* ---------- fiches mémoire, recherche, bas de page ---------- */
.memo { border-top: 1px solid var(--line); }
.memo h3 { display: flex; align-items: center; gap: 8px; }
.memo h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cc, var(--accent)); flex: none; }
.memo .src { font-family: var(--mono); }
.toast { background: var(--ink); color: var(--card); transition: opacity .2s ease, transform .2s ease; }
@media (max-width: 980px) {
  .bottom-nav a { font-weight: 400; min-height: 56px; }
  .bottom-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
  .bottom-nav a svg { stroke-width: 1.6; }
}
@media (max-width: 600px) {
  .hero h1 { font-size: 24px; }
  .hero { padding: 4px 0 16px; }
  .sec { padding: 4px 16px 16px; }
  .card { padding: 16px; }
  .grid.g3 > .stat b { font-size: 22px; }
}

/* ---------- schémas : textes à la graisse 600 au plus ---------- */
.sv .t-b, .sv .t-w, .sv .t-acc { font-weight: 600; }
.tree-q { font-weight: 600; }

/* ---------- bandeau « outil non officiel » et pied de page ---------- */
.unofficial { margin: 32px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.unofficial a { color: var(--ink2); display: inline-flex; align-items: center; min-height: 44px; }
.legal h2 { font-size: 18px; }
.legal p, .legal li { color: var(--ink2); }

/* ---------- derniers ajustements de graisse et d’espacement ---------- */
.ess-item .k { font-weight: 600; }
.tag-col { letter-spacing: 0; }
.search-pop .sr-c { font-family: var(--mono); }

/* ---------- cibles tactiles de 44 px ---------- */
.search input { height: 44px; }
.skip { min-height: 44px; display: inline-flex; align-items: center; }
.anim-ctrl .seg button, .chap-nav a { min-height: 44px; }
.hero .crumb a { display: inline-block; padding: 12px 0; margin: -12px 0; }

/* ---------- mode sombre : seuls les liens du texte prennent l’accent ---------- */
[data-theme="dark"] .tile, [data-theme="dark"] .chap-card, [data-theme="dark"] a.card, [data-theme="dark"] .search-pop a,
[data-theme="dark"] .brand, [data-theme="dark"] .side-link, [data-theme="dark"] .btn { color: var(--ink); }
[data-theme="dark"] .btn.primary { color: var(--accent-ink); }
[data-theme="dark"] .part-tabs a, [data-theme="dark"] .chap-nav a, [data-theme="dark"] .hero .crumb a, [data-theme="dark"] .unofficial a { color: var(--ink2); }
[data-theme="dark"] .part-tabs a[aria-current="page"] { color: var(--ink); }
[data-theme="dark"] .bottom-nav a { color: var(--muted); }
[data-theme="dark"] .bottom-nav a[aria-current="page"] { color: var(--ink); }

/* ---------- accueil : les 3 statistiques occupent toute la largeur ---------- */
.grid.g3:has(> .stat) { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ==========================================================
   Couleurs et icônes par catégorie (demande de l’utilisateur) :
   chaque partie retrouve sa couleur (bandeaux, onglet actif, icônes,
   boutons, schémas) pour être identifiée d’un coup d’œil. La couleur
   arrive par --accent (posée par setAccent sur la page) et --pc / --cc.
   Les bandeaux restent en aplat, sans dégradé.
   ========================================================== */
:root, [data-theme="dark"] {
  --accent-ink: #FFFFFF;
  --accent-text: color-mix(in srgb, var(--accent) 88%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--card));
}
[data-theme="dark"] {
  --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, var(--card));
}
[data-theme="dark"] .btn.primary { color: #FFFFFF; }

/* bandeau de titre coloré, avec l’icône de la partie */
.hero { background-image: none !important; background-color: var(--accent) !important; color: #fff; border-radius: 16px; padding: 24px 24px 20px; margin-bottom: 16px; border-bottom: 0; }
.hero .hero-ic { display: block; color: rgba(255, 255, 255, .9); }
.hero .crumb { color: rgba(255, 255, 255, .88); padding-right: 96px; font-weight: 600; }
.hero .crumb a, [data-theme="dark"] .hero .crumb a { color: #fff; }
.hero h1 { color: #fff; padding-right: 96px; }
.hero p { color: rgba(255, 255, 255, .94); }
.hero .meta span { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .32); color: #fff; }

/* onglet de la partie active en couleur */
.part-tabs a { border-color: var(--line); background: var(--card); }
.part-tabs a .dot { width: 10px; height: 10px; }
.part-tabs a[aria-current="page"], [data-theme="dark"] .part-tabs a[aria-current="page"] { background: var(--pc); border-color: var(--pc); color: #fff; }
.part-tabs a[aria-current="page"] .dot { background: #fff; }

/* barre latérale : icônes de la couleur de leur partie */
.side-link .ic, .side-link[aria-current="page"] .ic { width: 20px; height: 20px; color: var(--pc, var(--accent)); }
.side-link[aria-current="page"] { background: var(--accent-soft); }

/* accueil : tuiles avec bande colorée et icône */
.tile .band { height: 72px; margin: -20px -20px 12px; background: var(--pc) !important; position: relative; display: block; }
.tile .band::before { display: none; }
.tile .band b { position: absolute; left: 16px; bottom: 10px; color: #fff; font-size: 14px; font-weight: 600; }
.tile .band .ic { display: block; position: absolute; right: 14px; bottom: 10px; width: 36px; height: 36px; color: #fff; }
.tile:hover { border-color: var(--pc); }
.chap-card .ic { background: color-mix(in srgb, var(--cc, var(--accent)) 13%, var(--card)); color: var(--cc, var(--accent)); }
.chap-card:hover { border-color: var(--cc, var(--accent)); }
.meter i { background: var(--pc, var(--accent)); }

/* chapitre et schémas : la couleur de la partie revient */
.sec > h2 .h-ic { background: var(--accent-soft); color: var(--accent-text); }
.why { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.why b:first-child, [data-theme="dark"] .why b:first-child { color: var(--accent-text); }
.anim-ctrl .seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
figure.schema .fig, .anim-host { background: color-mix(in srgb, var(--accent) 4%, var(--card)); }
.stat b, .score-big { color: var(--accent-text); }

/* fiches mémoire : liseré de la couleur du chapitre */
.memo { border-top: 4px solid var(--cc, var(--accent)); }
.memo h3::before { display: none; }

@media (max-width: 600px) {
  .hero { padding: 20px 16px 16px; }
  .hero h1, .hero .crumb { padding-right: 60px; }
  .tile .band { margin: -16px -16px 12px; }
}
