@import "template.scss";

$gap: 30px;

/* ---- Thumbnail strip ---- */
.wrapper {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: grab;

  &::-webkit-scrollbar {
    display: none;
  }

  &:active {
    cursor: grabbing;
  }
}

.track {
  display: flex;
  gap: $gap;
  justify-content: center;
  min-width: 100%;
  width: max-content;
}

.group {
  display: flex;
  gap: $gap;
  flex: none;
}

.item {
  cursor: pointer;
  flex: none;
  user-select: none;
  -webkit-user-drag: none;

  &:focus-visible {
    outline: 3px solid $base-color;
    outline-offset: 3px;
  }
}

/* ---- Fullscreen lightbox ---- */
@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightboxFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.display {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99;
  width: 100vw;
  height: 100vh;
  background-color: $overlay;
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  outline: none;
  animation: lightboxFadeIn 200ms ease;
}

.closing {
  animation: lightboxFadeOut 200ms ease forwards;
}

.displayImage {
  display: block;
  max-height: 90vh;
  max-width: 90vw;
  object-fit: contain;
  user-select: none;
}

.close,
.nav {
  color: $white;
  font-weight: bold;
  position: fixed;
  background-color: $base-color;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  opacity: 0.6;

  &:hover,
  &:focus-visible {
    background-color: $shade1;
    opacity: 1;
  }

  &:focus-visible {
    outline: 3px solid $white;
    outline-offset: 2px;
  }
}

.close {
  top: 35px;
  right: 35px;
}

.nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 0;

  // Chevron drawn with CSS borders so it stays perfectly centred (no font metrics).
  &::before {
    content: "";
    display: block;
    width: 9px;
    height: 9px;
    border: solid $white;
    border-width: 0;
  }
}

.prev {
  left: 35px;

  &::before {
    border-width: 0 0 3px 3px;
    transform: rotate(45deg);
    margin-left: 3px; // optical centering of the rotated chevron
  }
}

.next {
  right: 35px;

  &::before {
    border-width: 3px 3px 0 0;
    transform: rotate(45deg);
    margin-right: 3px; // optical centering of the rotated chevron
  }
}

.captionBar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px;
  color: $white;
  text-align: center;
  font-size: 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.0));
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

@media (prefers-reduced-motion: reduce) {
  .display,
  .closing {
    animation: none;
  }
}
