/* Sizes are in px: the site template sets a 10px root font, so rem would shrink everything. */
/* Justified grid: every tile grows in proportion to its aspect ratio, so a row keeps one height. */
.lcg-grid {
  --lcg-gap: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--lcg-gap);
  margin: 16px 0 24px;
}

.lcg-grid::after {
  content: "";
  flex-grow: 999999;
}

.lcg-item {
  position: relative;
  display: block;
  flex-grow: calc(var(--lcg-ar) * 100);
  flex-basis: calc(var(--lcg-ar) * var(--lcg-row));
  aspect-ratio: var(--lcg-ar);
  max-width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(127, 127, 127, .15);
}

/* A single photo fills the content width; portrait shots stop at three quarters of the screen height. */
.lcg-grid--single .lcg-item {
  flex: 0 1 auto;
  width: min(100%, calc(var(--lcg-ar) * 75vh));
}

.lcg-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}

.lcg-item:hover img,
.lcg-item:focus-visible img {
  transform: scale(1.04);
  filter: brightness(1.05);
}

.lcg-item:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .lcg-grid {
    --lcg-row: 140px !important;
    --lcg-gap: 4px;
  }
}

.lcg-albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin: 16px 0 32px;
  padding: 0;
  list-style: none;
}

.lcg-album-link {
  display: flex;
  flex-direction: column;
  gap: 5.6px;
  color: inherit;
  text-decoration: none;
}

.lcg-album-cover {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(127, 127, 127, .15);
}

.lcg-album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.lcg-album-link:hover .lcg-album-cover img,
.lcg-album-link:focus-visible .lcg-album-cover img {
  transform: scale(1.04);
}

.lcg-album-title {
  font-weight: 600;
  line-height: 1.3;
}

.lcg-album-count {
  font-size: .875em;
  opacity: .7;
}

html.lcg-locked {
  overflow: hidden;
}

.lcg-lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(10, 10, 12, .94);
  color: #f2f2f2;
  overscroll-behavior: contain;
}

.lcg-lightbox::backdrop {
  background: transparent;
}

.lcg-lightbox[open] {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lcg-fade .2s ease;
}

/* The template styles figure, figcaption and img globally; the viewer resets what it relies on. */
.lcg-lightbox .lcg-figure,
.lcg-lightbox .lcg-caption,
.lcg-lightbox .lcg-image {
  border: 0;
  background: none;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
}

.lcg-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  padding: 56px 72px 20px;
  box-sizing: border-box;
}

.lcg-lightbox .lcg-image {
  display: block;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  max-width: 100%;
  max-height: calc(100dvh - 144px);
  object-fit: contain;
  user-select: none;
  touch-action: pan-y pinch-zoom;
  transition: opacity .2s ease;
}

.lcg-lightbox.is-loading .lcg-image {
  opacity: .35;
}

.lcg-lightbox .lcg-caption {
  max-width: 960px;
  margin: 0;
  padding: 0;
  color: #f2f2f2;
  font-family: inherit;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
}

.lcg-counter {
  position: absolute;
  top: 16px;
  left: 20px;
  font-size: 14.4px;
  opacity: .75;
  font-variant-numeric: tabular-nums;
}

.lcg-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  color: inherit;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}

.lcg-btn:hover,
.lcg-btn:focus-visible {
  background: rgba(255, 255, 255, .25);
}

.lcg-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

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

.lcg-prev {
  left: 12px;
}

.lcg-next {
  right: 12px;
}

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

@media (max-width: 575.98px) {
  .lcg-figure {
    padding: 56px 8px 16px;
  }

  .lcg-prev,
  .lcg-next {
    top: auto;
    bottom: 12px;
    transform: none;
  }
}

@keyframes lcg-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lcg-item img,
  .lcg-album-cover img,
  .lcg-image {
    transition: none;
  }

  .lcg-lightbox[open] {
    animation: none;
  }
}
