/* ===================================
   CASE STUDIES / SUCCESS STORIES
   =================================== */

.case-studies {
    background: var(--bg-darker);
    padding: var(--section-padding) 0;
    position: relative;
    overflow: hidden;
}

.case-studies--modern {
    isolation: isolate;
}

.case-studies--modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 215, 0, 0.24) 50%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.case-studies--modern::after {
    content: '';
    position: absolute;
    width: min(100%, 600px);
    height: 280px;
    bottom: 8%;
    right: -5%;
    background: radial-gradient(ellipse 70% 70% at 75% 50%, rgba(255, 215, 0, 0.08) 0%, transparent 72%);
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
}

.case-studies__inner {
    position: relative;
    z-index: 1;
}

.case-studies--modern .section-header {
    text-align: center;
}

.case-study-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 16px 0;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.case-study-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    margin-bottom: 80px;
    padding: 48px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-2xl, 28px);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
}

.case-study-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 215, 0, 0.32);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    box-shadow: 
        0 12px 40px rgba(255, 215, 0, 0.3),
        0 2px 0 rgba(255, 215, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.case-study-item:last-child {
    margin-bottom: 0;
}

/* Alternate layout - Reverse order on even items */
.case-study-item:nth-child(even) .case-study-content {
    order: 2;
}

.case-study-item:nth-child(even) .case-study-image {
    order: 1;
}

/* Content */
.case-study-content {
    order: 1;
}

.case-study-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 8px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.case-study-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.case-study-description {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 24px;
}

.case-study-challenge {
    margin-bottom: 24px;
}

.case-study-challenge h4 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 8px;
}

.case-study-challenge p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.7;
}

/* Metrics */
.case-study-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
}

.metric {
    text-align: center;
    padding: 20px;
    background: rgba(255, 215, 0, 0.05);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
}

.metric-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Image */
.case-study-image {
    order: 2;
    position: relative;
    border-radius: var(--radius-xl, 24px);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.1) 0%, 
        rgba(255, 165, 0, 0.05) 50%, 
        rgba(255, 237, 78, 0.08) 100%
    );
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Placeholder Pattern */
.case-study-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(30deg, rgba(255, 215, 0, 0.03) 12%, transparent 12.5%, transparent 87%, rgba(255, 215, 0, 0.03) 87.5%, rgba(255, 215, 0, 0.03)),
        linear-gradient(150deg, rgba(255, 215, 0, 0.03) 12%, transparent 12.5%, transparent 87%, rgba(255, 215, 0, 0.03) 87.5%, rgba(255, 215, 0, 0.03)),
        linear-gradient(30deg, rgba(255, 215, 0, 0.03) 12%, transparent 12.5%, transparent 87%, rgba(255, 215, 0, 0.03) 87.5%, rgba(255, 215, 0, 0.03)),
        linear-gradient(150deg, rgba(255, 215, 0, 0.03) 12%, transparent 12.5%, transparent 87%, rgba(255, 215, 0, 0.03) 87.5%, rgba(255, 215, 0, 0.03));
    background-size: 80px 140px;
    background-position: 0 0, 0 0, 40px 70px, 40px 70px;
    opacity: 0.5;
}

/* Placeholder Icon */
.case-study-image::after {
    content: '';
    width: 120px;
    height: 120px;
    background: rgba(255, 215, 0, 0.15);
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.case-study-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* Hide placeholder when image loads */
.case-study-image:has(img[src]:not([src=""])) {
    background: rgba(255, 255, 255, 0.03);
}

.case-study-image:has(img[src]:not([src=""]))::before,
.case-study-image:has(img[src]:not([src=""]))::after {
    display: none;
}

.case-study-item:hover .case-study-image img {
    transform: scale(1.05);
}

/* Tech Stack */
.case-study-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
}

.tech-tag {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 1024px) {
    .case-study-item {
        gap: 40px;
        padding: 40px;
    }
    
    .case-study-title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .case-studies--modern::after {
        display: none;
    }

    .case-study-eyebrow {
        font-size: 11px;
        letter-spacing: 0.12em;
    }

    .case-study-item {
        grid-template-columns: 1fr !important;
        gap: 32px;
        padding: 32px 24px;
        margin-bottom: 40px;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.08) !important;
    }
    
    /* Force same order on mobile - content first, image second */
    .case-study-item:nth-child(even) .case-study-content,
    .case-study-content {
        order: 1 !important;
    }
    
    .case-study-item:nth-child(even) .case-study-image,
    .case-study-image {
        order: 2 !important;
    }
    
    .case-study-title {
        font-size: 24px;
    }
    
    .case-study-metrics {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .metric {
        padding: 16px 12px;
    }
    
    .metric-value {
        font-size: 24px;
    }
    
    .metric-label {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .case-study-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

