/* ==========================================================================
   Womix 2026 — karta produktu (templates/page_produkt.tpl + /js/womix-2026-product.js).
   Ładowana warunkowo przez inc_header.tpl (wx_css="product"), po womix-2026-legacy.css.
   ========================================================================== */

.wx-legacy main.wx-product {
  overflow: visible; /* stary womix.less: main{overflow:hidden} psuje position:sticky */
  --wx-stick: 72px;
  padding: clamp(1.25rem, 2.5vw, 2.5rem) 0 clamp(3rem, 6vw, 5rem);
  font-size: 1.0625rem;
}
.wx-product *, .wx-product *::before, .wx-product *::after { box-sizing: border-box; }
.wx-product .wxi { width: 1.15em; height: 1.15em; }

/* ---------- okruszki ---------- */
.wx-crumbs { display: flex; flex-wrap: wrap; gap: .35rem .55rem; font-size: .875rem; color: var(--wx-muted); margin-bottom: clamp(1rem, 2vw, 1.75rem); }
.wx-legacy .wx-crumbs a { color: var(--wx-muted); text-decoration: none; }
.wx-legacy .wx-crumbs a:hover { color: var(--wx-red); }
.wx-crumbs [aria-current] { color: var(--wx-ink); font-weight: 500; }

/* ---------- hero: galeria + podsumowanie ---------- */
.wx-product-hero {
  display: grid; gap: clamp(1.5rem, 3vw, 3.5rem); grid-template-columns: 1fr;
  background: #fff; padding: clamp(1rem, 2.5vw, 2.5rem);
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 18px 40px -30px rgba(0,0,0,.25);
}
@media (min-width: 992px) { .wx-product-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; } }

