/* ==========================================================================
   Paraklub Krnov — prohlížeč fotek (lightbox.js)
   ========================================================================== */

.lb {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #03050a;
  color: #fff;
  overscroll-behavior: contain;
}
.lb::backdrop { background: rgba(3, 5, 10, 0.6); }
.lb[open] { display: block; animation: lb-fade 0.35s ease both; }
.lb.is-closing { animation: lb-fade-out 0.5s ease forwards; }
.lb.is-closing .lb__chrome,
.lb.is-closing .lb__ambient { opacity: 0 !important; transition: opacity 0.25s; }

/* Ambientní pozadí — rozmazaná aktuální fotka */
.lb__ambient { position: absolute; inset: 0; pointer-events: none; }
.lb__ambient span {
  position: absolute;
  inset: -15%;
  background: center / cover no-repeat;
  filter: blur(70px) saturate(1.6) brightness(0.5);
  opacity: 0;
  transform: scale(1.1);
  transition: opacity 1.1s ease, transform 8s ease-out;
}
.lb__ambient span.is-active { opacity: 1; transform: scale(1.2); }
.lb__ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 35%, rgba(3, 5, 10, 0.85) 100%),
    linear-gradient(180deg, rgba(3, 5, 10, 0.55), transparent 20%, transparent 75%, rgba(3, 5, 10, 0.8));
}

/* Scéna a slidy */
.lb__stage {
  position: absolute;
  inset: 76px 88px 132px;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
}
.lb--single .lb__stage { inset: 76px 24px 72px; }
.lb.is-fullscreen .lb__stage { inset: 64px 72px 112px; }
@media (max-width: 760px) {
  .lb__stage { inset: 72px 10px 118px; }
  .lb--single .lb__stage { inset: 72px 10px 60px; }
}

.lb__slide {
  grid-area: 1 / 1;
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 50px 100px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
  cursor: grab;
}
.lb__slide:active { cursor: grabbing; }
.lb__slide.is-current { z-index: 2; opacity: 1; pointer-events: auto; }
.lb__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  transition: filter 0.6s ease;
}
/* „zaostření“ z náhledu na plné rozlišení */
.lb__slide.is-loading img { filter: blur(10px) saturate(1.15); }
/* pomalý Ken Burns */
.lb__slide.is-current img {
  transform-origin: var(--kb-x, 50%) var(--kb-y, 50%);
  animation: lb-kenburns 16s ease-in-out 0.6s infinite alternate;
}
/* přejezd světla při příjezdu */
.lb__slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.45) 47%, rgba(255, 180, 140, 0.25) 52%, transparent 66%);
  mix-blend-mode: soft-light;
  transform: translateX(-130%);
  pointer-events: none;
}
.lb__slide.is-entering::after { animation: lb-sweep 1.1s 0.2s cubic-bezier(0.3, 0, 0.2, 1); }

/* Horní lišta */
.lb__top {
  position: absolute;
  inset: 0 0 auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px clamp(12px, 2vw, 24px);
}
.lb__counter {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--f-display);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.lb__counter strong { font-weight: 400; font-size: 2rem; color: var(--c-accent); }
.lb__counter span { font-size: 1.1rem; color: rgba(255, 255, 255, 0.6); }
.lb__tools { display: flex; gap: 0.5rem; margin-left: auto; }

.lb__btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(10, 14, 24, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.25s var(--ease-out);
}
.lb__btn:hover { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); }
.lb__btn:active { transform: scale(0.92); }
.lb__btn svg { width: 20px; height: 20px; }
.lb__btn[hidden] { display: none; }
.lb__play .i-pause { display: none; }
.lb__play[aria-pressed="true"] .i-play { display: none; }
.lb__play[aria-pressed="true"] .i-pause { display: block; }
.lb__play[aria-pressed="true"] { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-accent-ink); }

.lb__nav {
  position: absolute;
  top: 50%;
  z-index: 5;
  width: 58px;
  height: 58px;
  margin-top: -50px;
}
.lb__nav svg { width: 24px; height: 24px; }
.lb__prev { left: clamp(12px, 2vw, 24px); }
.lb__next { right: clamp(12px, 2vw, 24px); }
.lb__prev:hover { transform: translateX(-3px); }
.lb__next:hover { transform: translateX(3px); }
.lb--single .lb__nav,
.lb--single .lb__play,
.lb--single .lb__strip { display: none; }
@media (max-width: 760px) { .lb__nav { display: none; } }

.lb__caption {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 5;
  max-width: min(90vw, 70ch);
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: rgba(3, 5, 10, 0.6);
  backdrop-filter: blur(8px);
  font-size: 0.9rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  transform: translateX(-50%);
}
.lb--single .lb__caption { bottom: 18px; }
.lb__caption[hidden] { display: none; }

/* Průběh prezentace */
.lb__progress {
  position: absolute;
  inset: 0 0 auto;
  z-index: 6;
  height: 3px;
  opacity: 0;
  transition: opacity 0.3s;
}
.lb__progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--c-sky), var(--c-warn), var(--c-accent));
  transform: scaleX(0);
  transform-origin: left;
}
.lb.is-playing .lb__progress { opacity: 1; }

/* Pruh náhledů */
.lb__strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 10px calc(50vw - 36px);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.lb__strip::-webkit-scrollbar { display: none; }
.lb__thumb {
  flex: none;
  width: 72px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  opacity: 0.45;
  transition: opacity 0.25s, transform 0.35s var(--ease-out), border-color 0.25s;
}
.lb__thumb img { width: 100%; height: 100%; object-fit: cover; }
.lb__thumb:hover { opacity: 0.85; }
.lb__thumb.is-active { opacity: 1; border-color: var(--c-accent); transform: translateY(-4px) scale(1.12); }
@media (max-width: 760px) {
  .lb__thumb { width: 54px; height: 40px; }
  .lb__strip { padding-inline: calc(50vw - 27px); }
}
@media (max-height: 520px) {
  .lb__strip { display: none; }
  .lb__stage { bottom: 56px; }
  .lb__caption { bottom: 12px; }
}

/* Vstup ovládacích prvků + kino režim */
.lb[open] .lb__chrome { animation: lb-chrome 0.6s 0.25s var(--ease-out) backwards; }
.lb__chrome { transition: opacity 0.5s ease; }
.lb.is-idle .lb__chrome { opacity: 0; pointer-events: none; }
.lb.is-idle { cursor: none; }

@keyframes lb-fade { from { background-color: rgba(3, 5, 10, 0); } }
@keyframes lb-fade-out { to { background-color: rgba(3, 5, 10, 0); } }
@keyframes lb-chrome { from { opacity: 0; transform: translateY(10px); } }
@keyframes lb-kenburns { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes lb-sweep { to { transform: translateX(130%); } }

@media (prefers-reduced-motion: reduce) {
  .lb__slide.is-current img { animation: none; }
  .lb__slide.is-entering::after { animation: none; }
  .lb__ambient span { transition: opacity 0.3s; transform: none !important; }
}
