/* ── Gotowe projekty (strona główna): karuzela renderów + katalog w okienku — assets/js/projekty.js ── */

.pg { padding: 0 1rem 3rem; background: var(--white); }
.pg-naglowek { max-width: 880px; margin: 0 auto 1.25rem; text-align: center; }
.pg-tytul { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 800; color: var(--dark); margin: 0 0 .5rem; }
.pg-lead { color: var(--lq-tx2); margin: 0; line-height: 1.6; }

/* Karuzela: przewijany pas z przyciąganiem do kafelków */
.pg-karuzela { position: relative; }
.pg-tasma {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 8px 4px 14px; scrollbar-width: none;
}
.pg-tasma::-webkit-scrollbar { display: none; }
.pg-k {
  flex: 0 0 auto; width: clamp(150px, 17vw, 230px); scroll-snap-align: start; padding: 0; text-align: left;
  background: var(--white); border: 1px solid var(--lq-bd); border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; font: inherit; color: inherit;
}
.pg-k:hover, .pg-k:focus-visible { transform: translateY(-3px); border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .12); outline: none; }
.pg-k img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: var(--lq-bg); }
.pg-k-nazwa { display: block; padding: .5rem .65rem .6rem; font-size: .85rem; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-k-nazwa:empty { display: none; }
.pg-strz {
  position: absolute; top: 42%; transform: translateY(-50%); z-index: 2; width: 44px; height: 44px; border: 0;
  border-radius: 50%; background: var(--dark); color: var(--white); font-size: 1.6rem; line-height: 1; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25); opacity: .9;
}
.pg-strz:hover { background: var(--primary); opacity: 1; }
.pg-strz-l { left: -10px; }
.pg-strz-p { right: -10px; }
@media (hover: none) { .pg-strz { display: none; } }

/* Przycisk „Pokaż wszystkie” pod karuzelą — otwiera cały katalog */
.pg-wiecej { margin-top: .5rem; text-align: center; }
.pg-wszystkie {
  padding: .8rem 1.75rem; border: 0; border-radius: .25rem; background: var(--dark); color: var(--white);
  font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; transition: background-color .3s;
}
.pg-wszystkie:hover, .pg-wszystkie:focus-visible { background: var(--primary); outline: none; }

