/*=============== GALLERY ===============*/
.gallery__container {
  padding: calc(var(--header-height) + 2rem) 1rem 3rem;
}

.gallery__header {
  text-align: center;
  margin-bottom: 2.5rem;
}

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

@media screen and (min-width: 768px) {
  .gallery__grid {
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.gallery__item {
  position: relative;
  border-radius: 1.5rem;
  overflow: hidden;
  height: 300px;
  cursor: pointer;
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.gallery__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.8) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
  opacity: 0;
  transition: var(--transition);
}

@media (hover: hover) {
  .gallery__item:hover .gallery__img {
    transform: scale(1.1);
  }

  .gallery__item:hover .gallery__overlay {
    opacity: 1;
  }
}

@media screen and (max-width: 1024px) {
  .gallery__item.active-card .gallery__img {
    transform: scale(1.1);
  }
  
  .gallery__item.active-card .gallery__overlay {
    opacity: 1;
  }
}

.gallery__title {
  color: #fff;
  font-size: var(--h3-font-size);
  margin-bottom: .5rem;
}

.gallery__data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery__tag {
  color: var(--second-color);
  font-size: var(--smaller-font-size);
  font-weight: var(--font-semi-bold);
  text-transform: uppercase;
}

.gallery__view-btn {
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: var(--smaller-font-size);
  font-weight: var(--font-semi-bold);
  display: inline-flex;
  align-items: center;
  column-gap: 0.3rem;
  transition: var(--transition);
  cursor: pointer;
}

.gallery__view-btn i {
  font-size: 1rem;
}

.gallery__view-btn:hover {
  background-color: var(--second-color);
  border-color: var(--second-color);
  transform: scale(1.05);
}

/* Modal / Lightbox Premium */
.gallery__modal {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  z-index: 3000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: var(--transition);
}

.gallery__modal-content {
  position: relative;
  display: block;
  max-width: 95%;
  width: fit-content;
  min-width: 300px; /* Prevents close icon jumping to middle */
  min-height: 200px;
}

.gallery__modal-img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  border-radius: 1.5rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.3);
  object-fit: contain;
  transition: opacity 0.3s ease;
}

/* Spinner while high-res image loads */
.gallery__modal.modal-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--second-color);
  border-radius: 50%;
  animation: modal-spin 0.8s linear infinite;
}

.gallery__modal.modal-loading .gallery__modal-img {
  opacity: 0.3;
}

@keyframes modal-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.gallery__modal-close {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 40px;
  height: 40px;
  background-color: var(--bg-dark);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: var(--transition);
  z-index: 2010;
  border: 2px solid #fff;
}

.gallery__modal-close:hover {
  transform: scale(1.1);
  background-color: var(--second-color);
}

@media screen and (min-width: 768px) {
  .gallery__modal-content {
    width: fit-content;
    max-width: 80%;
  }
  .gallery__modal-close {
    top: -20px;
    right: -20px;
    width: 50px;
    height: 50px;
    font-size: 1.75rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =============== GALLERY SKELETON SHIMMER =============== */
.gallery__skeleton {
  background-color: #e2e8f0;
  border-radius: 1.5rem;
  overflow: hidden;
  height: 300px;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.gallery__skeleton-img {
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    #e2e8f0 0%,
    #ffffff 50%,
    #e2e8f0 100%
  );
  background-size: 200% 100%;
  animation: gallery-shimmer 1.5s ease-in-out infinite;
}

@keyframes gallery-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}


