/*
 * gallery.css — wystawka kliencka: hero galerii, rozdzialy, rytm kadrow,
 * lightbox z pobieraniem. Editorial dark: duzy serif, duzo oddechu.
 */

.ghero {
  position: relative;
  min-height: 88svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  padding-bottom: clamp(60px, 9vw, 110px);
}
.ghero-bg,
.ghero-bg img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ghero-bg img {
  object-position: var(--fp, center 30%);
  transform: scale(var(--z, 1));
  transform-origin: var(--fp, center 30%);
}
.ghero-content { position: relative; z-index: 2; }
.ghero-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 8vw, 110px);
  line-height: 1.02;
  margin: 0 0 18px;
}
.ghero .btn { margin-top: 22px; }

/* ---------- Rozdzialy ---------- */
.gallery-body { padding-top: clamp(50px, 8vw, 110px); }
.gchapter { padding-bottom: clamp(60px, 9vw, 130px); }
.gchapter-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: clamp(30px, 5vw, 60px);
}
.gchapter-num {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--accent);
}
.gchapter-title {
  font-size: clamp(30px, 4.4vw, 54px);
  font-weight: 600;
  margin: 0;
}

/* Justified layout: rzedy flex, szerokosci proporcjonalne do proporcji zdjec (--fg) */
.gflow { display: grid; gap: clamp(10px, 1.4vw, 16px); }
.grow-jrow {
  display: flex;
  gap: clamp(10px, 1.4vw, 16px);
}
.grow-jrow .gph {
  flex: var(--fg, 1) 1 0%;
  min-width: 0;
}
/* Ostatni niepelny rzad: nie rozciagaj samotnego kadru na cala szerokosc */
.grow-jrow-last .gph {
  flex: 0 1 auto;
  width: min(100%, calc(var(--fg, 1.5) * 380px));
}
@media (max-width: 640px) {
  .grow-jrow { flex-direction: column; }
  .grow-jrow-last .gph { width: 100%; }
}

.gph { margin: 0; }
.gph-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg-deep);
  aspect-ratio: var(--ar, 3 / 2);
}
.gph-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), opacity 0.5s;
}
.gph-open:hover img { transform: scale(1.03); }

/* ---------- Outro ---------- */
.goutro { background: var(--bg-deep); text-align: center; }
.goutro-inner { max-width: 640px; }
.goutro .lead { margin: 0 auto 30px; }

/* ---------- Lightbox ---------- */
.glightbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(20, 21, 26, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s var(--ease), visibility 0.35s;
}
.glightbox.is-open { opacity: 1; visibility: visible; }
.glb-stage {
  margin: 0;
  max-width: 92vw;
  max-height: 84vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.glb-stage img {
  max-width: 92vw;
  max-height: 84vh;
  width: auto;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.glb-close,
.glb-prev,
.glb-next {
  position: absolute;
  z-index: 2;
  background: none;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.25s, transform 0.25s;
  font-size: 26px;
  padding: 14px;
}
.glb-close { top: 14px; right: 20px; font-size: 40px; line-height: 1; }
.glb-close:hover { color: var(--accent); transform: rotate(90deg); }
.glb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.glb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.glb-prev:hover, .glb-next:hover { color: var(--accent); }
.glb-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 18px;
  font-size: 13px;
  color: var(--ink-dim);
}
.glb-dl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 9px 16px;
  border: 1px solid rgba(242, 239, 234, 0.35);
  border-radius: 2px;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.glb-dl svg { display: block; }
.glb-dl:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (max-width: 700px) {
  .glb-prev, .glb-next { display: none; } /* na mobile: swipe */
}

.gallery-404 { padding-top: 170px; min-height: 70svh; }

/* ---------- Bramka hasla galerii ---------- */
.gate { padding-top: 170px; min-height: 78svh; display: flex; align-items: center; }
.gate-inner { max-width: 560px; }
.gate-inner .lead { margin-bottom: 26px; }
.gate-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.gate-form input[type="password"] {
  flex: 1;
  min-width: 220px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 16px;
}
.gate-form input[type="password"]:focus { outline: none; border-color: var(--accent); }
.gate-err {
  flex: 0 0 100%;
  margin: 0;
  color: #FF9A66;
  font-size: 14px;
}

/* ---------- Pokaz slajdow: launcher w hero ---------- */
.ghero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; margin-top: 24px; }
.gss-start { display: inline-flex; align-items: center; gap: 8px; }
.gss-start svg { display: block; }
.gss-secs { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-dim); font-size: 13px; }
.gss-secs select {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px 9px;
}
.gss-secs select:focus { outline: none; border-color: var(--accent); }

/* ---------- Pokaz slajdow: overlay fullscreen ---------- */
.gss {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #0B0C0F;
  display: none;
}
.gss.is-open { display: block; }
.gss-stage { position: absolute; inset: 0; overflow: hidden; cursor: pointer; }
.gss-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 1s var(--ease); }
.gss-layer.is-on { opacity: 1; }
.gss-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15); /* baza chowa halo rozmycia przy krawedziach */
  filter: blur(34px) brightness(0.45);
  will-change: transform;
}
.gss-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain; /* cale zdjecie: pion i poziom bez przyciecia */
}
.gss-ui { position: absolute; inset: 0; pointer-events: none; transition: opacity 0.4s var(--ease); }
.gss-ui > * { pointer-events: auto; }
.gss.gss-idle { cursor: none; }
.gss.gss-idle .gss-ui { opacity: 0; }
.gss-btn {
  background: rgba(18, 19, 24, 0.5);
  border: 1px solid rgba(242, 239, 234, 0.25);
  color: #F2EFEA;
  cursor: pointer;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.gss-btn:hover { background: var(--accent); border-color: var(--accent); }
.gss-close { position: absolute; top: 22px; right: 26px; width: 46px; height: 46px; font-size: 26px; line-height: 1; }
.gss-count {
  position: absolute;
  top: 30px;
  left: 32px;
  color: rgba(242, 239, 234, 0.75);
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  letter-spacing: 0.14em;
}
.gss-controls {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
}
.gss-controls .gss-btn { width: 52px; height: 52px; font-size: 20px; }
.gss-play { width: 62px; height: 62px; font-size: 17px; }

/* Ken Burns: powolny dryf + zoom, kierunek naprzemienny co slajd */
@keyframes gssKb1 { from { transform: scale(1.15) translate(0, 0); } to { transform: scale(1.26) translate(-2.2%, -1.6%); } }
@keyframes gssKb2 { from { transform: scale(1.26) translate(1.8%, 1.3%); } to { transform: scale(1.15) translate(0, 0); } }
@media (max-width: 700px) {
  .gss-controls { bottom: 26px; gap: 12px; }
  .gss-count { top: 20px; left: 18px; }
}
