/* Lightbox + clickable photos */

[data-lightbox] {
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease, filter 0.18s ease;
  will-change: transform;
}
@media (hover: hover) {
  [data-lightbox]:hover { filter: brightness(1.08); transform: scale(1.012); }
}
[data-lightbox]:focus-visible {
  outline: 2px solid var(--accent, #c8f135);
  outline-offset: 3px;
}

/* Mobile long-press peek */
[data-lightbox].is-peeking {
  position: relative;
  z-index: 9999;
  transform: scale(1.6);
  filter: none;
  transition: transform 0.15s ease-out;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.lightbox-peek-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}
.lightbox-peek-backdrop.is-visible { opacity: 1; }

/* Modal dialog */
dialog.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  position: fixed;
  inset: 0;
  max-width: 100vw;
  /* dvh = dynamic viewport, accounts for iOS Safari URL bar so the
     bottom close button always sits on the visible screen. vh
     fallback for browsers without dvh support. */
  max-height: 100vh;
  max-height: 100dvh;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  color: #fff;
}
dialog.lightbox::backdrop {
  background: rgba(0,0,0,0.92);
}
.lightbox__inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__img {
  max-width: min(96vw, 1800px);
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__btn {
  position: absolute;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  padding: 0;
}
.lightbox__btn:hover {
  background: rgba(0,0,0,0.8);
  border-color: rgba(255,255,255,0.5);
}
.lightbox__btn:active { transform: scale(0.94); }
.lightbox__btn:disabled { opacity: 0.3; cursor: not-allowed; }
.lightbox__close { top: 18px; right: 18px; }
.lightbox__prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 18px; top: 50%; transform: translateY(-50%); }
.lightbox__prev:active, .lightbox__next:active { transform: translateY(-50%) scale(0.94); }
.lightbox__counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  font: 600 13px/1 var(--font-body, system-ui), sans-serif;
  letter-spacing: 0.04em;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 100px;
  color: rgba(255,255,255,0.85);
}
.lightbox__caption {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 900px);
  text-align: center;
  font: 400 14px/1.4 var(--font-body, system-ui), sans-serif;
  color: rgba(255,255,255,0.85);
  padding: 0 16px;
}

/* Big mobile-only close: chunky button below the photo */
.lightbox__close-bottom {
  display: none;
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 12px;
  padding: 18px 20px;
  font: 800 16px/1 var(--font-display, var(--font-body, system-ui)), sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.lightbox__close-bottom:hover,
.lightbox__close-bottom:focus-visible {
  border-color: #fff;
  background: rgba(255,255,255,0.08);
}
.lightbox__close-bottom:active { transform: scale(0.97); }

@media (max-width: 640px) {
  .lightbox__close { display: none; }
  .lightbox__prev { left: 8px; width: 44px; height: 44px; font-size: 20px; }
  .lightbox__next { right: 8px; width: 44px; height: 44px; font-size: 20px; }
  .lightbox__img { max-width: 100vw; max-height: 72vh; border-radius: 0; }
  .lightbox__close-bottom { display: block; }
  .lightbox__counter { bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 70px); font-size: 12px; padding: 6px 12px; }
  .lightbox__caption { bottom: calc(max(20px, env(safe-area-inset-bottom, 0px)) + 105px); font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-lightbox],
  [data-lightbox].is-peeking,
  .lightbox-peek-backdrop,
  .lightbox__btn { transition: none; }
}
