/* Pasek sklepu GrowNotice. Prefiks .gx-grownotice-. Tokeny presetu żyją na .gx-grownotice-host[data-preset],
   więc nadpisanie sklepu (#id { --gx-accent }) wygrywa, a kit panelu (:root --gx-*) nie wchodzi do paska.
   Układ: desktop = jedna linia w stałej wysokości hosta; host węższy niż 640 px = treść nad przyciskami
   (container query), postęp jako dolna krawędź. Bez gradientów tła, bez fontów z sieci. */

/* 0 ─ szkielet przed renderem: miejsce zarezerwowane, zanim w.js narysuje pasek (CLS ≈ 0) */
[data-grownotice-mount]:empty {
  display: block;
  position: relative;
  min-height: 56px;
}
[data-grownotice-mount]:empty::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(44%, 360px);
  height: 10px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: color-mix(in srgb, currentColor 9%, transparent);
  animation: gx-grownotice-pulse 1.4s ease-in-out infinite;
}

/* 1 ─ host i tokeny */
.gx-grownotice-host,
.gx-grownotice-host *,
.gx-grownotice-host *::before,
.gx-grownotice-host *::after { box-sizing: border-box; }
.gx-grownotice-host {
  display: block;
  position: relative;
  width: 100%;
  overflow: hidden;
  container-type: inline-size;
  container-name: gx-bar;
  font-family: inherit;
  color: var(--gx-fg);
  -webkit-text-size-adjust: 100%;
  --gx-bar-cta-fg: #ffffff;
  --gx-bar-cta-h: 36px;
  --gx-bar-cta-size: 13px;
  --gx-bar-cta-weight: 700;
  --gx-bar-track-w: 120px;
  --gx-bar-track-h: 4px;
  --gx-bar-track-bg: color-mix(in srgb, var(--gx-fg) 14%, transparent);
  --gx-bar-line: transparent;
  --gx-bar-shadow: none;
  --gx-bar-pad-x: 24px;
  --gx-bar-strong: 700;
  --gx-bar-strong-color: inherit;
  --gx-bar-ghost-hover: color-mix(in srgb, var(--gx-fg) 9%, transparent);
  --gx-bar-ease: cubic-bezier(.2, .8, .2, 1);
  --gx-bar-fast: 160ms;
}
.gx-grownotice-host[data-preset="clean"] {
  --gx-bg: #ffffff;
  --gx-fg: #1a1a1a;
  --gx-accent: #2563eb;
  --gx-radius: 4px;
  --gx-gap: 12px;
  --gx-font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gx-bar-line: color-mix(in srgb, var(--gx-fg) 10%, transparent);
}
.gx-grownotice-host[data-preset="bold"] {
  --gx-bg: #111111;
  --gx-fg: #ffffff;
  --gx-accent: #facc15;
  --gx-radius: 0px;
  --gx-gap: 16px;
  --gx-font: 700 15px/1.4 Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gx-bar-cta-fg: #111111;
  --gx-bar-cta-weight: 800;
  --gx-bar-track-h: 3px;
  --gx-bar-track-bg: color-mix(in srgb, var(--gx-fg) 18%, transparent);
  --gx-bar-strong: 800;
  --gx-bar-strong-color: var(--gx-accent);
  --gx-bar-ghost-hover: color-mix(in srgb, var(--gx-fg) 14%, transparent);
}
.gx-grownotice-host[data-preset="soft"] {
  --gx-bg: #f7f3ef;
  --gx-fg: #3b302a;
  --gx-accent: #c2410c;
  --gx-radius: 16px;
  --gx-gap: 14px;
  --gx-font: 15px/1.6 Nunito, ui-rounded, "Segoe UI", system-ui, sans-serif;
  --gx-bar-cta-h: 38px;
  --gx-bar-track-h: 6px;
  --gx-bar-track-bg: color-mix(in srgb, var(--gx-accent) 16%, transparent);
  --gx-bar-line: color-mix(in srgb, var(--gx-accent) 18%, transparent);
  --gx-bar-strong-color: var(--gx-accent);
}
/* kolory sklepu: tło i tekst wchodzą do tokenów, więc kreski, tor i przyciski liczą się od nich */
.gx-grownotice-host[data-custom-bg="1"] { --gx-bg: var(--gx-custom-bg); }
.gx-grownotice-host[data-custom-fg="1"] { --gx-fg: var(--gx-custom-fg); }
.gx-grownotice-host[data-reserve="low"] { height: 44px; min-height: 44px; --gx-bar-cta-h: 30px; }
.gx-grownotice-host[data-reserve="standard"] { height: 56px; min-height: 56px; }
.gx-grownotice-host[data-reserve="tall"] { height: 72px; min-height: 72px; }
.gx-grownotice-host[data-surface="storefront"][data-sticky="1"] {
  position: sticky;
  top: 0;
  z-index: 30;
}
/* podgląd w panelu rośnie z treścią; stałą wysokość widać dopiero w sklepie */
.gx-grownotice-host[data-surface="preview"][data-reserve] { height: auto; overflow: visible; }
/* w panelu o układzie decyduje przełącznik „Urządzenie podglądu” (data-layout), nie szerokość kolumny.
   Kolumna podglądu ma ~450 px, więc rząd „Komputer” dostaje dwie linie treści i krótszy tor zamiast wielokropka. */
