/* Advanced Portfolio Gallery - Common Styles v2.5.0 */

/* ==========================================================================
   Portfolio Wrapper & Base Layout
   ========================================================================== */

.apg-portfolio-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Filters now handled by filter-system.css */

/* ==========================================================================
   Grid Layout System
   ========================================================================== */

.apg-grid {
    display: grid;
    gap: 25px;
    margin-top: 30px;
}

.apg-grid.apg-columns-2 {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
}

.apg-grid.apg-columns-3 {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.apg-grid.apg-columns-4 {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

/* ==========================================================================
   Masonry Layout (JavaScript-based)
   ========================================================================== */

.apg-masonry {
    margin-top: 30px;
}

/* Masonry items - width only, positioning handled by JS */
.apg-masonry .apg-item {
    margin-bottom: 20px; /* Gutter handled by JS */
}

/* Column widths for Masonry - using percentages for responsive */
.apg-masonry.apg-columns-2 .apg-item {
    width: 50%;
}

.apg-masonry.apg-columns-3 .apg-item {
    width: 33.333%;
}

.apg-masonry.apg-columns-4 .apg-item {
    width: 25%;
}

/* ==========================================================================
   Portfolio Items - Isotope-Style Animation
   ========================================================================== */

.apg-item {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.4s ease;
    will-change: opacity, transform;
}

/* ==========================================================================
   Filter Animation States (Smooth Transitions)
   ========================================================================== */

/* Hidden state - smooth fade out without position: absolute */
.apg-item.filtering-hidden {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
    /* Keep in layout to prevent collapse */
}

/* Show state - smooth fade in */
.apg-item.filtering-show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Final hidden state - remove from layout after animation */
.apg-item.filter-hidden-final {
    display: none;
}

/* ==========================================================================
   Item Inner Container
   ========================================================================== */

.apg-item-inner {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.apg-item-inner:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

/* Link Container */
.apg-item-inner a {
    display: block;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

/* ==========================================================================
   Overlay (Common for all types)
   ========================================================================== */

.apg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.apg-item-inner a:hover .apg-overlay {
    opacity: 1;
}

.apg-icon {
    font-size: 48px;
    color: white;
    transform: scale(0.5);
    transition: transform 0.3s ease;
}

.apg-item-inner a:hover .apg-icon {
    transform: scale(1);
}

/* ==========================================================================
   Content Section
   ========================================================================== */

.apg-content {
    padding: 20px;
}

.apg-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.apg-excerpt {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* ==========================================================================
   GLightbox Overrides
   ========================================================================== */

.glightbox-clean .gslide-description {
    background: rgba(0, 0, 0, 0.75);
    padding: 15px;
}

.glightbox-clean .gdesc-inner h4 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.glightbox-clean .gdesc-inner p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .apg-grid.apg-columns-2,
    .apg-grid.apg-columns-3,
    .apg-grid.apg-columns-4 {
        grid-template-columns: 1fr;
    }
    
    .apg-masonry.apg-columns-2,
    .apg-masonry.apg-columns-3,
    .apg-masonry.apg-columns-4 {
        column-count: 1;
    }
}

@media (max-width: 480px) {
    .apg-portfolio-wrapper {
        padding: 10px;
    }
    
    .apg-content {
        padding: 15px;
    }
    
    .apg-title {
        font-size: 16px;
    }
    
    .apg-excerpt {
        font-size: 13px;
    }
}