/* ===== Black Friday =====
   Linked by base.html only while a Black Friday promo is live (every promo
   id in api/helpers/checkout/promos/black_friday.py starts with
   black_friday). It dresses the two places that carry the promo line: the
   announcement bar under the header and the note in the checkout page
   header. Both stay on the brand accent, a shade deeper, and get gold
   edging, pale gold lettering that catches the light every few seconds, and
   small gold stars in place of the promo emoji. Motion is slow throughout
   and stops under prefers-reduced-motion. */
.announce-bar--black-friday,
.page-header__promo-message--black-friday {
  --bf-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%23fff4d6'/%3E%3Cstop offset='1' stop-color='%23e6b85c'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M5 0c.4 2.9 2.1 4.6 5 5-2.9.4-4.6 2.1-5 5-.4-2.9-2.1-4.6-5-5 2.9-.4 4.6-2.1 5-5z'/%3E%3C/svg%3E");
}

/* ===== Announcement bar =====
   The ground is the default bar's: the accent, darker towards the middle,
   where the text sits. A gold rule runs along the top and bottom edges. */
.header .announce-bar.announce-bar--black-friday {
  --bf-rule: linear-gradient(90deg, rgba(220, 174, 90, 0), #dcae5a 16%, #fbe9b9 50%, #dcae5a 84%, rgba(220, 174, 90, 0));
  background:
    var(--bf-rule) top / 100% 1px no-repeat,
    var(--bf-rule) bottom / 100% 1px no-repeat,
    radial-gradient(circle, color-mix(in srgb, var(--accent-color) 78%, #000), color-mix(in srgb, var(--accent-color) 96%, #000));
  color: #ffedc2;
}

/* Most translations of the mobile line wrap to two lines, so the bar grows
   with its text instead of clipping the second one. */
.header.is-sticky .announce-bar.announce-bar--black-friday {
  max-height: 96px;
  padding-block: 10px;
}

/* The link fills the bar, so the whole strip is the tap target. */
.announce-bar--black-friday a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 26px;
  padding-inline: 16px;
  line-height: 1.35;
  letter-spacing: 0.05em;
}

/* A chevron closes the line and marks it as a link. The no-break space keeps
   it on the last word's line, and the glyph mirrors itself in RTL. */
.announce-bar--black-friday .announce-bar__text::after {
  content: "\00a0\203a";
}

.announce-bar--black-friday a:hover .announce-bar__text,
.announce-bar--black-friday a:focus-visible .announce-bar__text {
  text-decoration-line: underline;
  text-decoration-color: rgba(255, 237, 194, 0.8);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media only screen and (max-width: 700px) {
  .announce-bar--black-friday a {
    gap: 10px;
    padding-inline: 12px;
    letter-spacing: 0.02em;
  }
}

/* Wide screens leave the bar empty on both sides of the line: a few faint
   stars there, in two sets that brighten in turn. They stay clear of the
   middle, where the text is. */
@media only screen and (min-width: 1100px) {
  .announce-bar--black-friday::before,
  .announce-bar--black-friday::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.4;
    pointer-events: none;
    animation: black-friday-twinkle 5.2s ease-in-out infinite;
  }

  .announce-bar--black-friday::before {
    background:
      var(--bf-star) 3% 34% / 8px 8px no-repeat,
      var(--bf-star) 11% 70% / 5px 5px no-repeat,
      var(--bf-star) 19% 30% / 6px 6px no-repeat,
      var(--bf-star) 81% 70% / 6px 6px no-repeat,
      var(--bf-star) 89% 30% / 5px 5px no-repeat,
      var(--bf-star) 97% 66% / 8px 8px no-repeat;
  }

  .announce-bar--black-friday::after {
    background:
      var(--bf-star) 7% 64% / 5px 5px no-repeat,
      var(--bf-star) 15% 36% / 9px 9px no-repeat,
      var(--bf-star) 85% 64% / 9px 9px no-repeat,
      var(--bf-star) 93% 36% / 5px 5px no-repeat;
    animation-duration: 6.8s;
    animation-delay: -3.4s;
  }
}

/* ===== Checkout header note =====
   A plain plaque: one flat shade of the accent and a gold hairline, with no
   gradient, glow or shadow. The base rule clips its background to the text
   and forces its top margin and font size with !important: the clip is reset
   in both spellings (older browsers keep the prefixed one apart from the
   shorthand), the margin is forced back, and the size is set on the text
   span instead. */
.page-header .page-header__promo-message--black-friday {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  max-width: 100%;
  margin-top: 16px !important;
  padding: 9px 16px;
  border: 1px solid #e6b85c;
  border-radius: 12px;
  background: var(--accent-color);
  background: color-mix(in srgb, var(--accent-color) 86%, #000);
  -webkit-background-clip: border-box;
  background-clip: border-box;
  color: #ffedc2;
  -webkit-text-fill-color: #ffedc2;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

.page-header__promo-message--black-friday .page-header__promo-text {
  font-size: 16px;
  letter-spacing: 0.04em;
}

@media only screen and (max-width: 820px) {
  .page-header__promo-message--black-friday .page-header__promo-text {
    font-size: 14px;
    letter-spacing: 0.02em;
  }
}

/* ===== Shared: stars and lettering ===== */
/* The promo emoji gives way to a drawn pair of stars on each side. */
.announce-bar--black-friday .announce-bar__emoji,
.page-header__promo-message--black-friday .page-header__promo-emoji {
  display: none;
}

.announce-bar--black-friday a::before,
.announce-bar--black-friday a::after,
.page-header__promo-message--black-friday::before,
.page-header__promo-message--black-friday::after {
  content: "";
  flex: none;
  width: 19px;
  height: 20px;
  background:
    var(--bf-star) 100% 50% / 13px 13px no-repeat,
    var(--bf-star) 0 0 / 7px 7px no-repeat;
  animation: black-friday-sparkle 3.6s ease-in-out infinite;
}

.announce-bar--black-friday a::after,
.page-header__promo-message--black-friday::after {
  background-position: 0 50%, 100% 0;
  animation-delay: -1.8s;
}

[dir="rtl"] .announce-bar--black-friday a::before,
[dir="rtl"] .announce-bar--black-friday a::after,
[dir="rtl"] .page-header__promo-message--black-friday::before,
[dir="rtl"] .page-header__promo-message--black-friday::after {
  scale: -1 1;
}

.announce-bar--black-friday .announce-bar__text,
.page-header__promo-message--black-friday .page-header__promo-text {
  min-width: 0;
  text-wrap: balance;
}

/* Lettering: ivory at the top of each line to pale gold at the bottom, kept
   light enough to read on the accent, under a narrow band of white that
   crosses once per cycle and rests off the text between passes. The 1.35em
   pitch is the line height of both texts. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .announce-bar--black-friday .announce-bar__text,
  .page-header__promo-message--black-friday .page-header__promo-text {
    background:
      linear-gradient(105deg, rgba(255, 255, 255, 0) 45%, #fff 50%, rgba(255, 255, 255, 0) 55%) 100% 0 / 300% 100% no-repeat,
      linear-gradient(180deg, #fffaf0 22%, #ffedc2 52%, #fad892 86%) 0 0 / 100% 1.35em repeat-y;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: black-friday-glint 9s ease-in-out infinite;
  }
}

@keyframes black-friday-glint {
  0%,
  65% {
    background-position: 100% 0, 0 0;
  }
  100% {
    background-position: 0 0, 0 0;
  }
}

@keyframes black-friday-sparkle {
  0%,
  100% {
    transform: scale(0.82);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes black-friday-twinkle {
  0%,
  100% {
    opacity: 0.12;
  }
  50% {
    opacity: 0.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .announce-bar--black-friday::before,
  .announce-bar--black-friday::after,
  .announce-bar--black-friday a::before,
  .announce-bar--black-friday a::after,
  .announce-bar--black-friday .announce-bar__text,
  .page-header__promo-message--black-friday::before,
  .page-header__promo-message--black-friday::after,
  .page-header__promo-message--black-friday .page-header__promo-text {
    animation: none;
  }
}
