/*
 * Zabarvan CyberPunk - Sale Promo Ribbon
 * The seasonal sale strip that sits directly above the site header.
 * Aesthetic: hazard-yellow signal tape // black stencil type // chamfered CTA.
 * Scoped to [data-theme="cyberpunk"]. All rules unlayered.
 */

/* Server-rendered fallback for the fixed header offset. The component replaces
   this with a measured value on the client; these mirror its breakpoints so the
   header does not start at y=0 and jump down after hydration. Scoped with :has()
   so it only applies when the ribbon was actually rendered (ecommerce enabled). */
html[data-theme="cyberpunk"]:has(.cp-salebar) {
  --sale-banner-height: 43px;
}

@media (max-width: 900px) {
  html[data-theme="cyberpunk"]:has(.cp-salebar) {
    --sale-banner-height: 56px;
  }
}

@media (max-width: 560px) {
  html[data-theme="cyberpunk"]:has(.cp-salebar) {
    --sale-banner-height: 49px;
  }
}

@media (max-width: 400px) {
  html[data-theme="cyberpunk"]:has(.cp-salebar) {
    --sale-banner-height: 47px;
  }
}

/* Hidden by default (`.hidden` on the element); only the CyberPunk theme shows it.
   This sheet is loaded only for that theme, so no other theme ever paints the bar. */
[data-theme="cyberpunk"] .cp-salebar {
  display: block !important;
  position: sticky;
  top: var(--announcement-bar-height, 0px);
  z-index: 40;
  width: 100%;
  color: #050505;
  background-color: #fcee0a;
  background-image:
    repeating-linear-gradient(135deg, rgba(5, 5, 5, 0.035) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #fff048 0%, #fcee0a 55%, #efe006 100%);
  border-bottom: 1px solid rgba(5, 5, 5, 0.6);
  box-shadow: 0 1px 0 rgba(0, 240, 255, 0.22);
}

/* Hazard tape end caps */
[data-theme="cyberpunk"] .cp-salebar::before,
[data-theme="cyberpunk"] .cp-salebar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  background-image: repeating-linear-gradient(135deg, #050505 0 6px, transparent 6px 13px);
  opacity: 0.92;
}

[data-theme="cyberpunk"] .cp-salebar::before {
  left: 0;
}

[data-theme="cyberpunk"] .cp-salebar::after {
  right: 0;
}

/* ---------- 1. Desktop row ---------- */
[data-theme="cyberpunk"] .cp-salebar-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 42px;
  padding: 8px 56px;
  color: inherit;
  text-decoration: none;
}

[data-theme="cyberpunk"] .cp-salebar-title {
  font-family: var(--font-orbitron), sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

[data-theme="cyberpunk"] .cp-salebar-div {
  font-family: var(--font-geist-mono), monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: rgba(5, 5, 5, 0.35);
}

[data-theme="cyberpunk"] .cp-salebar-sub {
  font-family: var(--font-geist-mono), monospace;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(5, 5, 5, 0.74);
  white-space: nowrap;
}

[data-theme="cyberpunk"] .cp-salebar-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: #050505;
  color: #fcee0a;
  font-family: var(--font-orbitron), sans-serif;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  transition: background-color 0.18s ease, color 0.18s ease;
}

[data-theme="cyberpunk"] .cp-salebar-cta svg {
  width: 12px;
  height: 12px;
  transition: transform 0.18s ease;
}

[data-theme="cyberpunk"] .cp-salebar-link:hover .cp-salebar-cta {
  background: #00f0ff;
  color: #050505;
}

[data-theme="cyberpunk"] .cp-salebar-link:hover .cp-salebar-cta svg {
  transform: translateX(3px);
}

[data-theme="cyberpunk"] .cp-salebar-link:focus-visible {
  outline: 2px dashed #050505;
  outline-offset: -5px;
}

/* ---------- 2. Dismiss control ---------- */
[data-theme="cyberpunk"] .cp-salebar-close {
  position: absolute;
  top: 50%;
  right: 30px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  color: #050505;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

[data-theme="cyberpunk"] .cp-salebar-close:hover {
  opacity: 1;
  background: rgba(5, 5, 5, 0.08);
}

[data-theme="cyberpunk"] .cp-salebar-close:focus-visible {
  outline: 2px solid #050505;
  outline-offset: 1px;
  opacity: 1;
}

[data-theme="cyberpunk"] .cp-salebar-close svg {
  width: 13px;
  height: 13px;
}

/* ---------- 3. Tablet: two balanced rows ---------- */
@media (max-width: 900px) {
  [data-theme="cyberpunk"] .cp-salebar-link {
    gap: 3px 10px;
    padding: 7px 46px;
  }

  [data-theme="cyberpunk"] .cp-salebar-title {
    flex-basis: 100%;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-align: center;
  }

  [data-theme="cyberpunk"] .cp-salebar-div {
    display: none;
  }

  [data-theme="cyberpunk"] .cp-salebar::before,
  [data-theme="cyberpunk"] .cp-salebar::after {
    width: 14px;
  }

  [data-theme="cyberpunk"] .cp-salebar-close {
    right: 22px;
    width: 22px;
    height: 22px;
  }
}

/* ---------- 4. Phone tuning ---------- */
@media (max-width: 560px) {
  [data-theme="cyberpunk"] .cp-salebar-link {
    padding: 7px 38px;
  }

  [data-theme="cyberpunk"] .cp-salebar-title {
    font-size: 10px;
    letter-spacing: 0.12em;
  }

  [data-theme="cyberpunk"] .cp-salebar-sub {
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  [data-theme="cyberpunk"] .cp-salebar-cta {
    gap: 5px;
    padding: 5px 8px;
    font-size: 8px;
    letter-spacing: 0.14em;
  }

  [data-theme="cyberpunk"] .cp-salebar-cta svg {
    width: 10px;
    height: 10px;
  }

  [data-theme="cyberpunk"] .cp-salebar::before,
  [data-theme="cyberpunk"] .cp-salebar::after {
    width: 10px;
    background-image: repeating-linear-gradient(135deg, #050505 0 5px, transparent 5px 10px);
  }

  [data-theme="cyberpunk"] .cp-salebar-close {
    right: 16px;
  }
}

/* Very narrow screens: keep the two rows intact by dropping the CTA label
   (the whole ribbon is still the shop link, so the arrow keeps the affordance). */
@media (max-width: 400px) {
  [data-theme="cyberpunk"] .cp-salebar-link {
    gap: 3px 7px;
    padding: 6px 34px;
  }

  [data-theme="cyberpunk"] .cp-salebar-title {
    font-size: 9.5px;
    letter-spacing: 0.1em;
  }

  [data-theme="cyberpunk"] .cp-salebar-sub {
    font-size: 8.5px;
    letter-spacing: 0.08em;
  }

  [data-theme="cyberpunk"] .cp-salebar-cta {
    padding: 5px 8px;
  }
}

@media (max-width: 370px) {
  [data-theme="cyberpunk"] .cp-salebar-cta {
    padding: 5px;
  }

  [data-theme="cyberpunk"] .cp-salebar-cta-label {
    display: none;
  }
}
