/* ============================================================
   HOMO ARTIFEX — Bandeau de consentement cookies
   RGPD / nLPD · v3 · 2021-10
   © Denis Ponté / Association Place-Neuve
   ============================================================ */

/* ============================================================
   1. BANDEAU PRINCIPAL
   ============================================================ */
.hap-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px 40px;
  align-items: end;
  padding: clamp(20px, 3vw, 32px) clamp(20px, 5vw, 80px);
  background: var(--bg, #e3e2dd);
  color: var(--ink, #141413);
  border-top: 1px solid var(--line-dark, rgba(20, 20, 19, 0.3));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.08);
  font-family: var(--sans, "Inter", system-ui, -apple-system, sans-serif);
  transform: translateY(0);
  opacity: 1;
  transition:
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.hap-consent[hidden] {
  display: none !important;
}

.hap-consent--closing {
  transform: translateY(100%);
  opacity: 0;
}

/* ============================================================
   2. CORPS (texte + langues)
   ============================================================ */
.hap-consent__body {
  max-width: 72ch;
  min-width: 0;
}

/* --- Sélecteur de langue --- */
.hap-consent__langs {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 14px;
  padding: 0;
  border: 0;
}

.hap-consent__langs button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 3px 7px;
  margin: 0;
  cursor: pointer;
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted, #6b6a65);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.hap-consent__langs button:hover {
  color: var(--ink, #141413);
}

.hap-consent__langs button[aria-pressed="true"] {
  color: var(--accent, #c4362a);
  border-color: var(--accent, #c4362a);
  font-weight: 600;
}

.hap-consent__langs button:focus-visible {
  outline: 2px solid var(--accent, #c4362a);
  outline-offset: 2px;
}

/* --- Titre --- */
.hap-consent__title {
  font-family: var(--serif, "Newsreader", Georgia, serif);
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  color: var(--ink, #141413);
}

/* --- Texte --- */
.hap-consent__text {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  color: var(--muted, #6b6a65);
  max-width: 68ch;
}

/* --- Lien "En savoir plus" --- */
.hap-consent__link {
  color: var(--ink, #141413);
  text-decoration: underline;
  text-decoration-color: var(--accent, #c4362a);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.25s ease;
}

.hap-consent__link:hover {
  color: var(--accent, #c4362a);
}

.hap-consent__link:focus-visible {
  outline: 2px solid var(--accent, #c4362a);
  outline-offset: 2px;
}

/* ============================================================
   3. BOUTONS
   ============================================================ */
.hap-consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.hap-consent__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1;
  padding: 12px 22px;
  margin: 0;
  border: 1px solid var(--line-dark, rgba(20, 20, 19, 0.3));
  border-radius: 0;
  background: transparent;
  color: var(--ink, #141413);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease;
}

.hap-consent__btn:hover {
  border-color: var(--accent, #c4362a);
  color: var(--accent, #c4362a);
}

.hap-consent__btn:focus-visible {
  outline: 2px solid var(--accent, #c4362a);
  outline-offset: 3px;
}

.hap-consent__btn--solid {
  background: var(--accent, #c4362a);
  border-color: var(--accent, #c4362a);
  color: #fff;
}

.hap-consent__btn--solid:hover {
  background: transparent;
  color: var(--accent, #c4362a);
}

/* ============================================================
   4. ESPACE RÉSERVÉ EN BAS DE PAGE
   ============================================================ */
html.hap-consent-open body {
  padding-bottom: 160px;
}

@media (max-width: 720px) {
  html.hap-consent-open body {
    padding-bottom: 260px;
  }
}

/* ============================================================
   5. RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .hap-consent {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px;
  }

  .hap-consent__actions {
    justify-content: stretch;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .hap-consent__btn {
    flex: 1 1 auto;
    width: 100%;
    padding: 12px 14px;
    font-size: 10px;
  }

  .hap-consent__title {
    font-size: 1.1rem;
  }

  .hap-consent__text {
    font-size: 13px;
  }
}

/* ============================================================
   6. BOUTON FLOTTANT « PRÉFÉRENCES COOKIES »
   (apparaît une fois le consentement donné)
   ============================================================ */
.hap-consent-reopen {
  position: fixed;
  bottom: 12px;
  left: 12px;
  z-index: 9997;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--line-dark, rgba(20, 20, 19, 0.3));
  border-radius: 0;
  background: rgba(227, 226, 221, 0.9);
  color: var(--muted, #6b6a65);
  cursor: pointer;
  opacity: 0.55;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition:
    opacity 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.hap-consent-reopen:hover {
  opacity: 1;
  color: var(--accent, #c4362a);
  border-color: var(--accent, #c4362a);
}

.hap-consent-reopen:focus-visible {
  outline: 2px solid var(--accent, #c4362a);
  outline-offset: 3px;
  opacity: 1;
}

/* Sur mobile, on évite le chevauchement avec le bouton « back-to-top » */
@media (max-width: 720px) {
  .hap-consent-reopen {
    bottom: 72px;
    left: 12px;
    font-size: 9px;
    padding: 5px 8px;
  }
}

/* ============================================================
   7. ACCESSIBILITÉ — Réduction de mouvement
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hap-consent,
  .hap-consent-reopen {
    transition: none;
  }

  .hap-consent--closing {
    transform: none;
    opacity: 0;
  }
}

/* ============================================================
   8. IMPRESSION — Masquer le bandeau
   ============================================================ */
@media print {
  .hap-consent,
  .hap-consent-reopen {
    display: none !important;
  }

  html.hap-consent-open body {
    padding-bottom: 0 !important;
  }
}