/* =====================================================================
   GALERIA — kolaż koncertowy (tylko /galeria/)
   Płaszczyzna projektowa 1680 px (dane: assets/js/gallery-data.js),
   skalowana jednolicie przez jednostki kontenera (cqw) do 768 px.
   <= 767 px: osobny, pionowy układ naprzemienny.
   ===================================================================== */

.page-gallery { --gallery-bg: #303577; --gallery-ease: cubic-bezier(.22, 1, .36, 1); --gallery-hover-ease: cubic-bezier(.22, .8, .22, 1); background-color: var(--gallery-bg); }
.page-gallery main {
  background:
    radial-gradient(ellipse 76% 18% at 0% 0%, #000030 0%, transparent 78%),
    radial-gradient(ellipse 78% 24% at 100% 2%, #3e49af 0%, transparent 80%),
    radial-gradient(ellipse 85% 20% at 5% 30%, #3e49af66 0%, transparent 80%),
    radial-gradient(ellipse 76% 20% at 100% 50%, #191945 0%, transparent 78%),
    radial-gradient(ellipse 82% 19% at 0% 84%, #000030 0%, transparent 78%),
    radial-gradient(ellipse 80% 23% at 100% 98%, #3e49af 0%, transparent 82%),
    var(--gallery-bg);
}

.gallery-page__body {
  --gallery-footer-fade: clamp(180px, 19vw, 300px);
  padding-block: clamp(40px, 4vw, 64px) max(220px, var(--gallery-footer-fade));
  background: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(100% - var(--gallery-footer-fade)),
    var(--color-navy) 100%
  );
}

.page-gallery .page-head { padding-bottom: 0; }

.gallery-page__intro {
  width: 100%;
  max-width: 1320px;
  margin-top: 32px;
  font-family: var(--font-body);
  font-size: clamp(20px, 1.6667vw, 24pt);
  font-weight: 500;
  font-stretch: 100%;
  font-variation-settings: "wdth" 100;
  letter-spacing: .01em;
  line-height: 30pt;
}

/* Długie słowo w niezmienionym H1 musi mieścić się także na tabletach. */
@media (min-width: 768px) and (max-width: 1100px) {
  .page-gallery .page-head .h1 { font-size: clamp(52px, 7vw, 76px); }
}

/* Scena: 1680 px przy 1920 (2 × 120 px oddechu), mniejsze ekrany: szerokość − 2 × margines strony. */
.gallery-stage {
  container-type: inline-size;
  width: min(1680px, 100% - 2 * var(--page-margin));
  margin-inline: auto;
}

.gallery-collage {
  --u: calc(100cqw / var(--stage-w));
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  height: calc(var(--stage-h) * var(--u));
}

.gallery-item, .gallery-hover-backdrop {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  z-index: var(--z);
  --radius: 24px;
}

.gallery-hover-backdrop { pointer-events: none; }

.gallery-item__motion {
  margin: 0;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0);
  will-change: transform;
}

.gallery-item__link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  aspect-ratio: var(--ar);
  transition: transform 650ms cubic-bezier(.25, .1, .25, 1);
  -webkit-tap-highlight-color: transparent;
}
.gallery-item__link:focus-visible { outline: var(--focus); outline-offset: 4px; }

.gallery-item__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* proporcje = aspect-ratio pliku, więc bez przycinania */
  opacity: 1;
  transition: opacity 600ms ease;
}
.js-gallery .gallery-item__img.is-pending { opacity: 0; }

/* Rzeczywista mysz/rysik, także gdy urządzenie błędnie deklaruje brak hover. */
.gallery-item.is-pointer-hovered, .gallery-item.is-hover-elevated,
.gallery-item:focus-within { z-index: var(--hover-layer, 60); }
.gallery-item.is-pointer-hovered .gallery-item__link { transform: translateY(-2px) scale(1.018); }
.gallery-item.is-hover-elevated .gallery-item__link { transition: none; }

/* Miniatura „odlatuje” do lightboxa — w kolażu zostaje puste miejsce. */
.gallery-item.is-lifted .gallery-item__link { visibility: hidden; }

/* ---------------------------------------------------------------- Mobile */
@media (max-width: 767px) {
  .gallery-page__intro { margin-top: 24px; line-height: 1.5; }
  .gallery-stage { width: 100%; container-type: normal; overflow-x: clip; }
  .gallery-collage { height: auto; display: flex; flex-direction: column; padding-inline: 0; }
  .gallery-item {
    position: relative;
    left: auto; top: auto;
    --radius: 14px;
    z-index: var(--z);
  }
  .gallery-item--s { width: 58%; }
  .gallery-item--m { width: 74%; }
  .gallery-item--l { width: 90%; }
  .gallery-item--left  { margin-left: calc(var(--mi) + 2%); margin-right: auto; }
  .gallery-item--right { margin-left: auto; margin-right: calc(var(--mi) + 2%); }
  .gallery-item + .gallery-item { margin-top: -5vw; }
  .gallery-item--l + .gallery-item, .gallery-item + .gallery-item--l { margin-top: 3vw; }
  .gallery-item__motion { transform: none; will-change: auto; }
  .gallery-page__body { --gallery-footer-fade: 180px; padding-bottom: 210px; }
}

/* ---------------------------------------------------------------- Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-white);
  overflow: hidden;
  outline: none;
}
.gallery-lightbox::backdrop {
  background: rgba(0, 1, 49, .22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 380ms var(--gallery-ease, ease);
}
.gallery-lightbox.is-visible::backdrop { opacity: 1; }

.gallery-lightbox__figure { position: fixed; inset: 0; margin: 0; pointer-events: none; }
.gallery-lightbox__frame {
  position: fixed;
  left: 0; top: 0;
  border-radius: 24px;
  overflow: hidden;
  transform-origin: 0 0;
  pointer-events: auto;
  touch-action: pan-y pinch-zoom;
}
.gallery-lightbox__img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.gallery-lightbox__img--large { opacity: 0; transition: opacity 260ms ease; }
.gallery-lightbox__img--large.is-loaded { opacity: 1; }

.gallery-lightbox__btn {
  position: fixed;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 1, 49, .55);
  color: var(--color-white);
  cursor: pointer;
  opacity: 0;
  transition: opacity 240ms ease, background-color 200ms ease;
}
.gallery-lightbox.is-visible .gallery-lightbox__btn { opacity: 1; }
.gallery-lightbox__btn:hover { background: var(--color-pink); }
.gallery-lightbox__btn:focus-visible { outline: var(--focus); outline-offset: 3px; }
.gallery-lightbox__btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gallery-lightbox__close { top: max(20px, env(safe-area-inset-top)); right: max(20px, env(safe-area-inset-right)); }
.gallery-lightbox__prev { left: max(20px, env(safe-area-inset-left)); top: 50%; translate: 0 -50%; }
.gallery-lightbox__next { right: max(20px, env(safe-area-inset-right)); top: 50%; translate: 0 -50%; }

.gallery-lightbox__counter {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  translate: -50% 0;
  margin: 0;
  font-family: var(--font-numeric);
  font-size: 18px;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 240ms ease;
}
.gallery-lightbox.is-visible .gallery-lightbox__counter { opacity: .85; }

.gallery-lightbox__status {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: max(24px, env(safe-area-inset-top));
  translate: -50% 0;
  margin: 0;
  max-width: min(520px, 80vw);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--color-pink);
  color: var(--color-white);
  font-size: 15px;
  text-align: center;
}
.gallery-lightbox__status[hidden] { display: none; }
.gallery-lightbox__status button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin-left: 8px; padding: 4px 8px; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 767px) {
  .gallery-lightbox::backdrop { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
  .gallery-lightbox__frame { border-radius: 14px; }
  .gallery-lightbox__btn { width: 44px; height: 44px; }
  .gallery-lightbox__prev, .gallery-lightbox__next { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); translate: none; }
  .gallery-lightbox__counter { bottom: max(22px, env(safe-area-inset-bottom)); }
}

.gallery-scroll-lock { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .gallery-item__motion { transform: none; will-change: auto; }
  .gallery-item__link, .gallery-item__img, .gallery-lightbox::backdrop,
  .gallery-lightbox__img--large, .gallery-lightbox__btn, .gallery-lightbox__counter { transition: none; }
  .gallery-item.is-pointer-hovered .gallery-item__link { transform: none; }
}
