/* Site-wide image viewer (js/dd-lightbox.js). */

img.ddz-able {
  cursor: pointer;
}
img.ddz-able:focus-visible {
  outline: 3px solid #eea676;
  outline-offset: 3px;
}

html.ddz-open,
html.ddz-open body {
  overflow: hidden !important;
}
/* Keep the scrollbar's space so the page behind doesn't shift sideways. */
html.ddz-open { scrollbar-gutter: stable; }
/* The accessibility widget sits at the maximum z-index; hide it while the
   viewer is open so it doesn't cover the photo. */
html.ddz-open .uwy,
html.ddz-open .userway_buttons_wrapper,
html.ddz-open .uwif {
  display: none !important;
}

/* A dimmed, blurred layer over the page (not a black screen), with the
   photo framed in the middle of it. */
.ddz {
  position: fixed;
  inset: 0;
  z-index: 2147483600; /* above the sticky nav and the accessibility widget */
  display: grid;
  place-items: center;
  padding: 48px 88px;
  background: rgba(4, 16, 26, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  opacity: 0;
  transition: opacity 180ms ease;
  -webkit-tap-highlight-color: transparent;
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.ddz[hidden] { display: none; }
.ddz.is-open { opacity: 1; }

.ddz__frame {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  margin: 0;
  max-width: 100%;
  transform: scale(0.97);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ddz.is-open .ddz__frame { transform: none; }

.ddz__img {
  display: block;
  max-width: 100%;
  border-radius: 12px;
  background: #0b1a24;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 160ms ease;
}
.ddz.is-loading .ddz__img { opacity: 0; }

.ddz__meta {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.9rem;
  max-width: min(70ch, 100%);
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
}
.ddz__meta[hidden],
.ddz__caption[hidden],
.ddz__count[hidden] { display: none; }
.ddz__count {
  flex: none;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  font-variant-numeric: tabular-nums;
}

.ddz__btn {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}
.ddz__btn:hover { background: rgba(255, 255, 255, 0.26); }
.ddz__btn:active { transform: scale(0.94); }
.ddz__btn:focus-visible { outline: 3px solid #eea676; outline-offset: 2px; }
.ddz__btn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ddz__btn[hidden] { display: none; }

/* Close: a solid white button in the top-right corner, easy to find. */
.ddz__close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2;
  background: #fff;
  color: #00253a;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.ddz__close:hover { background: #eef3f5; }

/* Previous / next: either side of the photo. */
.ddz__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
}
.ddz__nav:active { transform: translateY(-50%) scale(0.94); }
.ddz__nav--prev { left: max(18px, env(safe-area-inset-left)); }
.ddz__nav--next { right: max(18px, env(safe-area-inset-right)); }

.ddz__spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #eea676;
  animation: ddz-spin 800ms linear infinite;
  opacity: 0;
  pointer-events: none;
}
.ddz.is-loading .ddz__spinner { opacity: 1; }
@keyframes ddz-spin { to { transform: rotate(360deg); } }

/* Phones: the photo uses the width; arrows sit at the bottom corners so they
   never cover it. */
@media (max-width: 640px) {
  .ddz {
    padding: 72px 12px 84px;
  }
  .ddz__nav {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    transform: none;
  }
  .ddz__nav:active { transform: scale(0.94); }
  .ddz__meta {
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ddz,
  .ddz__frame { transition: none; }
  .ddz__frame { transform: none; }
  .ddz__spinner { animation-duration: 2s; }
}
