/* Consentement RGPD (mu-plugins/tpc-consentement.php) : bandeau et panneau de préférences.
   Sobre : fond noir, filet discret, boutons de la maquette. « Tout refuser » et
   « Tout accepter » ont exactement le même style (exigence CNIL). */

/* Bandeau : carte en bas à gauche, jamais de voile, le site reste utilisable. */
.consentement{
  position:fixed; z-index:140;
  left:var(--coin); bottom:var(--coin);
  width:min(400px, calc(100vw - 2 * var(--coin)));
  padding:18px 18px 14px;
  background:var(--surface);
  border:1px solid var(--bord-net);
  border-radius:var(--rayon);
  box-shadow:0 24px 50px -20px rgba(0,0,0,.95);
  color:var(--blanc);
  font-family:var(--courante);
}
.consentement[hidden]{ display:none; }
.consentement__titre{
  margin:0 0 6px;
  font-family:var(--titrage); font-weight:800; font-size:1rem;
  line-height:1.2; letter-spacing:-.01em; text-transform:uppercase;
}
.consentement__texte{ margin:0 0 12px; font-size:.875rem; line-height:1.5; color:#cfcfcf; }
.consentement__texte a,
.consentement-panneau__intro a{ color:var(--blanc); text-decoration:underline; text-underline-offset:3px; }
.consentement__texte a:hover,
.consentement-panneau__intro a:hover{ color:var(--jaune); }

/* Boutons à la largeur du contenu, retour à la ligne si la place manque (le lien
   « Personnaliser » passe alors dessous). min-width ≥ libellé « Tout accepter » :
   « Tout refuser » et « Tout accepter » ont toujours exactement la même taille. */
.consentement__actions{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.consentement__bouton{ flex:0 0 auto; width:auto; min-width:9.25rem; max-width:100%; padding:8px 12px; font-size:.8125rem; line-height:1.4; }
/* Bouton « Gérer mes préférences » de la politique de cookies : largeur du texte. */
.consentement__bouton--page{ width:auto; min-width:0; min-height:40px; padding:8px 16px; font-size:14px; }
.consentement__lien{
  flex:0 0 auto;
  margin:0; padding:4px 2px;
  background:none; border:0; border-radius:6px; cursor:pointer;
  font-family:var(--courante); font-weight:400; font-size:.875rem;
  color:#cfcfcf; text-decoration:underline; text-underline-offset:3px;
}
.consentement__lien:hover{ color:var(--jaune); }

/* La carte « achats récents » occupe le même coin : masquée tant que le bandeau est là. */
.tpc-cs-ouvert .achat{ visibility:hidden!important; }

/* Panneau de préférences (<dialog> modal, ouvert à la demande) */
.consentement-panneau{
  width:min(500px, calc(100vw - 32px));
  max-height:min(760px, calc(100vh - 24px));
  max-height:min(760px, calc(100svh - 24px));
  margin:auto; padding:0;
  background:var(--surface); color:var(--blanc);
  border:1px solid var(--bord-net); border-radius:var(--rayon);
  box-shadow:0 30px 70px -20px rgba(0,0,0,.95);
  font-family:var(--courante);
  overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain;
}
.consentement-panneau::backdrop{ background:rgba(0,0,0,.72); }
.consentement-panneau__corps{ padding:20px 22px 18px; }
.consentement-panneau__tete{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin:0 0 8px; }
.consentement-panneau__titre{
  margin:0; font-family:var(--titrage); font-weight:800;
  font-size:18px; line-height:1.2; text-transform:uppercase; letter-spacing:-.01em;
}
.consentement-panneau__fermer{
  flex:0 0 auto; display:flex; align-items:center; justify-content:center;
  width:36px; height:36px; margin:-6px -6px 0 0;
  background:none; border:1px solid transparent; border-radius:8px; color:var(--blanc); cursor:pointer;
}
.consentement-panneau__fermer:hover{ border-color:var(--bord-net); }
.consentement-panneau__fermer svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; }
.consentement-panneau__intro{ margin:0 0 4px; font-size:14px; line-height:1.5; color:#cfcfcf; }

.consentement-panneau__liste{ margin:0; padding:0; list-style:none; }
.consentement-cat{
  display:flex; align-items:flex-start; justify-content:space-between; gap:18px;
  padding:12px 0; border-bottom:1px solid var(--bord);
}
.consentement-cat__texte{ min-width:0; }
.consentement-cat__nom{
  display:block; margin:0 0 4px;
  font-family:var(--titrage); font-weight:700; font-size:15px; line-height:1.3; text-transform:uppercase; letter-spacing:.02em;
}
.consentement-cat__desc{ margin:0; font-size:13.5px; line-height:1.5; color:var(--doux); }
.consentement-cat__toujours{
  flex:0 0 auto; padding-top:2px;
  font-family:var(--titrage); font-weight:700; font-size:12px; line-height:1.3; letter-spacing:.04em; text-transform:uppercase; color:var(--jaune);
  white-space:nowrap;
}

/* Interrupteur : case à cocher native (role="switch"), dessinée. */
.consentement-interrupteur{ position:relative; flex:0 0 auto; width:46px; height:26px; margin-top:1px; }
.consentement-interrupteur input{
  position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer; z-index:1;
}
.consentement-interrupteur__piste{
  position:absolute; inset:0; border-radius:999px;
  background:#2b2b2b; border:1px solid var(--bord-net);
  transition:background var(--glisse), border-color var(--glisse);
}
.consentement-interrupteur__piste::after{
  content:""; position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%;
  background:#bdbdbd; transition:transform var(--glisse), background var(--glisse);
}
.consentement-interrupteur input:checked + .consentement-interrupteur__piste{ background:var(--jaune); border-color:var(--jaune); }
.consentement-interrupteur input:checked + .consentement-interrupteur__piste::after{ transform:translateX(20px); background:var(--noir); }
.consentement-interrupteur input:focus-visible + .consentement-interrupteur__piste{ outline:2px solid var(--jaune); outline-offset:3px; }

/* Ligne de boutons collée en bas du panneau : toujours visible pendant le défilement. */
.consentement-panneau__actions{
  position:sticky; bottom:0; z-index:1;
  display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px;
  margin:6px -22px -18px; padding:12px 22px 16px;
  background:var(--surface); border-top:1px solid var(--bord);
}
.consentement__bouton--contour{
  --bg:transparent; --fg:var(--blanc);
  border-color:var(--bord-net);
}
.consentement__bouton--contour:hover{ box-shadow:none; border-color:var(--blanc); }

/* Politique de cookies : noms de cookies */
.doc__corps .carac code{ font-family:ui-monospace, Menlo, Consolas, monospace; font-size:.82em; color:var(--jaune); word-break:break-word; overflow-wrap:anywhere; }
.doc__corps .carac th, .doc__corps .carac td{ min-width:0; overflow-wrap:anywhere; }

/* Mobile : bande pleine largeur collée en bas, panneau en « feuille » depuis le bas.
   Tailles plafonnées en px (min()) : une police système agrandie ne fait pas exploser le bandeau. */
@media (max-width:560px){
  .consentement{
    left:0; right:0; bottom:0; width:auto; max-height:45svh; overflow-y:auto;
    padding:12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    border-width:1px 0 0; border-radius:0; box-shadow:0 -12px 30px -18px rgba(0,0,0,.9);
  }
  .consentement__titre{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; margin:0; }
  .consentement__texte{ margin:0 0 10px; font-size:min(.875rem, 16px); line-height:1.45; }
  .consentement__actions{ gap:8px; }
  /* Refuser et Accepter : même base, même croissance, même largeur minimale → identiques. */
  .consentement__bouton{ flex:1 1 0; min-width:9.4em; min-height:40px; padding:7px 6px; font-size:min(.8125rem, 15px); letter-spacing:.01em; }
  .consentement__lien{ flex:0 0 auto; display:inline-flex; align-items:center; min-height:40px; padding:0 2px; font-size:min(.875rem, 16px); }

  .consentement-panneau{
    width:100%; max-width:100%; margin:auto 0 0;
    max-height:75vh; max-height:75svh;
    border-width:1px 0 0; border-radius:14px 14px 0 0;
  }
  .consentement-panneau__corps{ padding:14px 16px 0; }
  .consentement-panneau__tete{ margin-bottom:4px; align-items:center; }
  .consentement-panneau__titre{ font-size:min(1.05rem, 19px); }
  .consentement-panneau__intro{ font-size:min(.875rem, 16px); line-height:1.45; margin-bottom:2px; }
  /* Une ligne compacte par catégorie : nom + interrupteur, description dessous. */
  .consentement-cat{ display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; column-gap:12px; row-gap:2px; padding:10px 0; }
  .consentement-cat__texte{ display:contents; }
  .consentement-cat__nom{ grid-column:1; grid-row:1; margin:0; font-size:min(.875rem, 16px); }
  .consentement-interrupteur, .consentement-cat__toujours{ grid-column:2; grid-row:1; margin:0; padding:0; }
  .consentement-cat__toujours{ font-size:min(.75rem, 14px); }
  .consentement-cat__desc{ grid-column:1 / -1; grid-row:2; font-size:min(.875rem, 16px); line-height:1.45; }
  .consentement-panneau__actions{
    justify-content:flex-start; gap:8px;
    margin:6px -16px 0; padding:10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .consentement-panneau__actions .consentement__bouton{ min-width:0; }
  .consentement__bouton--contour{ flex:1 1 100%; }
}

/* Écran bas (téléphone en paysage) : bandeau en bande large, titre gardé pour les lecteurs d'écran seulement. */
@media (max-height:500px) and (min-width:561px){
  .consentement{ right:var(--coin); width:auto; max-width:760px; padding:12px 16px 12px; }
  .consentement__texte{ margin-bottom:10px; }
}
@media (max-height:430px){
  .consentement__titre{ position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; margin:0; }
  .consentement-panneau__corps{ padding-top:16px; }
}

@media (prefers-reduced-motion:reduce){
  .consentement-interrupteur__piste, .consentement-interrupteur__piste::after{ transition:none; }
}

@media print{ .consentement, .consentement-panneau{ display:none!important; } }
