/* ==========================================================================
   Bannière et fenêtre des cookies — utilise les variables de assets/css/site.css
   (clair par défaut, sombre automatique)
   ========================================================================== */

#cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9999;
  padding: 1.25rem var(--gutter, 1.5rem);
  background: var(--surface, #fff); color: var(--text, #14111F);
  border-top: 1px solid var(--line, #E4E1EC);
  box-shadow: 0 -12px 32px -12px rgba(20, 17, 31, .25);
  animation: cookie-in .3s cubic-bezier(.2, .7, .2, 1);
}
@keyframes cookie-in { from { transform: translateY(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { from { transform: none; opacity: 1; } to { transform: translateY(100%); opacity: 0; } }

.cookie-banner-content { max-width: var(--wrap, 1240px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem 2.5rem; }
.cookie-title { margin: 0 0 .35rem; font-family: var(--font-display, Georgia, serif); font-size: 1.5rem; font-weight: 500; line-height: 1.15; letter-spacing: 0; }
.cookie-banner-text p { margin: 0; max-width: 62ch; font-size: .9375rem; line-height: 1.5; color: var(--text-2, #4B4860); }
.cookie-banner-actions { display: flex; flex-wrap: wrap; gap: .6rem; flex-shrink: 0; }

.cookie-btn {
  min-height: 44px; padding: 0 1.25rem; border: 1.5px solid transparent; border-radius: var(--radius, 6px);
  font: 600 .9375rem/1.2 var(--font-body, system-ui, sans-serif); white-space: nowrap; cursor: pointer;
  transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out;
}
.cookie-btn-primary { background: var(--accent, #C42B47); color: var(--accent-ink, #fff); }
.cookie-btn-primary:hover { background: color-mix(in srgb, var(--accent, #C42B47) 86%, var(--text, #14111F)); }
.cookie-btn-secondary { background: var(--text, #14111F); color: var(--bg, #F6F5F8); }
.cookie-btn-secondary:hover { background: color-mix(in srgb, var(--text, #14111F) 86%, var(--bg, #F6F5F8)); }
.cookie-btn-outline { background: transparent; color: var(--text, #14111F); border-color: var(--control, #6B6785); }
.cookie-btn-outline:hover { border-color: var(--text, #14111F); background: color-mix(in srgb, var(--text, #14111F) 6%, transparent); }
.cookie-btn:focus-visible, .cookie-modal-close:focus-visible { outline: 3px solid var(--focus, #C42B47); outline-offset: 3px; }

/* ---------- Fenêtre de paramètres ---------- */
#cookie-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: cookie-fade .2s ease-out; }
@keyframes cookie-fade { from { opacity: 0; } to { opacity: 1; } }
.cookie-modal-overlay { position: absolute; inset: 0; background: rgba(14, 11, 24, .72); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.cookie-modal-content {
  position: relative; width: 100%; max-width: 680px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface, #fff); color: var(--text, #14111F);
  border: 1px solid var(--line, #E4E1EC); border-radius: var(--radius-lg, 8px); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .55);
}
.cookie-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--line, #E4E1EC); }
.cookie-modal-header h2 { margin: 0; font-family: var(--font-display, Georgia, serif); font-size: 1.9rem; font-weight: 500; letter-spacing: 0; }
.cookie-modal-close { display: grid; place-items: center; width: 44px; height: 44px; background: transparent; border: 0; border-radius: var(--radius, 6px); color: var(--text, #14111F); cursor: pointer; }
.cookie-modal-close:hover { background: color-mix(in srgb, var(--text, #14111F) 8%, transparent); }
.cookie-modal-body { padding: 1.5rem; overflow-y: auto; }
.cookie-modal-body > p { margin: 0 0 1.25rem; color: var(--text-2, #4B4860); line-height: 1.55; }

.cookie-category { margin-bottom: 1rem; padding: 1.1rem 1.25rem; background: var(--bg, #F6F5F8); border: 1px solid var(--line, #E4E1EC); border-radius: var(--radius, 6px); }
.cookie-category-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.cookie-category-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; }
.cookie-category h3 { margin: 0; font: 700 1rem/1.3 var(--font-body, system-ui, sans-serif); letter-spacing: 0; }
.cookie-category p { margin: 0; font-size: .9375rem; line-height: 1.5; color: var(--text-2, #4B4860); }
.cookie-required, .cookie-optional { padding: .15rem .6rem; border: 1px solid var(--control, #6B6785); border-radius: 3px; font-size: .6875rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2, #4B4860); }

/* Interrupteur : zone tactile 44 px, anneau de focus visible */
.cookie-switch { position: relative; display: inline-block; flex: none; width: 56px; height: 32px; }
.cookie-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.cookie-slider { position: absolute; inset: 0; background: var(--surface-2, #EEECF3); border: 1.5px solid var(--control, #6B6785); border-radius: 32px; transition: background-color .18s ease-out, border-color .18s ease-out; }
.cookie-slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--control, #6B6785); transition: transform .18s ease-out, background-color .18s ease-out; }
.cookie-switch input:checked + .cookie-slider { background: var(--accent, #C42B47); border-color: var(--accent, #C42B47); }
.cookie-switch input:checked + .cookie-slider::before { transform: translateX(24px); background: var(--accent-ink, #fff); }
.cookie-switch input:focus-visible + .cookie-slider { outline: 3px solid var(--focus, #C42B47); outline-offset: 3px; }
.cookie-switch.disabled { opacity: .6; }
.cookie-switch.disabled input, .cookie-switch.disabled .cookie-slider { cursor: not-allowed; }

.cookie-info { margin-top: 1.25rem; padding: 1rem 1.1rem; background: var(--accent-soft, rgba(196, 43, 71, .09)); border-left: 3px solid var(--accent, #C42B47); border-radius: 0 var(--radius, 6px) var(--radius, 6px) 0; }
.cookie-info p { margin: 0; font-size: .9375rem; color: var(--text, #14111F); }
.cookie-info a { color: var(--accent, #C42B47); font-weight: 600; text-underline-offset: .2em; }
.cookie-modal-footer { display: flex; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--line, #E4E1EC); }

@media (max-width: 900px) {
  .cookie-banner-content { flex-direction: column; align-items: stretch; }
  .cookie-banner-actions { width: 100%; }
  .cookie-banner-actions .cookie-btn { flex: 1 1 auto; }
}
@media (max-width: 480px) {
  #cookie-banner { padding: 1rem; max-height: 85vh; overflow-y: auto; }
  .cookie-banner-actions .cookie-btn { width: 100%; }
  .cookie-modal-header h2 { font-size: 1.5rem; }
  .cookie-category-header { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  #cookie-banner, #cookie-modal { animation: none; }
}
