/* ==========================================
   GALLERY SECTION
========================================== */

.gallery {
  padding: 40px 0;

  background: linear-gradient(180deg, #f8fbff, #eef6ff);
}

.gallery .section-tag,
.gallery .section-title,
.gallery .section-subtitle {
  text-align: center;

  display: block;
}

/* ==========================================
   FILTER
========================================== */

.gallery-filter {
  display: flex;

  justify-content: center;

  align-items: center;

  flex-wrap: wrap;

  gap: 15px;

  margin: 50px 0;
}

.gallery-filter button {
  padding: 12px 22px;

  border: none;

  border-radius: 30px;

  background: var(--bg-light);

  color: var(--text);

  border: 1px solid var(--border);

  cursor: pointer;

  font-weight: 600;

  transition: 0.35s;

  box-shadow: var(--shadow-sm);
}

.gallery-filter button:hover,
.gallery-filter button.active {
  background: var(--primary);

  color: #fff;
}

/* ==========================================
   GRID
========================================== */

.gallery-grid {
  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 25px;
}

/* ==========================================
   ITEM
========================================== */

.gallery-item {
  position: relative;

  overflow: hidden;

  border-radius: 22px;

  cursor: pointer;

  border: 1px solid var(--border);

  background: var(--bg-light);

  box-shadow: var(--shadow-sm);

  transition: 0.35s;
}

.gallery-item:hover {
  transform: translateY(-8px);

  box-shadow: var(--shadow-lg);
}

.gallery-item img {
  width: 100%;

  height: 300px;

  object-fit: cover;

  transition: 0.45s;
}

/* ==========================================
   OVERLAY
========================================== */

.gallery-overlay {
  position: absolute;

  inset: 0;

  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.15));

  display: flex;

  flex-direction: column;

  justify-content: flex-end;

  align-items: center;

  padding: 25px;

  opacity: 0;

  transition: 0.35s;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.08);
}

/* ==========================================
   TITLE
========================================== */

.gallery-overlay h3 {
  color: #fff;

  margin-bottom: 18px;

  font-size: 20px;

  text-align: center;
}

/* ==========================================
   BUTTON
========================================== */

.gallery-view {
  width: 55px;

  height: 55px;

  border-radius: 50%;

  background: #fff;

  color: var(--primary);

  display: flex;

  justify-content: center;

  align-items: center;

  font-size: 22px;

  transition: 0.35s;
}

.gallery-view:hover {
  background: var(--primary);

  color: #fff;

  transform: rotate(10deg) scale(1.08);
}

/* ==========================================
   RESPONSIVE
========================================== */

@media (max-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery {
    padding: 80px 0;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .gallery-item img {
    height: 240px;
  }

  .gallery-filter {
    gap: 10px;
  }

  .gallery-filter button {
    padding: 10px 18px;

    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .gallery-item img {
    height: 200px;
  }

  .gallery-overlay h3 {
    font-size: 18px;
  }
}

/* ==========================================
   DARK MODE
========================================== */

body.dark .gallery {
  background: linear-gradient(180deg, #08101f, #101c31);
}

body.dark .gallery-item {
  background: var(--bg-light);

  border-color: #223048;
}

body.dark .gallery-filter button {
  background: #162338;

  border-color: #223048;

  color: #fff;
}

body.dark .gallery-filter button.active {
  background: var(--primary);
}

/* ==========================================
   ACCESSIBILITY
========================================== */

.gallery-filter button:focus,
.gallery-view:focus {
  outline: 3px solid rgba(37, 99, 235, 0.25);

  outline-offset: 3px;
}

/* ==========================================
   LIGHTBOX
========================================== */

.gallery-lightbox {
  position: fixed;

  inset: 0;

  background: rgba(0, 0, 0, 0.9);

  display: none;

  justify-content: center;

  align-items: center;

  z-index: 99999;
}

.gallery-lightbox.active {
  display: flex;
}

.gallery-lightbox-img {
  max-width: 90%;

  max-height: 85vh;

  border-radius: 15px;

  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
}

.gallery-close {
  position: absolute;

  top: 30px;

  right: 40px;

  font-size: 45px;

  color: white;

  cursor: pointer;
}

.gallery-prev,
.gallery-next {
  position: absolute;

  top: 50%;

  transform: translateY(-50%);

  width: 60px;

  height: 60px;

  border-radius: 50%;

  background: white;

  border: none;

  font-size: 26px;

  cursor: pointer;

  transition: 0.3s;
}

.gallery-prev:hover,
.gallery-next:hover {
  background: var(--primary);

  color: white;
}

.gallery-prev {
  left: 35px;
}

.gallery-next {
  right: 35px;
}

@media (max-width: 768px) {
  .gallery-prev,
  .gallery-next {
    width: 48px;

    height: 48px;

    font-size: 22px;
  }

  .gallery-close {
    font-size: 35px;

    right: 20px;
  }
}
