/* =========================================================================
   LE BANDEAU DES COOKIES (templates/_bandeau_cookies.html)
   =========================================================================
   Une feuille a part, et non un <style> dans la page : les pages publiques
   (dont « Etat du service ») ne portent ainsi aucun caractere qui ne soit pas
   le leur.

   RIEN NE RESTE CACHE SOUS LE BANDEAU. Tant qu'il est ouvert, le script pose
   sa hauteur dans --bp-cookies-h et la classe « bp-cookies-ouvert » sur
   <html> : la page gagne un espace de cette hauteur en bas (le dernier bouton
   peut remonter au-dessus du bandeau), et un element mis en vue - au clavier
   comme au doigt - s'arrete au-dessus de lui (scroll-padding ; WCAG 2.4.11,
   le focus n'est pas masque).

   Les couleurs sont les jetons du site (biopoint.css, :root). L'accueil ne
   charge pas biopoint.css : chaque jeton est donc repris avec, en repli, la
   valeur du site a l'identique (tests_pages_publiques.py compare les deux).
   ========================================================================= */
.bp-cookies { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
    display: flex; justify-content: center; padding: 0 12px calc(12px + env(safe-area-inset-bottom));
    pointer-events: none; transform: translateY(110%);
    transition: transform var(--bp-duree-3, 240ms) var(--bp-courbe, cubic-bezier(.2, 0, 0, 1));
    font-family: var(--bp-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", "Noto Sans", Arial, sans-serif); }
.bp-cookies.bp-cookies-visible { transform: translateY(0); }
.bp-cookies[hidden] { display: none; }
.bp-cookies-boite { pointer-events: auto; max-width: 880px; width: 100%; box-sizing: border-box;
    background: var(--bp-surface, #111115); color: var(--bp-text, #f3f3f6);
    border: 1px solid var(--bp-border-strong, #383843); border-radius: var(--bp-r-lg, 16px);
    box-shadow: var(--bp-shadow-lg, 0 24px 64px rgba(0, 0, 0, 0.55)); padding: 16px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
@media (min-width: 561px) { .bp-cookies-boite { padding: 20px 24px; } }
.bp-cookies-texte { flex: 1 1 320px; margin: 0; font-size: .875rem; line-height: 1.5; color: var(--bp-text-2, #c3c3cd); }
.bp-cookies-texte strong { color: var(--bp-text, #f3f3f6); font-weight: 600; }
/* La question d'abord, sur sa ligne ; le detail dessous. */
.bp-cookies-texte strong:first-child { display: block; margin-bottom: 4px; font-size: .9375rem; line-height: 1.4; }
.bp-cookies-boutons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bp-cookies-lien { color: var(--bp-primary-soft, #8fb5ff); font-size: .875rem; text-decoration: underline;
    text-decoration-thickness: 1px; text-underline-offset: 3px;
    min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.bp-cookies-lien:hover { color: var(--bp-text, #f3f3f6); }
/* « Accepter » et « Refuser » : LA MEME apparence, la meme taille, le meme poids (CNIL) -
   refuser n'est ni plus discret ni plus difficile qu'accepter. */
.bp-cookies-choix { min-height: 44px; min-width: 112px; padding: 0 16px;
    border: 1px solid var(--bp-border-control, #707080); border-radius: var(--bp-r-sm, 8px);
    background: var(--bp-surface-3, #1f1f25); color: var(--bp-text, #f3f3f6);
    font-weight: 600; font-size: .9375rem; font-family: inherit; cursor: pointer;
    transition: background-color var(--bp-duree-1, 120ms) ease; }
.bp-cookies-choix:hover { background: var(--bp-border-strong, #383843); }
.bp-cookies-choix:focus-visible, .bp-cookies-lien:focus-visible { outline: 2px solid var(--bp-primary-soft, #8fb5ff);
    outline-offset: 2px; }

html.bp-cookies-ouvert { scroll-padding-bottom: var(--bp-cookies-h, 0px); }
html.bp-cookies-ouvert body::after { content: ""; display: block; flex: none;
    height: var(--bp-cookies-h, 0px); }

/* LE CHOIX D'ABORD (data-bp-cookies-bloquant="oui") : un voile couvre toute la page tant
   que le visiteur n'a ni accepte ni refuse ; rien ne se clique ni ne defile dessous, et le
   script rend le reste de la page inerte (le clavier reste dans le bandeau). */
.bp-cookies.bp-cookies-bloquant { top: 0; align-items: center; pointer-events: auto;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--bp-overlay, rgba(5, 5, 8, 0.72));
    transform: none; opacity: 0; transition: opacity var(--bp-duree-3, 240ms) ease-out; touch-action: none;
    overscroll-behavior: contain; }
.bp-cookies.bp-cookies-bloquant.bp-cookies-visible { opacity: 1; }
.bp-cookies-bloquant .bp-cookies-boite { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
    overflow-y: auto; touch-action: pan-y; }
html.bp-cookies-bloque, html.bp-cookies-bloque body { overflow: hidden; }

/* Au telephone, les deux choix cote a cote, de la meme largeur. */
@media (max-width: 560px) {
    .bp-cookies-boutons { width: 100%; }
    .bp-cookies-lien { flex: 1 1 100%; justify-content: center; }
    .bp-cookies-choix { flex: 1 1 0; }
    .bp-cookies.bp-cookies-bloquant { align-items: flex-end; }
}

/* LA PUBLICITE LINKEDIN (data-bp-publicite="oui") : le premier niveau et le panneau
   « Gérer mes préférences », l'un a la place de l'autre, dans la meme boite. Les trois
   boutons du premier niveau, comme ceux du panneau, ont la regle .bp-cookies-choix. */
.bp-cookies-niveau { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center;
    gap: 12px 24px; min-width: 0; }
.bp-cookies-niveau[hidden] { display: none; }
.bp-cookies-categories { list-style: none; margin: 0; padding: 0; flex: 1 1 100%;
    display: grid; gap: 8px; }
.bp-cookies-categorie { border: 1px solid var(--bp-border, #26262e); border-radius: var(--bp-r, 12px); padding: 4px 16px 12px; }
.bp-cookies-categorie p { margin: 0; font-size: .8125rem; line-height: 1.5; color: var(--bp-text-2, #c3c3cd); }
.bp-cookies-categorie-tete { display: flex; align-items: center; justify-content: space-between;
    gap: 12px; min-height: 44px; }
.bp-cookies-categorie-nom { font-weight: 600; color: var(--bp-text, #f3f3f6); font-size: .875rem; cursor: pointer; }
.bp-cookies-toujours { font-size: .8125rem; font-weight: 500; color: var(--bp-text-3, #9898a6); text-align: right; }
/* L'interrupteur : une case a cocher (role="switch"), desactivee par defaut. */
.bp-cookies-interrupteur { -webkit-appearance: none; appearance: none; flex: none; position: relative;
    width: 44px; height: 24px; margin: 0; border-radius: 999px; border: 1px solid var(--bp-border-control, #707080);
    background: var(--bp-bg, #09090b); cursor: pointer;
    transition: background-color var(--bp-duree-1, 120ms) ease, border-color var(--bp-duree-1, 120ms) ease; }
.bp-cookies-interrupteur::after { content: ""; position: absolute; top: -11px; right: 0; bottom: -11px; left: 0; }
.bp-cookies-interrupteur::before { content: ""; position: absolute; top: 2px; left: 2px; width: 18px;
    height: 18px; border-radius: 50%; background: var(--bp-text, #f3f3f6);
    transition: transform var(--bp-duree-1, 120ms) var(--bp-courbe, cubic-bezier(.2, 0, 0, 1)); }
.bp-cookies-interrupteur:checked { background: var(--bp-primary, #1257d6); border-color: var(--bp-primary, #1257d6); }
.bp-cookies-interrupteur:checked::before { transform: translateX(20px); }
.bp-cookies-interrupteur:focus-visible { outline: 2px solid var(--bp-primary-soft, #8fb5ff); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .bp-cookies, .bp-cookies.bp-cookies-bloquant, .bp-cookies-choix, .bp-cookies-interrupteur,
    .bp-cookies-interrupteur::before { transition: none; }
}
