
/* --- Portfolio Section (Updated for Visibility) --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    justify-content: center;
    gap: 3rem;
    width: 100%;
    margin-top: 3rem;
}

.portfolio-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    backdrop-filter: blur(10px);
    min-height: auto; /* Let content dictate height */
    width: 100%;
    max-width: 420px; /* Limit width to prevent oversized cards on wide screens */
    margin: 0 auto; /* Center in grid cell */
}

.portfolio-item:hover {
    transform: translateY(-10px);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.portfolio-image {
    width: 100%;
    height: auto; /* Allow natural height for perfect aspect ratio */
    overflow: hidden;
    position: relative;
    padding: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.3) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.portfolio-image img {
    width: 100%;
    height: auto; /* Maintain original aspect ratio */
    display: block;
    object-fit: cover; /* Ensure no gaps, fill the width naturally */
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 0;
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.05);
}

.portfolio-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-grow: 1;
    justify-content: space-between;
}

.portfolio-info h3 {
    font-family: 'Syncopate', sans-serif;
    font-size: 1.4rem;
    color: #fff;
    margin-bottom: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
}

.portfolio-buttons {
    margin-top: auto; /* Push to bottom */
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
    flex-wrap: wrap;
    position: relative;
    z-index: 20;
}

.portfolio-action-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #fff; /* Solid White */
    color: #000; /* Black Text */
    text-decoration: none;
    font-weight: 700;
    border-radius: 50px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 2px solid #fff;
    cursor: pointer;
    min-width: 140px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.portfolio-action-btn:hover {
    background: #f0f0f0;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.2);
}

.portfolio-action-btn.outline {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.portfolio-action-btn.outline:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}

/* --- Desktop Portfolio Grid Styles (Enforce Grid) --- */
@media (min-width: 769px) {
    .portfolio-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(300px, 350px)) !important; /* Limit max column width */
        justify-content: center;
        gap: 3rem;
        width: 100%;
        margin-top: 3rem;
        overflow-x: visible !important; /* Ensure no scrollbars */
        flex-wrap: wrap !important;
    }
    
    .portfolio-item {
        width: 100% !important;
        max-width: 350px !important; /* Enforce smaller max-width */
        flex-shrink: 1 !important;
        margin: 0 auto !important;
    }
}

/* --- Mobile Portfolio Slider Styles --- */
@media (max-width: 768px) {
    .portfolio-grid {
        display: flex !important; /* Force flex to override any grid styles */
        flex-wrap: nowrap !important;
        overflow-x: hidden !important; /* Hide scrollbar for clean look */
        justify-content: flex-start;
        gap: 0; /* Let track handle gaps */
        width: 100%;
        margin-top: 2rem;
        padding-bottom: 2rem;
        position: relative;
        
        /* Mask for fade effect */
        mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
        -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    }
    
    .portfolio-track {
        display: flex;
        gap: 20px; /* Space between items */
        width: max-content; /* Ensure track stretches */
        will-change: transform;
        /* Animation will be handled by GSAP */
    }

    .portfolio-item {
        width: 85vw;
        max-width: 350px;
        flex-shrink: 0;
        margin: 0; /* Remove margins as gap handles spacing */
        min-height: 400px;
    }
    
    .portfolio-item:hover {
        transform: none; /* Disable hover lift on mobile to prevent glitches during scroll */
    }
}
