:root {
  --page-ink: #12231a;
  --page-text: #455449;
  --page-muted: #69786c;
  --page-paper: #fffdf8;
  --page-soft: #f3f8f0;
  --page-green: #245b39;
  --page-green-2: #6ca56b;
  --page-gold: #d99a3d;
  --page-blue: #e7f2f3;
  --page-line: rgba(18, 35, 26, 0.1);
  --page-shadow: 0 22px 70px rgba(32, 63, 43, 0.1);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--page-paper);
  color: var(--page-ink);
  padding-top: 0;
}

.gallery-page {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0) 0, #fffdf8 620px),
    var(--page-paper);
}

.gallery-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.gallery-banner {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  background: #dfeadd;
}

.banner-image-container,
.banner-image,
.banner-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.banner-image {
  object-fit: cover;
  object-position: center;
  z-index: -2;
}

.banner-overlay {
  z-index: -1;
  background:
    linear-gradient(
      90deg,
      rgba(10, 34, 18, 0.7),
      rgba(10, 34, 18, 0.28) 56%,
      rgba(10, 34, 18, 0.05)
    ),
    linear-gradient(0deg, rgba(10, 34, 18, 0.5), rgba(10, 34, 18, 0.02) 55%);
}

.banner-content {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 150px 0 76px;
}

.gallery-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  color: #ffe1aa;
  font:
    700 13px/1 "Montserrat",
    sans-serif;
  backdrop-filter: blur(12px);
  animation: galleryUp 0.7s ease both;
}

.banner-title {
  max-width: 760px;
  margin: 18px 0 0;
  color: #fff;
  font:
    800 58px/1.04 "Montserrat",
    sans-serif;
  letter-spacing: 0;
  text-shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
  animation: galleryUp 0.78s 0.08s ease both;
}

.highlight {
  color: #ffd38d;
}

.banner-description {
  max-width: 640px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 20px;
  line-height: 1.6;
  animation: galleryUp 0.78s 0.16s ease both;
}

.gallery-main {
  padding: 84px 0 96px;
}

.section-header {
  max-width: 760px;
  margin: 0 auto 42px;
  text-align: center;
}

.section-title {
  margin: 0;
  color: var(--page-ink);
  text-align: center;
  font:
    800 44px/1.12 "Montserrat",
    sans-serif;
  letter-spacing: 0;
}

.section-title::after {
  display: block;
  content: "";
  width: 58px;
  height: 3px;
  margin: 18px auto 0;
  border-radius: 999px;
  background: var(--page-green);
}

.section-subtitle {
  max-width: 760px;
  margin: 18px auto 0;
  color: var(--page-text);
  text-align: center;
  font-size: 17px;
  line-height: 1.7;
}

.gallery-filters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
}

.filter-btn,
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--page-line);
  border-radius: 999px;
  background: #fff;
  color: var(--page-green);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.25s ease,
    background 0.25s ease,
    color 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.filter-btn:hover,
.page-link:hover {
  transform: translateY(-2px);
  background: rgba(36, 91, 57, 0.06);
  color: var(--page-green);
  box-shadow: 0 18px 45px rgba(36, 91, 57, 0.12);
  border-color: rgba(36, 91, 57, 0.22);
}

.filter-btn.active,
.page-link.active {
  background: var(--page-green);
  color: #fff;
  border-color: var(--page-green);
  box-shadow: 0 18px 45px rgba(36, 91, 57, 0.2);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.gallery-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--page-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(32, 63, 43, 0.08);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    opacity 0.25s ease;
}

.gallery-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 80px rgba(32, 63, 43, 0.13);
  border-color: rgba(36, 91, 57, 0.18);
}

.gallery-card.is-filtered-out {
  display: none;
}

.image-container {
  position: relative;
  overflow: hidden;
  background: var(--page-soft);
}

.gallery-image {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  cursor: zoom-in;
}

.gallery-card:hover .gallery-image {
  transform: scale(1.045);
  filter: saturate(1.05);
}

.gallery-likes {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #d65b5b;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
  transition:
    transform 0.22s ease,
    background 0.22s ease,
    color 0.22s ease,
    box-shadow 0.22s ease;
}

