/* Gallery Grid Layout */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
#gallery {
    padding: 40px 0;
    background: #fff;
}

.gallery-row {
    max-width: 1245px;
    margin: 0 auto 30px;
    padding: 0 15px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.gallery-row:last-child {
    margin-bottom: 0;
}

.gallery-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: #ffffff;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.03),
        0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-item:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 8px 12px rgba(0, 0, 0, 0.05),
        0 3px 6px rgba(0, 0, 0, 0.1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.03) 100%
    );
    pointer-events: none;
}

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

.gallery-item a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: block;
    will-change: transform;
}

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

.gallery-title {
    margin: 15px;
    text-align: center;
    font-size: 18px;
    color: #2c3e50;
    font-weight: 600;
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 12px;
}

.gallery-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #3498db, #2980b9);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Responsive adjustments */
@media (max-width: 1024px) {
    .gallery-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .gallery-row {
        grid-template-columns: 1fr;
        padding: 0 10px;
        gap: 15px;
    }

    #gallery {
        padding: 30px 0;
    }
    
    .gallery-item img {
        height: 250px;
    }
}


.gallery-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.97);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  backdrop-filter: blur(8px);
}

.gallery-modal.active {
  opacity: 1;
}

.gallery-modal-content {
  position: relative;
  width: 90%;
  max-width: 1200px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  background: transparent;
  transform: translateY(20px) scale(0.98);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.gallery-modal.active .gallery-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.gallery-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  color: white;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(4px);
  border-radius: 12px 12px 0 0;
  margin-bottom: 10px;
}

.gallery-modal-title {
  font-size: 1.5rem;
  margin: 0;
  color: white;
  font-weight: 500;
}

.gallery-close-btn {
  background: transparent;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.3s ease;
}

.gallery-close-btn:hover {
  transform: rotate(90deg);
}

.gallery-modal-main {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-modal-image {
  max-width: 100%;
  max-height: calc(90vh - 180px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  cursor: zoom-in;
}

.gallery-modal-image.loaded {
  opacity: 1;
}

.gallery-modal-image.zoomed {
  cursor: zoom-out;
}

.gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  opacity: 0.7;
}

.gallery-nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

.gallery-nav-btn.prev {
  left: 20px;
}

.gallery-nav-btn.next {
  right: 20px;
}

.modal-description {
  padding: 25px 30px;
  margin: 20px auto;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  border-radius: 12px;
  line-height: 1.7;
  font-size: 1rem;
  max-width: 800px;
  width: 92%;
  animation: fadeInUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
  animation-fill-mode: both;
  animation-delay: 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 6px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.modal-description::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
}

.modal-description:empty {
  display: none;
}

.gallery-thumbnails {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 15px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(4px);
  border-radius: 0 0 12px 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

.gallery-thumbnail {
  width: 80px;
  height: 60px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  border: 2px solid transparent;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.gallery-thumbnail:hover {
  opacity: 0.8;
  transform: translateY(-2px);
}

.gallery-thumbnail.active {
  opacity: 1;
  border-color: #3498db;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
  transform: translateY(-2px);
}

.gallery-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .gallery-modal-content {
    width: 100%;
    height: 100%;
  }

  .gallery-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .gallery-thumbnails {
    gap: 5px;
  }

  .gallery-thumbnail {
    width: 60px;
    height: 45px;
  }
}