.wx-pg { min-width: 0; }
.wx-pg-main {
  display: flex; align-items: center; justify-content: center; position: relative;
  aspect-ratio: 4 / 3; background: var(--wx-paper-2); cursor: zoom-in; overflow: hidden;
}
.wx-pg-main img { max-width: 86%; max-height: 86%; width: auto; height: auto; object-fit: contain; transition: transform .4s var(--wx-ease); mix-blend-mode: multiply; }
.wx-pg-main:hover img { transform: scale(1.03); }
.wx-pg-main::after {
  content: ""; position: absolute; right: 1rem; bottom: 1rem; width: 40px; height: 40px; border-radius: 50%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316191c' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5M10.5 7.5v6M7.5 10.5h6'/%3E%3C/svg%3E") center / 20px no-repeat;
  box-shadow: 0 4px 14px -6px rgba(0,0,0,.35); opacity: .9;
}
.wx-pg-thumbs { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.wx-pg-thumbs[hidden] { display: none; }
.wx-pg-thumbs button {
  display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; padding: .35rem;
  background: var(--wx-paper-2); border: 2px solid transparent; cursor: pointer; transition: border-color .2s;
}
.wx-pg-thumbs button:hover { border-color: var(--wx-line); }
.wx-pg-thumbs button[aria-current="true"] { border-color: var(--wx-red); }
.wx-pg-thumbs img { max-width: 100%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }

.wx-product-summary { min-width: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.wx-product-cat { margin: 0; font: 600 .8125rem/1.2 var(--wx-font); letter-spacing: .12em; text-transform: uppercase; }
.wx-legacy .wx-product-cat a { color: var(--wx-red); text-decoration: none; }
.wx-legacy .wx-product-cat a:hover { color: var(--wx-red-dark); }
.wx-legacy .wx-product-title { margin: 0; font-size: clamp(2.25rem, 1.6rem + 2.2vw, 3.5rem); line-height: 1; }
.wx-product-title::after { content: ""; display: block; width: 48px; height: 3px; background: var(--wx-red); margin-top: 1rem; }
.wx-product-lead { margin: 0; font-size: 1.1875rem; line-height: 1.5; color: var(--wx-text); }
.wx-product-intro:empty { display: none; }
.wx-product-intro > :last-child { margin-bottom: 0; }
.wx-product-intro p { line-height: 1.6; }

.wx-keyspecs { margin: .25rem 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--wx-line); border: 1px solid var(--wx-line); }
.wx-keyspecs[hidden] { display: none; }
.wx-keyspecs > div { background: #fff; }
.wx-keyspecs dt, .wx-keyspecs dd { margin: 0; }
.wx-keyspecs dt { padding: .8rem 1rem 0; font: 500 .75rem/1.2 var(--wx-font); letter-spacing: .08em; text-transform: uppercase; color: var(--wx-muted); }
.wx-keyspecs dd { padding: .25rem 1rem .85rem; font: 600 1.25rem/1.2 var(--wx-display); color: var(--wx-ink); }

.wx-product-cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .4rem; }
.wx-product-cta .wx-btn { text-decoration: none; }
.wx-product-cta .wx-btn[hidden] { display: none; }
.wx-btn--line, a.wx-btn--line, a.wx-btn--line:visited { background: #fff; border-color: var(--wx-ink); color: var(--wx-ink); }
.wx-btn--line:hover, a.wx-btn--line:hover, a.wx-btn--line:focus { background: var(--wx-ink); color: #fff; }

/* ---------- spis treści (przyklejony pod nagłówkiem) ---------- */
.wx-product-toc {
  position: sticky; top: var(--wx-stick); z-index: 20; margin-top: clamp(1.5rem, 3vw, 2.5rem);
  background: rgba(243,244,245,.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--wx-line);
}
.wx-product-toc[hidden] { display: none; }
.wx-product-toc ul {
  list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(1rem, 2.5vw, 2.25rem);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.wx-product-toc ul::-webkit-scrollbar { display: none; }
.wx-legacy main.wx-product .wx-product-toc li a {
  display: block; padding: .95rem 0 .85rem; white-space: nowrap; text-decoration: none;
  font: 600 .9375rem/1.2 var(--wx-font); color: var(--wx-muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.wx-legacy main.wx-product .wx-product-toc li a:hover { color: var(--wx-ink); }
.wx-legacy main.wx-product .wx-product-toc li a.is-active { color: var(--wx-ink); border-bottom-color: var(--wx-red); }

/* ---------- treść ---------- */
.wx-product-content { padding-top: clamp(1.5rem, 3vw, 2.5rem); max-width: 100%; }
.wx-product-content > * { max-width: 100%; }
.wx-psec {
  background: #fff; padding: clamp(1.25rem, 3vw, 2.75rem); margin-bottom: 1.25rem;
  scroll-margin-top: calc(var(--wx-stick) + 4rem);
  box-shadow: 0 1px 0 rgba(0,0,0,.04), 0 18px 40px -30px rgba(0,0,0,.25);
}
@media (min-width: 992px) {
  .wx-psec { display: grid; grid-template-columns: minmax(200px, 3fr) minmax(0, 9fr); gap: 2.5rem; }
}
.wx-legacy .wx-psec-h { margin: 0 0 1.25rem; font-size: clamp(1.6rem, 1.3rem + .9vw, 2.1rem); }
.wx-psec-h::before { content: ""; display: block; width: 32px; height: 3px; background: var(--wx-red); margin-bottom: .8rem; }
@media (min-width: 992px) { .wx-legacy .wx-psec-h { margin: 0; position: sticky; top: calc(var(--wx-stick) + 4.5rem); align-self: start; } }
.wx-psec-body { min-width: 0; line-height: 1.65; }
.wx-psec-body > :first-child { margin-top: 0; }
.wx-psec-body > :last-child { margin-bottom: 0; }
.wx-psec-body p, .wx-psec-body ul, .wx-psec-body ol { margin: 0 0 1rem; max-width: 72ch; }
.wx-psec-body ul { padding-left: 1.2rem; }
.wx-psec-body li { margin-bottom: .35rem; }
.wx-psec-body li::marker { color: var(--wx-red); }
.wx-legacy .wx-psec-body h3, .wx-legacy .wx-psec-body h4 { margin: 2rem 0 .9rem; font-size: 1.35rem; }
.wx-psec-body img { display: block; max-width: 100%; height: auto; margin: 0 0 1rem; }
/* obrazki obok siebie (np. wymiary + schemat; JS grupuje sąsiednie obrazki w .wx-imgrow) */
.wx-imgrow { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-end; margin: 0 0 1.25rem; }
.wx-imgrow img { margin: 0; }
.wx-psec-body p:has(> img + img), .wx-psec-body p:has(> a > img):has(> a + a) { display: flex; flex-wrap: wrap; gap: 1rem; max-width: none; align-items: flex-start; }
.wx-psec-body p:has(> img + img) > img { flex: 1 1 260px; min-width: 0; object-fit: contain; }
.wx-psec-body figure { margin: 0 0 1.25rem; }
.wx-psec-body figcaption { font-size: .875rem; color: var(--wx-muted); margin-top: .4rem; }

/* tabele */
.wx-table-scroll { overflow-x: auto; margin: 0 0 1.25rem; -webkit-overflow-scrolling: touch; border: 1px solid var(--wx-line); }
.wx-legacy table.wx-table { width: 100%; border-collapse: collapse; margin: 0; font-size: .9375rem; background: #fff; font-variant-numeric: tabular-nums; }
.wx-legacy .wx-table th, .wx-legacy .wx-table td { padding: .7rem .9rem; border: 0; border-bottom: 1px solid var(--wx-line); text-align: left; vertical-align: top; }
.wx-legacy .wx-table tr:last-child > * { border-bottom: 0; }
.wx-legacy .wx-table thead th, .wx-legacy .wx-table thead td, .wx-legacy .wx-table tr:first-child > th {
  background: var(--wx-ink); color: #fff; font-weight: 600; white-space: nowrap; border-bottom: 0;
}
.wx-legacy .wx-table tbody tr:nth-child(even) > td { background: #fafafa; }
.wx-legacy .wx-table tbody tr:hover > td { background: #fff3f3; }
.wx-legacy .wx-table td p { margin: 0; }
/* tabele „klucz → wartość” (2 kolumny): wartości pogrubione */
.wx-legacy .wx-table tr > td:first-child:nth-last-child(2) { width: 40%; color: var(--wx-muted); }
.wx-legacy .wx-table tr > td:first-child:nth-last-child(2) + td { color: var(--wx-ink); font-weight: 500; }
/* nagłówek grupy (pełna szerokość) */
.wx-legacy .wx-table td[colspan], .wx-legacy .wx-table th[colspan] { background: var(--wx-paper-2); color: var(--wx-ink); font-weight: 600; }
.wx-legacy .wx-table code, .wx-legacy .wx-table .art { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .875em; color: var(--wx-ink); background: none; padding: 0; }

/* ---------- pliki do pobrania ---------- */
.wx-files { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.wx-legacy .wx-psec-body .wx-files li { margin: 0; }
.wx-legacy main.wx-product li a.wx-file {
  display: flex; align-items: center; gap: 1rem; height: 100%; padding: .9rem 1rem;
  border: 1px solid var(--wx-line); background: #fff; color: var(--wx-ink); text-decoration: none;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.wx-legacy main.wx-product li a.wx-file:hover { border-color: var(--wx-red); color: var(--wx-ink); box-shadow: 0 12px 24px -18px rgba(0,0,0,.4); transform: translateY(-1px); }
.wx-file-ext {
  flex: none; display: flex; align-items: center; justify-content: center; width: 46px; height: 56px; position: relative;
  background: var(--wx-ink); color: #fff; font: 700 .75rem/1 var(--wx-font); letter-spacing: .06em; text-transform: uppercase;
  clip-path: polygon(0 0, 70% 0, 100% 22%, 100% 100%, 0 100%);
}
.wx-file-ext[data-ext="pdf"] { background: var(--wx-red); }
.wx-file-ext[data-ext="jpg"], .wx-file-ext[data-ext="jpeg"], .wx-file-ext[data-ext="png"] { background: var(--wx-steel); }
.wx-file-ext[data-ext="zip"], .wx-file-ext[data-ext="dxf"], .wx-file-ext[data-ext="dwg"], .wx-file-ext[data-ext="step"], .wx-file-ext[data-ext="stp"] { background: #6b7a86; }
.wx-file-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.wx-file-name { font-weight: 600; line-height: 1.3; }
.wx-file-meta { font-size: .8125rem; color: var(--wx-muted); }
.wx-file > .wxi { flex: none; width: 22px; height: 22px; color: var(--wx-red); }

/* ---------- powiązane ---------- */
.wx-related { margin-top: clamp(2.5rem, 5vw, 4rem); }
.wx-legacy .wx-related-h { margin: 0 0 1.25rem; }
.wx-related-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.wx-legacy main.wx-product .wx-related-grid li a { display: flex; flex-direction: column; height: 100%; background: #fff; color: var(--wx-ink); text-decoration: none; transition: box-shadow .2s, transform .2s; }
.wx-legacy main.wx-product .wx-related-grid li a:hover { color: var(--wx-red); box-shadow: 0 18px 30px -22px rgba(0,0,0,.45); transform: translateY(-2px); }
.wx-related-img { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; padding: 1rem; background: #fff; }
.wx-related-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.wx-related-name { padding: .75rem 1rem 1rem; font: 600 1.125rem/1.2 var(--wx-display); border-top: 1px solid var(--wx-line); }

/* ---------- mobile ---------- */
@media (max-width: 575.98px) {
  .wx-legacy main.wx-product { padding-top: 1rem; }
  .wx-product > .wx-wrap:first-child { padding-left: 0; padding-right: 0; }
  .wx-crumbs { padding: 0 var(--wx-gutter); }
  .wx-product-hero { padding: 0 0 1.5rem; box-shadow: none; }
  .wx-product-summary { padding: 0 var(--wx-gutter); }
  .wx-pg-thumbs { padding: 0 var(--wx-gutter); grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 64px; overflow-x: auto; scrollbar-width: none; }
  .wx-product-cta .wx-btn { flex: 1 1 100%; justify-content: center; }
  .wx-keyspecs dd { font-size: 1.125rem; }
  .wx-product-content .wx-wrap, .wx-product > .wx-wrap:last-child { padding-left: 0; padding-right: 0; }
  .wx-psec { padding: 1.5rem var(--wx-gutter); margin-bottom: .75rem; box-shadow: none; }
  .wx-related { padding: 0 var(--wx-gutter); }
}

@media (prefers-reduced-motion: reduce) {
  .wx-product * { transition: none !important; }
  html { scroll-behavior: auto; }
}
@media (prefers-reduced-motion: no-preference) { html:has(.wx-product.has-toc) { scroll-behavior: smooth; } }
