/* ==========================================================
   Bandeau transition Colis Privé > Paack
   Dégradé issu de la maquette : FFFFFF 0% > F6F8FD 12% > E0E8FA 31%
   > BBCDF5 54% > 88A7ED 81% > 618BE8 100%
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&display=swap');

.cp-transition-banner {
  --cp-banner-text: #0e1330;           /* à ajuster avec la couleur exacte du Figma */
  --cp-banner-gradient: linear-gradient(
    90deg,
    #ffffff 0%,
    #f6f8fd 12%,
    #e0e8fa 31%,
    #bbcdf5 54%,
    #88a7ed 81%,
    #618be8 100%
  );

  /* Dans le flux, en haut de page, SANS z-index : le menu fixe du thème (z-index 99)
     doit toujours passer par-dessus, jamais être masqué par le bandeau. */
  position: relative;
  width: 100%;
  background: var(--cp-banner-gradient);
  color: var(--cp-banner-text);
  font-family: "Outfit", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.3;
}

.cp-transition-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 46px;
  padding: 8px 32px;
  box-sizing: border-box;
}

.cp-transition-banner__left {
  display: flex;
  align-items: center;
  gap: 32px;
  min-width: 0;
}

.cp-transition-banner__date,
.cp-transition-banner__becomes,
.cp-transition-banner__baseline {
  margin: 0;
  white-space: nowrap;
}

.cp-transition-banner__brands {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.cp-transition-banner__logo {
  display: block;
  height: 28px;
  width: auto;
}

.cp-transition-banner__baseline {
  text-align: right;
}

/* ---------- Tablette ---------- */
@media (max-width: 1024px) {
  .cp-transition-banner__inner {
    padding: 8px 20px;
    gap: 16px;
  }

  .cp-transition-banner__left {
    gap: 20px;
  }

  .cp-transition-banner__baseline {
    white-space: normal;
    max-width: 280px;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) { /* même point de rupture que le menu du thème */
  .cp-transition-banner {
    font-size: 16px;
  }

  .cp-transition-banner__inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 10px 12px 12px;
    text-align: center;
  }

  /* Ligne 1 : date / Ligne 2 : logos */
  .cp-transition-banner__left {
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 100%;
  }

  .cp-transition-banner__date {
    font-size: 16px;
    font-weight: 400;
  }

  .cp-transition-banner__brands {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 14px;
    width: 100%;
  }

  .cp-transition-banner__becomes {
    font-size: 15px;
  }

  .cp-transition-banner__logo {
    height: 36px;
    width: auto;
    max-width: 38%;
    object-fit: contain;
  }

  /* La baseline n'apparaît pas sur la maquette mobile */
  .cp-transition-banner__baseline {
    display: none;
  }
}

/* Très petits écrans (≤ 360px) */
@media (max-width: 360px) {
  .cp-transition-banner__brands {
    gap: 8px;
  }

  .cp-transition-banner__becomes {
    font-size: 13px;
  }

  .cp-transition-banner__logo {
    height: 30px;
  }
}

/* ==========================================================
   Bandeau DANS le header fixe du thème (#masthead)
   Le bandeau est le premier enfant de <header id="masthead"> : il reste donc
   collé en haut avec le menu, au scroll.
   - --cp-banner-h : hauteur du bandeau (valeurs par défaut ci-dessous, ensuite
     mesurée par js/bandeau-transition.js).
   - Le contenu de la page est descendu de cette hauteur (padding-top du body),
     car le header est en position: fixed (hors flux).
   - --cp-admin-h : barre d'administration WordPress (utilisateurs connectés).
   ========================================================== */
:root {
  --cp-banner-h: 46px;
}

body {
  padding-top: var(--cp-banner-h);
}

/* Barre d'administration WordPress (connecté uniquement) */
body.admin-bar {
  --cp-admin-h: 32px;
}

@media (max-width: 782px) {
  body.admin-bar {
    --cp-admin-h: 46px;
  }
}

/* ≤ 600px, la barre d'admin n'est plus fixe : elle défile avec la page */
@media (max-width: 600px) {
  body.admin-bar {
    --cp-admin-h: 0px;
  }
}

#masthead {
  top: var(--cp-admin-h, 0px);
}

/* ---------- Mobile (même point de rupture que le thème) ---------- */
@media (max-width: 768px) {
  :root {
    --cp-banner-h: 85px;
  }

  /* Le header mobile réserve déjà 63px (barre logo/burger) : on y ajoute le bandeau */
  #masthead {
    padding-top: calc(63px + var(--cp-banner-h));
  }

  /* Le bandeau se pose tout en haut du header, par-dessus la zone réservée */
  #masthead .cp-transition-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
  }

  /* Éléments du thème en position: fixed; top: 0 (relatifs à l'écran) */
  #masthead #header-row-1 .site-branding,
  #masthead #nav-account-mobile {
    top: calc(var(--cp-admin-h, 0px) + var(--cp-banner-h));
  }

  /* Éléments en position: absolute (relatifs au header) */
  #masthead #box-menu-burger {
    top: var(--cp-banner-h);
  }

  #masthead #box-menu {
    top: calc(63px + var(--cp-banner-h));
  }
}
