/*
 * Habillage « Black Friday » (apps/site/lib/habillages.ts).
 *
 * Chargé avec le bandeau (components/site/habillage.tsx) SEULEMENT pendant
 * le temps fort : hors opération, il ne pèse rien. Les couleurs sont celles
 * de la charte (docs/charte-bob.md) : le noir, couleur principale, et le
 * jaune Bob, celui des promotions. Aucune autre.
 *
 * Deux préfixes, et aucun autre (habillages.test.mjs) :
 *  - le bandeau, qui porte l’identifiant du kit :
 *    .habillage-bandeau[data-habillage='black-friday'] ;
 *  - le reste du site, repéré au bandeau, premier enfant du <body> :
 *    body:has(> .habillage-bandeau[data-habillage='black-friday']).
 * Plus précis que les classes du site, ils l’emportent quel que soit l’ordre
 * des feuilles. Un navigateur sans :has() garde le bandeau habillé et le
 * reste du site tel quel. Les classes `habillage-*` sont celles du bandeau
 * (components/site/bandeau-operation.tsx) ; `[data-pastille-promo]`, les
 * pastilles de remise des pages.
 *
 * Animations en CSS seul, lentes, sans clignotement (WCAG 2.3.1), coupées
 * quand le visiteur demande moins d’animations. Aucune dans le
 * configurateur : on ne distrait pas quelqu’un qui saisit ses cotes.
 */

.habillage-bandeau[data-habillage='black-friday'],
body:has(> .habillage-bandeau[data-habillage='black-friday']) {
  --bf-noir: #000;
  --bf-jaune: var(--color-bob-yellow, #ffd13d);
}

/* ------------------------------------------------------------------------
   1. Le bandeau d’opération, en tête de toutes les pages
   ------------------------------------------------------------------------ */
.habillage-bandeau[data-habillage='black-friday'] {
  position: relative;
  overflow: hidden;
  background: var(--bf-noir);
  color: #fff;
}
/* un reflet doré qui traverse le bandeau toutes les sept secondes */
.habillage-bandeau[data-habillage='black-friday']::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgb(255 209 61 / 0.28) 50%,
    transparent 65%
  );
  transform: translateX(-100%);
  animation: bf-reflet 7s ease-in-out 1s infinite;
}
.habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-lien {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  min-height: 44px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  font-size: 14px;
  line-height: 1.35;
  text-align: center;
  color: inherit;
  text-decoration: none;
}
.habillage-bandeau[data-habillage='black-friday']
  .habillage-bandeau-lien:focus-visible {
  outline: 3px solid var(--bf-jaune);
  outline-offset: -4px;
}
.habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-nom {
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-remise {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 6px;
  background: var(--bf-jaune);
  color: #000;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  animation: bf-tampon 0.7s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-texte {
  color: rgb(255 255 255 / 0.88);
}
.habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: var(--bf-jaune);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.habillage-bandeau[data-habillage='black-friday']
  .habillage-bandeau-lien:hover
  .habillage-bandeau-action {
  color: #fff;
}
/* Mobile : le nom, la remise et l’action sur une ligne, le périmètre et la
   date dessous, plus petits. */
@media (width < 40rem) {
  .habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-lien {
    gap: 2px 10px;
    padding: 7px 16px;
    font-size: 13px;
  }
  .habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-texte {
    order: 3;
    flex-basis: 100%;
    font-size: 12px;
  }
}

/* ------------------------------------------------------------------------
   Variante « code » (25/11/2026) : un code promo peut porter ce décor ;
   le texte et le code, puis le lien (components/site/bandeau-operation.tsx)
   ------------------------------------------------------------------------ */
.habillage-bandeau[data-habillage='black-friday'][data-variante='code'] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 20px;
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-offre {
  margin: 0;
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-code {
  display: inline-block;
  padding: 0 8px;
  border: 2px dashed var(--bf-jaune);
  border-radius: 6px;
  background: #fff;
  color: #000;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  cursor: text;
  -webkit-user-select: all;
  user-select: all;
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-conditions,
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-details {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgb(255 255 255 / 0.88);
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-details
  summary {
  cursor: pointer;
  text-decoration: underline;
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-conditions-offre {
  max-width: 64ch;
  margin: 4px auto 0;
  text-align: left;
  white-space: pre-line;
}
.habillage-bandeau[data-habillage='black-friday'][data-variante='code']
  .habillage-bandeau-lien {
  display: inline-flex;
  min-height: 0;
  margin: 0;
  padding: 0;
}

/* ------------------------------------------------------------------------
   2. L’en-tête : sa bande de réassurance passe au noir, dans le
      prolongement du bandeau (logo, recherche et menu ne changent pas)
   ------------------------------------------------------------------------ */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  header
  > div:first-child {
  background: var(--bf-noir);
  color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12);
}
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  header
  > div:first-child
  .text-bob-indigo {
  color: var(--bf-jaune);
}
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  header
  > div:first-child
  a:hover {
  color: var(--bf-jaune);
}

/* ------------------------------------------------------------------------
   3. Le hero de l’accueil : nuit noire pailletée d’or
   ------------------------------------------------------------------------ */
body:has(> .habillage-bandeau[data-habillage='black-friday']) .bob-pattern {
  background-color: var(--bf-noir);
  background-image:
    radial-gradient(circle, rgb(255 209 61 / 0.55) 0 1.5px, transparent 2px),
    radial-gradient(circle, rgb(255 255 255 / 0.2) 0 1px, transparent 1.5px);
  background-size:
    46px 46px,
    29px 29px;
  background-position:
    0 0,
    13px 17px;
  animation: bf-paillettes 40s linear infinite;
}
body:has(> .habillage-bandeau[data-habillage='black-friday']) .hero-voile {
  background: linear-gradient(to top, var(--bf-noir), transparent 30%);
}
@media (width >= 48rem) {
  body:has(> .habillage-bandeau[data-habillage='black-friday']) .hero-voile {
    background: linear-gradient(
      to right,
      var(--bf-noir),
      rgb(0 0 0 / 0.6) 35%,
      transparent 70%
    );
  }
}
/* La vignette de l’offre, posée sur la photo : un tampon jaune */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-creative-slot='home_hero_sticker'] {
  background: var(--bf-jaune);
  color: #000;
  box-shadow:
    0 0 0 3px #000,
    0 14px 34px -10px rgb(0 0 0 / 0.7);
  transform: rotate(-4deg);
  animation: bf-tampon-vignette 0.8s cubic-bezier(0.2, 1.4, 0.4, 1);
}
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-creative-slot='home_hero_sticker']
  .text-muted-foreground,
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-creative-slot='home_hero_sticker']
  .text-bob-dark-blue {
  color: #000;
}

/* ------------------------------------------------------------------------
   4. Les pastilles de remise : noires à liseré jaune sur fond clair,
      jaunes sur le hero noir
   ------------------------------------------------------------------------ */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-pastille-promo] {
  background: var(--bf-noir);
  color: var(--bf-jaune);
  box-shadow: inset 0 0 0 1.5px var(--bf-jaune);
}
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  .bob-pattern
  [data-pastille-promo] {
  background: var(--bf-jaune);
  color: #000;
  box-shadow: none;
}
/* sur les vignettes de l’accueil : une étiquette un peu penchée */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  .rangee-produits
  [data-pastille-promo] {
  transform: rotate(-5deg);
  box-shadow:
    inset 0 0 0 1.5px var(--bf-jaune),
    0 6px 14px -6px rgb(0 0 0 / 0.6);
}

