.l112-gallery {
  --l112-gallery-accent: var(--wp--preset--color--primary, #d71920);
  --l112-gallery-border: #dcdcde;
  --l112-gallery-text: #1d2327;
  margin: 28px 0;
  scroll-margin-top: 9rem;
  color: var(--l112-gallery-text);
}

.l112-gallery__description {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.6;
}

.l112-gallery--featured {
  margin: 24px 0 0;
}

.l112-featured-gallery__lead {
  margin: 0;
}

.l112-featured-gallery__link,
.l112-featured-gallery__preview {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 8px;
  background: #e5e7e9;
  color: #fff;
}

.l112-featured-gallery__link:focus-visible,
.l112-featured-gallery__preview:focus-visible {
  outline: 3px solid var(--l112-gallery-accent);
  outline-offset: 3px;
}

.l112-featured-gallery__link > img,
.l112-featured-gallery__preview > img {
  display: block;
  width: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.l112-featured-gallery__link > img {
  aspect-ratio: 16 / 9;
}

.l112-featured-gallery__link:hover > img,
.l112-featured-gallery__preview:hover > img {
  transform: scale(1.015);
}

.l112-featured-gallery__caption {
  margin-top: 10px;
  color: #4f5358;
  font-size: 0.9rem;
  line-height: 1.45;
}

.l112-featured-gallery__previews {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 12px;
}

.l112-featured-gallery__preview {
  border-radius: 6px;
}

.l112-featured-gallery__preview > img {
  height: 100%;
  aspect-ratio: 16 / 9;
}

.l112-featured-gallery__preview--more::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: rgba(0, 0, 0, 0.64);
  content: "";
  transition: background-color 0.15s ease;
}

.l112-featured-gallery__preview--more:hover::after,
.l112-featured-gallery__preview--more:focus-visible::after {
  background: rgba(0, 0, 0, 0.54);
}

.l112-featured-gallery__more-label {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 10px;
  color: #fff;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.l112-featured-gallery__more-label strong {
  font-weight: 700;
}

.l112-featured-video {
  width: 100%;
  margin: 24px 0 0;
  overflow: hidden;
  border-radius: 8px;
  background: #111;
  aspect-ratio: 16 / 9;
}

.l112-featured-video video,
.l112-featured-video iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.l112-featured-video video {
  object-fit: contain;
}

.l112-gallery__images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.l112-gallery--list .l112-gallery__images {
  grid-template-columns: 1fr;
}

.l112-gallery--list .l112-gallery__item > img,
.l112-gallery--list .l112-gallery__item .l112-gallery__zoom > img {
  height: auto;
  max-height: 100vh;
  max-height: 100dvh;
  aspect-ratio: auto;
  object-fit: contain;
}

.l112-gallery__item,
.l112-gallery__slide {
  min-width: 0;
  margin: 0;
}

.l112-gallery__item {
  overflow: hidden;
  border: 1px solid var(--l112-gallery-border);
  border-radius: 7px;
  background: #fff;
}

.l112-gallery__item > img,
.l112-gallery__item .l112-gallery__zoom > img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.l112-gallery__zoom {
  position: relative;
  display: block;
  color: inherit;
  cursor: zoom-in;
}

.l112-gallery__zoom::after {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  content: "↗";
  font-size: 18px;
  line-height: 34px;
  text-align: center;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

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

.l112-gallery__caption {
  padding: 10px 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}

.l112-gallery__ad {
  width: 100%;
  grid-column: 1 / -1;
  margin: 18px 0;
  text-align: center;
}

.l112-gallery__ad .ad-holder-galeria1,
.l112-gallery__ad .ad-holder-galeria2,
.l112-gallery__ad .ad-holder-galeria3 {
  min-height: 318px;
}

.l112-gallery__pagination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.l112-gallery__pagination-side--next {
  text-align: right;
}

.l112-gallery__page-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid var(--l112-gallery-border);
  border-radius: 5px;
  background: #fff;
  color: var(--l112-gallery-text);
  font-weight: 600;
  text-decoration: none;
}

.l112-gallery__page-link:hover,
.l112-gallery__page-link:focus-visible {
  border-color: var(--l112-gallery-accent);
  color: var(--l112-gallery-accent);
}

.l112-gallery__page-status {
  color: #646970;
  font-size: 0.9rem;
  white-space: nowrap;
}

.l112-gallery__fotorama {
  overflow: hidden;
  border-radius: 8px;
  background: #111;
}

.l112-gallery__stage {
  position: relative;
  display: grid;
  min-height: min(68vh, 720px);
  place-items: center;
  overflow: hidden;
}

.l112-gallery__slide {
  width: 100%;
}

.l112-gallery__slide[hidden] {
  display: none;
}

.l112-gallery__slide > img,
.l112-gallery__slide .l112-gallery__zoom > img {
  display: block;
  width: 100%;
  height: min(68vh, 720px);
  object-fit: contain;
}

.l112-gallery__slide .l112-gallery__caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 28px 72px 14px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
  color: #fff;
  text-align: center;
}