/* Katalog w okienku */
html.pg-otwarty { overflow: hidden; }
.pg-katalog {
  width: min(1400px, 96vw); height: 92vh; max-width: none; max-height: none; padding: 0; border: 0;
  border-radius: 14px; overflow: hidden; color: var(--dark); background: var(--lq-bg);
}
.pg-katalog[open] { display: flex; flex-direction: column; }
.pg-katalog::backdrop { background: rgba(0, 0, 0, .65); }
.pg-k-gora {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem;
  background: var(--dark); color: var(--white); border-bottom: 3px solid var(--primary);
}
.pg-k-tytuly { flex: 1 1 320px; min-width: 0; }
.pg-k-gora h2 { font-size: 1.2rem; font-weight: 800; margin: 0; color: var(--white); }
.pg-k-info { margin: .2rem 0 0; font-size: .85rem; color: #c9c9c9; }
.pg-k-koszyk {
  display: inline-flex; gap: .35rem; align-items: center; padding: .55rem 1rem; border-radius: 999px;
  background: var(--primary); color: var(--white); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.pg-k-koszyk:hover { background: #c4161d; color: var(--white); }
.pg-k-koszyk span:last-child::before { content: '·'; margin-right: .4rem; }
.pg-k-koszyk[hidden] { display: none; }
.pg-k-zamknij {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .12); color: var(--white);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.pg-k-zamknij:hover { background: var(--primary); }

.pg-zakladki { display: flex; gap: .5rem; overflow-x: auto; padding: .75rem 1.25rem; background: var(--white);
  border-bottom: 1px solid var(--lq-bd); scrollbar-width: thin; }
.pg-zakladki button {
  flex: 0 0 auto; padding: .45rem .9rem; border: 1px solid var(--lq-bd2); border-radius: 999px; background: var(--white);
  font: inherit; font-size: .85rem; font-weight: 600; color: var(--dark); cursor: pointer; white-space: nowrap;
}
.pg-zakladki button:hover { border-color: var(--primary); color: var(--primary); }
.pg-zakladki button[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--white); }

.pg-siatka {
  flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px;
  /* max-content: kafelki z overflow:hidden inaczej dałoby się ścisnąć do wysokości okienka */
  grid-auto-rows: max-content; padding: 16px 1.25rem 24px; align-content: start;
}
.pg-t {
  position: relative; display: flex; flex-direction: column; background: var(--white); border: 1px solid var(--lq-bd);
  border-radius: 10px; overflow: hidden; transition: box-shadow .2s ease, border-color .2s ease;
}
.pg-t:hover { box-shadow: 0 8px 22px rgba(0, 0, 0, .12); border-color: var(--lq-bd2); }
.pg-t.pg-wybrany { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .35); }
.pg-t-obraz { display: block; padding: 0; border: 0; background: var(--lq-bg); cursor: zoom-in; }
.pg-t-obraz img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.pg-t-opis { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .7rem .7rem; font-size: .8rem;
  color: var(--lq-tx2); line-height: 1.35; }
.pg-t-opis strong { color: var(--dark); font-size: .88rem; }

/* „Dodaj do koszyka”: na kafelku po najechaniu (nad dolną krawędzią obrazka); dodany — widoczny stale */
.pg-t-dodaj {
  padding: .55rem .8rem; border: 0; border-radius: 8px; background: var(--primary); color: var(--white);
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.pg-t-dodaj:hover { background: #c4161d; }
.pg-t-dodaj.pg-jest { background: #1e7d3c; }
.pg-t-dodaj.pg-jest:hover { background: var(--dark); }
/* dół kwadratowego obrazka: margin-top w % liczy się od szerokości kafelka = wysokości obrazka */
.pg-t > .pg-t-dodaj { position: absolute; left: 10px; right: 10px; top: 0; margin-top: calc(100% - 3.3rem); opacity: 0;
  transform: translateY(6px); transition: opacity .18s ease, transform .18s ease; }
.pg-t:hover > .pg-t-dodaj, .pg-t:focus-within > .pg-t-dodaj, .pg-t > .pg-t-dodaj.pg-jest { opacity: 1; transform: none; }
@media (hover: none) {
  .pg-t > .pg-t-dodaj { position: static; opacity: 1; transform: none; margin: 0 .6rem .6rem; box-shadow: none; }
}

/* Wybór ilości po „Dodaj do koszyka”: „Zamów 1 szt.” / „Zamów 10 szt.” z ceną brutto (projekty.js pokazWybor).
   Na kafelku — nakładka na kwadratowy obrazek z oknem przy dolnej krawędzi; w powiększeniu — w miejscu przycisku. */
.pg-wybiera > .pg-t-dodaj { visibility: hidden; }
.pg-pg-opis.pg-wybiera > .pg-t-dodaj { display: none; }
.pg-t > .pg-wybor {
  position: absolute; top: 0; left: 0; right: 0; aspect-ratio: 1; z-index: 2; display: flex; flex-direction: column;
  justify-content: flex-end; padding: 8px; background: linear-gradient(rgba(0, 0, 0, .05) 35%, rgba(0, 0, 0, .55));
}
.pg-wybor-okno {
  position: relative; display: flex; flex-direction: column; gap: .4rem; padding: .55rem; border-radius: 10px;
  background: rgba(20, 20, 20, .94); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.pg-pg-opis > .pg-wybor { align-self: stretch; max-width: 360px; }
.pg-opcja {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .1rem .6rem; width: 100%;
  padding: .55rem .7rem; border: 0; border-radius: 8px; background: var(--primary); color: var(--white); font: inherit;
  font-size: .82rem; font-weight: 700; line-height: 1.25; text-align: left; cursor: pointer;
}
.pg-opcja:hover, .pg-opcja:focus-visible { background: #c4161d; outline: 2px solid var(--white); outline-offset: -3px; }
.pg-cena { font-weight: 800; white-space: nowrap; }
.pg-cena:empty { display: none; }
.pg-wybor-info { margin: 0; font-size: .7rem; color: #cfcfcf; text-align: center; }
.pg-wybor-info[hidden] { display: none; }
.pg-wybor-x {
  position: absolute; top: -9px; right: -6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: var(--white); color: var(--dark); font-size: 1.05rem; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.pg-wybor-x:hover { background: var(--primary); color: var(--white); }
.pg-pg-opis .pg-opcja { padding: .75rem 1rem; font-size: .95rem; }

/* Powiększenie renderu w okienku */
.pg-podglad { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  padding: 2rem; background: rgba(0, 0, 0, .78); }
.pg-podglad[hidden] { display: none; }
.pg-pg-ramka { position: relative; display: flex; gap: 1.25rem; align-items: center; max-width: 1000px; width: 100%;
  max-height: 100%; padding: 1rem; background: var(--white); border-radius: 12px; }
.pg-pg-ramka img { width: min(62vh, 60%); height: auto; aspect-ratio: 1; object-fit: contain; border-radius: 8px;
  background: var(--lq-bg); }
.pg-pg-opis { display: flex; flex-direction: column; gap: .6rem; flex: 1; min-width: 0; }
.pg-pg-opis strong { font-size: 1.3rem; }
.pg-pg-opis span { color: var(--lq-tx2); }
.pg-pg-opis .pg-t-dodaj { align-self: flex-start; padding: .75rem 1.4rem; font-size: 1rem; }
.pg-pg-zamknij { position: absolute; top: -14px; right: -14px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--dark); color: var(--white); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.pg-pg-zamknij:hover { background: var(--primary); }

@media (max-width: 767.98px) {
  .pg-katalog { width: 100vw; height: 100dvh; border-radius: 0; }
  .pg-siatka { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; padding: 10px; }
  .pg-k-info { display: none; }
  .pg-podglad { padding: 1rem; }
  .pg-pg-ramka { flex-direction: column; }
  .pg-pg-ramka img { width: 100%; }
  .pg-pg-zamknij { top: 6px; right: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-tasma { scroll-behavior: auto; }
  .pg-k, .pg-t-dodaj { transition: none; }
}