.gx-grownotice-host[data-surface="preview"] { container-type: normal; }
.gx-grownotice-host[data-surface="preview"]:not([data-layout="stack"]) .gx-grownotice-bar { padding: 10px 16px; }
.gx-grownotice-host[data-surface="preview"]:not([data-layout="stack"]) .gx-grownotice-copy {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}
.gx-grownotice-host[data-surface="preview"]:not([data-layout="stack"]) .gx-grownotice-track { --gx-bar-track-w: 72px; }

/* 2 ─ pasek */
.gx-grownotice-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--gx-gap);
  height: 100%;
  min-height: inherit;
  padding: 0 var(--gx-bar-pad-x);
  background: var(--gx-bg);
  color: var(--gx-fg);
  font: var(--gx-font);
  box-shadow: inset 0 -1px 0 var(--gx-bar-line), var(--gx-bar-shadow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.gx-grownotice-host[data-inherit-font="1"] .gx-grownotice-bar { font-family: inherit; }

/* 3 ─ treść */
.gx-grownotice-copy {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.gx-grownotice-host[data-reserve="tall"] .gx-grownotice-copy {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  text-align: center;
}
.gx-grownotice-copy p,
.gx-grownotice-rich p { margin: 0; display: inline; }
.gx-grownotice-copy strong,
.gx-grownotice-rich strong {
  font-weight: var(--gx-bar-strong);
  color: var(--gx-bar-strong-color);
  font-variant-numeric: tabular-nums;
}
.gx-grownotice-copy em,
.gx-grownotice-rich em { font-style: italic; }
.gx-grownotice-copy a,
.gx-grownotice-rich a,
.gx-grownotice-inline {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color var(--gx-bar-fast);
}
.gx-grownotice-copy a:hover,
.gx-grownotice-rich a:hover,
.gx-grownotice-inline:hover { text-decoration-color: currentColor; }

/* 4 ─ postęp do darmowej dostawy */
.gx-grownotice-track {
  flex: 0 0 var(--gx-bar-track-w);
  width: var(--gx-bar-track-w);
  height: var(--gx-bar-track-h);
  border-radius: 999px;
  overflow: hidden;
  background: var(--gx-bar-track-bg);
}
.gx-grownotice-track > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gx-accent);
  animation: gx-grownotice-grow .55s var(--gx-bar-ease) both;
}
/* Bold: postęp jako żółta krawędź całego paska, treść zostaje na jednej linii */
.gx-grownotice-host[data-preset="bold"] .gx-grownotice-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  flex: none;
  width: auto;
  border-radius: 0;
}

