/* ═══════════════════════════════════════════════════════════════
   Nasij — Gallery Cards 4-Column Layout
   من الصورة المرفقة: صغّر البطاقات لـ 4 بطاقات بالصف الواحد
   Exact style from reference image
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cream-ref: #f7f1e3;
  --ink-text: #14143a;
  --border-soft: #ddd;
}

/* ── Override Gallery Grid لـ 4 columns ──────────────────────── */
#gallery > div > div:nth-child(3),
section[id="gallery"] > div > div:nth-child(3),
.gallery-grid,
.gallery-collection-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 14px !important;
  margin-bottom: 56px !important;
}

/* Tablet: 3 columns */
@media (max-width: 1280px) {
  #gallery > div > div:nth-child(3),
  section[id="gallery"] > div > div:nth-child(3),
  .gallery-grid,
  .gallery-collection-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
  }
}

/* Small Tablet: 2 columns */
@media (max-width: 768px) {
  #gallery > div > div:nth-child(3),
  section[id="gallery"] > div > div:nth-child(3),
  .gallery-grid,
  .gallery-collection-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}

/* Mobile: 1 column */
@media (max-width: 480px) {
  #gallery > div > div:nth-child(3),
  section[id="gallery"] > div > div:nth-child(3),
  .gallery-grid,
  .gallery-collection-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
}

/* ── Smaller Card Container ──────────────────────────────────── */
.gallery-item,
article.gallery-item,
#gallery article,
section[id="gallery"] article {
  background: var(--cream-ref) !important;
  border-radius: 24px !important;
  overflow: hidden !important;
  border: 1px solid #e5e0d3 !important;
  transition: all 0.25s ease !important;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
}

.gallery-item:hover,
article.gallery-item:hover,
#gallery article:hover,
section[id="gallery"] article:hover {
  border-color: #d9cfc0 !important;
  transform: translateY(-2px) !important;
}

/* ── Image Container (smaller aspect) ────────────────────────── */
.gallery-image-wrapper,
.gallery-thumb,
#gallery article > div:first-child,
section[id="gallery"] article > div:first-child {
  position: relative;
  aspect-ratio: 3 / 4 !important;
  overflow: hidden;
  background: #f5f0e8 !important;
  border-radius: 20px !important;
  margin: 10px !important;
}

.gallery-image,
#gallery img,
section[id="gallery"] img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  transition: transform 0.5s ease !important;
}

.gallery-item:hover .gallery-image,
article.gallery-item:hover img,
#gallery article:hover img,
section[id="gallery"] article:hover img {
  transform: scale(1.03) !important;
}

/* ── Float Tag (smaller & subtle) ────────────────────────────── */
.gallery-tag,
.gallery-item span[class*="tag"],
#gallery span[class*="tag"],
section[id="gallery"] span[class*="tag"],
#gallery article span:not(:last-child),
section[id="gallery"] article span:not(:last-child) {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(247, 241, 227, 0.85) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
  color: var(--ink-text) !important;
  font-size: 9px !important;
  letter-spacing: 0.15em !important;
  padding: 4px 10px !important;
  border-radius: 12px !important;
  font-family: 'Tajawal', 'Work Sans', sans-serif !important;
  font-weight: 500 !important;
  text-transform: none !important;
  z-index: 1;
  white-space: nowrap;
}

/* ── Card Footer (smaller text) ──────────────────────────────– */
.gallery-content,
.gallery-footer,
#gallery article footer,
#gallery article > div:last-child,
section[id="gallery"] article > div:last-child {
  padding: 12px 10px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px !important;
  flex: 1;
  flex-wrap: wrap;
}

/* Card Title (smaller) */
.gallery-item-title,
#gallery article h3,
section[id="gallery"] article h3 {
  font-family: 'Tajawal', 'Work Sans', sans-serif !important;
  font-size: 13px !important;
  color: var(--ink-text) !important;
  margin: 0 !important;
  font-weight: 500 !important;
  line-height: 1.3 !important;
  word-break: break-word;
  flex: 1;
}

/* Arrow Icon (smaller) */
.gallery-arrow,
#gallery article span:last-child,
section[id="gallery"] article span:last-child {
  color: var(--ink-text) !important;
  font-size: 14px !important;
  font-family: 'Limelight', serif !important;
  font-weight: 400 !important;
  transition: transform 0.3s ease !important;
  flex-shrink: 0;
  opacity: 0.6;
}

.gallery-item:hover .gallery-arrow,
#gallery article:hover span:last-child,
section[id="gallery"] article:hover span:last-child {
  transform: translateX(-2px) !important;
  opacity: 1;
}

/* ── Text description (all ink color) ────────────────────────── */
.gallery-desc,
#gallery article p,
section[id="gallery"] article p {
  color: var(--ink-text) !important;
  font-size: 12px !important;
  margin: 4px 0 0 0 !important;
  line-height: 1.4 !important;
}

/* ── Subtitle styling ────────────────────────────────────────── */
#gallery article footer p,
section[id="gallery"] article footer p {
  color: var(--ink-text) !important;
  opacity: 0.85;
  font-size: 11px !important;
  margin: 0 !important;
}

/* ── Responsive font sizing ──────────────────────────────────── */
@media (max-width: 1280px) {
  .gallery-item-title,
  #gallery article h3,
  section[id="gallery"] article h3 {
    font-size: 12px !important;
  }

  .gallery-content,
  #gallery article > div:last-child,
  section[id="gallery"] article > div:last-child {
    padding: 10px 8px !important;
  }

  .gallery-arrow,
  #gallery article span:last-child,
  section[id="gallery"] article span:last-child {
    font-size: 12px !important;
  }
}

@media (max-width: 768px) {
  .gallery-item-title,
  #gallery article h3,
  section[id="gallery"] article h3 {
    font-size: 11px !important;
  }

  .gallery-content,
  #gallery article > div:last-child,
  section[id="gallery"] article > div:last-child {
    padding: 8px 6px !important;
  }

  .gallery-tag,
  #gallery span[class*="tag"],
  section[id="gallery"] span[class*="tag"] {
    font-size: 8px !important;
    padding: 3px 8px !important;
  }
}

@media (max-width: 480px) {
  .gallery-content,
  #gallery article > div:last-child,
  section[id="gallery"] article > div:last-child {
    padding: 10px !important;
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery-item-title,
  #gallery article h3,
  section[id="gallery"] article h3 {
    font-size: 13px !important;
  }

  .gallery-image-wrapper,
  #gallery article > div:first-child,
  section[id="gallery"] article > div:first-child {
    aspect-ratio: 4 / 5 !important;
    margin: 12px !important;
  }
}

/* ── Remove conflicting styles ───────────────────────────────– */
.gallery-item,
article.gallery-item,
#gallery article,
section[id="gallery"] article {
  box-shadow: none !important;
  background-color: var(--cream-ref) !important;
}

/* ── Ensure ink color for all text ───────────────────────────– */
#gallery article *,
section[id="gallery"] article * {
  color: var(--ink-text) !important;
}

#gallery article img,
section[id="gallery"] article img {
  color: inherit;
}

#gallery article span:last-child,
section[id="gallery"] article span:last-child {
  color: var(--ink-text) !important;
}
