/* ========================================
   STORY FRAMES CAROUSEL - CINEMATIC 3D CONCEPT
   ======================================== */

/* Projects Showcase - Story Frames Carousel */
.projects-showcase {
    padding: 100px 0 60px 0;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    perspective: 1000px;
}

.projects-showcase::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.02) 0%, transparent 60%);
    pointer-events: none;
    animation: parallaxBackground 20s ease-in-out infinite;
}

/* Dark theme background effects */
[data-theme="dark"] .projects-showcase::before {
    background: 
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
}

/* Light theme background effects */
[data-theme="light"] .projects-showcase::before {
    background: 
        radial-gradient(circle at 30% 20%, rgba(0, 0, 0, 0.02) 0%, transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(0, 0, 0, 0.01) 0%, transparent 60%);
}

@keyframes parallaxBackground {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-20px) scale(1.02); }
}

.projects-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.projects-header {
    text-align: center;
    margin-bottom: 80px;
    margin-top: 2.5rem;
    position: relative;
}

.projects-title {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 28px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    position: relative;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.projects-title::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--text-primary), transparent);
    border-radius: 2px;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { opacity: 0.6; transform: translateX(-50%) scaleX(1); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1.1); }
}

.projects-subtitle {
    font-size: 1.4rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
    opacity: 0.9;
}

/* Story Frames Carousel Container */
.carousel-container {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    margin: 0 auto 0.75rem auto;
}

.carousel-track {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Project Cards - Refined 3D Layout */
.project-card {
    position: absolute;
    width: 500px;
    height: 280px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-radius: 24px;
    padding: 0;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.15),
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    opacity: 0.6;
    scale: 0.85;
    will-change: transform, opacity, box-shadow;
    overflow: hidden;
    box-sizing: border-box;
    filter: blur(1px);
    backdrop-filter: blur(10px);
}

/* Center Card - Active State (Above All Others) */
.project-card.active {
    opacity: 1;
    scale: 1.3;
    transform: translateZ(120px) rotateY(0deg) translateY(-30px);
    border-color: var(--text-primary);
    box-shadow: 
        0 40px 120px rgba(0, 0, 0, 0.25),
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 0 0 1px var(--text-primary),
        0 0 60px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 10;
    animation: activeCardPulse 4s ease-in-out infinite;
    filter: blur(0px);
    backdrop-filter: blur(20px);
}

@keyframes activeCardPulse {
    0%, 100% { 
        box-shadow: 
            0 30px 80px var(--shadow-heavy),
            0 0 0 1px var(--text-primary),
            0 0 40px rgba(255, 255, 255, 0.15),
            0 0 60px rgba(255, 255, 255, 0.05);
    }
    50% { 
        box-shadow: 
            0 35px 100px var(--shadow-heavy),
            0 0 0 1px var(--text-primary),
            0 0 50px rgba(255, 255, 255, 0.2),
            0 0 80px rgba(255, 255, 255, 0.08);
    }
}

/* Dark theme active card glow */
[data-theme="dark"] .project-card.active {
    box-shadow: 
        0 25px 60px var(--shadow-heavy),
        0 0 0 1px var(--text-primary),
        0 0 30px rgba(255, 255, 255, 0.15);
}

/* Light theme active card glow */
[data-theme="light"] .project-card.active {
    box-shadow: 
        0 25px 60px var(--shadow-heavy),
        0 0 0 1px var(--text-primary),
        0 0 30px rgba(0, 0, 0, 0.1);
}

/* Left Side Cards - Refined Positioning */
.project-card.left {
    transform: translateX(-220px) translateZ(-80px) rotateY(20deg) translateY(10px);
    opacity: 0.6;
}

.project-card.left-2 {
    transform: translateX(-420px) translateZ(-160px) rotateY(30deg) translateY(15px);
    opacity: 0.4;
}

/* Right Side Cards - Refined Positioning */
.project-card.right {
    transform: translateX(220px) translateZ(-80px) rotateY(-20deg) translateY(10px);
    opacity: 0.6;
}

.project-card.right-2 {
    transform: translateX(420px) translateZ(-160px) rotateY(-30deg) translateY(15px);
    opacity: 0.4;
}