/* 5 ─ przyciski */
.gx-grownotice-cta,
.gx-grownotice-dismiss,
.gx-grownotice-pause {
  flex: none;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--gx-bar-cta-h);
  padding: 0 14px;
  border-radius: var(--gx-radius);
  background: var(--gx-accent);
  color: var(--gx-bar-cta-fg);
  font: inherit;
  font-size: var(--gx-bar-cta-size);
  font-weight: var(--gx-bar-cta-weight);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform var(--gx-bar-fast) var(--gx-bar-ease),
    background-color var(--gx-bar-fast) var(--gx-bar-ease),
    box-shadow var(--gx-bar-fast) var(--gx-bar-ease),
    opacity var(--gx-bar-fast) var(--gx-bar-ease),
    filter var(--gx-bar-fast) var(--gx-bar-ease);
}
.gx-grownotice-cta:hover,
.gx-grownotice-host[data-shot="hover"] .gx-grownotice-cta {
  filter: brightness(1.07);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--gx-accent) 38%, transparent);
}
.gx-grownotice-cta:active {
  transform: translateY(0) scale(.98);
  filter: brightness(.96);
  box-shadow: none;
}
.gx-grownotice-dismiss,
.gx-grownotice-pause {
  background: transparent;
  color: inherit;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  opacity: .78;
}
.gx-grownotice-dismiss:hover,
.gx-grownotice-pause:hover {
  opacity: 1;
  background: var(--gx-bar-ghost-hover);
}
.gx-grownotice-dismiss:active,
.gx-grownotice-pause:active { transform: scale(.97); }
/* ikony rysowane w CSS (bez glifów Unicode i bez żądań sieciowych) */
.gx-grownotice-dismiss::before,
.gx-grownotice-pause::before {
  content: "";
  display: block;
  flex: none;
  width: 10px;
  height: 10px;
}
.gx-grownotice-dismiss::before {
  background:
    linear-gradient(currentColor, currentColor) center / 100% 1.6px no-repeat,
    linear-gradient(currentColor, currentColor) center / 1.6px 100% no-repeat;
  transform: rotate(45deg);
}
.gx-grownotice-pause::before {
  width: 8px;
  background:
    linear-gradient(currentColor, currentColor) left / 2.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right / 2.5px 100% no-repeat;
}
.gx-grownotice-pause[aria-pressed="true"]::before {
  width: 0;
  height: 0;
  background: none;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
}
/* fokus: podwójny pierścień w kolorze tekstu, widoczny na każdym tle presetu i sklepu */
.gx-grownotice-cta:focus-visible,
.gx-grownotice-dismiss:focus-visible,
.gx-grownotice-pause:focus-visible,
.gx-grownotice-inline:focus-visible {
  outline: 2px solid var(--gx-fg);
  outline-offset: 2px;
}
.gx-grownotice-cta:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gx-bg), 0 0 0 4px var(--gx-fg);
}

