/* Base Reset & Typography */
.sma-gallery-wrap { 
    width: 100%; position: relative; margin: 40px 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    box-sizing: border-box; color: #111;
}
.sma-gallery-wrap * { box-sizing: border-box; }

/* Category Filters */
.sma-category-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; justify-content: center; }
.sma-cat-btn { background: #f1f5f9; border: 1px solid transparent; padding: 8px 16px; border-radius: 30px; cursor: pointer; font-weight: 500; font-size: 14px; transition: all 0.3s; color: #475569; }
.sma-cat-btn:hover { background: #e2e8f0; }
.sma-cat-btn.active { background: #0f172a; color: #fff; border-color: #0f172a; }

/* THE MAGIC TALL IMAGE AUTO-SCROLL */
.sma-media-box { position: relative; overflow: hidden; background: #f5f5f7; height: 100%; width: 100%; display: block; border-radius: inherit; }
.sma-img-scroller { width: 100%; height: 100%; background-size: cover; background-position: top center; background-repeat: no-repeat; transition: background-position var(--scroll-speed, 3s) ease-in-out, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.sma-card:hover .sma-img-scroller { background-position: bottom center; }
video { width: 100%; height: 100%; object-fit: cover; }
.sma-audio-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; width: 100%; color: #94a3b8; font-size: 18px; text-align: center; }
.sma-audio-placeholder i { font-size: 40px; margin-bottom: 10px; color: #cbd5e1; }

/* Layout 1: Modern Grid */
.layout-grid .sma-items-container { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 24px; }
.layout-grid .sma-card { border-radius: 12px; height: 350px; position: relative; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.layout-grid .sma-card:hover .sma-img-scroller { transform: scale(1.05); }

/* Layout 2: Smart Masonry */
.layout-masonry .sma-items-container { columns: var(--cols); column-gap: 24px; }
.layout-masonry .sma-card { break-inside: avoid; margin-bottom: 24px; border-radius: 12px; overflow: hidden; display: block; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
.layout-masonry .sma-media-box { height: 300px; }

/* Layout 3: Bento Box Grid */
.layout-bento .sma-items-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; grid-auto-rows: 250px; }
.layout-bento .sma-card { border-radius: 16px; overflow: hidden; position: relative; }
.layout-bento .sma-card:nth-child(4n+1) { grid-column: span 2; grid-row: span 2; }
.layout-bento .sma-card:nth-child(4n+2), .layout-bento .sma-card:nth-child(4n+3) { grid-column: span 1; grid-row: span 1; }
.layout-bento .sma-card:nth-child(4n+4) { grid-column: span 2; grid-row: span 1; }

/* Layout 4: Elegant Framed */
.layout-framed .sma-items-container { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 40px; }
.layout-framed .sma-card { border: 12px solid #fff; box-shadow: 0 20px 40px rgba(0,0,0,0.08); background: #fff; padding-bottom: 0; height: 400px; position: relative; }

/* Overlay styles for Grid/Masonry/Bento/Framed */
.sma-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); opacity: 0; transition: opacity 0.3s; display: flex; align-items: flex-end; padding: 25px; cursor: pointer; z-index: 2; }
.sma-card:hover .sma-overlay { opacity: 1; }
.sma-overlay-content h3 { color: #fff; margin: 0 0 10px; font-size: 20px; transform: translateY(15px); transition: 0.3s; }
.sma-btn-glass { background: rgba(255,255,255,0.2); backdrop-filter: blur(5px); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 13px; transform: translateY(15px); opacity: 0; transition: 0.3s 0.1s; display: inline-block; }
.sma-card:hover .sma-overlay-content h3, .sma-card:hover .sma-btn-glass { transform: translateY(0); opacity: 1; }

/* Layout 5: Slider (Swiper) */
.layout-slider .swiper-container { padding-bottom: 50px; }
.layout-slider .sma-card { display: flex; flex-direction: column; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }
.layout-slider .sma-media-box { height: 350px; }
.layout-slider .sma-slider-info { padding: 25px; text-align: center; display: flex; flex-direction: column; flex: 1; }
.layout-slider .sma-slider-info h3 { margin: 0 0 15px; font-size: 22px; }
.layout-slider .sma-desc-clamp { font-size: 15px; color: #64748b; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 20px; }
.layout-slider .sma-view-btn { margin-top: auto; align-self: center; background: #0f172a; color: #fff; border: none; padding: 10px 24px; border-radius: 30px; cursor: pointer; transition: 0.3s; }
.layout-slider .sma-view-btn:hover { background: #334155; transform: scale(1.05); }
.swiper-pagination-bullet-active { background: #0f172a !important; }
.swiper-button-next, .swiper-button-prev { color: #0f172a !important; }

/* Layout 6: Portfolio Zigzag */
.layout-zigzag { padding: 60px 20px; }
.layout-zigzag .sma-items-container { display: flex; flex-direction: column; gap: 100px; max-width: 1400px; margin: 0 auto; }
.layout-zigzag .sma-card { display: flex; align-items: center; gap: 60px; opacity: 0; transform: translateY(40px); transition: 0.8s ease-out; width: 100%; }
.layout-zigzag .sma-card.is-visible { opacity: 1; transform: translateY(0); }
.layout-zigzag .sma-card:nth-child(even) { flex-direction: row-reverse; }
.layout-zigzag .sma-media-box { flex: 1; height: 500px; border-radius: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.1); cursor: pointer; min-width: 0; }
.layout-zigzag .sma-zigzag-info { flex: 1; padding: 20px; min-width: 0; }
.layout-zigzag .sma-zigzag-info h3 { font-size: 36px; margin: 0 0 15px; font-weight: 800; line-height: 1.2; }
.layout-zigzag .sma-badge { display: inline-block; background: #e2e8f0; color: #475569; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; margin-bottom: 20px; letter-spacing: 1px; }
.layout-zigzag .sma-desc-clip { font-size: 16px; color: #475569; line-height: 1.8; margin-bottom: 30px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.layout-zigzag .sma-view-btn { background: transparent; border: 2px solid #0f172a; color: #0f172a; padding: 12px 28px; border-radius: 30px; font-weight: 600; cursor: pointer; transition: 0.3s; display: inline-flex; align-items: center; gap: 10px; }
.layout-zigzag .sma-view-btn:hover { background: #0f172a; color: #fff; }

/* Layout 7: Fanned Deck Carousel */
.layout-carousel { display: flex; justify-content: center; align-items: center; min-height: 500px; }
.layout-carousel .swiper-container { width: 320px; height: 450px; padding: 20px 0; margin: 0 auto; }
.layout-carousel .sma-card { width: 100%; height: 100%; border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.layout-carousel .sma-overlay { border-radius: 18px; }

/* Layout 8: Download Gallery */
.layout-download .sma-items-container { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 24px; }
.sma-download-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.08); transition: transform 0.3s, box-shadow 0.3s; }
.sma-download-card:hover { transform: translateY(-5px); box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.sma-download-media { height: 250px; overflow: hidden; position: relative; }
.sma-download-media .sma-img-scroller { background-size: cover; background-position: center; }
.sma-download-media video { object-fit: cover; }
.sma-audio-cover { display: flex; align-items: center; justify-content: center; height: 100%; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #fff; }
.sma-audio-cover i { font-size: 60px; opacity: 0.8; }
.sma-download-info { padding: 20px; }
.sma-download-info h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #0f172a; }
.sma-download-desc { font-size: 14px; color: #64748b; line-height: 1.5; margin-bottom: 15px; }
.sma-download-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sma-dl-action-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; background: #f1f5f9; color: #475569; text-decoration: none; cursor: pointer; border: none; transition: all 0.2s; }
.sma-dl-action-btn:hover { background: #0f172a; color: #fff; }
.sma-dl-action-btn.liked { background: #fef2f2; color: #ef4444; }
.sma-dl-action-btn.liked:hover { background: #ef4444; color: #fff; }
.sma-dl-action-btn.sma-upsell-btn { opacity: 0.7; cursor: not-allowed; }
.sma-dl-action-btn .sma-count { background: rgba(0,0,0,0.1); padding: 2px 6px; border-radius: 4px; font-size: 11px; }

/* Backlink */
.sma-backlink { display: block; text-align: center; margin-top: 40px; font-size: 10px; color: #94a3b8; text-decoration: none; opacity: 0.5; transition: 0.3s; }
.sma-backlink:hover { opacity: 1; }

/* --- UNIVERSAL MODAL --- */
.sma-modal { position: fixed; inset: 0; z-index: 999999; display: flex; align-items: center; justify-content: center; }
.sma-modal-bg { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(10px); }
.sma-modal-content { position: relative; width: 90%; max-width: 1200px; height: 85vh; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); display: flex; flex-direction: column; animation: smaPop 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes smaPop { 0% { opacity: 0; transform: scale(0.95) translateY(20px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }

.sma-modal-close-btn { position: absolute; top: 20px; right: 20px; background: #f1f5f9; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 18px; cursor: pointer; z-index: 10; color: #475569; transition: 0.2s; }
.sma-modal-close-btn:hover { background: #e2e8f0; color: #ef4444; transform: rotate(90deg); }

.sma-modal-split { display: flex; width: 100%; height: 100%; }
.sma-modal-media-wrap { flex: 1.5; background: #f8fafc; overflow-y: auto; overflow-x: hidden; position: relative; }
.sma-modal-media { width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.sma-modal-media img { width: 100%; height: auto; display: block; }
.sma-modal-media video { width: 100%; height: auto; }
.sma-modal-media audio { margin-top: 50%; width: 80%; }

.sma-modal-info { flex: 1; padding: 50px 40px; overflow-y: auto; background: #fff; display: flex; flex-direction: column; }
.sma-m-title { font-size: 32px; font-weight: 800; margin: 0 0 20px; color: #0f172a; line-height: 1.2; }
.sma-m-meta { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid #e2e8f0; font-size: 14px; color: #64748b; }
.sma-m-meta span { display: flex; align-items: center; gap: 6px; }
.sma-m-meta b { color: #0f172a; }
.sma-m-tech { margin-bottom: 20px; font-weight: 600; color: #3b82f6; font-size: 14px; }
.sma-m-desc { font-size: 16px; color: #475569; line-height: 1.8; margin-bottom: 30px; }

.sma-visit-btn { display: inline-block; background: #2563eb; color: #fff; padding: 12px 24px; border-radius: 8px; text-decoration: none; font-weight: 600; transition: 0.2s; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
.sma-visit-btn:hover { background: #1d4ed8; transform: translateY(-2px); color: #fff; }

.sma-m-actions { margin-top: auto; padding-top: 30px; display: flex; gap: 12px; }
.sma-action-btn { flex: 1; background: #fff; border: 1px solid #cbd5e1; padding: 12px; border-radius: 12px; cursor: pointer; font-weight: 600; color: #0f172a; display: flex; flex-direction: column; align-items: center; gap: 5px; transition: all 0.2s; text-decoration: none; font-size: 13px; }
.sma-action-btn:hover { border-color: #0f172a; background: #f8fafc; color: #0f172a; }
.sma-action-btn i { font-size: 20px; }
.sma-like-btn.liked i { color: #ef4444; animation: smaHeartBounce 0.5s; }
.sma-dl-btn i { color: #22c55e; }
.sma-share-btn i { color: #3b82f6; }

@keyframes smaHeartBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.4); } }

/* ========================================
   RESPONSIVE ADJUSTMENTS - MOBILE FIRST
   ======================================== */

/* Tablet Landscape (max-width: 1024px) */
@media(max-width: 1024px) {
    .layout-bento .sma-items-container { grid-template-columns: repeat(2, 1fr); }
    .layout-bento .sma-card:nth-child(n) { grid-column: span 1; grid-row: span 1; }
    
    .layout-zigzag .sma-card, 
    .layout-zigzag .sma-card:nth-child(even) { 
        flex-direction: column; 
        gap: 30px; 
    }
    .layout-zigzag .sma-media-box { 
        height: 350px; 
        width: 100%; 
        flex: none;
    }
    .layout-zigzag .sma-zigzag-info {
        width: 100%;
        text-align: center;
    }
    .layout-zigzag .sma-badge {
        display: inline-block;
    }
    .layout-zigzag .sma-view-btn {
        align-self: center;
    }
    
    .sma-modal-split { flex-direction: column; }
    .sma-modal-media-wrap { flex: none; height: 50vh; }
    .sma-modal-info { padding: 30px 20px; }
}

/* Tablet Portrait (max-width: 768px) */
@media(max-width: 768px) {
    .layout-grid .sma-items-container, 
    .layout-framed .sma-items-container { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .layout-grid .sma-card { height: 280px; }
    .layout-framed .sma-card { height: 300px; border-width: 8px; }
    
    .layout-masonry .sma-items-container { columns: 2; }
    
    .layout-download .sma-items-container { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .sma-download-media { height: 200px; }
    .sma-download-info { padding: 15px; }
    .sma-download-info h3 { font-size: 16px; }
    
    .layout-slider .sma-media-box { height: 280px; }
    .layout-slider .sma-slider-info { padding: 20px; }
    .layout-slider .sma-slider-info h3 { font-size: 18px; }
    
    /* Carousel Mobile */
    .layout-carousel { min-height: 400px; padding: 0 10px; }
    .layout-carousel .swiper-container { width: 260px; height: 360px; }
    .layout-carousel .sma-card { border-radius: 14px; }
    
    /* Zigzag Mobile */
    .layout-zigzag { padding: 40px 15px; }
    .layout-zigzag .sma-items-container { gap: 60px; }
    .layout-zigzag .sma-media-box { 
        height: 280px; 
        border-radius: 16px;
    }
    .layout-zigzag .sma-zigzag-info h3 { 
        font-size: 24px; 
    }
    .layout-zigzag .sma-desc-clip {
        font-size: 14px;
        -webkit-line-clamp: 4;
    }
    .layout-zigzag .sma-view-btn {
        padding: 10px 22px;
        font-size: 14px;
    }
}

/* Mobile (max-width: 480px) */
@media(max-width: 480px) {
    .layout-grid .sma-items-container, 
    .layout-framed .sma-items-container { grid-template-columns: 1fr; gap: 16px; }
    .layout-grid .sma-card { height: 300px; }
    .layout-framed .sda-card { height: 320px; }
    
    .layout-masonry .sma-items-container { columns: 1; }
    .layout-masonry .sma-media-box { height: 250px; }
    
    .layout-download .sma-items-container { grid-template-columns: 1fr; gap: 16px; }
    .sma-download-media { height: 220px; }
    .sma-download-actions { gap: 6px; }
    .sma-dl-action-btn { padding: 6px 10px; font-size: 12px; }
    
    .layout-slider .sma-media-box { height: 250px; }
    .layout-slider .swiper-button-next, 
    .layout-slider .swiper-button-prev { display: none; }
    
    /* Carousel Mobile Small */
    .layout-carousel { min-height: 350px; }
    .layout-carousel .swiper-container { width: 220px; height: 300px; }
    
    /* Zigzag Mobile Small */
    .layout-zigzag { padding: 30px 10px; }
    .layout-zigzag .sma-items-container { gap: 40px; }
    .layout-zigzag .sma-media-box { 
        height: 220px;
        border-radius: 12px;
    }
    .layout-zigzag .sma-zigzag-info { 
        padding: 15px 10px; 
    }
    .layout-zigzag .sma-zigzag-info h3 { 
        font-size: 20px; 
        margin-bottom: 10px;
    }
    .layout-zigzag .sma-badge { 
        font-size: 11px; 
        padding: 3px 10px;
        margin-bottom: 12px;
    }
    .layout-zigzag .sma-desc-clip {
        font-size: 13px;
        line-height: 1.6;
        margin-bottom: 20px;
    }
    .layout-zigzag .sma-view-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
    
    /* Modal Mobile */
    .sma-modal-content { 
        width: 95%; 
        height: 90vh; 
        border-radius: 16px; 
    }
    .sma-modal-media-wrap { height: 40vh; }
    .sma-modal-info { padding: 20px 15px; }
    .sma-m-title { font-size: 22px; }
    .sma-m-meta { gap: 10px; font-size: 12px; }
    .sma-m-desc { font-size: 14px; }
    .sma-m-actions { flex-wrap: wrap; }
    .sma-action-btn { padding: 10px; font-size: 12px; }
    
    /* Category Filters Mobile */
    .sma-category-filters { gap: 8px; }
    .sma-cat-btn { padding: 6px 12px; font-size: 12px; }
}

/* Very Small Screens (max-width: 360px) */
@media(max-width: 360px) {
    .layout-carousel .swiper-container { width: 200px; height: 280px; }
    .layout-zigzag .sma-media-box { height: 180px; }
    .layout-zigzag .sma-zigzag-info h3 { font-size: 18px; }
    .sma-download-media { height: 180px; }
}