/**
 * IRP - Gallery page: category tabs and image grid
 */

.gallery-section {
  padding: 4rem 0 6rem;
  background: linear-gradient(to bottom, #fff 0%, #f8fafc 100%);
}

.gallery-container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.gallery-tabs-wrap {
  margin-bottom: 2.5rem;
}

.gallery-tabs-select-wrap {
  display: none;
  max-width: 32rem;
  margin: 0 auto 1.25rem;
}

.gallery-tabs-select-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.gallery-tabs-select {
  width: 100%;
  padding: 0.9rem 2.75rem 0.9rem 1rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #2563eb 50%),
    linear-gradient(135deg, #2563eb 50%, transparent 50%);
  background-position:
    calc(100% - 1.35rem) 1.25rem,
    calc(100% - 1.1rem) 1.25rem;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
}

.gallery-tabs-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
}

.gallery-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  position: relative;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 0;
}

.gallery-tab {
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #4b5563;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 0.3s ease;
  font-family: inherit;
}

.gallery-tab:hover {
  color: #2563eb;
}

.gallery-tab.is-active {
  color: #2563eb;
}

.gallery-tabs-indicator {
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 3px;
  background: #2563eb;
  border-radius: 3px 3px 0 0;
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (max-width: 1024px) {
.gallery-container {
  padding: 0 45px;
}
}

@media (max-width: 767px) {
  .gallery-tabs-select-wrap {
    display: block;
  }

  .gallery-tabs {
    display: none;
  }
}

.gallery-panels {
  min-height: 200px;
}

.gallery-panel {
  display: none;
}

.gallery-panel.is-active {
  display: block;
  animation: gallery-fade 0.3s ease;
}

@keyframes gallery-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 2px solid transparent;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  pointer-events: none;
}

.gallery-item:hover {
  box-shadow: 0 20px 40px -12px rgba(37, 99, 235, 0.25), 0 8px 16px -8px rgba(0, 0, 0, 0.15);
  transform: translateY(-6px) scale(1.02);
}

.gallery-item:hover::before {
  border-color: rgba(37, 99, 235, 0.4);
}

.gallery-link {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  position: relative;
}

.gallery-link::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-item:hover .gallery-link::after {
  opacity: 1;
}

.gallery-link-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 3rem;
  height: 3rem;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.gallery-item:hover .gallery-link-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.gallery-link-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #2563eb;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

.gallery-empty {
  text-align: center;
  color: #6b7280;
  font-size: 1.125rem;
  padding: 3rem;
}

@media (min-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.75rem;
  }
}

@media (min-width: 992px) {
  .gallery-section {
    padding: 5rem 0 7rem;
  }
  .gallery-tabs {
    margin-bottom: 3rem;
  }
  .gallery-tab {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
  }
}

/* Lightbox popup - trending design */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gallery-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  transition: background 0.35s ease;
}

.gallery-lightbox.is-open .gallery-lightbox-backdrop:hover {
  background: rgba(15, 23, 42, 0.9);
}

.gallery-lightbox-close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  z-index: 10;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: #1f2937;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-close svg {
  width: 1.25rem;
  height: 1.25rem;
}

.gallery-lightbox-close:hover {
  background: #374151;
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  visibility: hidden;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: none;
  background: #1f2937;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.gallery-lightbox-prev svg,
.gallery-lightbox-next svg {
  width: 1.5rem;
  height: 1.5rem;
}

.gallery-lightbox-prev:hover,
.gallery-lightbox-next:hover {
  background: #374151;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-prev:active,
.gallery-lightbox-next:active {
  transform: translateY(-50%) scale(0.98);
}

.gallery-lightbox-prev {
  left: 0.75rem;
}

.gallery-lightbox-next {
  right: 0.75rem;
}

@media (max-width: 480px) {
  .gallery-lightbox {
    padding: 1rem;
  }

  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    width: 2.5rem;
    height: 2.5rem;
  }

  .gallery-lightbox-prev svg,
  .gallery-lightbox-next svg {
    width: 1.15rem;
    height: 1.15rem;
  }

  .gallery-lightbox-prev {
    left: 0.5rem;
  }

  .gallery-lightbox-next {
    right: 0.5rem;
  }

  .gallery-lightbox-close {
    width: 2.25rem;
    height: 2.25rem;
    top: -0.6rem;
    right: -0.6rem;
  }

  .gallery-lightbox-close svg {
    width: 1.1rem;
    height: 1.1rem;
  }
}

@media (min-width: 768px) {
  .gallery-lightbox-prev,
  .gallery-lightbox-next {
    width: 3.25rem;
    height: 3.25rem;
  }
  .gallery-lightbox-prev svg,
  .gallery-lightbox-next svg {
    width: 1.5rem;
    height: 1.5rem;
  }
  .gallery-lightbox-prev {
    left: 1.5rem;
  }
  .gallery-lightbox-next {
    right: 1.5rem;
  }
}

.gallery-lightbox-content {
  position: relative;
  z-index: 5;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: lightbox-zoom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightbox-zoom {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.gallery-lightbox-img-wrap {
  background: #fff;
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
}

.gallery-lightbox-img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  display: block;
}