/* 6 ─ przewijanie i rotacja */
.gx-grownotice-marquee {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
.gx-grownotice-marquee-move {
  display: flex;
  width: max-content;
  white-space: nowrap;
}
.gx-grownotice-marquee-move > span { padding-right: 40px; }
.gx-grownotice-host[data-motion="marquee"] .gx-grownotice-marquee-move {
  animation: gx-grownotice-marquee 18s linear infinite;
}
.gx-grownotice-host[data-motion="marquee"][data-speed="fast"] .gx-grownotice-marquee-move {
  animation-duration: 12s;
}
.gx-grownotice-host[data-motion="marquee"][data-speed="slow"] .gx-grownotice-marquee-move {
  animation-duration: 28s;
}
.gx-grownotice-host[data-motion="marquee"][data-direction="right"] .gx-grownotice-marquee-move {
  animation-direction: reverse;
}
.gx-grownotice-host[data-motion="marquee"]:hover .gx-grownotice-marquee-move,
.gx-grownotice-host[data-motion="marquee"]:focus-within .gx-grownotice-marquee-move,
.gx-grownotice-host[data-motion="marquee"][data-paused="1"] .gx-grownotice-marquee-move {
  animation-play-state: paused;
}
.gx-grownotice-host[data-motion="fade"] .gx-grownotice-slide { animation: gx-grownotice-fade .4s var(--gx-bar-ease) both; }
.gx-grownotice-host[data-motion="slide"] .gx-grownotice-slide { animation: gx-grownotice-slide .4s var(--gx-bar-ease) both; }

/* 7 ─ stany bez komunikatu */
.gx-grownotice-empty,
.gx-grownotice-error {
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
}
.gx-grownotice-empty { color: color-mix(in srgb, var(--gx-fg) 58%, transparent); }
.gx-grownotice-error { color: #b91c1c; }
.gx-grownotice-host[data-preset="bold"] .gx-grownotice-error { color: #fca5a5; }

@keyframes gx-grownotice-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes gx-grownotice-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes gx-grownotice-slide {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes gx-grownotice-grow {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0); }
}
@keyframes gx-grownotice-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

/* 8 ─ układ kompaktowy: host węższy niż 640 px (telefon, wąski podgląd w panelu).
   Treść na górze, przyciski w jednym rzędzie pod nią, postęp jako dolna krawędź. */
@container gx-bar (max-width: 640px) {
  .gx-grownotice-bar {
    height: auto;
    flex-wrap: wrap;
    align-content: center;
    row-gap: 10px;
    column-gap: 10px;
    padding: 14px 16px 16px;
    text-align: center;
  }
  .gx-grownotice-copy {
    flex: 1 0 100%;
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    text-wrap: balance;
    line-height: 1.45;
  }
  .gx-grownotice-marquee { flex: 1 0 100%; }
  .gx-grownotice-track {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    flex: none;
    width: auto;
    height: 3px;
    border-radius: 0;
  }
  .gx-grownotice-cta { min-height: 44px; padding: 0 20px; }
  .gx-grownotice-dismiss,
  .gx-grownotice-pause { min-height: 44px; padding: 0 12px; }
  .gx-grownotice-host[data-preset="bold"] .gx-grownotice-bar { padding: 16px 16px 20px; }
  .gx-grownotice-host[data-preset="bold"] .gx-grownotice-cta { min-height: 48px; padding: 0 24px; }
  .gx-grownotice-host[data-preset="soft"] .gx-grownotice-bar {
    margin: 8px 12px;
    padding: 14px 14px 16px;
    border-radius: var(--gx-radius);
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(59, 48, 42, .06), 0 10px 28px -8px rgba(59, 48, 42, .22);
  }
  .gx-grownotice-host[data-preset="soft"] .gx-grownotice-track { height: 4px; }
}
/* na telefonie host rośnie z treścią; sam host nie może odpytać własnej szerokości, stąd media query */
@media (max-width: 640px) {
  .gx-grownotice-host[data-reserve] { height: auto; overflow: visible; }
}
/* 8b ─ wymuszony układ kompaktowy: podgląd „Telefon” w panelu i lab `front.php?layout=stack`.
   Te same reguły co w @container wyżej; host dostaje `data-layout="stack"` z w.js. Trzymać w zgodzie. */
.gx-grownotice-host[data-layout="stack"][data-reserve] { height: auto; overflow: visible; }
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-bar {
  height: auto;
  flex-wrap: wrap;
  align-content: center;
  row-gap: 10px;
  column-gap: 10px;
  padding: 14px 16px 16px;
  text-align: center;
}
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-copy {
  flex: 1 0 100%;
  display: block;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  text-wrap: balance;
  line-height: 1.45;
}
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-marquee { flex: 1 0 100%; }
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  flex: none;
  width: auto;
  height: 3px;
  border-radius: 0;
}
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-cta { min-height: 44px; padding: 0 20px; }
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-dismiss,
.gx-grownotice-host[data-layout="stack"] .gx-grownotice-pause { min-height: 44px; padding: 0 12px; }
.gx-grownotice-host[data-layout="stack"][data-preset="bold"] .gx-grownotice-bar { padding: 16px 16px 20px; }
.gx-grownotice-host[data-layout="stack"][data-preset="bold"] .gx-grownotice-cta { min-height: 48px; padding: 0 24px; }
.gx-grownotice-host[data-layout="stack"][data-preset="soft"] .gx-grownotice-bar {
  margin: 8px 12px;
  padding: 14px 14px 16px;
  border-radius: var(--gx-radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(59, 48, 42, .06), 0 10px 28px -8px rgba(59, 48, 42, .22);
}
.gx-grownotice-host[data-layout="stack"][data-preset="soft"] .gx-grownotice-track { height: 4px; }
/* przeglądarka bez container queries: przynajmniej zawijanie i tor pod przyciskami */
@supports not (container-type: inline-size) {
  @media (max-width: 640px) {
    .gx-grownotice-bar { height: auto; flex-wrap: wrap; padding: 14px 16px 16px; text-align: center; }
    .gx-grownotice-copy { flex: 1 0 100%; white-space: normal; overflow: visible; text-overflow: clip; }
    .gx-grownotice-track { flex: none; width: min(100%, 220px); }
  }
}

/* 9 ─ mniej ruchu: bez przewijania (tekst zawinięty), bez wejść, bez pulsu */
@media (prefers-reduced-motion: reduce) {
  .gx-grownotice-host *,
  .gx-grownotice-host *::before,
  [data-grownotice-mount]:empty::before {
    animation: none !important;
    transition: none !important;
  }
  .gx-grownotice-host[data-motion="marquee"] .gx-grownotice-marquee { mask-image: none; -webkit-mask-image: none; }
  .gx-grownotice-host[data-motion="marquee"] .gx-grownotice-marquee-move { width: auto; white-space: normal; }
  .gx-grownotice-host[data-motion="marquee"] .gx-grownotice-marquee-move > span { padding-right: 0; }
  .gx-grownotice-host[data-motion="marquee"] .gx-grownotice-marquee-move > span[aria-hidden="true"] { display: none; }
  .gx-grownotice-cta:hover { transform: none; }
}