/* ------------------------------------------------------------------------
   5. Fiches produit, gammes et configurateur
   ------------------------------------------------------------------------ */
/* Le prix payé d’une offre (`ShownAmount`), surligné de jaune comme au
   marqueur, partout où il est barré : fiches, gammes, pages dimension,
   configurateur. */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-prix-promo] {
  padding: 0 0.12em;
  background: linear-gradient(transparent 52%, var(--bf-jaune) 52%);
  color: #000;
  box-decoration-break: clone;
}
/* sur le hero noir de l’accueil, le prix reste jaune, sans surlignage */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  .bob-pattern
  [data-prix-promo] {
  padding: 0;
  background: none;
  color: inherit;
}
/* L’étiquette de l’offre, sur la photo d’une fiche ou du configurateur */
body:has(> .habillage-bandeau[data-habillage='black-friday'])
  [data-pastille-offre] {
  background: var(--bf-noir);
  color: var(--bf-jaune);
  box-shadow:
    0 0 0 2px var(--bf-jaune),
    0 14px 34px -10px rgb(0 0 0 / 0.7);
  transform: rotate(-4deg);
}
/* Le bouton principal (« Configurer », « Ajouter au panier »…) : noir, texte
   jaune ; désactivé, il garde son gris. */
body:has(> .habillage-bandeau[data-habillage='black-friday']) .cta {
  background: var(--bf-noir);
  color: var(--bf-jaune);
}
body:has(> .habillage-bandeau[data-habillage='black-friday']) .cta:hover {
  background: #262626;
}
body:has(> .habillage-bandeau[data-habillage='black-friday']) .cta:disabled {
  background: #b9c6d6;
  color: #fff;
}

/* ------------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------------ */
@keyframes bf-reflet {
  0% {
    transform: translateX(-100%);
  }
  35%,
  100% {
    transform: translateX(100%);
  }
}
/* Les « tampons » partent grossis, jamais invisibles : une page en
   arrière-plan ou un navigateur qui ne joue pas l’animation montre quand
   même la remise. Sans délai ni remplissage, pour la même raison. */
@keyframes bf-tampon {
  from {
    transform: scale(1.8) rotate(-8deg);
  }
  to {
    transform: none;
  }
}
@keyframes bf-tampon-vignette {
  from {
    transform: scale(1.5) rotate(-14deg);
  }
  to {
    transform: rotate(-4deg);
  }
}
@keyframes bf-paillettes {
  to {
    background-position:
      46px 92px,
      42px 75px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .habillage-bandeau[data-habillage='black-friday']::after {
    display: none;
  }
  .habillage-bandeau[data-habillage='black-friday'] .habillage-bandeau-remise,
  body:has(> .habillage-bandeau[data-habillage='black-friday']) .bob-pattern,
  body:has(> .habillage-bandeau[data-habillage='black-friday'])
    [data-creative-slot='home_hero_sticker'] {
    animation: none;
  }
}

@media print {
  .habillage-bandeau[data-habillage='black-friday'] {
    display: none;
  }
}
