/*
 * Thèmes de couleur daltonien, pride et 1er août, communs à tous les modules du CdC (bouton du thème du bandeau commun, thèmes
 * cochés dans Portail › Administration › Thème de couleur). Fichier unique dans cdcapps/Commun, chargé par chaque module.
 *
 * Les deux thèmes partent du thème clair (data-theme="light") et ajoutent data-cdc-theme="daltonien" ou "pride" sur
 * <html> : ils redéfinissent les variables de couleur de chaque palette (cdc-base.css d'Agenda, Contacts, Documents,
 * Journal de bord et Interventions ; Portail ; Horaire ; Planning et Tableau de piquet ; bandeau ; notifications).
 * Une variable qu'un module n'utilise pas est sans effet. Sélecteur « html:root[…] » : plus fort que les « :root » et
 * « :root[data-theme=light] » des modules, quel que soit l'ordre des feuilles. L'impression reste celle du thème clair.
 * Pages affichées dans le kiosque (html.en-kiosque) : thème propre au kiosque (clair / sombre), sans ces couleurs.
 */

/* ---------- Daltonien : rouge et vert (indiscernables pour la plupart des daltoniens) remplacés par la palette
   d'Okabe et Ito — bleu = correct / disponible, orange vermillon = erreur / manquant, jaune orangé = attention. ---------- */
@media screen {
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) {
    /* Portail */
    --succes-fond: #dcebf7;
    --succes-texte: #00507f;
    --alerte-fond: #fbe4d3;
    --alerte-texte: #8f3a00;
    --danger: #c25400;
    /* Horaire */
    --success: #0072b2;
    --error: #c25400;
    /* Planning piquet */
    --ok: #0072b2;
    --ok-soft: #dcebf7;
    --amber: #b07800;
    --amber-soft: #fdf1d6;
    --warn: #c25400;
    --warn-soft: #fbe4d3;
    --hol-vd: #d9ecf7;
    --cal-vd: #a9d2ec;
    /* Tableau de piquet */
    --ok-text: #00507f;
    --ok-bg: #dcebf7;
    --alert: #c25400;
    --alert-text: #8f3a00;
    --alert-bg: #fbe4d3;
    --repl: #b07800;
    --repl-bg: #fff8e6;
    --repl-text: #6b4a00;
    /* Agenda : exploitation (vert) en bleu-vert, critique (rouge) en vermillon */
    --exploitation: #009e73;
    --niv-critique-fond: #c25400;
    --ferie: #56708a;
    /* Journal de bord : ouvert orange, clos bleu */
    --jdb-clos-fond: #e6f1fa;
    --jdb-clos-bord: #8cc3e8;
    --jdb-clos-texte: #00507f;
  }
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) .cdc-notifications {
    --cdc-n-succes: #00507f;
    --cdc-n-succes-fond: #dcebf7;
    --cdc-n-info: #3b3b8f;
    --cdc-n-info-fond: #ececf8;
    --cdc-n-avertissement: #6b4a00;
    --cdc-n-avertissement-fond: #fdf1d6;
    --cdc-n-erreur: #8f3a00;
    --cdc-n-erreur-fond: #fbe4d3;
  }
  /* Horaire : couvertures, badges et totaux écrits en dur (vert / rouge type tableur). */
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) :is(table.planning td.coverage, .legend .coverage, table.planning td.badges, table.planning td.available).ok,
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) table.planning tfoot td.total.least-hours { background-color: #cfe5f5; color: #00466f; }
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) :is(table.planning td.coverage, .legend .coverage, table.planning td.badges, table.planning td.available).missing,
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) table.planning tfoot td.total.most-hours { background-color: #fbd9c0; color: #7a3100; }
  /* Icône des lunettes : verres jaune et bleu pour rester visibles dans ce thème. */
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) .cdc-i-daltonien rect:first-of-type { fill: #e69f00; }
  html:root[data-cdc-theme="daltonien"]:not(.en-kiosque) .cdc-i-daltonien rect:last-of-type { fill: #0072b2; }
}

/* ---------- Pride : fond lavande, violet et rose, bandeau violet souligné d'un arc-en-ciel. ---------- */
@media screen {
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) {
    /* cdc-base.css (Agenda, Contacts, Documents, Journal de bord, Interventions) et Portail */
    --fond: #f7f1fb;
    --surface: #ffffff;
    --surface-2: #efe3f7;
    --bordure: #e0cdee;
    --texte: #2b1739;
    --texte-doux: #6e5683;
    --lien: #8e24aa;
    --carte: #ffffff;
    --discret: #6e5683;
    --accent: #8e24aa;
    --accent-texte: #ffffff;
    /* Horaire */
    --text: #2b1739;
    --muted: #6e5683;
    --border: #e0cdee;
    --bg: #f7f1fb;
    --card: #ffffff;
    --head: #f1e6f8;
    --line: #e6d6f1;
    --line-strong: #a07fb8;
    --subtle: #faf5fd;
    --menu: #f1e6f8;
    /* Planning piquet */
    --ink: #2b1739;
    --accent-ink: #ffffff;
    --accent-soft: #f6e3fa;
    --bar: #5b1f7a;
    --bar-ink: #ffffff;
    --bar-muted: #f0c4e4;
    --bar-line: #8a3fae;
    --stripe: rgba(91, 31, 122, .06);
    /* Tableau de piquet */
    --navy: #5b1f7a;
    --navy-2: #6f2a91;
    --navy-line: #9554b5;
    --on-navy-muted: #f0d5ec;
    --primary: #8e24aa;
    --primary-dark: #6a1b82;
    --info: #6a1b82;
    --info-bg: #f6e9fb;
    --surface-2: #f6eefb;
    --link: #8e24aa;
    --link-hover: #c2185b;
    --tile-line: rgba(91, 31, 122, .16);
    --tile-line-strong: rgba(91, 31, 122, .28);
    --mode-text: #c2185b;
    /* Agenda */
    --aujourdhui: #c2185b;
    /* Rose des titres et des liens survolés */
    --cdc-pride-rose: #c2185b;
    --cdc-arc-en-ciel: linear-gradient(90deg, #e40303 0 16.66%, #ff8c00 0 33.33%, #ffed00 0 50%, #008026 0 66.66%, #004dff 0 83.33%, #750787 0);
  }
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) .cdc-header {
    --cdc-header-bg: #5b1f7a;
    background: linear-gradient(90deg, #4a1766, #7b1f86 55%, #b0186a);
    border-bottom: 4px solid transparent;
    border-image: var(--cdc-arc-en-ciel) 1;
  }
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) h1 { color: #6a1b82; }
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) a:hover { color: var(--cdc-pride-rose); }
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) .cdc-header a:hover { color: inherit; }
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) :focus-visible { outline-color: var(--cdc-pride-rose); }
  /* Petit arc-en-ciel sous les titres de page (fond plutôt que ::after : titres en ligne ou en flex compris). */
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) :is(main, .page) h1 {
    padding-bottom: 6px;
    background: var(--cdc-arc-en-ciel) left bottom / 4.5rem 4px no-repeat;
  }
  /* Bouton principal en dégradé violet → rose (Portail et modules cdc-base). */
  html:root[data-cdc-theme="pride"]:not(.en-kiosque) .bouton.principal {
    background: linear-gradient(90deg, #7b1fa2, #c2185b);
    border-color: #8e24aa;
    color: #fff;
  }
}

