/* ==========================================================================
   Archange 140 : bandeau et préférences cookies (mu-plugin archange140-consent)
   Charte du thème archange140 : fond parchemin, filet or, texte nuit, titres Cinzel,
   texte Inter, boutons capitales espacées. Carte en position fixe : aucun espace réservé
   dans la page, pas de décalage (CLS), pas de voile sur le site. Valeurs de repli si les
   variables du thème sont absentes.
   ========================================================================== */

.a140-cc {
  --cc-nuit: var(--wp--preset--color--nuit, #131116);
  --cc-encre: var(--wp--preset--color--encre, #25212A);
  --cc-pierre: var(--wp--preset--color--pierre, #6B6358);
  --cc-lin: var(--wp--preset--color--lin, #E4D9C6);
  --cc-fond: var(--wp--preset--color--parchemin, #F4EEE3);
  --cc-ivoire: var(--wp--preset--color--ivoire, #FBF8F2);
  --cc-or: var(--wp--preset--color--or, #C2A063);
  --cc-or-profond: var(--wp--preset--color--or-profond, #7D5F28);
  --cc-pourpre: var(--wp--preset--color--pourpre, #8B1E24);
  --cc-marial: var(--wp--preset--color--marial, #1E3557);
  --cc-titre: var(--wp--preset--font-family--inscription, Cinzel, "Trajan Pro", Georgia, serif);
  --cc-texte: var(--wp--preset--font-family--sans, Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --cc-rayon: 2px;
  position: fixed;
  z-index: 9990;
  left: 16px;
  right: 16px;
  bottom: 16px;
  box-sizing: border-box;
  max-width: 980px;
  max-height: calc(100vh - 32px);
  margin: 0 auto;
  padding: 24px 26px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cc-fond);
  color: var(--cc-nuit);
  border: 1px solid var(--cc-lin);
  border-top: 3px solid var(--cc-or);
  border-radius: var(--cc-rayon);
  box-shadow: 0 30px 60px -24px rgba(19, 17, 22, .45), 0 2px 8px rgba(19, 17, 22, .08);
  font: 400 15px/1.6 var(--cc-texte);
  text-align: left;
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
  animation: a140-cc-in .26s ease-out both;
}
@supports (max-height: 100dvh) {
  .a140-cc { max-height: calc(100dvh - 32px); }
}
.a140-cc[hidden] { display: none !important; }
.a140-cc *, .a140-cc *::before, .a140-cc *::after { box-sizing: border-box; }

.a140-cc__title {
  margin: 0 0 8px;
  font: 500 1.25rem/1.2 var(--cc-titre);
  letter-spacing: .04em;
  text-transform: none;
  color: var(--cc-nuit);
}
.a140-cc__title:focus { outline: none; }
.a140-cc__text { margin: 0; color: var(--cc-encre); font-size: inherit; line-height: inherit; }
.a140-cc__link { color: var(--cc-marial); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.a140-cc__link:hover { color: var(--cc-pourpre); }
.a140-cc__purposes { margin-top: 6px; }
.a140-cc__purposes strong { color: var(--cc-nuit); font-weight: 600; }

/* Boutons : « Tout refuser » et « Tout accepter » côte à côte, strictement identiques (taille, couleur, poids) */
.a140-cc__actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 620px; margin: 18px 0 0 auto; }
.a140-cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--cc-nuit);
  border-radius: var(--cc-rayon);
  background: var(--cc-nuit);
  color: var(--cc-ivoire);
  font: 600 .8rem/1.2 var(--cc-texte);
  letter-spacing: .14em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  box-shadow: none;
  transition: background-color .18s, border-color .18s, color .18s;
  -webkit-tap-highlight-color: transparent;
}
.a140-cc-btn:hover { background: var(--cc-pourpre); border-color: var(--cc-pourpre); color: var(--cc-ivoire); }
.a140-cc-btn--outline { background: transparent; color: var(--cc-nuit); }
.a140-cc-btn--outline:hover { background: var(--cc-nuit); border-color: var(--cc-nuit); color: var(--cc-ivoire); }
.a140-cc :focus-visible { outline: 2px solid var(--cc-or-profond); outline-offset: 3px; }

/* Panneau de préférences : en-tête et boutons fixes, contenu défilant (fenêtres basses : voir plus bas) */
.a140-cc--prefs { display: flex; flex-direction: column; max-width: 720px; padding: 0; overflow: hidden; z-index: 99999; }
.a140-cc__head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 6px; }
.a140-cc__head .a140-cc__title { margin: 8px 0 0; }
.a140-cc__close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 -10px 0 0; padding: 0; border: 0; border-radius: var(--cc-rayon); background: transparent; color: var(--cc-nuit); cursor: pointer; }
.a140-cc__close:hover { background: var(--cc-lin); color: var(--cc-nuit); }
.a140-cc__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px; }
.a140-cc__body > .a140-cc__text { margin-bottom: 12px; }
.a140-cc--prefs .a140-cc__actions { flex: none; max-width: none; margin: 0; padding: 16px 24px 20px; border-top: 1px solid var(--cc-lin); }

.a140-cc-cat { padding: 14px 0; border-top: 1px solid var(--cc-lin); }
.a140-cc-cat__head { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.a140-cc-cat__label { flex: 1 1 auto; min-width: 0; font: 500 1rem/1.3 var(--cc-titre); letter-spacing: .03em; color: var(--cc-nuit); cursor: pointer; }
.a140-cc-cat__state { flex: none; font-size: .78rem; font-weight: 600; letter-spacing: .06em; color: var(--cc-or-profond); }
.a140-cc-cat__desc { margin: 4px 0 0; font-size: .9rem; line-height: 1.55; color: var(--cc-pierre); }

/* Interrupteurs : vraie case à cocher (role="switch"), pastille dessinée en arrière-plan */
.a140-cc-switch {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 52px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #857C70 radial-gradient(circle closest-side, #fff 88%, rgba(255, 255, 255, 0) 100%) no-repeat 3px 50% / 24px 24px;
  cursor: pointer;
  transition: background-color .18s, background-position .18s;
}
.a140-cc-switch:checked { background-color: var(--cc-marial); background-position: calc(100% - 3px) 50%; }
.a140-cc-switch:disabled { background-color: var(--cc-or-profond); opacity: .6; cursor: not-allowed; }
.a140-cc-switch:focus-visible { outline-offset: 3px; }

/* Espace de fin de page ajouté par le script tant que le bandeau est visible (hauteur et couleur en ligne) */
.a140-cc-spacer { display: block; height: 0; margin: 0; padding: 0; border: 0; pointer-events: none; }

@keyframes a140-cc-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* Mobile : feuille pleine largeur collée en bas */
@media (max-width: 640px) {
  .a140-cc {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    max-height: 85vh;
    padding: 18px 16px max(14px, env(safe-area-inset-bottom));
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    font-size: 14px;
    line-height: 1.5;
  }
  @supports (max-height: 100dvh) {
    .a140-cc { max-height: 85dvh; }
  }
  .a140-cc__title { margin-bottom: 6px; font-size: 1.08rem; }
  .a140-cc__actions { gap: 8px; max-width: none; margin-top: 14px; }
  .a140-cc-cat { padding: 10px 0; }
  .a140-cc-cat__desc { font-size: .85rem; line-height: 1.5; }
  .a140-cc--prefs { padding: 0; }
  .a140-cc__head { padding: 16px 16px 4px; }
  .a140-cc__body { padding: 0 16px; }
  .a140-cc--prefs .a140-cc__actions { margin: 0; padding: 12px 16px max(14px, env(safe-area-inset-bottom)); }
}

/* Écran étroit : refus et acceptation sur la même ligne, troisième bouton sur toute la largeur
   (deux rangées au lieu de trois, bandeau moins haut) */
@media (max-width: 539px) {
  .a140-cc__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a140-cc__actions > :last-child { grid-column: 1 / -1; }
  .a140-cc-btn { padding: 8px 8px; letter-spacing: .1em; }
}

/* Fenêtre basse (téléphone à l'horizontale, fort zoom) : le panneau entier défile, en-tête et
   boutons compris, pour que les interrupteurs et « Enregistrer mes choix » restent atteignables
   (WCAG 1.4.10). */
@media (max-height: 560px) {
  .a140-cc--prefs { display: block; overflow-y: auto; max-height: calc(100vh - 16px); }
  .a140-cc--prefs .a140-cc__body { overflow: visible; }
  .a140-cc--prefs .a140-cc__head { padding-top: 12px; }
  .a140-cc--prefs .a140-cc__actions { padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  @supports (max-height: 100dvh) {
    .a140-cc--prefs { max-height: calc(100dvh - 16px); }
  }
}
@media (max-height: 560px) and (max-width: 640px) {
  .a140-cc--prefs { max-height: calc(100vh - 8px); }
  @supports (max-height: 100dvh) {
    .a140-cc--prefs { max-height: calc(100dvh - 8px); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .a140-cc { animation: none; }
  .a140-cc-btn, .a140-cc-switch { transition: none; }
}
@media (forced-colors: active) {
  .a140-cc { border: 2px solid CanvasText; }
  .a140-cc-switch { border: 2px solid CanvasText; }
  .a140-cc-switch:checked { background-color: Highlight; }
}
@media print {
  .a140-cc, .a140-cc-spacer { display: none !important; }
}
