/*
 * Palettes de couleurs des pages publiques (vitrine, article de blog).
 *
 * Une palette redéfinit les variables de la charte (--accent, --accent-dark, --accent-soft, --orange…, voir css/main.css)
 * sur la balise <html data-palette="code"> posée par layouts/base.php. Clair ET sombre : le mode sombre suit le réglage
 * de l'appareil, [data-theme] ou la case #bascule-theme. « bleu » = la charte d'origine : seul son mode sombre est écrit ici.
 *
 * Sens des variables en mode sombre (convention de ces palettes) : --accent est le remplissage des boutons (texte blanc dessus),
 * --accent-dark / --titre-bleu sont la teinte CLAIRE des textes et liens colorés.
 * RÈGLES DE LISIBILITÉ (contrôle du 16/11/2026) : un TEXTE ou un anneau de focus coloré s'écrit avec --titre-bleu, jamais avec --accent
 * (en sombre, --accent est un fond de bouton : 2,3:1 à 3,2:1 sur le fond de page, trop pâle pour du petit texte) ; le texte POSÉ SUR --accent
 * s'écrit var(--on-accent, #fff) (blanc, sauf thème dont l'accent est clair : Artistique « Original » en sombre).
 *
 * Chargée par les layouts qui affichent un thème : vitrine (layouts/vitrine.php) et blog (layouts/_article_theme.php).
 * Ajouter une palette : voir docs/metier/themes-palettes.md §9. Les échantillons du formulaire (.vt-palette-swatch--*) restent
 * dans vitrines.css.
 */
:root[data-palette="vert"] {
  --accent: #2f6847; --accent-dark: #214b34; --accent-soft: #e6f0e7;
  --orange: #b66f55; --orange-texte: #914c37; --orange-soft: #f7ece7; --orange-puce: #b66f55;
  --titre-bleu: var(--accent-dark);
}
:root[data-palette="bordeaux"] {
  --accent: #7c3046; --accent-dark: #5c2435; --accent-soft: #f3e8ec;
  --orange: #ad7448; --orange-texte: #83552f; --orange-soft: #f5ede4; --orange-puce: #ad7448;
  --titre-bleu: var(--accent-dark);
}
:root[data-palette="graphite"] {
  --accent: #45566d; --accent-dark: #2e3b4d; --accent-soft: #e9edf2;
  --orange: #b66f55; --orange-texte: #914c37; --orange-soft: #f7ece7; --orange-puce: #b66f55;
  --titre-bleu: var(--accent-dark);
}
/* « Terre cuite & bois » (terracotta) : palette du thème vitrine Artisans (16-17/11/2026). Elle change AUSSI le fond et le texte
 * (papier chaud, encre brune), donc ses blocs clair et sombre redéfinissent --bg, --fg, --muted, --card-bg, --border.
 * Contrastes calculés (WCAG AA) : textes ≥ 5,1:1, blanc sur bouton ≥ 5,7:1, icônes ocre ≥ 3:1, en clair et en sombre. */
:root[data-palette="terracotta"] {
  --bg: #fbf7f1; --fg: #2b211b; --muted: #6a5a4e; --card-bg: #f3ebe0; --border: #e3d6c5;
  --accent: #a3472b; --accent-dark: #7a3320; --accent-soft: #f6e6dd;
  --orange: #a86c33; --orange-texte: #85511f; --orange-soft: #f5eadc; --orange-puce: #a86c33;
  --titre-bleu: var(--accent-dark);
}

/* « Clinique » : palette du thème vitrine Santé (18/11/2026). Vert d'eau sur blanc, calme et lisible ; le « orange » de la charte
 * devient un vert d'eau secondaire (filets, puces). Contrastes calculés : textes ≥ 6,2:1, blanc sur bouton 5,5:1, en clair et en sombre. */
:root[data-palette="clinique"] {
  --bg: #ffffff; --fg: #10292d; --muted: #4a5f63; --card-bg: #f2f7f7; --border: #dde9e8;
  --accent: #0f766e; --accent-dark: #115e59; --accent-soft: #e3f2ef;
  --orange: #14857a; --orange-texte: #115e59; --orange-soft: #e3f2ef; --orange-puce: #14857a;
  --titre-bleu: var(--accent-dark);
}