/* ---------- 1er août (fête nationale suisse) : rouge et blanc du drapeau, bandeau rouge semé de croix suisses. ---------- */
@media screen {
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) {
    /* cdc-base.css et Portail */
    --fond: #fff7f6;
    --surface: #ffffff;
    --surface-2: #fbe7e5;
    --bordure: #f0cfcb;
    --texte: #2a1312;
    --texte-doux: #7a4b47;
    --lien: #c8102e;
    --carte: #ffffff;
    --discret: #7a4b47;
    --accent: #da291c;
    --accent-texte: #ffffff;
    /* Horaire */
    --text: #2a1312;
    --muted: #7a4b47;
    --border: #f0cfcb;
    --bg: #fff7f6;
    --card: #ffffff;
    --head: #fbeceb;
    --line: #f3dcd9;
    --line-strong: #b57d77;
    --subtle: #fffafa;
    --menu: #fbeceb;
    /* Planning piquet */
    --ink: #2a1312;
    --accent-ink: #ffffff;
    --accent-soft: #fde4e1;
    --bar: #b3170f;
    --bar-ink: #ffffff;
    --bar-muted: #ffd0cb;
    --bar-line: #d9443a;
    --stripe: rgba(179, 23, 15, .05);
    /* Tableau de piquet */
    --navy: #b3170f;
    --navy-2: #c41f15;
    --navy-line: #e0584f;
    --on-navy-muted: #ffdcd8;
    --primary: #da291c;
    --primary-dark: #a8140b;
    --info: #a8140b;
    --info-bg: #fdeceb;
    --surface-2: #fdf1f0;
    --link: #c8102e;
    --link-hover: #8f0c08;
    --tile-line: rgba(179, 23, 15, .15);
    --tile-line-strong: rgba(179, 23, 15, .27);
    /* Agenda */
    --aujourdhui: #da291c;
    /* Croix suisse blanche (bras = 1/6 de la largeur, longueur 7/6 de l'épaisseur, proportions officielles). */
    --cdc-croix-suisse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23ffffff' fill-opacity='.22' d='M13 6h6v7h7v6h-7v7h-6v-7H6v-6h7z'/%3E%3C/svg%3E");
  }
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) .cdc-header {
    --cdc-header-bg: #da291c;
    background-color: #da291c;
    background-image: var(--cdc-croix-suisse);
    background-size: 2.25rem 2.25rem;
    background-repeat: repeat;
    border-bottom: 3px solid #ffffff;
    box-shadow: 0 1px 0 #da291c;
  }
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) .cdc-header-menu-list { background-color: #b3170f; }
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) h1 { color: #b3170f; }
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) :focus-visible { outline-color: #da291c; }
  /* Petit drapeau sous les titres de page : bande rouge et blanche. */
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) :is(main, .page) h1 {
    padding-bottom: 6px;
    background: linear-gradient(90deg, #da291c 0 50%, #f0cfcb 0) left bottom / 4.5rem 4px no-repeat;
  }
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) .bouton.principal { background: #da291c; border-color: #da291c; color: #fff; }
  /* Icône du bouton sur le bandeau rouge : contour blanc visible. */
  html:root[data-cdc-theme="suisse"]:not(.en-kiosque) .cdc-i-suisse rect { stroke: #ffffff; }
}
