#projects {
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 6% 8%;
    background-image:
        radial-gradient(circle at 75% 25%, rgba(164, 133, 255, 0.03) 0%, transparent 30%),
        radial-gradient(circle at 25% 75%, rgba(106, 226, 255, 0.03) 0%, transparent 30%);
}

.projects-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.projects-header {
    text-align: center;
    margin-bottom: 4rem;
}

.projects-header h2 {
    font-family: 'Clash Display', sans-serif;
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink), var(--accent-cyan));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    position: relative;
}

.projects-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink));
    border-radius: 3px;
}

.projects-subheading {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
}

.project-card {
    background: rgba(20, 20, 30, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    background: rgba(20, 20, 30, 0.35);
    box-shadow:
        0 15px 40px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(106, 226, 255, 0.2),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    transform: skewX(-25deg);
    transition: all 0.75s ease;
    z-index: 2;
    pointer-events: none;
}

.project-card:hover::before {
    left: 150%;
}

.project-image-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 220px;
}

.project-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.5s ease;
}
.has-image {
    object-fit: contain !important;
}

.project-card:hover .project-image {
    transform: scale(1.05);
}

.project-info {
    padding: 1.8rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-tech {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.project-tech-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: rgba(106, 226, 255, 0.1);
    color: var(--accent-cyan);
    font-weight: 500;
}

.project-title {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-white);
    position: relative;
    display: inline-block;
}

.project-description {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 1rem;
    margin-bottom: 1rem;
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s ease;
}

/* Disable transitions for low-end devices */
.low-end-device .project-description {
    transition: none;
}

/* Initial collapsed state - limit to approximately 3 lines */
.project-description.collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    max-height: 4.8rem; /* 3 lines × 1.6 line-height */
    text-overflow: ellipsis;
}

/* Expanded state */
.project-description.expanded {
    max-height: 300px; /* Large enough to fit any description */
}

/* Clickable description styling */
.project-description.clickable {
    cursor: pointer;
    position: relative;
}

.project-description.clickable:hover {
    color: var(--text-white);
}

/* Read more button */
.read-more-btn {
    color: var(--accent-cyan);
    background: none;
    border: none;
    padding: 0;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.read-more-btn:hover {
    color: var(--accent-purple);
}

.read-more-btn svg {
    width: 16px;
    height: 16px;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

.read-more-btn.expanded svg {
    transform: rotate(180deg);
}

.project-links {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.project-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    padding-bottom: 2px;
}

.project-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-cyan);
    transition: width 0.3s ease;
}

.project-link:hover {
    color: var(--accent-purple);
}

.project-link:hover::after {
    width: 100%;
    background: var(--accent-purple);
}

.project-link-icon {
    font-size: 1rem;
}

/* Project card animations are now in styles.css */

/* Responsive adjustments */
@media (max-width: 768px) {
    .projects-header h2 {
        font-size: 2.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-image-container {
        height: 200px;
    }
}
