/*
 * ╔═══════════════════════════════════════════════════════════════╗
 * ║          GALLERY SECTION - CLEANED & COMPLIANT                ║
 * ║               قسم المعرض - منظف 100%                         ║
 * ╚═══════════════════════════════════════════════════════════════╝
 * 
 * ✅ 100% متوافق مع دستور التصميم
 * ✅ صفر hardcoded colors - كل شيء عبر CSS Variables
 * ✅ صفر !important
 * ✅ يعمل مع جميع الثيمات الأربعة
 * ✅ تطابق بصري 1:1 مع النسخة السابقة
 * 
 * آخر تحديث: 2026-01-16
 */

/* ===== Creative Gallery Section ===== */
.gallery-section {
  padding: 20px 0 60px;
  position: relative;
  overflow: visible;
  /* ⚡ Fix: Allow hover effects to extend */
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 220px);
  gap: 20px;
  padding: 20px 0;
}

.gallery-item {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 20px 60px rgba(var(--black-rgb), 0.15);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--neutral-100);
  will-change: transform;
}

/* Creative Grid Layout - Mosaic Style (For 10 images) */
/* Row 1 */
.gallery-item:nth-child(1) {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item:nth-child(2) {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item:nth-child(3) {
  grid-column: span 1;
  grid-row: span 1;
}

/* Row 2 (partial) */
.gallery-item:nth-child(4) {
  grid-column: span 2;
  grid-row: span 1;
}

/* Row 3 */
.gallery-item:nth-child(5) {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item:nth-child(6) {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item:nth-child(7) {
  grid-column: span 1;
  grid-row: span 1;
}

.gallery-item:nth-child(8) {
  grid-column: span 1;
  grid-row: span 1;
}

/* Extra items if any (9, 10) */
.gallery-item:nth-child(9),
.gallery-item:nth-child(10) {
  grid-column: span 2;
  grid-row: span 1;
}

/* Image Styling */
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  transition: transform 0.4s ease;
}

/* Hover Effects - مثل library-image */
.gallery-item:hover {
  transform: translateY(-10px);
  box-shadow: 0 25px 50px rgba(var(--black-rgb), 0.2);
  z-index: 10;
}

.gallery-item:hover img {
  transform: none;
}

/* Light sweep effect - مثل library-image */
.gallery-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(var(--white-rgb), 0.15) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.8s ease;
  pointer-events: none;
  border-radius: 20px;
}

.gallery-item:hover::after {
  transform: translateX(100%);
}

/* Overlay Effect */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(var(--black-rgb), 0.7) 0%, rgba(var(--black-rgb), 0) 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 20px;
}

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

.gallery-icon-wrapper {
  width: 45px;
  height: 45px;
  background: rgba(var(--white-rgb), 0.25);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-white);
  font-size: 1.1rem;
  transform: translateY(15px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gallery-item:hover .gallery-icon-wrapper {
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 992px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 200px);
  }

  /* Reset layout for tablet */
  .gallery-item:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
  }

  .gallery-item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .gallery-item:nth-child(4) {
    grid-column: span 2;
  }
}

@media (max-width: 768px) {
  .gallery-section {
    padding-inline: clamp(0.75rem, 3vw, 1.25rem);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    justify-items: stretch;
  }

  .gallery-item:nth-child(n) {
    grid-column: span 1;
    grid-row: span 1;
    height: 200px;
    margin-inline: 0;
    max-width: 100%;
  }

  .gallery-item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
    height: 300px;
  }

  .gallery-item img {
    display: block;
    object-position: center;
  }
}

@media (max-width: 480px) {
  .gallery-section {
    padding-inline: clamp(0.5rem, 3vw, 1rem);
  }

  .gallery-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    align-items: stretch;
  }

  /* Responsive gallery - media query provides specificity */
  .gallery-item {
    height: 250px;
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
  }

  .gallery-item:nth-child(1) {
    height: 280px;
  }

  .gallery-item img {
    display: block;
    object-position: center;
  }
}