/* Use Cases Section - Premium Project Cards */

.use-cases {
    padding: 6rem 0;
    background: var(--background-light);
}

.use-cases .container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.use-cases-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 4rem;
}

.use-cases-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.use-cases-header p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Project Cards Container - Horizontal Scrolling like Technologies */
.project-cards {
    display: flex;
    overflow-x: auto;
    gap: 2rem;
    padding: 2rem 0;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    margin-top: 3rem;
    position: relative;
}

.project-cards::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari/Opera */
}

/* Ensure first and last items have proper spacing */
.project-cards::after {
    content: '';
    min-width: 5%;
    height: 1px;
    display: block;
    flex-shrink: 0;
}

/* Individual Project Card - Reduced Height, Extended Image */
.project-card {
    width: 520px;
    min-width: 520px;
    max-width: 540px;
    flex: 0 0 auto;
    scroll-snap-align: center;
    background: var(--background-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    min-height: 580px;
    /* Reduced height */
    border: 1px solid var(--border-color);
    position: relative;
    /* Ensure flex children don't overflow */
    align-items: stretch;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

/* Project Image Carousel - Extended Width, Reduced Height */
.project-image-carousel {
    width: 100%;
    height: 320px;
    min-height: 320px;
    max-height: 320px;
    overflow: hidden !important;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    position: relative;
    flex-shrink: 0;
    z-index: 1;
    isolation: isolate;
    /* Strict containment - nothing escapes */
    contain: strict;
    /* Create a hard boundary - nothing can escape this container */
    position: relative;
}

.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-height: 320px;
    z-index: 1;
    isolation: isolate;
    overflow: hidden !important;
    /* Strict containment - clip all children */
    contain: strict;
    /* Create hard boundary */
    position: relative;
}

.carousel-track {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.carousel-track img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.5s ease-in-out;
}

.carousel-track img:first-child {
    position: relative;
}

/* Carousel Navigation Buttons */
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    /* Strictly contain within carousel container - prevent overflow */
    max-width: calc(100% - 24px);
    max-height: 44px;
    /* Ensure buttons cannot escape the image container */
    top: clamp(22px, 50%, 276px);
    /* Ensure buttons are positioned relative to carousel-container only */
    position: absolute;
}

.carousel-prev {
    left: 12px;
    right: auto;
}

.carousel-next {
    right: 12px;
    left: auto;
}

.project-image-carousel:hover .carousel-btn,
.carousel-btn:focus {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 0, 0, 0.15);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-btn i {
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Carousel Indicators */
.carousel-indicators {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 20px;
    align-items: center;
    justify-content: center;
    /* Ensure indicators stay within image area */
    max-width: calc(100% - 24px);
    pointer-events: auto;
    /* Strictly contain within carousel container */
    max-height: 40px;
    /* Ensure indicators stay at bottom of image and cannot escape */
    bottom: 16px;
    top: auto;
    /* Position relative to carousel-container only */
    position: absolute;
}

.carousel-indicators .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.carousel-indicators .indicator.active {
    background: rgba(255, 255, 255, 1);
    width: 24px;
    border-radius: 4px;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.carousel-indicators .indicator:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

/* Project Content - Optimized Text Layout */
.project-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    /* Allow flex shrinking */
    overflow: hidden;
    /* Prevent content overflow */
    position: relative;
    z-index: 1000;
    background: var(--background-light);
    isolation: isolate;
    /* Ensure content is above carousel and properly separated */
    margin-top: 0;
    /* Create clear boundary - ensure separation from image */
    border-top: 1px solid transparent;
    /* Ensure content renders above carousel elements */
    transform: translateZ(0);
    will-change: transform;
}

.project-content h3 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.project-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 0 1 auto;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Project Facts - 2 Column Layout */
.project-facts {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
    flex: 0 0 auto;
    min-height: 0;
}

.project-facts li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.project-facts li i {
    color: var(--primary-color);
    font-size: 0.875rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
    width: 16px;
}

.project-facts li strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 0.25rem;
}

/* Project Button */
.project-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    margin-top: auto;
    margin-bottom: 0;
    width: 100%;
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
    z-index: 1;
    isolation: isolate;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.project-btn::before,
.project-btn::after {
    content: none !important;
    display: none !important;
}

.project-btn>* {
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.project-btn span {
    display: inline-block;
    line-height: 1.5;
    white-space: nowrap;
    position: relative;
    z-index: 2;
    text-shadow: none;
    outline: none;
    -webkit-text-stroke: 0;
    margin: 0;
    padding: 0;
}

.project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.project-btn:active {
    transform: translateY(0);
}

.project-btn i {
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
    font-size: 0.9375rem;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    text-shadow: none;
    outline: none;
    -webkit-text-stroke: 0;
    margin-left: 0.75rem;
    margin-right: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    width: auto;
    height: auto;
}

.project-btn:hover i {
    transform: translateX(4px);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .project-card {
        width: 480px;
        min-width: 480px;
        max-width: 500px;
        min-height: 560px;
    }

    .project-image-carousel {
        height: 300px;
        min-height: 300px;
        max-height: 300px;
    }
}

@media (max-width: 1024px) {
    .project-cards {
        padding: 2rem 0;
    }

    .project-card {
        width: 420px;
        min-width: 420px;
        max-width: 440px;
        min-height: 540px;
    }

    .project-image-carousel {
        height: 280px;
        min-height: 280px;
        max-height: 280px;
    }

    .project-facts {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .use-cases-header h2 {
        font-size: 2rem;
    }

    .use-cases-header p {
        font-size: 1.125rem;
    }
}

@media (max-width: 768px) {
    .use-cases {
        padding: 4rem 0;
    }

    .use-cases-header {
        margin-bottom: 3rem;
        padding: 0 1rem;
    }

    .use-cases-header h2 {
        font-size: 1.75rem;
    }

    .use-cases-header p {
        font-size: 1rem;
    }

    .project-cards {
        padding: 2rem 0;
    }

    .project-card {
        width: 360px;
        min-width: 360px;
        max-width: 380px;
        min-height: 520px;
    }

    .project-image-carousel {
        height: 260px;
        min-height: 260px;
        max-height: 260px;
    }

    .project-content {
        padding: 1.25rem;
    }

    .project-content h3 {
        font-size: 1.125rem;
    }

    .project-description {
        font-size: 0.875rem;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    .project-facts {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .project-facts li {
        font-size: 0.8125rem;
        gap: 0.5rem;
    }

    .carousel-btn {
        width: 40px;
        height: 40px;
        opacity: 0.8;
    }

    .carousel-prev {
        left: 8px;
    }

    .carousel-next {
        right: 8px;
    }

    .carousel-indicators {
        bottom: 12px;
        padding: 6px 10px;
        background: rgba(0, 0, 0, 0.4);
    }

    .carousel-indicators .indicator {
        width: 6px;
        height: 6px;
    }

    .carousel-indicators .indicator.active {
        width: 20px;
    }
}

@media (max-width: 480px) {
    .use-cases {
        padding: 3rem 0;
    }

    .project-cards {
        padding: 2rem 0;
    }

    .project-card {
        width: 300px;
        min-width: 300px;
        max-width: 320px;
        min-height: 500px;
    }

    .project-image-carousel {
        height: 240px;
        min-height: 240px;
        max-height: 240px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-facts {
        grid-template-columns: 1fr;
    }
}