:root {
    --primary-color: #44B486;
    --primary-dark: #2d7f5b;
    --text-light: #ffffff;
    --text-gray: #dddddd;
    --bg-dark: rgba(30, 30, 30, 0.4);
    --bg-darker: rgba(30, 30, 30, 0.85);
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;
    --border-radius: 12px;
    --border-radius-lg: 20px;
}

/* === Background untuk Hero dan Projects === */

/* --- Hero Section --- */
.portofolio-hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 0 10%;
    color: var(--text-light);
    text-align: left;
    position: relative;
    z-index: 10;
}

/* PERUBAHAN: Gradasi font seperti di home */
.portofolio-hero h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: var(--spacing-md);
    opacity: 0;
    transform: translateX(-100px);
    animation: slideInLeft 1.5s ease-out forwards;
    line-height: 1.1;
    position: relative;
    z-index: 11;
    
    /* GRADASI SEPERTI DI HOME */
    background: linear-gradient(135deg, #ffffff, #292929);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.portofolio-hero .btn-more {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.125rem;
    padding: 0.75rem 1.75rem;
    border-radius: 50px;
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    text-decoration: none;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-50px);
    animation: slideInButton 1.5s ease-out forwards;
    animation-delay: 1s;
    display: inline-block;
    cursor: pointer;
    position: relative;
    z-index: 11;
}

.portofolio-hero .btn-more:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(68, 180, 134, 0.3);
}

@keyframes slideInButton {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Project Section --- */
.projects-section {
    padding: var(--spacing-xl) 5%;
    position: relative;
    z-index: 5;
}

/* PERUBAHAN: Gradasi untuk section title */
.section-title {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: var(--spacing-xl);
    text-align: center;
    
    /* GRADASI SEPERTI DI HOME */
    background: linear-gradient(135deg, #ffffff, #000000);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Filter Buttons */
.project-filters {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: var(--bg-dark);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(68, 180, 134, 0.3);
}

/* Projects Grid - IMPROVED */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: var(--spacing-lg);
    margin: 0 auto;
    max-width: 1400px;
}

.project-item {
    background: var(--bg-darker);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(40px);
    cursor: pointer;
    position: relative;
    z-index: 6;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.project-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.project-item:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(68, 180, 134, 0.2);
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.project-image-container {
    position: relative;
    overflow: hidden;
    height: 250px;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.project-item:hover .project-image {
    transform: scale(1.1);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(0, 0, 0, 0.7) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: var(--spacing-md);
}

.project-item:hover .project-overlay {
    opacity: 1;
}

.project-category {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
}

.project-content {
    padding: var(--spacing-lg);
}

.project-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-sm);
    line-height: 1.3;
    transition: color 0.3s ease;
}

.project-item:hover .project-title {
    color: var(--primary-color);
}

.project-desc {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.project-date {
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    color: var(--text-gray);
}

.project-link {
    color: var(--primary-color);
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.project-item:hover .project-link {
    transform: translateX(5px);
}

/* Project Modal */
.project-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    overflow-y: auto;
    padding: 2rem 0;
}

.modal-content {
    position: relative;
    background: var(--bg-darker);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    max-width: 900px;
    width: 90%;
    margin: 2rem auto;
    color: var(--text-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-image {
    width: 100%;
    max-height: 450px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
    line-height: 1.2;
}

.modal-desc {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--text-gray);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
}

.modal-details {
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.05);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.close-modal {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2.5rem;
    color: var(--text-light);
    background: rgba(0, 0, 0, 0.5);
    border: none;
    cursor: pointer;
    z-index: 1001;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.close-modal:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Loading Animation */
.loading {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.loading.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Tablet Responsive === */
@media (max-width: 1024px) {
    .portofolio-hero {
        padding: 0 5%;
    }

    .portofolio-hero h1 {
        font-size: 4rem;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
        gap: var(--spacing-md);
    }

    .section-title {
        font-size: 2.5rem;
    }
}

/* === Mobile Responsive - Portfolio Grid === */
@media (max-width: 768px) {
    .portofolio-hero {
        height: 70vh;
        padding: 0 var(--spacing-md);
        text-align: center;
        align-items: center;
    }

    .portofolio-hero h1 {
        font-size: 2.5rem;
        margin-bottom: var(--spacing-sm);
    }

    .portofolio-hero .btn-more {
        font-size: 1rem;
        padding: 0.6rem 1.5rem;
    }

    .projects-section {
        padding: var(--spacing-lg) 4%;
    }

    .section-title {
        font-size: 2.2rem;
        margin-bottom: var(--spacing-lg);
    }

    /* 🔥 FIXED: Projects Grid 2 Kolom Rapi */
    .projects-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        width: 100%;
    }

    .project-item {
        width: 100%;
        margin: 0;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        overflow: hidden;
        transition: all 0.3s ease;
        display: flex;
        flex-direction: column;
    }

    .project-image-container {
        width: 100%;
        height: 120px;
        overflow: hidden;
        position: relative;
    }

    .project-image {
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 0.3s ease;
    }

    .project-content {
        padding: 12px;
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .project-title {
        font-size: 0.85rem;
        font-weight: 600;
        line-height: 1.3;
        color: #fff;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 2.4em;
    }

    .project-desc {
        font-size: 0.75rem;
        line-height: 1.4;
        color: #ccc;
        margin: 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        min-height: 2.8em;
    }

    .project-category {
        font-size: 0.7rem;
        color: #44B486;
        font-weight: 500;
        margin-top: auto;
        padding-top: 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Filter buttons */
    .project-filters {
        display: flex;
        gap: 8px;
        margin-bottom: var(--spacing-lg);
        flex-wrap: wrap;
        justify-content: center;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 20px;
        color: #fff;
        cursor: pointer;
        transition: all 0.3s ease;
        white-space: nowrap;
    }

    .filter-btn.active,
    .filter-btn:hover {
        background: #44B486;
        border-color: #44B486;
    }
}

/* === Small Mobile (480px dan bawah) === */
@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .project-image-container {
        height: 100px;
    }

    .project-content {
        padding: 10px;
        gap: 4px;
    }

    .project-title {
        font-size: 0.8rem;
        min-height: 2.2em;
    }

    .project-desc {
        font-size: 0.7rem;
        min-height: 2.6em;
    }

    .project-category {
        font-size: 0.65rem;
        padding-top: 6px;
    }

    .portofolio-hero h1 {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.8rem;
    }
}

/* === Very Small Mobile (375px dan bawah) === */
@media (max-width: 375px) {
    .projects-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .project-image-container {
        height: 90px;
    }

    .project-content {
        padding: 8px;
    }

    .project-title {
        font-size: 0.75rem;
        min-height: 2em;
    }

    .project-desc {
        font-size: 0.65rem;
        min-height: 2.4em;
    }

    .project-category {
        font-size: 0.6rem;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
}

/* === Pastikan tidak ada overflow === */
.projects-grid {
    box-sizing: border-box;
}

.project-item {
    box-sizing: border-box;
}

/* === Animation untuk loading === */
.project-item {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.project-item:nth-child(2n) {
    animation-delay: 0.1s;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}