/* ===============================
   PORTFOLIO GRID
================================ */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 45px 30px; /* Wider vertical gap for titles below images */
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

/* ===============================
   PROJECT CARDS
================================ */
.project-card {
    text-decoration: none;
    color: white;
    display: block;
    transition: transform 0.3s ease, background 0.3s ease;
    border-radius: 15px;
    overflow: hidden;
}

.image-box {
    width: 100%;
    aspect-ratio: 1 / 1; /* Ensures perfect square boxes */
    overflow: hidden;
    border-radius: 15px;
    background: #111;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 18px; /* Space for text below */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.project-details {
    transition: transform 0.3s ease;
}

.project-details h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: white;
    transition: color 0.3s ease;
}

.project-details p {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ===============================
   HOVER EFFECTS (Desktop)
================================ */
@media (min-width: 769px) {
    .project-card:hover {
        transform: translateY(-8px);
    }

    .project-card:hover .image-box {
        border-color: #29aae1; 
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    }

    .project-card:hover img {
        transform: scale(1.08);
    }

    .project-card:hover h3 {
        color: #29aae1;
    }
}

/* ===============================
   BACK TO TOP
================================ */
#backToTop {
    display: none; 
    position: fixed;
    bottom: 30px;
    right: 30px; 
    z-index: 2000;
    background: #1a1a1a;
    color: white;
    border: 1px solid #444;
    padding: 15px;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

#backToTop:hover {
    border-color: #29aae1;
    transform: scale(1.1);
}

/* ===============================
   RESPONSIVE (The "Better Mobile" Update)
================================ */
@media (max-width: 992px) {
    .portfolio-grid { 
        grid-template-columns: repeat(2, 1fr);
        gap: 30px; 
    }
}

@media (max-width: 768px) {
    /* Navbar Mobile Styles */
    .nav-links {
        position: absolute;
        top: 70px;
        right: 0;
        background: #000;
        flex-direction: column;
        width: 200px;
        border-left: 1px solid #333;
        padding: 20px;
        display: none;
    }

    .nav-links.show { display: flex; }
    .menu-toggle { display: block; }

    /* Improved Mobile Grid */
    .portfolio-grid {
        grid-template-columns: 1fr; /* Stacked for better focus */
        gap: 40px;
        padding: 0 25px;
    }

    .project-card {
        background: rgba(255, 255, 255, 0.03); /* Subtle card definition */
        padding-bottom: 20px;
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .image-box {
        margin-bottom: 15px;
        border-radius: 15px 15px 0 0; /* Flat bottom to connect to text */
        border: none;
        aspect-ratio: 16 / 10; /* Wider view for easier scrolling */
    }

    .project-details {
        text-align: center;
        padding: 0 10px;
    }

    .project-details h3 {
        font-size: 1.3rem;
    }

    #backToTop { bottom: 20px; right: 20px; }
}

@media (max-width: 480px) {
    .portfolio-grid { padding: 0 15px; }
    .section-heading { font-size: 1.8rem; margin-bottom: 20px; }
}
