/*
 * Lightbox (pairs with assets/js/lightbox.js). The backdrop is always dark, so
 * the light-theme ink would be unreadable: .lb re-declares screen.css's dark
 * palette — never a new hex value.
 */

.lb {
  --color-heading: #f2f5ec;
  --color-muted: #8d968c;
  --color-link: #7ab0ff;
  position: fixed;
  inset: 0;
  z-index: 10000;
  touch-action: none;
}

.lb[hidden] {
  display: none;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  /* see DESIGN.md → Components · Glass chrome; tokens in screen.css: grain over
     --glass-scrim at the shared --glass-filter, never a locally invented blur.
     Scrim density on purpose. The 150ms opacity ramp samples no backdrop, then
     lands; tint and grain are painted, so they hold throughout. */
  background-color: var(--glass-scrim);
  background-image: var(--glass-noise);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  opacity: 0;
}

.lb.is-open .lb-backdrop {
  opacity: 1;
}

img[data-lightbox] {
  cursor: zoom-in;
}

.lb-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px var(--space-md) var(--space-7xl);
  /* clicks outside the image fall through to the backdrop */
  pointer-events: none;
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: none;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  outline: 1px solid oklch(1 0 0 / 0.1);
}

.lb-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2xs);
  padding: 0 72px;
  text-align: center;
  pointer-events: none;
}

/* The caption role owns the type; the rules below own the box and the muted ink. */
.lb-caption {
  margin: 0;
  color: var(--color-heading);
}

.lb-caption[hidden] {
  display: none;
}

.lb-counter {
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.lb-btn {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-heading);
  opacity: 0.72;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lb-btn[hidden] {
  display: none;
}

.lb-close {
  top: 12px;
  right: 12px;
}

.lb-prev,
.lb-next {
  top: 50%;
  transform: translateY(-50%);
}

.lb-prev {
  left: 8px;
}

.lb-next {
  right: 8px;
}

.lb-btn:focus-visible {
  outline: var(--focus-w) solid var(--focus-color);
  outline-offset: 2px;
}

@media (hover: hover) {
  .lb-btn:hover {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .lb-btn {
    transition: opacity var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
  }
}
