/* ==========================================================================
   Promotion banner (inc/promotions.php)
   Site blue panel with a red notched ribbon, the promotion's photos laid out
   as a spread (slots 1 to 8, in the order chosen in Promotions), text and
   button on the right. Loaded only while a promotion is showing.
   ========================================================================== */

.hb-promo {
  --promo-pine: #006ee6;      /* site secondary: the top bar and buttons */
  --promo-pine-lit: #1f84f2;
  --promo-pine-deep: #005ac2;
  --promo-cream: #ffffff;
  --promo-cream-soft: #ffffff; /* the softer blue-grey is too faint on this blue */
  --promo-berry: #c23e28;
  --promo-button: #f9c82d;    /* site accent */
  --promo-button-hover: #fbd65e;
  --promo-navy: #003d80;      /* site primary, for button text */
  --promo-shadow: rgba(0, 38, 92, 0.45);

  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  /* Photos on the left, text and button on the right. */
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  color: var(--promo-cream);
  background-color: var(--promo-pine);
  /* Light from the top left, falling off towards the bottom right. */
  background-image: linear-gradient(118deg, var(--promo-pine-lit) 0%, var(--promo-pine) 42%, var(--promo-pine-deep) 100%);
}

/* Fine grain on the panel only (behind text and photos), so the gradient
   never bands. */
.hb-promo::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hb-promo__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 2.5rem 2.5rem 2.5rem 1rem;
}

/* The flyer's notched ribbon. Right padding clears the notch. */
.hb-promo__ribbon {
  margin: 0 0 1rem;
  padding: 0.4rem 1.75rem 0.4rem 0.85rem;
  background: var(--promo-berry);
  color: var(--promo-cream);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.25;
  clip-path: polygon(0 0, 100% 0, calc(100% - 0.7rem) 50%, 100% 100%, 0 100%);
}

.hb-promo__title {
  margin: 0 !important;
  color: var(--promo-cream) !important;
  font-size: clamp(2rem, 1.45rem + 1.6vw, 2.75rem) !important;
  font-weight: 700;
  line-height: 1.08 !important;
}

.hb-promo__price {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.85rem 0 0;
}

