/* Projects Section CSS */
#projects {
    background-color: transparent;
}

/* Global Carousel Layout */
.projects-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 2rem;
    padding: 40px 0;
    /* Vertical padding only, horiz handled by card margins */
    /* Space for scrollbar/dots */
    width: 100%;
    -webkit-overflow-scrolling: touch;

    /* Hide scrollbar completely */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

.projects-grid::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.project-card {
    background: transparent;
    /* Set to transparent for mask */
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;

    /* Reset old border styles */
    border: none;
    position: relative;
    z-index: 0;

    /* Create gap for border visibility (Thickness) */
    padding: var(--proj-border-width, 5px);

    /* Desktop Sizing: fixed width cards */
    flex: 0 0 350px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

/* Ensure Glow Visibility at Edges */
.project-card:first-child {
    margin-left: 120px;
}

.project-card:last-child {
    margin-right: 120px;
}

/* Rotating Border Effect (Shooting Star) */
.project-card::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: var(--proj-gradient, conic-gradient(from 0deg,
                transparent 0%,
                transparent 50%,
                rgba(56, 189, 248, 0.1) 60%,
                rgba(129, 140, 248, 0.4) 75%,
                rgba(192, 132, 252, 0.8) 85%,
                #38bdf8 100%));
    animation: rotateBorder var(--proj-anim-speed, 4s) linear infinite;
    z-index: -2;
}

/* Inner Background Mask */
.project-card::after {
    content: '';
    position: absolute;
    inset: var(--proj-border-width, 5px);
    /* Border width */
    background: var(--dark-surface);
    border-radius: calc(20px - var(--proj-border-width, 5px));
    /* 20px - 5px */
    z-index: -1;
}

@keyframes rotateBorder {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.project-card:hover {
    box-shadow: 0 0 30px var(--proj-glow-color, rgba(56, 189, 248, 0.3));
}


.project-image {
    width: 100%;
    height: 220px;
    /* Fixed height container */
    overflow: hidden;
    /* Separator */
    position: relative;
    z-index: 2;
    border-radius: calc(20px - var(--proj-border-width, 5px)) calc(20px - var(--proj-border-width, 5px)) 0 0;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 1, 0.2, 1);
}

.project-card:hover .project-image img {
    transform: scale(1.08);
}

.project-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.project-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.project-desc {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    flex-grow: 1;
    /* Push button to bottom */
}

/* Wrapper for positioning arrows */
.projects-wrapper {
    position: relative;
    width: 100%;
    margin: 0 0 1rem 0;
    padding: 0 10px;
}

/* Nav Arrows - Premium Design */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.nav-arrow:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow.prev {
    left: -24px;
}

.nav-arrow.next {
    right: -24px;
}

/* Updated Premium Button */
.project-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.8rem;
    background: rgba(56, 189, 248, 0.08);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    width: fit-content;
    align-self: flex-start;
    /* Align left */
    backdrop-filter: blur(5px);
}

.project-link:hover {
    background: var(--primary-color);
    color: #0f172a;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
    transform: translateY(-2px);
}

.project-link i {
    transition: transform 0.3s ease;
}

.project-link:hover i {
    transform: translateX(3px) rotate(-15deg);
}


/* Dot Pagination Styles (Global) */
.project-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.project-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-dot.active {
    background-color: var(--primary-color);
    width: 24px;
    border-radius: 4px;
}

/* Mobile Updates */
@media (max-width: 768px) {
    #projects {
        height: auto;
        padding: 4rem 0;
        /* Remove side padding to allow full width swipe */
    }

    .projects-grid {
        display: flex;
        /* Force Flex */
        flex-wrap: nowrap;
        /* No Wrap */
        overflow-x: auto;
        /* Horizontal Scroll */
        -webkit-overflow-scrolling: touch;
        /* Smooth iOS scroll */
        gap: 15px;
        /* Margin between cards */
        padding: 40px 0;
        /* Vertical Padding Only */
        scroll-snap-type: x mandatory;
        /* Snap to cards */
        width: 100%;
    }

    .project-card:first-child {
        margin-left: 20px;
    }

    .project-card:last-child {
        margin-right: 20px;
    }

    .project-card {
        flex: 0 0 75vw;
        /* Reduced from 85vw */
        width: 75vw;
        max-width: 300px;
        scroll-snap-align: center;
        /* Snap to center */
        margin-right: 0;
    }

    /* Hide Arrows completely on mobile */
    .nav-arrow {
        display: none !important;
    }

    .projects-wrapper {
        padding: 0;
        margin: 0;
        /* Reset desktop negative margins */
        width: 100%;
    }

    .project-pagination {
        margin-top: 0;
    }
}