/* SCDev Gallery Pro - Frontend Styles */

.scdev-gallery {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    background: transparent;
    display: grid;
    grid-auto-rows: 300px;
}

.scdev-gallery.scdev-gallery-grid.scdev-cols-1 { grid-template-columns: 1fr; }
.scdev-gallery.scdev-gallery-grid.scdev-cols-2,
.scdev-gallery.scdev-gallery-grid.scdev-cols-3 { grid-template-columns: repeat(2, 1fr); }

.scdev-gallery.scdev-gallery-masonry {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-flow: dense;
}
.scdev-gallery.scdev-gallery-masonry .scdev-gallery-item:nth-child(3n+1) { grid-row: span 2; }
.scdev-gallery.scdev-gallery-masonry .scdev-gallery-item:nth-child(3n+2),
.scdev-gallery.scdev-gallery-masonry .scdev-gallery-item:nth-child(3n+3) { grid-row: span 1; }
.scdev-gallery.scdev-gallery-masonry .scdev-gallery-image { height: 100%; }

/* Gallery Item */
.scdev-gallery-item {
    background: inherit;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}
.scdev-gallery-item:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    transform: translateY(-4px);
}

/* Gallery Link */
.scdev-gallery-link {
    text-decoration: none;
    color: inherit;
    display: block;
    width: 100%;
    height: 100%;
    position: relative !important;
}

/* Gallery Image Container */
.scdev-gallery-image {
    width: 100% !important;
    height: 100% !important;
    background: transparent;
    overflow: hidden;
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    z-index: 1 !important;
    pointer-events: none;
}
.scdev-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}
.scdev-gallery-image.no-image {
    background: var(--no-image-bg, #e8e8e8);
    display: flex;
    align-items: center;
    justify-content: center;
}
.scdev-gallery-image.no-image img { display: none !important; }

/* Hover Effects */
.scdev-gallery-item.scdev-hover-zoom:hover .scdev-gallery-image img { transform: scale(1.1); }
.scdev-gallery-item.scdev-hover-fade:hover .scdev-gallery-image { opacity: 0.8; }
.scdev-gallery-item.scdev-hover-slide:hover .scdev-gallery-image img { transform: translateX(10px); }
.scdev-gallery-item.scdev-hover-lift:hover { transform: translateY(-8px); }

/* Gallery Content Overlay */
.scdev-gallery-content {
    position: absolute !important;
    bottom: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 16px) !important;
    max-width: calc(100% - 16px) !important;
    padding: 6px 8px 2px 8px !important;
    background: var(--overlay-bg, rgba(0,0,0,0.85)) !important;
    color: #fff !important;
    z-index: 20 !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100px !important;
    min-height: 100px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
    pointer-events: auto;
}

.scdev-gallery-title {
    margin: 0 0 2px 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: var(--title-text-color, #00d4ff) !important;
    line-height: 1.2 !important;
    text-align: center !important;
    word-wrap: break-word !important;
}
.scdev-gallery-excerpt {
    margin: 0 !important;
    font-size: 13px !important;
    color: var(--excerpt-text-color, #fff) !important;
    line-height: 1.2 !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    line-clamp: 2 !important;
}
.scdev-gallery-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--meta-color, #ffd700);
    margin: 2px 0 0 0 !important;
}

/* No meta — hide overlay */
.scdev-gallery.scdev-no-meta .scdev-gallery-content { display: none !important; }

/* Animations */
.scdev-gallery-item.scdev-anim-fade-up   { opacity:0; transform:translateY(20px); animation:scdev-fade-up 0.6s ease forwards; }
.scdev-gallery-item.scdev-anim-fade-in   { opacity:0; animation:scdev-fade-in 0.6s ease forwards; }
.scdev-gallery-item.scdev-anim-slide-up  { opacity:0; transform:translateY(30px); animation:scdev-slide-up 0.7s ease forwards; }
.scdev-gallery-item.scdev-anim-zoom-in   { opacity:0; transform:scale(0.8); animation:scdev-zoom-in 0.7s ease forwards; }
@keyframes scdev-fade-up  { to { opacity:1; transform:translateY(0); } }
@keyframes scdev-fade-in  { to { opacity:1; } }
@keyframes scdev-slide-up { to { opacity:1; transform:translateY(0); } }
@keyframes scdev-zoom-in  { to { opacity:1; transform:scale(1); } }
.scdev-gallery-item:nth-child(1) { animation-delay:0.1s; }
.scdev-gallery-item:nth-child(2) { animation-delay:0.2s; }
.scdev-gallery-item:nth-child(3) { animation-delay:0.3s; }
.scdev-gallery-item:nth-child(4) { animation-delay:0.4s; }
.scdev-gallery-item:nth-child(5) { animation-delay:0.5s; }
.scdev-gallery-item:nth-child(6) { animation-delay:0.6s; }
.scdev-gallery-item:nth-child(n+7) { animation-delay:0.7s; }

/* Lightbox */
.scdev-lightbox-overlay {
    display: none; position:fixed; inset:0;
    background:rgba(0,0,0,0.9); z-index:9999;
    opacity:0; transition:opacity 0.3s ease;
}
.scdev-lightbox-overlay.active { display:flex; align-items:center; justify-content:center; opacity:1; }
.scdev-lightbox-content { position:relative; max-width:90vw; max-height:90vh; }
.scdev-lightbox-image { max-width:100%; max-height:85vh; object-fit:contain; border-radius:4px; }
.scdev-lightbox-close {
    position:absolute; top:-40px; right:0;
    background:none; border:none; color:#fff; font-size:32px;
    cursor:pointer; width:40px; height:40px;
    display:flex; align-items:center; justify-content:center;
}
.scdev-lightbox-nav {
    position:absolute; top:50%; transform:translateY(-50%);
    background:rgba(255,255,255,0.2); border:none; color:#fff;
    font-size:24px; cursor:pointer; padding:10px 15px;
    border-radius:4px; z-index:10000;
}
.scdev-lightbox-prev { left:-60px; }
.scdev-lightbox-next { right:-60px; }

/* ── MOBILE: single column ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .scdev-gallery {
        grid-template-columns: 1fr !important;
    }
    .scdev-lightbox-prev { left:-40px; }
    .scdev-lightbox-next { right:-40px; }
}
@media (max-width: 480px) {
    .scdev-gallery {
        grid-template-columns: 1fr !important;
    }
    .scdev-lightbox-prev, .scdev-lightbox-next { display:none; }
}

/* ── Night mode ─────────────────────────────────────────────────────────────── */
body.night-mode .scdev-gallery-item { background:#1e1e2e !important; box-shadow:0 2px 8px rgba(0,0,0,0.4); }
body.night-mode .scdev-gallery-image.no-image { background:#2a2a3e !important; }
body.night-mode .scdev-gallery-content { background:rgba(20,20,35,0.92) !important; }
body.night-mode .scdev-gallery-title { color:var(--title-text-color, #7eb8ff) !important; }
body.night-mode .scdev-gallery-excerpt { color:#ccc !important; }
body.night-mode .scdev-gallery-meta { color:#aaa !important; }
