/* ==========================================================================
   CyberBay — consentement aux témoins et page « Politique de confidentialité »
   Aucun style en ligne (compatible avec la CSP du site). Les couleurs et les
   rayons viennent des variables de style.css.
   ========================================================================== */

/* ---------- Fenêtre de consentement ---------- */

/* En bas à droite : le texte et les boutons d'appel à l'action, à gauche,
   restent lisibles tant que le choix n'est pas fait. */
.cc {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: calc(100% - 44px);
  max-width: 560px;
  max-height: calc(100vh - 44px);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow:
    0 30px 70px -24px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(46, 230, 197, 0.06);
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.55;
  animation: cc-in 0.35s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.cc[hidden],
.cc [hidden] {
  display: none;
}

@keyframes cc-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* La fenêtre attend la fin de l'écran de chargement et des transitions. */
.is-loading .cc,
.is-leaving .cc {
  visibility: hidden;
}

.cc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text);
}

.cc-title:focus {
  outline: none;
}

.cc-title svg {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.cc p {
  margin: 0 0 12px;
  color: var(--muted);
}

.cc a {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* « Tout refuser » et « Tout accepter » ont le même poids visuel. */
.cc-btn {
  flex: 1 1 150px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.cc-btn:hover {
  border-color: var(--accent);
  background: rgba(46, 230, 197, 0.1);
}

/* « Enregistrer mes choix » occupe sa propre ligne. */
.cc-btn-wide {
  flex-basis: 100%;
}

.cc-btn-link {
  flex: 1 1 100%;
  min-height: 0;
  padding: 6px 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cc-btn-link:hover {
  background: none;
  color: var(--text);
}

/* Catégories de témoins */

.cc-cats {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.cc-cat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 18px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.cc-cat-name {
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.cc-cat-desc {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.88rem;
}

.cc-cat-state {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

/* Interrupteur : une vraie case à cocher, restylée. */
.cc-switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cc-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}

.cc-switch:checked {
  border-color: var(--accent);
  background: rgba(46, 230, 197, 0.28);
}

.cc-switch:checked::before {
  transform: translateX(20px);
  background: var(--accent);
}

.cc-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 999px;
}

/* Le bouton « haut de page » ne passe pas sous la fenêtre. */
.cc-open .to-top {
  display: none;
}

@media (max-width: 760px) {
  .cc {
    right: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 20px;
  }
}

/* ---------- Pied de page : liens légaux ---------- */

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.footer-legal a,
.footer-legal button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-legal a:hover,
.footer-legal button:hover {
  color: var(--accent);
}

/* ---------- Page « Politique de confidentialité » ---------- */

.legal-meta {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Le sommaire compte plus de neuf entrées : 01, 02 … 10. */
.legal .toc a::before {
  content: counter(toc, decimal-leading-zero);
}

/* Le tableau défile dans son cadre sans élargir la page sur petit écran. */
.legal .article-list {
  grid-template-columns: minmax(0, 1fr);
}

.legal .article h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.6rem);
}

.legal h3 {
  margin: 26px 0 8px;
  color: var(--text);
}

.legal p,
.legal li {
  max-width: 46em;
}

.legal p strong,
.legal li strong {
  font-weight: 600;
  color: var(--text);
}

.legal ul {
  margin: 0 0 1em;
  padding-left: 1.2em;
  color: var(--muted);
}

.legal li {
  margin-bottom: 6px;
}

.legal li::marker {
  color: var(--accent);
}

.legal .article a:not(.text-link) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal address {
  margin: 0 0 1em;
  padding: 16px 20px;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(46, 230, 197, 0.05);
  font-style: normal;
  color: var(--text);
}

.legal .article > :last-child {
  margin-bottom: 0;
}

.table-wrap {
  margin: 0 0 1em;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.legal table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.legal caption {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.legal th,
.legal td {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  color: var(--muted);
}

.legal thead th {
  background: rgba(148, 163, 184, 0.06);
  font-weight: 600;
  color: var(--text);
}

.legal tbody th {
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.legal .cc-open-btn {
  margin: 4px 0 1em;
}