.hb-promo__amount {
  font-size: clamp(2.75rem, 2rem + 2.4vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
}

.hb-promo__terms {
  color: var(--promo-cream-soft);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
}

.hb-promo__items {
  max-width: 30rem;
  margin: 0.9rem 0 0;
  color: var(--promo-cream-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.hb-promo__extra {
  max-width: 30rem;
  margin: 0.5rem 0 0;
  color: var(--promo-cream);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
}

.hb-promo__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.4rem;
  padding: 0.8rem 1.25rem;
  border-radius: 8px;
  background: var(--promo-button);
  color: var(--promo-navy) !important;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
}

.hb-promo__cta:hover {
  background: var(--promo-button-hover);
}

.hb-promo__cta:focus-visible {
  outline: 2px solid var(--promo-cream);
  outline-offset: 3px;
}

.hb-promo__arrow {
  width: 1em;
  height: 1em;
  flex: none;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hb-promo__cta:hover .hb-promo__arrow {
  transform: translate(2px, -2px);
}

/* --------------------------------------------------------------------------
   The spread: store product photos, overlapping like a laid-out order.
   -------------------------------------------------------------------------- */

.hb-promo__spread {
  position: relative;
  order: -1;
  min-height: 100%;
}

.hb-promo__item {
  position: absolute;
  height: auto;
  max-width: none;
  /* Tight, directional shadow tinted to the panel: lit from the top left. */
  filter: drop-shadow(5px 9px 7px var(--promo-shadow));
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.hb-promo__item--1 { top: 9%;  left: 6%;  width: 28%; z-index: 1; transform: rotate(-6deg); }
.hb-promo__item--2   { top: 4%;  left: 33%; width: 20%; z-index: 2; transform: rotate(8deg); }
.hb-promo__item--3 { top: 10%; left: 58%; width: 32%; z-index: 1; transform: rotate(4deg); }
.hb-promo__item--4 { top: 27%; left: 20%; width: 42%; z-index: 3; }
.hb-promo__item--5  { top: 34%; left: 57%; width: 27%; z-index: 4; transform: rotate(-4deg); }
.hb-promo__item--6   { top: 57%; left: 3%;  width: 24%; z-index: 4; transform: rotate(-8deg); }
.hb-promo__item--7  { top: 63%; left: 29%; width: 27%; z-index: 5; }
.hb-promo__item--8 { top: 60%; left: 60%; width: 24%; z-index: 5; transform: rotate(6deg); }

/* Hover: the spread settles a few pixels, one item after another. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .hb-promo:hover .hb-promo__item { translate: 0 -5px; }
  .hb-promo__item { transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), translate 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .hb-promo__item--1 { transition-delay: 0s; }
  .hb-promo__item--2   { transition-delay: 0.04s; }
  .hb-promo__item--3 { transition-delay: 0.08s; }
  .hb-promo__item--4 { transition-delay: 0.12s; }
  .hb-promo__item--5  { transition-delay: 0.16s; }
  .hb-promo__item--6   { transition-delay: 0.2s; }
  .hb-promo__item--7  { transition-delay: 0.24s; }
  .hb-promo__item--8 { transition-delay: 0.28s; }
}

/* --------------------------------------------------------------------------
   Homepage: takes the place of the "Bundle & Save" band.
   -------------------------------------------------------------------------- */

.hb-promo--home {
  min-height: 22rem;
  margin-top: 40px !important;
  margin-bottom: 24px !important;
  border-radius: 16px;
}

/* --------------------------------------------------------------------------
   Shop and category pages: takes the place of "Sale Now On".
   -------------------------------------------------------------------------- */

.hb-promo--shop {
  min-height: 12.5rem;
  border-radius: 0.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

.hb-promo--shop .hb-promo__content {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "ribbon ribbon"
    "title  title"
    "price  cta";
  align-items: center;
  justify-content: start;
  column-gap: 1.75rem;
  padding: 1.75rem 2rem 1.75rem 1rem;
}

.hb-promo--shop .hb-promo__ribbon { grid-area: ribbon; justify-self: start; margin-bottom: 0.75rem; }
.hb-promo--shop .hb-promo__title  { grid-area: title; font-size: clamp(1.6rem, 1.3rem + 0.9vw, 2rem) !important; }
.hb-promo--shop .hb-promo__price  { grid-area: price; margin-top: 0.6rem; }
.hb-promo--shop .hb-promo__amount { font-size: clamp(2.1rem, 1.7rem + 1.2vw, 2.75rem); }
.hb-promo--shop .hb-promo__cta    { grid-area: cta; margin-top: 0.6rem; }

.hb-promo--shop .hb-promo__item--1,
.hb-promo--shop .hb-promo__item--2,
.hb-promo--shop .hb-promo__item--6,
.hb-promo--shop .hb-promo__item--8 { display: none; }

.hb-promo--shop .hb-promo__item--5  { top: 2%;  left: 6%;  width: 34%; z-index: 1; transform: rotate(-6deg); }
.hb-promo--shop .hb-promo__item--3 { top: 4%;  left: 50%; width: 44%; z-index: 1; transform: rotate(5deg); }
.hb-promo--shop .hb-promo__item--4 { top: 36%; left: 20%; width: 48%; z-index: 3; }
.hb-promo--shop .hb-promo__item--7  { top: 54%; left: 64%; width: 32%; z-index: 4; }

/* --------------------------------------------------------------------------
   Product page note outside the ordering window.
   -------------------------------------------------------------------------- */

.hb-promo-note {
  margin: 0.5rem 0 0;
  color: var(--wp--preset--color--primary);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}

/* --------------------------------------------------------------------------
   Tablet and phone: photos on top, text underneath.
   -------------------------------------------------------------------------- */

@media (max-width: 781px) {
  .hb-promo,
  .hb-promo--shop {
    grid-template-columns: minmax(0, 1fr);
  }

  .hb-promo__spread {
    order: -1;
    height: 12rem;
    min-height: 0;
  }

  .hb-promo--shop .hb-promo__spread {
    height: 9rem;
  }

  .hb-promo__content,
  .hb-promo--shop .hb-promo__content {
    padding: 0.5rem 1.5rem 1.75rem;
  }

  /* Shop version: stack like the homepage one; the side-by-side
     price and button don't fit a phone. */
  .hb-promo--shop .hb-promo__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .hb-promo--shop .hb-promo__cta {
    margin-top: 1.1rem;
  }

  .hb-promo--home {
    margin-top: 24px !important;
  }
}

/* --------------------------------------------------------------------------
   Motion, to draw attention (off for reduced motion; nothing depends on it).
   1. Snow (when ticked): two layers falling at different speeds, behind the photos and
      text (z-index 0, above the panel colour only).
   2. A glint across the button every 2 seconds (the sweep takes about
      1.26s, the same speed as before; the rest of the cycle is a pause).
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .hb-promo--snow::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Ccircle cx='105.0' cy='51.1' r='2.18' fill='white' fill-opacity='0.48'/%3E%3Ccircle cx='171.2' cy='118.1' r='1.47' fill='white' fill-opacity='0.68'/%3E%3Ccircle cx='15.7' cy='139.3' r='1.48' fill='white' fill-opacity='0.49'/%3E%3Ccircle cx='136.4' cy='262.0' r='1.55' fill='white' fill-opacity='0.55'/%3E%3Ccircle cx='199.8' cy='299.7' r='2.09' fill='white' fill-opacity='0.63'/%3E%3Ccircle cx='308.6' cy='18.5' r='2.43' fill='white' fill-opacity='0.58'/%3E%3Ccircle cx='49.0' cy='40.8' r='1.77' fill='white' fill-opacity='0.82'/%3E%3Ccircle cx='60.4' cy='185.5' r='2.17' fill='white' fill-opacity='0.62'/%3E%3Ccircle cx='174.9' cy='23.6' r='1.47' fill='white' fill-opacity='0.54'/%3E%3Ccircle cx='216.3' cy='137.4' r='1.78' fill='white' fill-opacity='0.71'/%3E%3Ccircle cx='145.4' cy='97.5' r='2.35' fill='white' fill-opacity='0.76'/%3E%3Ccircle cx='80.2' cy='183.2' r='2.03' fill='white' fill-opacity='0.84'/%3E%3Ccircle cx='231.6' cy='93.8' r='2.58' fill='white' fill-opacity='0.50'/%3E%3Ccircle cx='134.5' cy='240.2' r='1.58' fill='white' fill-opacity='0.67'/%3E%3Ccircle cx='16.2' cy='212.5' r='2.32' fill='white' fill-opacity='0.71'/%3E%3Ccircle cx='277.1' cy='101.9' r='2.23' fill='white' fill-opacity='0.72'/%3E%3C/svg%3E"),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Ccircle cx='90.9' cy='111.5' r='1.35' fill='white' fill-opacity='0.66'/%3E%3Ccircle cx='101.5' cy='116.8' r='0.83' fill='white' fill-opacity='0.68'/%3E%3Ccircle cx='124.9' cy='156.3' r='0.77' fill='white' fill-opacity='0.59'/%3E%3Ccircle cx='21.4' cy='159.5' r='1.19' fill='white' fill-opacity='0.47'/%3E%3Ccircle cx='192.6' cy='189.2' r='1.16' fill='white' fill-opacity='0.73'/%3E%3Ccircle cx='34.2' cy='6.9' r='1.07' fill='white' fill-opacity='0.48'/%3E%3Ccircle cx='40.5' cy='50.5' r='0.72' fill='white' fill-opacity='0.66'/%3E%3Ccircle cx='88.6' cy='165.7' r='1.06' fill='white' fill-opacity='0.74'/%3E%3Ccircle cx='100.0' cy='131.2' r='1.02' fill='white' fill-opacity='0.58'/%3E%3Ccircle cx='195.5' cy='195.2' r='1.29' fill='white' fill-opacity='0.77'/%3E%3Ccircle cx='64.5' cy='48.1' r='0.90' fill='white' fill-opacity='0.48'/%3E%3Ccircle cx='151.1' cy='80.9' r='1.29' fill='white' fill-opacity='0.62'/%3E%3Ccircle cx='187.9' cy='166.7' r='0.70' fill='white' fill-opacity='0.54'/%3E%3Ccircle cx='178.8' cy='94.2' r='1.39' fill='white' fill-opacity='0.63'/%3E%3Ccircle cx='18.0' cy='124.9' r='1.24' fill='white' fill-opacity='0.57'/%3E%3Ccircle cx='20.7' cy='67.9' r='1.37' fill='white' fill-opacity='0.79'/%3E%3Ccircle cx='26.7' cy='51.3' r='0.77' fill='white' fill-opacity='0.48'/%3E%3Ccircle cx='157.0' cy='38.1' r='1.09' fill='white' fill-opacity='0.65'/%3E%3Ccircle cx='40.6' cy='144.5' r='0.79' fill='white' fill-opacity='0.74'/%3E%3Ccircle cx='26.4' cy='84.8' r='0.85' fill='white' fill-opacity='0.57'/%3E%3Ccircle cx='190.4' cy='158.3' r='0.91' fill='white' fill-opacity='0.85'/%3E%3Ccircle cx='44.5' cy='79.7' r='1.30' fill='white' fill-opacity='0.74'/%3E%3C/svg%3E");
    background-size: 320px 320px, 200px 200px;
    background-repeat: repeat;
    opacity: 0.55;
    /* Each layer moves a whole number of tiles per cycle, so the loop is seamless. */
    animation: hb-promo-snow 26s linear infinite;
  }

  .hb-promo__cta,
  .hb-topbar-promo .hb-topbar-cta {
    position: relative;
    overflow: hidden;
    isolation: isolate;
  }

  /* Same glint on the top bar's button while a promotion runs. */
  .hb-promo__cta::after,
  .hb-topbar-promo .hb-topbar-cta::after {
    content: "";
    position: absolute;
    inset: -20% auto -20% 0;
    width: 45%;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
    transform: translateX(-130%);
    animation: hb-promo-glint 2s cubic-bezier(0.4, 0, 0.2, 1) 1s infinite;
  }
}

@keyframes hb-promo-snow {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 640px, 0 200px; }
}

@keyframes hb-promo-glint {
  0%   { transform: translateX(-130%); }
  63%  { transform: translateX(260%); }
  100% { transform: translateX(260%); }
}
