/*=========================================================
                    PROJECTS
=========================================================*/

.projects {
    position: relative;
    overflow: hidden;
    padding: 50px 0 120px;
    background: linear-gradient(180deg, #061823 0%, #081f2b 100%);
}

    .projects::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: radial-gradient(circle at 15% 20%, rgba(20,217,235,.06), transparent 35%), radial-gradient(circle at 85% 80%, rgba(20,217,235,.05), transparent 30%);
    }

    .projects::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(180deg, rgba(255,255,255,.015), transparent 35%);
    }


/*=========================================================
                    FILTER
=========================================================*/

.projects-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0 0 60px;
}

.filter-btn {
    position: relative;
    overflow: hidden;
    border: none;
    outline: none;
    cursor: pointer;
    user-select: none;
    padding: 15px 28px;
    border-radius: 40px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #d9e5ea;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(20,217,235,.18);
    backdrop-filter: blur(12px);
    transition: transform .35s ease, background .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease;
}

    .filter-btn::before {
        content: "";
        position: absolute;
        top: 0;
        left: -120%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255,255,255,.22), transparent);
        transition: left .6s ease;
    }

    .filter-btn:hover::before {
        left: 120%;
    }

    .filter-btn:hover {
        transform: translateY(-3px);
        color: #ffffff;
        border-color: #14d9eb;
        background: rgba(20,217,235,.08);
    }

    .filter-btn.active {
        color: #041018;
        background: #14d9eb;
        border-color: #14d9eb;
        transform: scale(1.05);
        box-shadow: 0 10px 24px rgba(20,217,235,.28);
    }

    .filter-btn:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(20,217,235,.22);
    }


/*=========================================================
                    GRID
=========================================================*/

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 34px;
}

.project-card {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    background: linear-gradient(180deg, #0a1f2b 0%, #081923 100%);
    border: 1px solid rgba(20,217,235,.18);
    opacity: 1;
    visibility: visible;
    transition: opacity .35s ease, transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}

    .project-card.hide {
        opacity: 0;
        visibility: hidden;
        transform: scale(.97);
        pointer-events: none;
        position: absolute; /* برای جلوگیری از جا به جایی */
    }

    .project-card.show {
        opacity: 1;
        visibility: visible;
        transform: scale(1);
        position: relative;
    }


/*=========================================================
                    IMAGE
=========================================================*/

.project-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #091c28;
}

    .project-image img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform .35s ease, filter .35s ease;
    }

    .project-image::after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(to top, rgba(0,0,0,.30), rgba(0,0,0,.02) 55%, transparent);
        transition: opacity .35s ease, background .35s ease;
    }


/*=========================================================
                    STATUS
=========================================================*/

.project-status {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 96px;
    height: 34px;
    padding: 0 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255,255,255,.18);
    box-shadow: 0 8px 18px rgba(0,0,0,.18);
}

    .project-status.running {
        background: linear-gradient(180deg, rgba(0,188,140,.92), rgba(0,165,122,.82));
    }

    .project-status.finished {
        background: linear-gradient(180deg, rgba(63,132,255,.92), rgba(33,105,240,.82));
    }


/*=========================================================
                    CONTENT
=========================================================*/

.project-content {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 210px;
    padding: 28px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,.01), rgba(255,255,255,0));
    transition: background .35s ease;
}

.project-title {
    margin: 0;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.75;
    letter-spacing: -.2px;
    text-align: center;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-details {
    margin-top: 22px;
    margin-right: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity .55s ease, transform .55s ease, visibility .55s ease;
}

.project-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.86);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.8;
}

    .project-info i {
        width: 18px;
        flex-shrink: 0;
        text-align: center;
        color: #14d9eb;
        font-size: 15px;
    }

.project-description {
    position: absolute;
    right: 28px;
    left: 28px;
    bottom: 18px;
    height: 112px;
    box-sizing: border-box;
    padding: 8px 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(10,38,48,.88), rgba(7,28,37,.95));
    border: 1px solid rgba(20,217,235,.22);
    backdrop-filter: blur(14px);
    box-shadow: inset 0 1px 0 rgba(20,217,235,.08), 0 8px 20px rgba(0,0,0,.16), 0 0 18px rgba(20,217,235,.12);
    color: #14d9eb;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    line-height: 2;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transform-origin: bottom center;
    transition: opacity .55s ease, transform .55s ease, visibility .55s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


