/*
 * The gallery lightbox (assets/js/gallery.js): PhotoSwipe as the old site
 * styled it (components/blocks/_gallery.scss), converted to plain CSS
 * (ADR-0007). PhotoSwipe's own CSS is in assets/vendor/.
 */

.pswp {
  --pswp-icon-stroke-width: 0px !important;
}

/* The caption of the image shown, under it. paragraphStyle('small') */
.pswp__custom-caption {
  font-size: var(--font-size-small);
  letter-spacing: 0.03em;
  font-weight: 200;
  color: #fff;
  text-align: center;
  width: calc(100% - 2rem);
  padding: 2px 8px;
  border-radius: 4px;
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  line-height: 1.2;

  @media screen and (orientation: landscape) {
    background-color: rgba(0, 0, 0, 0.4);
  }

  @media screen and (min-width: 768px) {
    width: auto;
    padding: 6px 8px 2px 8px;
    border-radius: 0;
  }

  a {
    color: #fff;
    text-decoration: underline;
  }
}

.pswp__button.pswp__button--zoom {
  display: none !important;
}

/* paragraphStyle('small') */
.pswp__counter {
  font-size: var(--font-size-small);
  letter-spacing: 0.03em;
  font-weight: 200;
}

.pswp--touch .pswp__button--arrow {
  visibility: visible;
}

.pswp__button {
  width: unset;
  height: unset;
  opacity: 1;
  margin: 0;
  top: 0;
  right: 0;
  padding: 0.75rem 1rem;
  transform: translateY(-4px);

  @media screen and (orientation: landscape) {
    transform: translateY(-2px);
  }

  &:hover {
    padding: 0.75rem 1rem;
    transform: translateY(-4px);

    @media screen and (orientation: landscape) {
      transform: translateY(-2px);
    }
  }

  &:disabled {
    opacity: 0.2 !important;
    cursor: default;
  }

  @media (hover: hover) {
    transition: opacity var(--transition-fast) !important;

    &:hover {
      opacity: var(--opacity);
    }
  }

  /* The arrows: beside the image in landscape, hidden in portrait. */
  &.pswp__button--arrow {
    display: none;
    top: unset !important;
    bottom: 0;
    padding: 0.75rem 1rem;
    width: 3.5rem !important;

    @media screen and (orientation: landscape) {
      display: block;
      bottom: unset !important;
      top: 50% !important;
    }

    svg {
      width: 1.5rem;
      height: auto;
    }

    /* None for a gallery of one, as PhotoSwipe's own CSS has it. */
    .pswp--one-slide & {
      display: none;
    }
  }
}
