/* La carte de cookies de CookieScript, sur tous les sites où GTM la pose.

   **Ce fichier est la seule écriture de son dessin.** Il est chargé par le
   gabarit du site, et les autres domaines le reçoivent d'une balise de GTM :
   <link rel="stylesheet" href="https://go.funnels.club/cookies.css">
   Il ne doit donc dépendre de rien : chaque jeton du site a sa valeur de repli,
   parce que ClickFunnels ne les connaît pas.

   Le dessin est celui du modèle fourni par Rémy : une carte blanche, l'image
   du cookie en petit à côté du titre, le texte, puis les boutons. Elle est collée au
   bas de l'écran et prend toute sa largeur : carte sur téléphone, bouton en
   pleine largeur, et barre sur ordinateur, le bouton à droite.

   Son HTML vient de CookieScript : on l'habille, sans toucher à sa mécanique.
   Le préfixe `html` passe devant la feuille que CookieScript injecte après la
   nôtre.

   Le bouton de refus attend d'être activé chez CookieScript : son dessin est
   prêt, il apparaîtra à côté de « Fermer ». */

html #cookiescript_injected {
  position: fixed;
  inset: auto auto 0 1.5rem;
  z-index: 999999;
  box-sizing: border-box;
  width: 24rem;
  max-width: calc(100vw - 3rem);
  margin: 0;
  padding: 1rem 1.25rem;

  font-family: var(--font-sans, inherit);
  font-size: 0.875rem;
  text-align: left;
  color: var(--muted-foreground, #6b7280);

  opacity: 1;
  background-color: var(--card, #fff);
  border: 1px solid var(--border, rgb(107 114 128 / 0.3));
  border-bottom: none;
  border-radius: 0.5rem 0.5rem 0 0;
  box-shadow: 0 -8px 30px rgb(0 0 0 / 0.1);
}

@media (max-width: 639px) {
  html #cookiescript_injected {
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    padding: 0.875rem 1.25rem calc(0.875rem + env(safe-area-inset-bottom));
    border-inline: none;
  }
}

html #cookiescript_toppart {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

html #cookiescript_leftpart,
html #cookiescript_rightpart {
  position: relative;
  display: block;
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 0;
  margin: 0;
}

/* L'image du cookie, celle du modèle, servie à côté de ce fichier : en petit,
   à gauche du titre. Elle est calée sur le titre, qui lui laisse sa place. */
html #cookiescript_leftpart::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0;
  width: 1.5rem;
  height: 1.5rem;
  background: url("cookie.svg") center / contain no-repeat;
}

html #cookiescript_description {
  padding: 0;
  margin: 0;
  text-align: left;
}

/* Le titre, écrit ici, faute de champ pour lui dans le HTML de CookieScript. */
html #cookiescript_description::before {
  content: "Information cookie";
  display: block;
  padding: 0 0 0.25rem 2rem;
  font-family: var(--font-sans, inherit);
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.75rem;
  text-align: left;
  color: var(--card-foreground, #1f2937);
}

html #cookiescript_description span {
  display: block;
  padding: 0;
  margin: 0;
  font-family: var(--font-sans, inherit);
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: left;
  text-wrap: pretty;
  color: var(--muted-foreground, #6b7280);
}

html #cookiescript_buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  width: 100%;
  padding: 0;
  margin: 0;
}

html #cookiescript_accept,
html #cookiescript_reject {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 2.5rem;
  min-height: 0;
  padding: 0 1rem;
  margin: 0;

  font-family: var(--font-sans, inherit);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: normal;

  border-radius: var(--radius, 5px);
  cursor: pointer;
  transition:
    background-color 300ms ease,
    transform 150ms ease;
}

html #cookiescript_accept {
  color: var(--primary-foreground, #fff);
  background-color: var(--primary, #2563eb);
  border: none;
}

/* Le survol du site. Sans cette règle, CookieScript reprend la main et le
   bouton vire au jaune de sa palette. */
html #cookiescript_accept:hover {
  background-color: color-mix(in oklab, var(--primary, #2563eb) 90%, transparent);
}

html #cookiescript_reject {
  color: var(--card-foreground, #1f2937);
  background-color: transparent;
  border: 1px solid var(--border, rgb(107 114 128 / 0.3));
}

html #cookiescript_reject:hover {
  background-color: color-mix(in oklab, var(--primary, #2563eb) 10%, transparent);
}

html #cookiescript_accept:active,
html #cookiescript_reject:active {
  transform: scale(0.95);
}

/* La croix reste retirée, sur décision de Rémy : « Fermer » dit la même chose
   et offre une plus grande cible. */
html #cookiescript_injected .cookiescript_pre_header,
html #cookiescript_close {
  display: none;
}

/* Vide, le conteneur du bas ne doit pas creuser un blanc sous le bouton. */
html #cookiescript_bottompart:empty {
  display: none;
}

/* Sur ordinateur, une barre sur toute la largeur de l'écran, le texte à gauche
   et « Fermer » à droite, sur demande de Rémy. Le contenu reste dans une
   colonne de 72 rem, pour que le bouton ne parte pas au bout d'un grand écran. */
@media (min-width: 640px) {
  html #cookiescript_injected {
    inset: auto 0 0 0;
    width: 100%;
    max-width: none;
    padding: 0.75rem max(1.5rem, calc((100% - 72rem) / 2));
    border-inline: none;
    border-radius: 0;
  }

  html #cookiescript_toppart {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
  }

  html #cookiescript_leftpart {
    flex: 1 1 auto;
    width: auto;
  }

  html #cookiescript_rightpart {
    flex: 0 0 auto;
    width: auto;
  }

  html #cookiescript_buttons {
    width: auto;
  }

  html #cookiescript_accept,
  html #cookiescript_reject {
    flex: 0 0 auto;
    padding: 0 2rem;
  }
}
