/* =========================================================
   Katalog: listingi (stoly-stoliki, krzesla) + karty produktów
   Figma: "Listing" (23:2), "Produkt" (24:2)
   ========================================================= */

/* ---------- Badge "Nowość" na zdjęciu ---------- */
.p-badge {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--c-green);
  color: var(--c-ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 13px;
}

/* ---------- Kadr zdjęć 16:9 jak w Figmie ----------
   Figma powiększa render o 10% od górnej krawędzi (h:110%, w:146.7%).
   Ukrywa to przy okazji znak wodny w lewym dolnym rogu zdjęć. */
.p-card__media--wide img,
.gallery__main--wide img,
.gallery__thumb--wide img {
  transform: scale(1.1);
  transform-origin: 50% 0;
}

/* ---------- Filtry ---------- */
.filters {
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}
.filters__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-block: 15px;   /* 64px łącznie z obramowaniem, jak w Figmie */
}
.filters__chips { display: flex; gap: 8px; }
.chip {
  padding: 7px 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  background: var(--c-white);
  color: var(--c-ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  transition: border-color .2s, background-color .2s, color .2s;
}
.chip:hover { border-color: var(--c-ink); }
.chip.is-active { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-white); }
.filters__right { display: flex; align-items: center; gap: 24px; font-size: 13px; line-height: 16px; white-space: nowrap; }
.filters__count { color: var(--c-muted); }
.filters__sort { font-size: 13px; font-weight: 500; line-height: 16px; color: var(--c-ink); }
.filters__sort:hover { opacity: .65; }

/* ---------- Siatka produktów ---------- */
.products { padding: 32px 0 64px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px 16px;
}
.product-grid--chairs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-card[hidden] { display: none; }
.p-card__link { display: flex; flex-direction: column; gap: 14px; }
.p-card__media {
  position: relative;
  height: 292px;            /* Figma: stała wysokość, szerokość płynna */
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-soft);
}
.product-grid--chairs .p-card__media { height: auto; aspect-ratio: 3 / 4; }
.p-card__media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: scale .6s ease;
}
.p-card__link:hover .p-card__media img { scale: 1.04; }
.p-card__meta { display: flex; flex-direction: column; gap: 6px; }
.p-card__row { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.p-card__title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: -.01em;
}
.p-card__model { flex-shrink: 0; font-size: 12px; line-height: 15px; color: var(--c-muted); white-space: nowrap; }
.p-card__sub { font-size: 13px; line-height: 16px; color: var(--c-muted); }

.products__more { display: flex; justify-content: center; margin-top: 40px; }
.products__more:has([hidden]) { display: none; }
.btn--more { padding: 11px 23px; }
.products__empty { padding: 48px 0; text-align: center; color: var(--c-muted); font-size: 15px; }
.products__empty .link-arrow { color: var(--c-ink); }

/* ---------- SEO ---------- */
.seo { padding: 64px 0; background: var(--c-soft); }
.seo__cols,
.seo__more {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 48px;
  margin-top: 32px;
}
.seo__more[hidden] { display: none; }
.seo__col { display: flex; flex-direction: column; gap: 10px; }
.seo__col--wide { grid-column: 1 / -1; max-width: 820px; }
.seo__h { font-size: 15px; line-height: 18px; font-weight: 500; }
.seo__col p { font-size: 14px; line-height: 22px; color: var(--c-muted); }
.seo__col a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 3px; }
.seo__toggle {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 4px;
  margin-top: 32px;
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  color: var(--c-ink);
}
.seo__toggle:hover { opacity: .65; }
.seo__chev { display: inline-block; font-size: 11px; line-height: 16px; transition: transform .2s; }
.seo__toggle[aria-expanded="true"] .seo__chev { transform: rotate(180deg) translateY(-2px); }

/* =========================================================
   Karta produktu
   ========================================================= */
.product-crumb { padding: 24px 0; }

.product { padding: 8px 0 72px; }
.product__inner {
  display: grid;
  grid-template-columns: minmax(0, 736fr) minmax(0, 416fr);
  gap: 48px;
  align-items: start;
}

/* ---------- Galeria ---------- */
.gallery { display: flex; flex-direction: column; gap: 12px; outline: none; }
.gallery__main {
  position: relative;
  aspect-ratio: 736 / 552;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-soft);
}
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
/* białe rendery bryły – całe, na białym tle; krzesła (pion) – całe, na jasnym tle */
.gallery__main--render { background: var(--c-white); box-shadow: inset 0 0 0 1px var(--c-line); }
.gallery__main--render img { object-fit: contain; padding: 4%; }
.gallery__thumb--render { background: var(--c-white); }
.gallery__thumb--render img { transform: scale(1.35); }   /* jak miniatura 3 w Figmie: przybliżona bryła */
.gallery__main--contain img,
.gallery__thumb.gallery__thumb--contain img { object-fit: contain; }
.gallery__arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  margin-top: -20px;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  color: var(--c-ink);
  transition: transform .2s;
}
.gallery__arrow--prev { left: 16px; }
.gallery__arrow--next { right: 16px; }
.gallery__arrow:hover { transform: scale(1.08); }
.gallery__counter {
  position: absolute;
  right: 16px; bottom: 16px;
  z-index: 2;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(35, 31, 32, .7);
  color: var(--c-white);
  font-size: 11px;
  font-weight: 500;
  line-height: 13px;
}
.gallery__thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 12px;
}
.gallery__thumb {
  position: relative;
  display: block;
  width: 100%;
  height: 160px;
  border-radius: var(--r-md);
  overflow: hidden;
  opacity: .65;
  background: var(--c-soft);
  transition: opacity .2s;
}
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumb::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 1.5px solid transparent;
  transition: border-color .2s;
}
.gallery__thumb:hover { opacity: 1; }
.gallery__thumb.is-active { opacity: 1; }
.gallery__thumb.is-active::after { border-color: var(--c-ink); }

