/**
 * Black Friday announcement bar.
 * Layout offsets only. Navigation menu rules in main.css are not modified.
 *
 * --dz-bf-h     measured bar height (includes the notch inset)
 * --dz-bf-admin WordPress admin bar offset, only while this bar is showing
 */

:root {
  --dz-bf-h: calc(46px + env(safe-area-inset-top, 0px));
  --dz-bf-admin: 0px;
}

body.admin-bar {
  --dz-bf-admin: 32px;
}

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

html.dz-bf-off {
  --dz-bf-h: 0px;
}

html.dz-bf-off body.admin-bar {
  --dz-bf-admin: 0px;
}

/* Keep in-flow content, the sticky header and side rails below the bar. */
html:not(.dz-bf-off) body.dz-bf-on {
  padding-top: var(--dz-bf-h);
}

html:not(.dz-bf-off) body.dz-bf-on .dz-main-header {
  top: calc(var(--dz-bf-admin) + var(--dz-bf-h));
}

html:not(.dz-bf-off) body.dz-bf-on .dz-pdp-stage {
  top: calc(96px + var(--dz-bf-admin) + var(--dz-bf-h));
}

html:not(.dz-bf-off) body.dz-bf-on .dz-review-sticky-card {
  top: calc(88px + var(--dz-bf-admin) + var(--dz-bf-h));
}

html:not(.dz-bf-off) body.dz-bf-on .dz-article-aside {
  top: calc(6.5rem + var(--dz-bf-admin) + var(--dz-bf-h));
}

html:not(.dz-bf-off) body.dz-bf-on .dz-acc-rail {
  top: calc(88px + var(--dz-bf-admin) + var(--dz-bf-h));
}

/* In-flow WooCommerce notices stay in the page. This only keeps anchor jumps clear of the bar. */
html:not(.dz-bf-off) body.dz-bf-on .woocommerce-notices-wrapper,
html:not(.dz-bf-off) body.dz-bf-on .woocommerce-message,
html:not(.dz-bf-off) body.dz-bf-on .woocommerce-error,
html:not(.dz-bf-off) body.dz-bf-on .woocommerce-info {
  scroll-margin-top: calc(var(--dz-bf-h) + var(--dz-bf-admin) + 12px);
}

/* Havin opens upward from the bottom dock. Cap the panel so it stops under the bar. */
html:not(.dz-bf-off) body.dz-bf-on .havin-chat {
  max-height: calc(100vh - var(--dz-bf-h) - var(--dz-bf-admin) - 150px);
}

.dz-bf-bar {
  position: fixed;
  top: var(--dz-bf-admin);
  left: 0;
  right: 0;
  z-index: 10020;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  color: #f8f1de;
  font-family: var(--dz-font-main, "Vazirmatn", Tahoma, sans-serif);
  font-size: clamp(12px, 1.02vw, 14.5px);
  line-height: 1.4;
  background-color: #0c0c0d;
  background-image:
    linear-gradient(100deg, rgba(2, 132, 199, 0.28), transparent 24%, transparent 76%, rgba(212, 175, 55, 0.22)),
    linear-gradient(180deg, #1c1c1f 0%, #090909 100%);
  box-shadow:
    inset 0 1px 0 rgba(243, 212, 138, 0.55),
    inset 0 -2px 0 #0284c7,
    0 8px 18px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  direction: rtl;
}

html.dz-bf-off .dz-bf-bar {
  display: none !important;
}

.dz-bf-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 32%,
    rgba(255, 236, 180, 0.16) 46%,
    rgba(125, 211, 252, 0.14) 54%,
    transparent 68%
  );
  transform: translateX(80%);
  animation: dz-bf-sweep 5.6s ease-in-out infinite;
  pointer-events: none;
}

.dz-bf-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 46px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.28rem 0.85rem;
}

.dz-bf-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.dz-bf-desktop {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.dz-bf-msg {
  min-width: 0;
  font-weight: 600;
}

.dz-bf-gift {
  display: inline-block;
  transform-origin: center;
  animation: dz-bf-pulse 2.2s ease-in-out infinite;
}

.dz-bf-sep {
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e0b84a;
  box-shadow: 0 0 0 3px rgba(224, 184, 74, 0.16);
}

.dz-bf-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff1c2 0%, #e0b84a 100%);
  color: #1a1203;
  font-weight: 800;
  line-height: 1.5;
}

.dz-bf-marquee,
.dz-bf-rotator {
  display: none;
}

.dz-bf-marquee {
  overflow: hidden;
  min-width: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.dz-bf-track {
  display: flex;
  width: max-content;
  direction: ltr;
  animation: dz-bf-marquee 36s linear infinite;
}

.dz-bf-group {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding-inline: 1.4rem;
  direction: rtl;
  white-space: nowrap;
}

.dz-bf-bar:hover .dz-bf-track,
.dz-bf-bar:focus-within .dz-bf-track {
  animation-play-state: paused;
}

.dz-bf-rotator {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.dz-bf-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.dz-bf-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid #f3d48a;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 58%, #0369a1 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.92em;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.4);
}

.dz-bf-cta:hover {
  color: #1a1203;
  background: linear-gradient(180deg, #fff1c2 0%, #e0b84a 100%);
  border-color: #0284c7;
}

.dz-bf-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(243, 212, 138, 0.5);
  background: transparent;
  color: #f3d48a;
  font-family: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.dz-bf-close:hover {
  background: rgba(243, 212, 138, 0.14);
  color: #ffffff;
}

.dz-bf-cta:focus-visible,
.dz-bf-close:focus-visible {
  outline: 2px solid #7dd3fc;
  outline-offset: 1px;
}

@media (max-width: 992px) {
  .dz-bf-row {
    gap: 0.4rem;
    padding: 0.22rem 0.4rem;
  }

  .dz-bf-desktop {
    display: none;
  }

  .dz-bf-marquee {
    display: block;
  }

  .dz-bf-cta {
    height: 32px;
    padding: 0 0.7rem;
  }

  .dz-bf-close {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 992px) and (prefers-reduced-motion: reduce) {
  .dz-bf-marquee {
    display: none;
  }

  .dz-bf-rotator {
    display: block;
  }
}

@media (min-width: 993px) {
  .dz-bf-sr {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dz-bf-bar::after,
  .dz-bf-gift,
  .dz-bf-track {
    animation: none;
  }
}

@media print {
  .dz-bf-bar {
    display: none !important;
  }

  body.dz-bf-on {
    padding-top: 0 !important;
  }
}

@keyframes dz-bf-sweep {
  0% { transform: translateX(85%); }
  100% { transform: translateX(-85%); }
}

@keyframes dz-bf-pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(224, 184, 74, 0));
  }
  50% {
    transform: scale(1.16);
    filter: drop-shadow(0 0 6px rgba(240, 200, 90, 0.95));
  }
}

@keyframes dz-bf-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
