/* ==========================================================================
   PhotoSwipe caption customisation for editorial theme
   ========================================================================== */

/* Lightbox background adapts to theme */
.pswp {
  --pswp-bg: var(--color-bg);
}

/* Make close/arrow icons solid in light mode.
   By default PhotoSwipe uses white fill + dark stroke, which looks outlined
   against a light background. Override so the icon is a solid dark shape. */
:root:not([data-theme="dark"]) .pswp {
  --pswp-icon-color: var(--color-text);
  --pswp-icon-color-secondary: var(--color-bg);
  --pswp-icon-stroke-color: var(--color-bg);
}

/* Undo the override when system prefers dark and no explicit light theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pswp {
    --pswp-icon-color: #fff;
    --pswp-icon-color-secondary: #4f4f4f;
    --pswp-icon-stroke-color: #4f4f4f;
  }
}

/* ==========================================================================
   Arrow navigation — placed in the top bar alongside other controls
   ========================================================================== */

/* Pull arrows out of the viewport-center default and into the top bar */
.pswp__button--arrow {
  position: absolute;
  top: 0;
  width: 50px;
  height: 60px;
  margin-top: 0;
  z-index: 20;
  pointer-events: auto;
  border-radius: 0;
  background: none;
  backdrop-filter: none;
  opacity: 0.85;
  transition: opacity 0.25s ease;
}

.pswp--has_mouse .pswp__button--arrow {
  opacity: 0.85;
}

.pswp__button--arrow:hover {
  opacity: 1;
  background: none;
}

/* Position: centered pair in the top bar */
.pswp__button--arrow--prev {
  left: 50%;
  right: auto;
  transform: translateX(calc(-100% - 2px));
}

.pswp__button--arrow--next {
  left: 50%;
  right: auto;
  transform: translateX(2px);
}

/* Size and center the icon to match other top-bar buttons */
.pswp__button--arrow .pswp__icn {
  width: 32px;
  height: 32px;
  top: 14px;
  left: 9px;
  right: auto;
  margin: 0;
  transform: none;
}

.pswp__button--arrow--next .pswp__icn {
  left: auto;
  right: 9px;
  transform: scale(-1, 1);
}

/* ==========================================================================
   Caption bar
   ========================================================================== */

.pswp-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem 1.5rem 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

.pswp-caption__title {
  font-weight: 500;
  font-size: 0.9375rem;
  color: #f0eeea;
}

.pswp-caption__meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.02em;
}

.pswp-caption__link {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  margin-left: auto;
  transition: color 150ms, border-color 150ms;
}

.pswp-caption__link:hover {
  color: #f0eeea;
  border-color: rgba(255, 255, 255, 0.6);
}

/* License badge — subtle pill in the meta line */
.pswp-caption__license {
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  padding: 0.125rem 0.375rem;
  white-space: nowrap;
  line-height: 1.2;
  transition: color 150ms, border-color 150ms;
  text-decoration: none;
  display: inline-block;
  vertical-align: baseline;
}

.pswp-caption__license:hover {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.3);
}
