/*
 * Thrive Consent : bandeau et préférences.
 * Couleurs réglées dans l'admin (variables --tc-*) ; un thème peut les surcharger sur #thrive-consent.
 */
#thrive-consent {
  --tc-radius: 12px;
  --tc-font: inherit;
  --tc-z: 2147483000;
  --tc-shadow: 0 10px 40px rgb(0 0 0 / 0.18);
  --tc-border: color-mix(in srgb, var(--tc-text) 14%, transparent);
  --tc-muted: color-mix(in srgb, var(--tc-text) 72%, var(--tc-bg));
  font-family: var(--tc-font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--tc-text);
}

#thrive-consent[hidden],
#thrive-consent [hidden] {
  display: none !important;
}

#thrive-consent *,
#thrive-consent *::before,
#thrive-consent *::after {
  box-sizing: border-box;
}

/* Bandeau */
.tc-banner {
  position: fixed;
  z-index: var(--tc-z);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--tc-bg);
  color: var(--tc-text);
  box-shadow: var(--tc-shadow);
  animation: tc-in 0.25s ease-out;
}

.tc-root--bar .tc-banner {
  inset: auto 0 0 0;
  border-top: 1px solid var(--tc-border);
}

.tc-root--box .tc-banner {
  bottom: 1rem;
  width: min(26rem, calc(100% - 2rem));
  border: 1px solid var(--tc-border);
  border-radius: var(--tc-radius);
}

.tc-root--box.tc-root--left .tc-banner {
  left: 1rem;
}

.tc-root--box.tc-root--right .tc-banner {
  right: 1rem;
}

.tc-root--popup .tc-banner {
  top: 50%;
  left: 50%;
  width: min(34rem, calc(100% - 2rem));
  border-radius: var(--tc-radius);
  transform: translate(-50%, -50%);
}

.tc-root--popup:has(.tc-banner:not([hidden]))::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: calc(var(--tc-z) - 1);
  background: var(--tc-overlay, rgb(0 0 0 / 0.5));
  -webkit-backdrop-filter: blur(var(--tc-overlay-blur, 0px));
  backdrop-filter: blur(var(--tc-overlay-blur, 0px));
}

.tc-banner__title {
  margin: 0 0 0.25rem;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.tc-banner__text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--tc-muted);
}

.tc-banner__policy,
.tc-prefs__intro a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.tc-banner__actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 900px) {
  .tc-root--bar .tc-banner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.25rem 2rem;
  }

  .tc-root--bar .tc-banner__body {
    max-width: 52rem;
  }

  .tc-root--bar .tc-banner__actions {
    display: flex;
    flex-shrink: 0;
  }
}

/* Boutons : « Tout accepter » et « Tout refuser » ont exactement le même poids (CNIL). */
.tc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.625rem 1.125rem;
  border: 2px solid var(--tc-button);
  border-radius: calc(var(--tc-radius) - 4px);
  background: var(--tc-button);
  color: var(--tc-button-fg);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

.tc-btn:hover {
  opacity: 0.88;
}

.tc-btn--ghost {
  background: transparent;
  color: var(--tc-text);
}

#thrive-consent :focus-visible {
  outline: 3px solid var(--tc-button);
  outline-offset: 2px;
}

/* Préférences */
.tc-prefs {
  position: fixed;
  inset: 0;
  width: min(40rem, calc(100% - 2rem));
  max-width: none;
  height: fit-content;
  max-height: min(85vh, 48rem);
  margin: auto; /* les remises à zéro (Tailwind) retirent celle du navigateur */
  padding: 0;
  border: 0;
  border-radius: var(--tc-radius);
  background: var(--tc-bg);
  color: var(--tc-text);
  box-shadow: var(--tc-shadow);
}

.tc-prefs::backdrop {
  background: var(--tc-overlay, rgb(0 0 0 / 0.5));
  -webkit-backdrop-filter: blur(var(--tc-overlay-blur, 0px));
  backdrop-filter: blur(var(--tc-overlay-blur, 0px));
}

.tc-prefs__form {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  margin: 0;
}

.tc-prefs__header,
.tc-prefs__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}

.tc-prefs__header {
  justify-content: space-between;
  border-bottom: 1px solid var(--tc-border);
}

.tc-prefs__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
}

.tc-prefs__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.5rem -0.5rem -0.5rem 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.tc-prefs__body {
  overflow-y: auto;
  padding: 1rem 1.25rem;
}

.tc-prefs__intro {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--tc-muted);
}

.tc-cat {
  padding: 0.875rem 0;
  border-top: 1px solid var(--tc-border);
}

.tc-cat__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tc-cat__label {
  flex: 1;
  font-weight: 600;
  cursor: pointer;
}

.tc-cat__always {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--tc-muted);
}

.tc-cat__desc {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--tc-muted);
}

.tc-prefs__id {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  color: var(--tc-muted);
  overflow-wrap: anywhere;
}

.tc-prefs__id code {
  font-size: inherit;
  background: none;
  padding: 0;
}