/* Card Hover Effects - Refined */
.project-card:hover {
    transform: translateZ(40px) scale(1.05) translateY(-5px);
    box-shadow: 0 20px 50px var(--shadow-heavy);
    opacity: 0.9;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.project-card.active:hover {
    transform: translateZ(100px) scale(1.2) translateY(-30px);
    box-shadow: 
        0 30px 70px var(--shadow-heavy),
        0 0 0 1px var(--text-primary),
        0 0 40px rgba(255, 255, 255, 0.15);
    animation: none;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Dark theme active card hover glow */
[data-theme="dark"] .project-card.active:hover {
    box-shadow: 
        0 30px 70px var(--shadow-heavy),
        0 0 0 1px var(--text-primary),
        0 0 40px rgba(255, 255, 255, 0.2);
}

/* Light theme active card hover glow */
[data-theme="light"] .project-card.active:hover {
    box-shadow: 
        0 30px 70px var(--shadow-heavy),
        0 0 0 1px var(--text-primary),
        0 0 40px rgba(0, 0, 0, 0.15);
}

/* Project Content Styling */
.project-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 24px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 1.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity, box-shadow;
    flex-shrink: 0;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
}

/* Dark theme project image */
[data-theme="dark"] .project-image {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-color: var(--border-color);
}

/* Light theme project image */
[data-theme="light"] .project-image {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-color: var(--border-color);
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.project-placeholder {
    font-size: 3rem;
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.6;
    transition: var(--transition);
}

/* Dark theme placeholder */
[data-theme="dark"] .project-placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Light theme placeholder */
[data-theme="light"] .project-placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.project-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.9));
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 0;
    max-width: 100%;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 24px;
    backdrop-filter: blur(15px);
    pointer-events: none;
}

.project-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 16px;
    line-height: 1.2;
    flex-shrink: 0;
    text-align: left;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-shadow: 
        0 2px 12px rgba(0, 0, 0, 0.6),
        0 1px 4px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.01em;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    flex-shrink: 0;
    justify-content: flex-start;
    max-width: 100%;
}

.tech-tag {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.85) 100%);
    color: #000000;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tech-tag:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Dark theme tech tags */
[data-theme="dark"] .tech-tag {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .tech-tag:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* Light theme tech tags */
[data-theme="light"] .tech-tag {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="light"] .tech-tag:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

/* CTA Button - Gentle Hover Animation */
.project-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.9) 100%);
    color: #000000;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 800;
    font-size: 0.75rem;
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    width: auto;
    text-align: center;
    opacity: 0;
    transform: translateY(15px);
    will-change: transform, opacity;
    flex-shrink: 0;
    margin-top: auto;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    max-width: fit-content;
    box-sizing: border-box;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.15);
}

.project-card:hover .project-content {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
    pointer-events: auto;
}

.project-card:hover .project-cta {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.3s;
}

.project-cta:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.95) 100%);
    color: #000000;
    transform: translateY(-4px) scale(1.05);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.35),
        0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Enhanced hover effects for all thumbnails */
.project-card:hover .project-image {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    border-color: var(--text-primary);
}

.project-card.active:hover .project-image {
    transform: translateY(-5px);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.25);
    border-color: var(--text-primary);
}

/* Image frame polish */
.project-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
}

.project-card:hover .project-image::before {
    opacity: 1;
}

/* Navigation Controls */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    box-shadow: 0 12px 32px var(--shadow-medium);
    backdrop-filter: blur(15px);
    will-change: transform, background-color, box-shadow;
}

.carousel-nav:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 12px 32px var(--shadow-heavy);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-nav.prev {
    left: -30px;
}

.carousel-nav.next {
    right: -30px;
}

.carousel-nav svg {
    width: 24px;
    height: 24px;
}

/* Pagination Dots */
.carousel-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 60px;
}

.pagination-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
    will-change: transform, background-color, box-shadow;
}