.like-btn:hover {
  transform: translateY(-2px) scale(1.02);
  background: #fff;
  box-shadow: 0 18px 45px rgba(214, 91, 91, 0.16);
}

.like-btn.liked {
  color: #fff;
  background: #d65b5b;
  border-color: #d65b5b;
}

.gallery-content {
  padding: 22px;
}

.gallery-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--page-muted);
  font-size: 14px;
}

.gallery-title {
  margin: 0 0 10px;
  color: var(--page-ink);
  font:
    800 21px/1.2 "Montserrat",
    sans-serif;
}

.gallery-description {
  margin: 0;
  color: var(--page-text);
  line-height: 1.65;
}

.empty-gallery {
  grid-column: 1 / -1;
  padding: 56px 34px;
  text-align: center;
  color: var(--page-text);
  border: 1px solid var(--page-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(32, 63, 43, 0.08);
}

.empty-gallery i {
  display: block;
  margin-bottom: 16px;
  color: var(--page-green-2);
  font-size: 54px;
}

.empty-gallery h3 {
  margin: 0 0 10px;
  color: var(--page-green);
  font:
    800 28px/1.15 "Montserrat",
    sans-serif;
}

.empty-gallery p {
  margin: 0;
  color: var(--page-text);
  font-size: 17px;
  line-height: 1.6;
}

.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 40px 0 0;
  padding: 0;
  list-style: none;
}

.page-item.disabled .page-link {
  opacity: 0.5;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(18, 35, 26, 0.58);
  backdrop-filter: blur(8px);
}

.modal.show {
  display: flex;
}

.modal-content {
  position: relative;
  width: min(1000px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.26);
}

.modal-img-container {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(68vh, 720px);
  background: #0f1a13;
}

.modal-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  object-fit: contain;
  opacity: 0;
  transform: scale(0.985);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.modal-img.loaded {
  opacity: 1;
  transform: scale(1);
}

.loader {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.24);
  border-top-color: #ffd38d;
  border-radius: 50%;
  animation: gallerySpin 0.8s linear infinite;
}

.photo-counter {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.86);
  color: var(--page-ink);
  font-weight: 800;
  backdrop-filter: blur(12px);
}

#modalLikeContainer {
  top: auto;
  right: 18px;
  bottom: 18px;
}

.close,
.nav-arrow {
  position: absolute;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--page-ink);
  cursor: pointer;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(12px);
  transition:
    transform 0.22s ease,
    background 0.22s ease;
  user-select: none;
}

.close {
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  font-size: 30px;
  line-height: 1;
}

.nav-arrow {
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  font-size: 28px;
  text-decoration: none;
}

.nav-arrow.prev {
  left: 18px;
}

.nav-arrow.next {
  right: 18px;
}

.close:hover {
  transform: translateY(-2px) scale(1.03);
  background: #fff;
}

.nav-arrow:hover {
  transform: translateY(-50%) scale(1.05);
  background: #fff;
}

.gallery-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 0.72s ease,
    transform 0.72s ease;
}

.gallery-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes galleryUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gallerySpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .gallery-shell,
  .banner-content,
  .gallery-grid {
    width: min(100% - 28px, 1180px);
  }

  .gallery-banner {
    min-height: 430px;
  }

  .banner-content {
    padding: 122px 0 52px;
  }

  .banner-title {
    font-size: 38px;
  }

  .banner-description {
    font-size: 16px;
  }

  .gallery-main {
    padding: 56px 0 72px;
  }

  .section-title {
    font-size: 32px;
  }

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

  .gallery-image {
    height: 235px;
  }

  .modal {
    padding: 14px;
  }

  .modal-content {
    border-radius: 16px;
  }

  .modal-img-container {
    min-height: 64vh;
  }

  .modal-img {
    max-height: calc(100vh - 130px);
  }

  .nav-arrow {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .nav-arrow.prev {
    left: 10px;
  }

  .nav-arrow.next {
    right: 10px;
  }

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

  .photo-counter {
    left: 12px;
    bottom: 12px;
  }

  #modalLikeContainer {
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 480px) {
  .gallery-filters {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }

  .filter-btn {
    white-space: nowrap;
  }

  .gallery-content {
    padding: 18px;
  }

  .gallery-title {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
