/* Portfolio Page Specific Styles */

/* Base container for the portfolio page */
.portfolio-container {
    max-width: auto; /* Wider for more projects */
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
    padding: 2.5rem;
    margin-top: 20px;
    margin-bottom: 20px;
    margin-right: 20px;
    margin-left: 260px; /* Accommodate sidebar */
    backdrop-filter: blur(8px);
    transition: transform 0.3s ease; /* For sidebar open/close effect */

    /* Landing Page Animation */
    opacity: 0; /* Start invisible */
    transform: translateY(20px); /* Start slightly below */
    animation: fadeInSlideUp 1s ease-out forwards; /* Apply animation */
    animation-delay: 0.5s; /* Delay for better effect after sidebar is stable */
}

/* Revised Heading Style */
.section-title {
    color: #ffa500;
    font-size: 2.8rem; /* Keep a decent size for the main title */
    margin-bottom: 0.5rem;
    text-align: center;
    font-weight: 700; /* Bold */
}

.section-description {
    text-align: center;
    color: #ccc;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Category Tabs/Filters */
.portfolio-tabs {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.tab-btn {
    padding: 0.7rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 2px solid orange;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap; /* Prevent text wrapping */
}

.tab-btn.active,
.tab-btn:hover {
    background: orange;
    color: #111; /* Dark text on orange background */
    box-shadow: 0 5px 15px rgba(255, 165, 0, 0.4);
}

/* Project Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem; /* Increased gap for visual separation */
}

/* Individual Portfolio Item (Card) */
.portfolio-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden; /* Important for image zoom and overlay */
    transition: transform 0.3s ease, box-shadow 0.3s ease; /* For lift and shadow */
    cursor: pointer; /* Indicate interactivity */
    display: flex;
    flex-direction: column;
    height: 380px; /* Fixed height for consistent card size */
}

.portfolio-item img {
    width: 100%;
    height: 60%; /* Image takes 60% of the card height */
    object-fit: cover;
    border-radius: 10px 10px 0 0; /* Rounded top corners */
    transition: transform 0.4s ease; /* For image zoom on hover */
}

.portfolio-item .portfolio-content {
    padding: 1rem 1.5rem;
    color: #eee;
    flex-grow: 1; /* Allows content to take remaining space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.portfolio-item .portfolio-content h3 {
    font-size: 1.5rem;
    color: orange;
    margin-bottom: 0.5rem;
}

.portfolio-item .portfolio-content p {
    font-size: 0.95rem;
    color: #ccc;
    line-height: 1.4;
}


/* NEW HOVER EFFECT: Overlay fade-in and lift */
.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9); /* Darker overlay */
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    text-align: center;
    opacity: 0; /* Start hidden */
    transform: translateY(100%); /* Start from bottom */
    transition: opacity 0.4s ease, transform 0.4s ease; /* Smooth transition for overlay */
    color: #fff;
    box-sizing: border-box; /* Include padding in dimensions */
}

.portfolio-item:hover {
    transform: translateY(-10px); /* Lifts the card */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 165, 0, 0.5); /* Stronger shadow with orange glow */
}

.portfolio-item:hover img {
    transform: scale(1.1); /* Subtle zoom on image */
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1; /* Fade in overlay */
    transform: translateY(0); /* Slide up overlay */
}

/* Overlay Content Styles */
.portfolio-overlay h4 {
    font-size: 1.6rem;
    color: orange;
    margin-bottom: 0.8rem;
}

.portfolio-overlay p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.portfolio-overlay .tech-stack {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.5rem;
    padding-left: 0;
    justify-content: center;
}

.portfolio-overlay .tech-stack li {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.portfolio-overlay .view-project-btn {
    padding: 0.8rem 1.5rem;
    background-color: orange;
    color: #111;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto; /* Push button to bottom */
}

.portfolio-overlay .view-project-btn:hover {
    background-color: #eaa31f;
    transform: translateY(-3px);
}


/* Back to Home Button (at the bottom of the page) */
.back-btn {
    display: inline-block;
    margin-top: 3rem; /* More space from the grid */
    padding: 0.8rem 1.5rem;
    background-color: orange;
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    transition: background 0.3s;
}

.back-text {
    margin-left: 0;
    transition: margin-left 0.3s;
}

.back-btn:hover {
    background-color: #eaa31f;
}

.back-btn:hover .back-text {
    margin-left: 6px; /* Space appears only on hover */
}

/* Responsive adjustments for portfolio gallery page */
@media (max-width: 768px) {
    /* Adjust sidebar behavior similar to other pages */
    body {
        padding-left: 2rem; /* Reset padding for mobile */
        flex-direction: column; /* Stack elements vertically */
        align-items: center; /* Center content horizontally */
        justify-content: flex-start; /* Align content to top on mobile */
    }

    /* Adjust main content position on mobile */
    .portfolio-container {
        margin-left: 0; /* Remove fixed margin on mobile */
        margin-right: 0;
        padding: 1.5rem; /* Adjust padding for smaller screens */
        transform: translateX(0); /* Default position */
        transition: transform 0.3s ease;
        margin-top: 1rem;
        margin-bottom: 1rem;
        width: calc(100% - 4rem); /* width accounts for 2rem padding on each side */
    }

    /* When sidebar is active, push the main content to the right */
    body.sidebar-open .portfolio-container {
        transform: translateX(240px); /* Move content by sidebar width */
    }

    .section-title {
        font-size: 2rem;
    }

    .section-description {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }

    .portfolio-tabs {
        flex-direction: column; /* Stack tabs vertically on small screens */
        align-items: center;
        gap: 0.8rem;
        margin-bottom: 2rem;
    }

    .tab-btn {
        width: 100%; /* Make tabs full width */
        text-align: center;
    }

    .portfolio-grid {
        grid-template-columns: 1fr; /* Stack projects vertically on small screens */
        gap: 1.5rem;
    }

    .portfolio-item {
        height: auto; /* Allow height to adjust on mobile */
    }

    .portfolio-item img {
        height: 180px; /* Adjust image height for mobile */
    }

    .portfolio-item .portfolio-content h3 {
        font-size: 1.3rem;
    }

    .portfolio-overlay {
        opacity: 1; /* Always show overlay on small screens, no hover needed */
        position: relative; /* Position relative for normal flow */
        transform: translateY(0); /* No translation */
        padding: 1rem;
        background: rgba(255, 255, 255, 0.05); /* Lighter background for mobile */
        margin-top: -10px; /* Overlap slightly with image */
        border-radius: 0 0 10px 10px; /* Rounded bottom corners */
    }

    .portfolio-overlay h4 {
        font-size: 1.4rem;
    }

    .portfolio-overlay p {
        font-size: 0.85rem;
    }

    .portfolio-overlay .tech-stack li {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    /* Hide the initial simple content on mobile if overlay is always visible */
    .portfolio-item .portfolio-content {
        display: none;
    }
}