/* « Braise » : palette du thème vitrine Gastro (18/11/2026). Rouge braise sur papier chaud, salle « soir » en sombre ; elle change aussi le
 * fond et le texte. Contrastes calculés (WCAG AA) : clair, texte 16,4:1, gris 7,1:1, titres colorés 9,4:1, blanc sur bouton 6,5:1, orange
 * de texte 4,9:1 ; sombre, texte 18,1:1, gris 7,8:1, titres colorés 10,4:1, blanc sur bouton 6,5:1. L'orange vif reste décoratif. */
:root[data-palette="braise"] {
  --bg: #faf7f2; --fg: #1c1917; --muted: #57534e; --card-bg: #ffffff; --border: #e6e0d6;
  --accent: #b91c1c; --accent-dark: #7f1d1d; --accent-soft: #fdf0ee;
  --orange: #ea580c; --orange-texte: #c2410c; --orange-soft: #fff1e6; --orange-puce: #ea580c;
  --titre-bleu: var(--accent-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-palette="bleu"],
  :root[data-theme="dark"][data-palette="bleu"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="bleu"] {
    --accent: #2f5fae; --accent-dark: #a9c5f2; --accent-soft: #172846;
    --orange: #fb923c; --orange-texte: #fdba74; --orange-soft: #2a1c10; --orange-puce: #f97316;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="bleu"] {
    --accent: #1d4ed8; --accent-dark: #1e3a8a; --accent-soft: #eaf0fe;
    --orange: #f97316; --orange-texte: #c2410c; --orange-soft: #fff3e8; --orange-puce: #ea580c;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="vert"],
  :root[data-theme="dark"][data-palette="vert"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="vert"] {
    --accent: #2f7249; --accent-dark: #a7d8b7; --accent-soft: #183225;
    --orange: #dc8d6c; --orange-texte: #f0b89f; --orange-soft: #34231d; --orange-puce: #dc8d6c;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="vert"] {
    --accent: #2f6847; --accent-dark: #214b34; --accent-soft: #e6f0e7;
    --orange: #b66f55; --orange-texte: #914c37; --orange-soft: #f7ece7; --orange-puce: #b66f55;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="bordeaux"],
  :root[data-theme="dark"][data-palette="bordeaux"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="bordeaux"] {
    --accent: #80364c; --accent-dark: #e4a6b7; --accent-soft: #371e27;
    --orange: #d29768; --orange-texte: #efc19c; --orange-soft: #33261b; --orange-puce: #d29768;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="bordeaux"] {
    --accent: #7c3046; --accent-dark: #5c2435; --accent-soft: #f3e8ec;
    --orange: #ad7448; --orange-texte: #83552f; --orange-soft: #f5ede4; --orange-puce: #ad7448;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="graphite"],
  :root[data-theme="dark"][data-palette="graphite"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="graphite"] {
    --accent: #435b74; --accent-dark: #afc4db; --accent-soft: #202b38;
    --orange: #d98b60; --orange-texte: #f0b895; --orange-soft: #34251d; --orange-puce: #d98b60;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="graphite"] {
    --accent: #45566d; --accent-dark: #2e3b4d; --accent-soft: #e9edf2;
    --orange: #b66f55; --orange-texte: #914c37; --orange-soft: #f7ece7; --orange-puce: #b66f55;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="terracotta"],
  :root[data-theme="dark"][data-palette="terracotta"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="terracotta"] {
    --bg: #1a1512; --fg: #f1e9e0; --muted: #b6a699; --card-bg: #251e19; --border: #3b3029;
    --accent: #a84a2c; --accent-dark: #f0b597; --accent-soft: #3a2219;
    --orange: #d39a5f; --orange-texte: #e8bd8c; --orange-soft: #33261a; --orange-puce: #d39a5f;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="terracotta"] {
    --bg: #fbf7f1; --fg: #2b211b; --muted: #6a5a4e; --card-bg: #f3ebe0; --border: #e3d6c5;
    --accent: #a3472b; --accent-dark: #7a3320; --accent-soft: #f6e6dd;
    --orange: #a86c33; --orange-texte: #85511f; --orange-soft: #f5eadc; --orange-puce: #a86c33;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="clinique"],
  :root[data-theme="dark"][data-palette="clinique"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="clinique"] {
    --bg: #0b1719; --fg: #e4f0f0; --muted: #9db3b6; --card-bg: #122427; --border: #1f3a3e;
    --accent: #0f766e; --accent-dark: #7fd6cb; --accent-soft: #143a37;
    --orange: #2bb3a3; --orange-texte: #7fd6cb; --orange-soft: #143a37; --orange-puce: #2bb3a3;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="clinique"] {
    --bg: #ffffff; --fg: #10292d; --muted: #4a5f63; --card-bg: #f2f7f7; --border: #dde9e8;
    --accent: #0f766e; --accent-dark: #115e59; --accent-soft: #e3f2ef;
    --orange: #14857a; --orange-texte: #115e59; --orange-soft: #e3f2ef; --orange-puce: #14857a;
    --titre-bleu: var(--accent-dark);
  }
  :root:not([data-theme="light"])[data-palette="braise"],
  :root[data-theme="dark"][data-palette="braise"],
  html:not([data-theme="light"]):has(#bascule-theme:not(:checked))[data-palette="braise"] {
    --bg: #0c0a09; --fg: #f5f5f4; --muted: #a8a29e; --card-bg: #1c1917; --border: #292524;
    --accent: #b91c1c; --accent-dark: #fca5a5; --accent-soft: #3a1515;
    --orange: #fb923c; --orange-texte: #fdba74; --orange-soft: #2a1c10; --orange-puce: #f97316;
    --titre-bleu: var(--accent-dark);
  }
  html:has(#bascule-theme:checked)[data-palette="braise"] {
    --bg: #faf7f2; --fg: #1c1917; --muted: #57534e; --card-bg: #ffffff; --border: #e6e0d6;
    --accent: #b91c1c; --accent-dark: #7f1d1d; --accent-soft: #fdf0ee;
    --orange: #ea580c; --orange-texte: #c2410c; --orange-soft: #fff1e6; --orange-puce: #ea580c;
    --titre-bleu: var(--accent-dark);
  }
}

@media (prefers-color-scheme: light) {
  :root[data-theme="dark"][data-palette="bleu"],
  html:has(#bascule-theme:checked)[data-palette="bleu"] {
    --accent: #2f5fae; --accent-dark: #a9c5f2; --accent-soft: #172846;
    --orange: #fb923c; --orange-texte: #fdba74; --orange-soft: #2a1c10; --orange-puce: #f97316;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="vert"],
  html:has(#bascule-theme:checked)[data-palette="vert"] {
    --accent: #2f7249; --accent-dark: #a7d8b7; --accent-soft: #183225;
    --orange: #dc8d6c; --orange-texte: #f0b89f; --orange-soft: #34231d; --orange-puce: #dc8d6c;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="bordeaux"],
  html:has(#bascule-theme:checked)[data-palette="bordeaux"] {
    --accent: #80364c; --accent-dark: #e4a6b7; --accent-soft: #371e27;
    --orange: #d29768; --orange-texte: #efc19c; --orange-soft: #33261b; --orange-puce: #d29768;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="graphite"],
  html:has(#bascule-theme:checked)[data-palette="graphite"] {
    --accent: #435b74; --accent-dark: #afc4db; --accent-soft: #202b38;
    --orange: #d98b60; --orange-texte: #f0b895; --orange-soft: #34251d; --orange-puce: #d98b60;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="terracotta"],
  html:has(#bascule-theme:checked)[data-palette="terracotta"] {
    --bg: #1a1512; --fg: #f1e9e0; --muted: #b6a699; --card-bg: #251e19; --border: #3b3029;
    --accent: #a84a2c; --accent-dark: #f0b597; --accent-soft: #3a2219;
    --orange: #d39a5f; --orange-texte: #e8bd8c; --orange-soft: #33261a; --orange-puce: #d39a5f;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="clinique"],
  html:has(#bascule-theme:checked)[data-palette="clinique"] {
    --bg: #0b1719; --fg: #e4f0f0; --muted: #9db3b6; --card-bg: #122427; --border: #1f3a3e;
    --accent: #0f766e; --accent-dark: #7fd6cb; --accent-soft: #143a37;
    --orange: #2bb3a3; --orange-texte: #7fd6cb; --orange-soft: #143a37; --orange-puce: #2bb3a3;
    --titre-bleu: var(--accent-dark);
  }
  :root[data-theme="dark"][data-palette="braise"],
  html:has(#bascule-theme:checked)[data-palette="braise"] {
    --bg: #0c0a09; --fg: #f5f5f4; --muted: #a8a29e; --card-bg: #1c1917; --border: #292524;
    --accent: #b91c1c; --accent-dark: #fca5a5; --accent-soft: #3a1515;
    --orange: #fb923c; --orange-texte: #fdba74; --orange-soft: #2a1c10; --orange-puce: #f97316;
    --titre-bleu: var(--accent-dark);
  }
}