/*=========================================================
                    DESKTOP HOVER
=========================================================*/

@media (hover:hover) {
    .project-card:hover {
        transform: translateY(-10px);
        border-color: rgba(20,217,235,.42);
        box-shadow: 0 20px 45px rgba(0,0,0,.38), 0 0 24px rgba(20,217,235,.16);
    }

    .project-card::before {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: 22px;
        pointer-events: none;
        opacity: 0;
        box-shadow: inset 0 0 0 1px rgba(20,217,235,.35), 0 0 22px rgba(20,217,235,.18);
        transition: opacity .35s ease;
    }

    .project-card:hover::before {
        opacity: 1;
    }

    .project-card:hover .project-image img {
        transform: scale(1.08);
        filter: brightness(1.05) contrast(1.04) saturate(1.05);
    }

    .project-card:hover .project-image::after {
        background: linear-gradient(to top, rgba(0,0,0,.45), rgba(0,0,0,.08) 65%, transparent);
    }

    .project-card:hover .project-content {
        background: linear-gradient(180deg, rgba(20,217,235,.02), rgba(20,217,235,.09));
    }

    .project-card:hover .project-title {
        transform: translateY(-4px);
        color: #14d9eb;
    }

    .project-card:hover .project-details {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .project-card:hover .project-description {
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        pointer-events: none;
    }
}


/*=========================================================
                    MOBILE CLICK MODE
=========================================================*/

@media (hover:none) {
    .project-card.mobile-active {
        border-color: rgba(20,217,235,.40);
        box-shadow: 0 16px 36px rgba(0,0,0,.34), 0 0 20px rgba(20,217,235,.14);
    }

        .project-card.mobile-active .project-content {
            background: linear-gradient(180deg, rgba(20,217,235,.02), rgba(20,217,235,.09));
        }

        .project-card.mobile-active .project-details {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
            pointer-events: auto;
        }

        .project-card.mobile-active .project-description {
            opacity: 0;
            visibility: hidden;
            transform: translateY(-8px);
            pointer-events: none;
        }
}


/*=========================================================
                    PERFORMANCE
=========================================================*/

.project-card,
.project-image img,
.project-content,
.project-details,
.project-description {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
}


/*=========================================================
                    RESPONSIVE
=========================================================*/

@media (max-width:1400px) {
    .projects-grid {
        gap: 30px;
    }
}

@media (max-width:1300px) {
    .projects-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
        gap: 28px;
    }
}

@media (max-width:991px) {
    .projects {
        padding: 40px 0 90px;
    }

    .projects-filter {
        gap: 12px;
        margin-bottom: 45px;
    }

    .filter-btn {
        padding: 13px 22px;
        font-size: 14px;
    }

    .project-content {
        min-height: 200px;
        padding: 24px;
    }

    .project-title {
        font-size: 21px;
    }

    .project-description {
        right: 24px;
        left: 24px;
        bottom: 16px;
        height: 108px;
        font-size: 15px;
    }
}

@media (max-width:767px) {
    .projects {
        padding: 30px 0 70px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .projects-filter {
        display: grid;
        grid-template-columns: repeat(3,1fr);
        gap: 8px;
        margin-bottom: 30px;
    }

    .filter-btn {
        width: 100%;
        padding: 12px 6px;
        font-size: 13px;
        border-radius: 14px;
    }

    .project-image {
        aspect-ratio: 16/10;
    }

    .project-status {
        top: 12px;
        right: 12px;
        min-width: 86px;
        height: 30px;
        font-size: 12px;
        padding: 0 12px;
    }

    .project-content {
        min-height: 190px;
        padding: 20px;
    }

    .project-title {
        font-size: 19px;
    }

    .project-info {
        font-size: 14px;
    }

    .project-description {
        right: 20px;
        left: 20px;
        bottom: 14px;
        height: 100px;
        font-size: 14px;
        line-height: 1.9;
        padding: 14px 16px 14px 22px;
    }
}

@media (max-width:420px) {

    .filter-btn {
        font-size: 12px;
        padding: 11px 4px;
    }

    .project-title {
        font-size: 18px;
    }
}

@media (prefers-reduced-motion:reduce) {
    * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
