.poel-gallery {
  --poel-gallery-orange: #f45b0b;
  --poel-gallery-navy: #102b3d;
  --poel-gallery-sand: #f6f2ea;
  color: var(--poel-gallery-navy);
  font-family: "Source Sans 3", Arial, sans-serif;
  width: 100%;
}

.poel-gallery *,
.poel-gallery *::before,
.poel-gallery *::after {
  box-sizing: border-box;
}

.poel-gallery__grid {
  display: grid;
  gap: 12px;
  grid-auto-flow: dense;
  grid-auto-rows: 165px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.poel-gallery__item {
  appearance: none;
  background: var(--poel-gallery-sand);
  border: 0;
  border-radius: 14px;
  cursor: zoom-in;
  grid-row: span 2;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.poel-gallery__item--wide {
  grid-column: span 2;
  grid-row: span 2;
}

.poel-gallery__item--tall {
  grid-row: span 3;
}

.poel-gallery__item img {
  display: block;
  height: 100%;
  object-fit: cover;
  transition: filter 0.35s ease, transform 0.55s ease;
  width: 100%;
}

.poel-gallery__item::after {
  background: linear-gradient(0deg, rgba(7, 27, 40, 0.34), transparent 48%);
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 0.3s ease;
}

.poel-gallery__item:hover img,
.poel-gallery__item:focus-visible img {
  filter: saturate(1.06);
  transform: scale(1.035);
}

.poel-gallery__item:hover::after,
.poel-gallery__item:focus-visible::after {
  opacity: 1;
}

.poel-gallery__item:focus-visible {
  outline: 3px solid var(--poel-gallery-orange);
  outline-offset: 3px;
}

.poel-gallery__zoom {
  align-items: center;
  background: var(--poel-gallery-orange);
  border-radius: 50%;
  bottom: 16px;
  color: #fff;
  display: flex;
  height: 44px;
  justify-content: center;
  opacity: 0;
  position: absolute;
  right: 16px;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  width: 44px;
  z-index: 2;
}

.poel-gallery__zoom svg {
  fill: none;
  height: 22px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 22px;
}

.poel-gallery__item:hover .poel-gallery__zoom,
.poel-gallery__item:focus-visible .poel-gallery__zoom {
  opacity: 1;
  transform: translateY(0);
}

.poel-gallery__empty {
  background: var(--poel-gallery-sand);
  border-left: 4px solid var(--poel-gallery-orange);
  border-radius: 10px;
  color: #526976;
  margin: 0;
  padding: 20px;
}

.poel-gallery__empty code {
  color: var(--poel-gallery-navy);
}

/* Lightbox */

.poel-gallery__lightbox {
  background: transparent;
  border: 0;
  height: 100vh;
  margin: auto;
  max-height: none;
  max-width: none;
  overflow: visible;
  padding: 28px 80px 34px;
  width: 100vw;
}

.poel-gallery__lightbox::backdrop {
  background: rgba(4, 17, 26, 0.94);
  backdrop-filter: blur(7px);
}

.poel-gallery__figure {
  align-items: center;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: center;
  margin: 0;
}

.poel-gallery__figure img {
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  display: block;
  max-height: calc(100vh - 142px);
  max-width: 100%;
  object-fit: contain;
}

.poel-gallery__caption {
  align-items: center;
  color: #fff;
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  max-width: 760px;
  text-align: center;
}

.poel-gallery__caption-text {
  font-family: "Source Sans 3", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.poel-gallery__counter {
  color: rgba(255, 255, 255, 0.62);
  font-family: "Roboto Condensed", Arial, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  margin-top: 4px;
  text-transform: uppercase;
}

.poel-gallery__close,
.poel-gallery__nav {
  align-items: center;
  appearance: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  padding: 0;
  position: fixed;
  z-index: 3;
}

.poel-gallery__close {
  background: var(--poel-gallery-orange);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 1.9rem;
  height: 48px;
  line-height: 1;
  right: 25px;
  top: 22px;
  width: 48px;
}

.poel-gallery__nav {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 2.5rem;
  height: 54px;
  line-height: 1;
  top: 50%;
  transform: translateY(-50%);
  width: 54px;
}

.poel-gallery__nav--previous {
  left: 22px;
}

.poel-gallery__nav--next {
  right: 22px;
}

.poel-gallery__close:hover,
.poel-gallery__close:focus-visible,
.poel-gallery__nav:hover,
.poel-gallery__nav:focus-visible {
  background: var(--poel-gallery-orange);
  outline: 2px solid #fff;
  outline-offset: 3px;
}

body.poel-gallery-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .poel-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .poel-gallery__grid {
    gap: 10px;
    grid-auto-rows: 135px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .poel-gallery__item--wide {
    grid-column: span 2;
  }

  .poel-gallery__lightbox {
    padding: 68px 14px 82px;
  }

  .poel-gallery__figure img {
    max-height: calc(100vh - 190px);
  }

  .poel-gallery__caption {
    max-width: calc(100vw - 40px);
  }

  .poel-gallery__caption-text {
    font-size: 0.92rem;
  }

  .poel-gallery__nav {
    bottom: 15px;
    height: 48px;
    top: auto;
    transform: none;
    width: 48px;
  }

  .poel-gallery__nav--previous {
    left: calc(50% - 59px);
  }

  .poel-gallery__nav--next {
    right: calc(50% - 59px);
  }

  .poel-gallery__close {
    height: 44px;
    right: 14px;
    top: 12px;
    width: 44px;
  }
}

@media (max-width: 460px) {
  .poel-gallery__grid {
    display: block;
  }

  .poel-gallery__item {
    aspect-ratio: 4 / 3;
    display: block;
    margin-bottom: 10px;
    width: 100%;
  }

  .poel-gallery__item--tall {
    aspect-ratio: 3 / 4;
  }

  .poel-gallery__zoom {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .poel-gallery__item img,
  .poel-gallery__item::after,
  .poel-gallery__zoom {
    transition: none;
  }
}
