/* --- Global Reset & Variables --- */
body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #0f101a;
    background: 
        radial-gradient(circle at 0% 0%, rgba(81, 209, 113, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(37, 40, 68, 1) 0%, #0f101a 100%);
    background-attachment: fixed;
    color: #e0e0e0;
    line-height: 1.7;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- Navigation & Back Button --- */
.back-button {
    position: fixed;
    top: 30px;
    left: 30px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, 0.03);
    color: #51d171;
    border-radius: 12px;
    font-weight: 600;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(81, 209, 113, 0.2);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    z-index: 1000;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.back-button:hover {
    background: #51d171;
    color: #0f101a;
    box-shadow: 0 0 25px rgba(81, 209, 113, 0.4);
    transform: translateX(8px);
}

/* --- Header Section --- */
header {
    padding: 80px 20px 40px;
    text-align: center;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #ffffff;
}

header::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, #51d171, #3ba659);
    margin: 24px auto 0;
    border-radius: 10px;
}

/* --- Grid Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 100px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

/* --- Project Card (The "Glass" Look) --- */
.project-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative; /* Essential for the stretched link */
    height: 100%;
}

.project-card:hover {
    transform: translateY(-12px);
    border-color: rgba(81, 209, 113, 0.5);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 
                0 0 20px rgba(81, 209, 113, 0.1);
}

/* --- Image Fixes --- */
.project-image {
    margin: 0; /* Resets default browser figure margins */
    width: 100%;
    height: 240px;
    overflow: hidden;
    position: relative;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.8) brightness(0.9);
    transition: all 0.8s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.08);
    filter: saturate(1.1) brightness(1.1);
}

/* --- Content & Stretched Link --- */
.project-info {
    padding: 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    margin: 0 0 12px;
    font-size: 1.5rem;
    font-weight: 700;
}


.project-info h3 a::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.project-info p {
    font-size: 0.95rem;
    color: #b0b0b0;
    margin-bottom: 28px;
    font-weight: 300;
}

/* --- Tags Footer --- */
.tag-container {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
}

.tag {
    display: inline-block;
    background: rgba(81, 209, 113, 0.05);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #51d171;
    border: 1px solid rgba(81, 209, 113, 0.2);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: 0.3s ease;
}

.project-card:hover .tag {
    background: rgba(81, 209, 113, 0.15);
    border-color: #51d171;
}

/* --- Animations --- */
@media (prefers-reduced-motion: no-preference) {
    .project-card {
        opacity: 0;
        animation: slideUp 0.8s forwards cubic-bezier(0.23, 1, 0.32, 1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive Adjustments --- */
@media screen and (max-width: 600px) {
    .back-button {
        display: none;
    }
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    header h1 {
        font-size: 2rem;
    }
}