.portfolio {
    width: 100%;
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(135deg, #0b131f 0%, #0b131f 50%, #0b131f 100%);
    height: 600px;
    position: relative; /* Added for pseudo-element positioning */
}

.portfolio::before {
    content: '';
    position: absolute;
    top: -180px; /* Changed from 2px to -100px to position behind heading */
    left: 50%;
    transform: translateX(-50%);
    width: 1200px;
    height: 900px;
    background-image: url('../images/Ellipse\ 3.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center top;
    z-index: 1; /* Keep gradient visible */
    pointer-events: none; /* This prevents it from blocking clicks */
}

.portfolio h2 {
    color: #ffffff;
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 60px;
    letter-spacing: -0.02em;
    position: relative; /* Added to ensure it's above the gradient */
    z-index: 2;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 50px;
    position: relative; /* Added to ensure it's above the gradient */
    z-index: 2;
}

.portfolio-item {
    position: relative;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 2; /* Ensure portfolio items are above the gradient */
    background: transparent; /* Card background matching portfolio background */
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: transparent 1px solid;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.portfolio-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.portfolio-image {
    width: 100%;
    height: 280px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: translateY(-2px);
}

.project-preview {
    width: 100%;
    height: 100%;
    position: relative;
    background-size: cover;
    background-position: center;
    transition: transform 0.3s ease;
}

.portfolio-item:hover .project-preview {
    transform: scale(1.05);
}

/* Topo UI Design */
.project-preview.topo {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #CD853F 100%);
    background-image: url('../images/pc.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    position: relative;
}

/* Bastion UI Design */
.project-preview.bastion {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #60a5fa 100%);
    background-image: url('../images/laptop.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    position: relative;
}

/* Strapi Product Design */
.project-preview.strapi {
    background: linear-gradient(135deg, #374151 0%, #6b7280 50%, #9ca3af 100%);
    background-image: url('../images/iphone.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    position: relative;
}

.portfolio-item h3 {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding-top: 5px;
    width: 140px;
    line-height: 1.2;
}

.portfolio-item h3::before {
    content: '';
    width: 28px;
    height: 28px;
    border-radius: 6px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    color: white;
}

.portfolio-item:nth-child(1) h3::before {
    content: 'UI';
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.portfolio-item:nth-child(2) h3::before {
    content: '≡';
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.portfolio-item:nth-child(3) h3::before {
    content: 'S';
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
}

.portfolio-item:nth-child(3) h3::after {
    content: 'api';
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    position: absolute;
    left: 40px;
    top: 40px;
}

/* Styling for the api span */
.portfolio-item h3 .api-text {
    color: #94a3b8;
    font-size: 12px;
    font-weight: 400;
    margin-left: 0;
    display: block;
}

.portfolio-item:nth-child(3) h3 .api-text {
    margin-left: 40px; /* Align with the main text after the icon */
}

.portfolio-item:nth-child(3) h3 {
    position: relative;
}

.portfolio-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
    position: relative; /* Added to ensure it's above the gradient */
    z-index: 2;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: #ffffff;
    border: 3.5px solid #035343;
    /* box-shadow: 0 0 10px rgba(0, 212, 170, 0.4); */
    width: 14px;
    height: 14px;
}

.dot:hover {
    background: #ffffff;
    border: 2px solid #00d4aa;
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.3);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .portfolio::before {
        top: -80px; /* Adjusted for tablet */
        width: 800px;
        height: 1000px;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }
    
    .portfolio-item {
        padding: 18px;
    }
}

@media (max-width: 768px) {
    .portfolio::before {
        top: -60px; /* Adjusted for mobile */
        width: 600px;
        height: 800px;
    }
    
    .portfolio h2 {
        font-size: 2.5rem;
        margin-bottom: 40px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .portfolio-image {
        height: 240px;
    }
    
    .portfolio-item {
        padding: 16px;
    }

    .project-preview.bastion::after {
        font-size: 9px;
        top: 30px;
        left: 30px;
        right: 30px;
    }
}

@media (max-width: 480px) {
    .portfolio::before {
        top: -40px; /* Adjusted for small mobile */
        width: 400px;
        height: 600px;
    }
    
    .portfolio h2 {
        font-size: 2rem;
    }

    .portfolio-image {
        height: 200px;
    }

    .portfolio-item h3 {
        font-size: 15px;
    }
    
    .portfolio-item {
        padding: 14px;
    }

    .project-preview.bastion::after {
        font-size: 8px;
        line-height: 1.3;
    }

    .project-preview.strapi::after {
        font-size: 11px;
    }
}