/* ---------- Info ---------- */
.product__info { display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }
.product__eyebrow {
  font-size: 11px;
  font-weight: 500;
  line-height: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-green);
}
.product__title { font-size: 40px; line-height: 42px; font-weight: 500; letter-spacing: -.02em; }
.product__lead { font-size: 15px; line-height: 23px; color: var(--c-muted); }
.facts { margin: 0; padding-top: 8px; }
.facts__row {
  display: flex;
  gap: 16px;
  padding: 12px 0 11px;     /* Figma: obramowanie wewnątrz 41px wiersza */
  border-top: 1px solid var(--c-line);
  line-height: 17px;
}
.facts__row dt { width: 88px; flex-shrink: 0; font-size: 13px; color: var(--c-muted); }
.facts__row dd { margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 500; }

.quote-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: var(--r-xl);
  background: var(--c-soft);
}
.quote-card__title { font-size: 15px; font-weight: 500; line-height: 18px; }
.btn--block { width: 100%; font-size: 14px; line-height: 17px; padding: 14px 20px; }
.btn--block.btn--dark { padding-block: 15px; border: 0; }
.btn--block.btn--outline { padding-block: 13px; }   /* 45px z obramowaniem, jak w Figmie */

/* ---------- Specyfikacja ---------- */
.spec { padding: 72px 0; background: var(--c-soft); }
.spec__inner {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
.spec__intro { display: flex; flex-direction: column; gap: 12px; }
.spec__intro p { font-size: 14px; line-height: 21px; color: var(--c-muted); }
.spec__table { margin: 0; border-top: 1px solid var(--c-line); }
.spec__row {
  display: flex;
  gap: 24px;
  padding: 14px 0 13px;     /* Figma: obramowanie wewnątrz 45px wiersza */
  border-bottom: 1px solid var(--c-line);
  line-height: 17px;
}
.spec__row:first-child { padding-top: 13px; }
.spec__row dt { width: 220px; flex-shrink: 0; font-size: 13px; color: var(--c-muted); }
.spec__row dd { margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 500; line-height: 17px; }
.spec__row dd.is-multi { line-height: 22px; margin-block: -2px; }

/* ---------- Kolory ---------- */
.colors { padding: 64px 0; background: #f8f8f8; }
.colors__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.colors__sub { margin-top: 8px; font-size: 14px; line-height: 17px; color: var(--c-muted); }
.swatches {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}
.swatches--15 { grid-template-columns: repeat(15, minmax(0, 1fr)); }
.swatch { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.swatch img { width: 100%; height: 108px; border-radius: var(--r-sm); object-fit: cover; }
.swatches--15 .swatch img { height: auto; aspect-ratio: 1; }
.swatch span { font-size: 11px; line-height: 13px; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Podobne modele ---------- */
.similar { padding: 24px 0 72px; }
.similar__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.product-grid--similar.product-grid--chairs { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* =========================================================
   Responsywność
   ========================================================= */
@media (max-width: 1200px) {
  .filters__inner { flex-direction: column; align-items: stretch; gap: 14px; }
  .filters__chips {
    overflow-x: auto;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .filters__chips::-webkit-scrollbar { display: none; }
  .filters__right { justify-content: space-between; }
  .swatches { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px 8px; }
  .swatches--15 { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; }
  .p-card__media { height: auto; aspect-ratio: 389 / 292; }
  .product-grid--chairs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seo__cols, .seo__more { grid-template-columns: 1fr; gap: 24px; }

  .product__inner { grid-template-columns: 1fr; gap: 32px; }
  .gallery__thumb { height: auto; aspect-ratio: 237 / 160; }
  .spec__inner { grid-template-columns: 1fr; gap: 24px; }
  .spec__row dt { width: 40%; max-width: 220px; }
  .product-grid--similar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .product-grid.product-grid--similar {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: 78%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .product-grid.product-grid--similar::-webkit-scrollbar { display: none; }
  .product-grid--similar .p-card { scroll-snap-align: start; }
  .colors__head { flex-direction: column; }
}

@media (max-width: 640px) {
  .products { padding-top: 24px; }
  .product-grid { grid-template-columns: 1fr; gap: 32px; }
  .product-grid--chairs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .product-grid--chairs .p-card__row { flex-direction: column; gap: 2px; }
  .product-grid--chairs .p-card__title { font-size: 16px; line-height: 20px; }
  .seo { padding: 48px 0; }

  .product-crumb { padding: 16px 0; }
  .product { padding-bottom: 56px; }
  .product__title { font-size: 32px; line-height: 36px; }
  .product__title br { display: none; }
  .gallery__arrow { width: 36px; height: 36px; margin-top: -18px; }
  .gallery__arrow--prev { left: 12px; }
  .gallery__arrow--next { right: 12px; }
  .gallery__thumbs { gap: 8px; }
  .spec { padding: 56px 0; }
  .spec__row { flex-direction: column; gap: 4px; }
  .spec__row dt { width: auto; max-width: none; }
  .colors { padding: 48px 0; }
  .swatches { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swatches--15 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .swatch img { height: auto; aspect-ratio: 1; }
  .similar { padding-bottom: 56px; }
}