.tc-switch {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tc-text) 28%, var(--tc-bg));
  appearance: none;
  cursor: pointer;
  transition: background 0.15s;
}

.tc-switch::after {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
  transition: transform 0.15s;
}

.tc-switch:checked {
  background: var(--tc-button);
}

.tc-switch:checked::after {
  transform: translateX(1.25rem);
}

.tc-switch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tc-prefs__actions {
  flex-wrap: wrap;
  border-top: 1px solid var(--tc-border);
}

.tc-prefs__actions .tc-btn {
  flex: 1 1 10rem;
}

/* Bouton « Gérer mes cookies » */
.tc-revisit {
  position: fixed;
  bottom: 1rem;
  z-index: calc(var(--tc-z) - 2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--tc-border);
  border-radius: 50%;
  background: var(--tc-bg);
  color: var(--tc-text);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.16);
  cursor: pointer;
}

.tc-root--left .tc-revisit {
  left: 1rem;
}

.tc-root--right .tc-revisit {
  right: 1rem;
}

.tc-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Mobile : le bandeau reste sous un tiers de l'écran, les trois boutons sur une ligne. */
@media (max-width: 599px) {
  .tc-banner {
    gap: 0.75rem;
    padding: 1rem;
  }

  .tc-root--box .tc-banner,
  .tc-root--box.tc-root--left .tc-banner,
  .tc-root--box.tc-root--right .tc-banner {
    right: 0.5rem;
    bottom: 0.5rem;
    left: 0.5rem;
    width: auto;
  }

  .tc-banner__title {
    font-size: 1rem;
  }

  .tc-banner__text {
    max-height: 7.5em;
    overflow-y: auto;
    font-size: 0.875rem;
  }

  .tc-banner__actions .tc-btn {
    min-height: 2.75rem;
    padding: 0.5rem 0.375rem;
    font-size: 0.8125rem;
  }

  .tc-prefs {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: var(--tc-radius) var(--tc-radius) 0 0;
  }
}

/* Encarts des contenus externes (vidéos, cartes…) tant que la catégorie « Contenus externes » n'est pas accordée */
.tc-embed {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tc-text) 7%, var(--tc-bg));
  color: var(--tc-text);
  container-type: inline-size;
}

.tc-embed > iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Le message tient même dans un encart étroit ; la proportion reprend la main une fois le contenu affiché. */
.tc-embed:not(.is-active) {
  min-height: 14rem;
}

.tc-embed:not(.is-active) > iframe {
  visibility: hidden;
}

.tc-embed.is-active {
  border-radius: 0;
  background: none;
}

.tc-embed.is-active > .tc-embed__placeholder {
  display: none;
}

/* Bloc d'intégration WordPress à ratio fixe : l'encart donne la hauteur, pas le calage du cadre (::before). */
.wp-block-embed__wrapper:has(> .tc-embed)::before {
  display: none;
}

.tc-embed__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  text-align: center;
}

.tc-embed__text {
  max-width: 34rem;
  margin: 0;
}

.tc-embed__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin: 0;
}

.tc-embed__link {
  color: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.tc-embed :focus-visible {
  outline: 3px solid var(--tc-button);
  outline-offset: 2px;
}

@container (max-width: 420px) {
  .tc-embed__placeholder {
    gap: 0.5rem;
    padding: 0.75rem;
    font-size: 0.8125rem;
  }

  .tc-embed__button {
    min-height: 2.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
  }
}


  from {
    opacity: 0;
    translate: 0 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tc-banner,
  .tc-switch,
  .tc-switch::after,
  .tc-btn {
    animation: none;
    transition: none;
  }
}

/* Mention du signal Global Privacy Control */
.tc-root .tc-gpc { margin: .5em 0 0; padding: .4em .7em; border-left: 3px solid currentColor; font-size: .875em; line-height: 1.45; opacity: .85; }
.tc-root .tc-gpc[hidden] { display: none; }

/* Liste [thrive_consent_cookies] : discrète, le thème garde la main sur la typographie */
.tc-cookie-list__scroll { overflow-x: auto; margin: 0 0 1.5em; }
.tc-cookie-list table { width: 100%; border-collapse: collapse; font-size: .9em; }
.tc-cookie-list th, .tc-cookie-list td { text-align: left; vertical-align: top; padding: .5em .75em; border-bottom: 1px solid rgba(127, 127, 127, .3); }
.tc-cookie-list th { font-weight: 600; }
.tc-cookie-list code { white-space: nowrap; }
.tc-cookie-list__updated { font-size: .85em; opacity: .75; }
@media (max-width: 600px) {
  .tc-cookie-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tc-cookie-list table, .tc-cookie-list tbody, .tc-cookie-list tr, .tc-cookie-list td { display: block; width: 100%; }
  .tc-cookie-list tr { padding: .5em 0; border-bottom: 1px solid rgba(127, 127, 127, .3); }
  .tc-cookie-list td { border: 0; padding: .15em 0; }
  .tc-cookie-list td::before { content: attr(data-label) " : "; font-weight: 600; }
  .tc-cookie-list code { white-space: normal; word-break: break-all; }
}