.l112-gallery__stage-control {
  position: absolute;
  z-index: 2;
  top: 50%;
  width: 46px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  cursor: pointer;
  font-size: 38px;
  line-height: 1;
  transform: translateY(-50%);
}

.l112-gallery__stage-control--previous {
  left: 12px;
}

.l112-gallery__stage-control--next {
  right: 12px;
}

.l112-gallery__thumbnails {
  display: flex;
  gap: 8px;
  padding: 10px;
  overflow-x: auto;
  background: #1d1d1d;
  scrollbar-width: thin;
}

.l112-gallery__thumbnail {
  flex: 0 0 92px;
  height: 68px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  background: #333;
  cursor: pointer;
  opacity: 0.68;
}

.l112-gallery__thumbnail.is-active,
.l112-gallery__thumbnail:hover,
.l112-gallery__thumbnail:focus-visible {
  border-color: #fff;
  opacity: 1;
}

.l112-gallery__thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.l112-gallery-lightbox[hidden] {
  display: none;
}

.l112-gallery-lightbox {
  position: fixed;
  z-index: 100000;
  inset: 0;
  display: grid;
  place-items: center;
}

.l112-gallery-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.l112-gallery-lightbox__content {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(94vw, 1500px);
  height: 94vh;
  place-items: center;
}

.l112-gallery-lightbox__figure {
  display: grid;
  max-width: 100%;
  max-height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
}

.l112-gallery-lightbox__figure img {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 64px);
  object-fit: contain;
}

.l112-gallery-lightbox__meta {
  display: flex;
  width: 100%;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  color: #fff;
}

.l112-gallery-lightbox__counter {
  margin-left: auto;
  white-space: nowrap;
}

.l112-gallery-lightbox__close,
.l112-gallery-lightbox__control {
  position: absolute;
  z-index: 2;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.l112-gallery-lightbox__close {
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 36px;
  line-height: 44px;
}

.l112-gallery-lightbox__control {
  top: 50%;
  width: 52px;
  height: 64px;
  border-radius: 4px;
  font-size: 44px;
  line-height: 1;
  transform: translateY(-50%);
}

.l112-gallery-lightbox__control--previous {
  left: 0;
}

.l112-gallery-lightbox__control--next {
  right: 0;
}

body.has-l112-gallery-lightbox {
  overflow: hidden;
}

@media (max-width: 782px) {
  .l112-gallery--featured {
    margin-top: 18px;
  }

  .l112-featured-video {
    margin-top: 18px;
  }

  .l112-featured-gallery__link > img {
    aspect-ratio: 4 / 3;
  }

  .l112-featured-gallery__previews {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    margin-top: 8px;
  }

  .l112-featured-gallery__more-label {
    font-size: 0.82rem;
  }

  .l112-gallery__images {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .l112-gallery__stage {
    min-height: 52vh;
  }

  .l112-gallery__slide > img,
  .l112-gallery__slide .l112-gallery__zoom > img {
    height: 52vh;
  }

  .l112-gallery__pagination {
    grid-template-columns: 1fr 1fr;
  }

  .l112-gallery__page-status {
    grid-column: 1 / -1;
    grid-row: 1;
    text-align: center;
  }

  .l112-gallery__pagination-side {
    grid-row: 2;
  }

  .l112-gallery__page-link {
    font-size: 0.85rem;
  }

  .l112-gallery-lightbox__control {
    top: auto;
    bottom: 14px;
    width: 48px;
    height: 48px;
    transform: none;
  }
}

@media (max-width: 480px) {
  .l112-gallery__images {
    grid-template-columns: 1fr;
  }

  .l112-gallery__thumbnail {
    flex-basis: 76px;
    height: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .l112-gallery__zoom::after {
    transition: none;
  }
}

/* Native modal owns background inertness and the keyboard boundary. */
dialog.l112-gallery-lightbox { margin: 0; border: 0; padding: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; color: #fff; }
dialog.l112-gallery-lightbox:not([open]) { display: none; }
.l112-gallery-lightbox__content { min-width: 0; grid-template-columns: minmax(0, 1fr); box-sizing: border-box; padding: 56px 0 76px; }
.l112-gallery-lightbox__figure { min-width: 0; width: 100%; height: 100%; margin: 0; overflow: auto; }
.l112-gallery-lightbox__figure img { min-width: 0; min-height: 0; max-height: 100%; }
.l112-gallery-lightbox__meta { box-sizing: border-box; flex-wrap: wrap; min-width: 0; gap: .5rem; overflow-wrap: anywhere; }
.l112-gallery-lightbox__counter { white-space: normal; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.l112-gallery-lightbox button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .l112-gallery * { scroll-behavior: auto !important; transition: none !important; } }