.pagination-dot.active {
    background: var(--text-primary);
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
    0%, 100% { 
        transform: scale(1.3);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% { 
        transform: scale(1.4);
        box-shadow: 0 0 25px rgba(255, 255, 255, 0.4);
    }
}

.pagination-dot:hover {
    background: var(--text-secondary);
    transform: scale(1.1);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Responsive Design - Refined Story Frames */
@media (max-width: 1024px) {
    .carousel-container {
        height: 500px;
    }

    .project-card {
        width: 300px;
        height: 400px;
        padding: 28px;
    }

    .project-card.active {
        transform: translateZ(70px) rotateY(0deg) translateY(-15px);
        scale: 1.1;
    }

    .project-card.left {
        transform: translateX(-200px) translateZ(-70px) rotateY(18deg) translateY(8px);
    }

    .project-card.left-2 {
        transform: translateX(-380px) translateZ(-140px) rotateY(28deg) translateY(12px);
    }

    .project-card.right {
        transform: translateX(200px) translateZ(-70px) rotateY(-18deg) translateY(8px);
    }

    .project-card.right-2 {
        transform: translateX(380px) translateZ(-140px) rotateY(-28deg) translateY(12px);
    }

    .carousel-nav {
        width: 50px;
        height: 50px;
    }

    .carousel-nav.prev {
        left: -25px;
    }

    .carousel-nav.next {
        right: -25px;
    }
}

@media (max-width: 768px) {
    .projects-showcase {
        padding: 36px 0 32px; /* reduce even more above projects on mobile */
    }

    /* tighten header spacing under hero on mobile */
    .projects-header {
        margin-top: 0.5rem;
        margin-bottom: 40px;
    }

    .projects-title {
        font-size: 2.5rem;
    }

    .projects-subtitle {
        font-size: 1.1rem;
    }

    .carousel-container {
        height: 300px;
    }

    .project-card {
        width: 400px;
        height: 200px;
        padding: 0;
    }

    .project-card.active {
        transform: translateZ(60px) rotateY(0deg) translateY(-10px);
        scale: 1.05;
    }

    .project-card.left {
        transform: translateX(-220px) translateZ(-60px) rotateY(15deg) translateY(5px);
    }

    .project-card.left-2 {
        transform: translateX(-440px) translateZ(-120px) rotateY(25deg) translateY(8px);
    }

    .project-card.right {
        transform: translateX(220px) translateZ(-60px) rotateY(-15deg) translateY(5px);
    }

    .project-card.right-2 {
        transform: translateX(440px) translateZ(-120px) rotateY(-25deg) translateY(8px);
    }

    .carousel-nav {
        width: 45px;
        height: 45px;
    }

    .carousel-nav.prev {
        left: -22px;
    }

    .carousel-nav.next {
        right: -22px;
    }

    .project-image {
        width: 200px;
        height: 100%;
        border-radius: 20px 0 0 20px;
    }

    .project-content {
        width: 200px;
        padding: 16px;
    }

    .project-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .tech-tag {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .project-cta {
        font-size: 0.6rem;
        padding: 6px 10px;
    }
}

@media (max-width: 480px) {
    .projects-title {
        font-size: 2rem;
    }

    .carousel-container {
        height: 250px;
    }

    .projects-showcase {
        padding: 28px 0 24px; /* extra-tight on small phones */
    }

    .projects-header {
        margin-top: 0.4rem;
        margin-bottom: 32px;
    }

    .project-card {
        width: 350px;
        height: 180px;
        padding: 0;
    }

    .project-card.active {
        transform: translateZ(50px) rotateY(0deg) translateY(-8px);
        scale: 1.05;
    }

    .project-image {
        width: 180px;
        height: 100%;
        border-radius: 20px 0 0 20px;
        margin-bottom: 0;
    }

    .project-content {
        width: 170px;
        padding: 12px;
    }

    .tech-tag {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .project-cta {
        font-size: 0.6rem;
        padding: 6px 10px;
    }

    .project-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }


    .carousel-nav {
        width: 40px;
        height: 40px;
    }

    .carousel-nav.prev {
        left: -20px;
    }

    .carousel-nav.next {
        right: -20px;
    }
}

@media (max-width: 360px) {
    .carousel-container {
        height: 200px;
    }

    .project-card {
        width: 300px;
        height: 160px;
        padding: 0;
    }

    .project-image {
        width: 160px;
        height: 100%;
        border-radius: 20px 0 0 20px;
        margin-bottom: 0;
    }

    .project-content {
        width: 140px;
        padding: 10px;
    }

    .tech-tag {
        font-size: 0.45rem;
        padding: 1px 3px;
    }

    .project-title {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .project-cta {
        font-size: 0.55rem;
        padding: 5px 8px;
    }

    .project-tech {
        margin-bottom: 8px;
        gap: 2px;
    }
}

/* Additional responsive adjustments for very small screens */
@media (max-width: 320px) {
    .carousel-container {
        height: 180px;
    }

    .project-card {
        width: 280px;
        height: 140px;
        padding: 0;
    }

    .project-image {
        width: 140px;
        height: 100%;
        border-radius: 20px 0 0 20px;
        margin-bottom: 0;
    }

    .project-content {
        width: 140px;
        padding: 8px;
    }

    .tech-tag {
        font-size: 0.4rem;
        padding: 1px 2px;
    }

    .project-title {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .project-cta {
        font-size: 0.5rem;
        padding: 4px 6px;
    }

    .project-tech {
        margin-bottom: 6px;
        gap: 1px;
    }
}

/* ========================================
   PROJECTS UNDERLAYER SECTION
   ======================================== */

/* Underlayer Container */
.projects-underlayer {
    margin-top: -90px;
    padding: 0 24px;
    position: relative;
    z-index: 0;
    width: 100%;
}

.underlayer-container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

.underlayer-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 30%, #0a0a0a 70%, #000000 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 28px;
    padding: 100px 70px;
    text-align: center;
    position: relative;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 12px 40px rgba(0, 0, 0, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.4),
        inset 1px 0 0 rgba(255, 255, 255, 0.05),
        inset -1px 0 0 rgba(0, 0, 0, 0.2);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(30px) translateZ(20px);
    animation: fadeUpIn 1.2s ease-out 0.5s forwards;
    width: 100%;
    margin: 0 auto;
    transform-style: preserve-3d;
    backdrop-filter: blur(15px) saturate(120%);
}

/* Fade up animation */
@keyframes fadeUpIn {
    from {
        opacity: 0;
        transform: translateY(30px) translateZ(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

/* Underlayer Heading */
.underlayer-heading {
    font-size: 3.5rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 20px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    position: relative;
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.5),
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(255, 255, 255, 0.1);
    transform: translateZ(10px);
}

.underlayer-heading::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--text-primary), transparent);
    border-radius: 2px;
    animation: underlineGlow 3s ease-in-out infinite;
}

@keyframes underlineGlow {
    0%, 100% { 
        opacity: 0.6; 
        transform: translateX(-50%) scaleX(1); 
    }
    50% { 
        opacity: 1; 
        transform: translateX(-50%) scaleX(1.2); 
    }
}

/* Underlayer Subtext */
.underlayer-subtext {
    font-size: 1.4rem;
    color: #e5e5e5;
    line-height: 1.6;
    font-weight: 400;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
    text-shadow: 
        0 1px 5px rgba(0, 0, 0, 0.4),
        0 2px 10px rgba(0, 0, 0, 0.2);
    transform: translateZ(5px);
}

/* Hover Effects */
.underlayer-content:hover {
    transform: translateY(-12px) translateZ(15px);
    box-shadow: 
        0 40px 120px rgba(0, 0, 0, 0.6),
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 8px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        inset 0 -1px 0 rgba(0, 0, 0, 0.5),
        inset 1px 0 0 rgba(255, 255, 255, 0.1),
        inset -1px 0 0 rgba(0, 0, 0, 0.3);
}

/* Dark Theme - Light Background */
[data-theme="dark"] .underlayer-content {
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 50%, #e9ecef 100%);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .underlayer-heading {
    color: #000000;
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.2),
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .underlayer-subtext {
    color: #333333;
    opacity: 0.8;
    text-shadow: 
        0 1px 5px rgba(0, 0, 0, 0.1),
        0 2px 10px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .underlayer-heading::after {
    background: linear-gradient(90deg, transparent, #000000, transparent);
}

/* Light Theme - Dark Background */
[data-theme="light"] .underlayer-content {
    background: linear-gradient(135deg, #1a1a1a 0%, #000000 50%, #0a0a0a 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .underlayer-heading {
    color: #ffffff;
    text-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.5),
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 1px 3px rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .underlayer-subtext {
    color: #e5e5e5;
    opacity: 0.9;
    text-shadow: 
        0 1px 5px rgba(0, 0, 0, 0.4),
        0 2px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .underlayer-heading::after {
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
}

/* Responsive Design */
@media (max-width: 768px) {
    .carousel-container {
        height: 300px;
    }

    .project-card {
        width: 400px;
        height: 200px;
        padding: 0;
    }

    .project-card.active {
        transform: translateZ(60px) rotateY(0deg) translateY(-10px);
        scale: 1.05;
    }

    .project-card.left {
        transform: translateX(-220px) translateZ(-60px) rotateY(15deg) translateY(5px);
    }

    .project-card.left-2 {
        transform: translateX(-440px) translateZ(-120px) rotateY(25deg) translateY(8px);
    }

    .project-card.right {
        transform: translateX(220px) translateZ(-60px) rotateY(-15deg) translateY(5px);
    }

    .project-card.right-2 {
        transform: translateX(440px) translateZ(-120px) rotateY(-25deg) translateY(8px);
    }

    .carousel-nav {
        width: 45px;
        height: 45px;
    }

    .carousel-nav.prev {
        left: -22px;
    }

    .carousel-nav.next {
        right: -22px;
    }

    .project-image {
        width: 100%;
        height: 100%;
        border-radius: 20px;
    }

    .project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 20px;
    }

    .project-content {
        width: 100%;
        padding: 20px;
    }

    .project-title {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .tech-tag {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .project-cta {
        font-size: 0.6rem;
        padding: 6px 10px;
    }

    .projects-underlayer {
        margin-top: -75px;
        padding: 0 16px;
    }

    .underlayer-content {
        padding: 50px 30px;
        border-radius: 20px;
    }

    .underlayer-heading {
        font-size: 2.2rem;
        margin-bottom: 16px;
        line-height: 1.2;
    }

    .underlayer-subtext {
        font-size: 1.1rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .carousel-container {
        height: 250px;
    }

    .project-card {
        width: 350px;
        height: 180px;
        padding: 0;
    }

    .project-card.active {
        transform: translateZ(50px) rotateY(0deg) translateY(-8px);
        scale: 1.05;
    }

    .project-image {
        width: 100%;
        height: 100%;
        border-radius: 20px;
        margin-bottom: 0;
    }

    .project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 20px;
    }

    .project-content {
        width: 100%;
        padding: 20px;
    }

    .tech-tag {
        font-size: 0.5rem;
        padding: 2px 4px;
    }

    .project-cta {
        font-size: 0.6rem;
        padding: 6px 10px;
    }

    .project-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
    }

    .carousel-nav.prev {
        left: -20px;
    }

    .carousel-nav.next {
        right: -20px;
    }

    .projects-underlayer {
        margin-top: -60px;
        padding: 0 12px;
    }

    .underlayer-content {
        padding: 40px 20px;
        border-radius: 16px;
        text-align: center;
    }

    .underlayer-heading {
        font-size: 1.8rem;
        margin-bottom: 12px;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .underlayer-subtext {
        font-size: 0.95rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 360px) {
    .carousel-container {
        height: 200px;
    }

    .project-card {
        width: 300px;
        height: 160px;
        padding: 0;
    }

    .project-image {
        width: 160px;
        height: 100%;
        border-radius: 20px 0 0 20px;
        margin-bottom: 0;
    }

    .project-content {
        width: 140px;
        padding: 10px;
    }

    .tech-tag {
        font-size: 0.45rem;
        padding: 1px 3px;
    }

    .project-title {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .project-cta {
        font-size: 0.55rem;
        padding: 5px 8px;
    }

    .project-tech {
        margin-bottom: 8px;
        gap: 2px;
    }

    .projects-underlayer {
        margin-top: -45px;
        padding: 0 8px;
    }

    .underlayer-content {
        padding: 32px 16px;
        border-radius: 14px;
    }

    .underlayer-heading {
        font-size: 1.5rem;
        margin-bottom: 10px;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .underlayer-subtext {
        font-size: 0.85rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

@media (max-width: 320px) {
    .carousel-container {
        height: 180px;
    }

    .project-card {
        width: 280px;
        height: 140px;
        padding: 0;
    }

    .project-image {
        width: 140px;
        height: 100%;
        border-radius: 20px 0 0 20px;
        margin-bottom: 0;
    }

    .project-content {
        width: 140px;
        padding: 8px;
    }

    .tech-tag {
        font-size: 0.4rem;
        padding: 1px 2px;
    }

    .project-title {
        font-size: 0.8rem;
        margin-bottom: 4px;
    }

    .project-cta {
        font-size: 0.5rem;
        padding: 4px 6px;
    }

    .project-tech {
        margin-bottom: 6px;
        gap: 1px;
    }

    .projects-underlayer {
        margin-top: -40px;
        padding: 0 6px;
    }

    .underlayer-content {
        padding: 28px 12px;
        border-radius: 12px;
    }

    .underlayer-heading {
        font-size: 1.3rem;
        margin-bottom: 8px;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .underlayer-subtext {
        font-size: 0.8rem;
        line-height: 1.3;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Enhanced Theme Compatibility */

/* Dark theme enhancements */
[data-theme="dark"] .project-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 15px 40px var(--shadow-medium);
}

[data-theme="dark"] .project-card:hover {
    box-shadow: 0 20px 50px var(--shadow-heavy);
}

[data-theme="dark"] .carousel-nav {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .carousel-nav:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

[data-theme="dark"] .pagination-dot {
    background: var(--border-color);
}

[data-theme="dark"] .pagination-dot.active {
    background: var(--text-primary);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* Light theme enhancements */
[data-theme="light"] .project-card {
    background: var(--bg-primary);
    border-color: var(--border-color);
    box-shadow: 0 15px 40px var(--shadow-medium);
}

[data-theme="light"] .project-card:hover {
    box-shadow: 0 20px 50px var(--shadow-heavy);
}

[data-theme="light"] .carousel-nav {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="light"] .carousel-nav:hover {
    background: var(--text-primary);
    color: var(--bg-primary);
}

[data-theme="light"] .pagination-dot {
    background: var(--border-color);
}

[data-theme="light"] .pagination-dot.active {
    background: var(--text-primary);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}