:root {
  --eg-sand: #d0b17a;
  --eg-text: #2d2d2d;
}

.egallery {
  max-width: 1200px;
  margin: 0 auto;
}

.egallery__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 0 18px;
}

.egallery__hint {
  color: #444;
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0.9;
  max-width: 720px;
}

.egallery__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.egallery__btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(208, 177, 122, 0.35);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--eg-text);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.egallery__btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.10);
  border-color: rgba(208, 177, 122, 0.7);
}

.egallery__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.egallery__counter {
  font-size: 0.9rem;
  color: #444;
  min-width: 86px;
  text-align: center;
}

.egallery__viewport {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 6px 4px 16px;
}

@media (min-width: 640px) {
  .egallery__viewport {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .egallery__viewport {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.egallery__slide {
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
  position: relative;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.egallery__slide img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transform: scale(1.001);
  transition: transform 0.9s ease;
}

.egallery__slide:hover img {
  transform: scale(1.06);
}

.egallery__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 14px;
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.4;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.75) 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.egallery__slide:hover .egallery__caption,
.egallery__slide:focus-visible .egallery__caption {
  opacity: 1;
  transform: translateY(0);
}

.egallery__caption strong {
  font-weight: 500;
}

/* Lightbox */
.eg-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 5000;
}

.eg-lightbox.is-open {
  display: block;
}

.eg-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.86);
}

.eg-lightbox__panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.eg-lightbox__content {
  width: min(1100px, 94vw);
  max-height: 86vh;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
}

.eg-lightbox__imgwrap {
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
  position: relative;
}

.eg-lightbox__img {
  width: 100%;
  height: 100%;
  max-height: 78vh;
  object-fit: contain;
  display: block;
  background: rgba(0, 0, 0, 0.15);
}

.eg-lightbox__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
}

.eg-lightbox__caption {
  margin: 0;
  opacity: 0.95;
}

.eg-lightbox__counter {
  opacity: 0.75;
  white-space: nowrap;
}

.eg-lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.eg-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.eg-lightbox__nav--prev {
  left: 18px;
}

.eg-lightbox__nav--next {
  right: 18px;
}

@media (max-width: 540px) {
  .egallery__top {
    flex-direction: column;
    align-items: flex-start;
  }
  .egallery__controls {
    align-self: stretch;
    justify-content: space-between;
    width: 100%;
  }
  .eg-lightbox__nav {
    width: 44px;
    height: 44px;
  }
  .eg-lightbox__nav--prev {
    left: 10px;
  }
  .eg-lightbox__nav--next {
    right: 10px;
  }
}
