/* ==========================================================================
   Case Studies Showcase - Modern Playful Cards with Clean Design
   ========================================================================== */

.case-studies-draggable {
    position: relative;
    background: transparent !important;
    min-height: unset;
    padding: 2rem 0 1.5rem 0;
    overflow: visible; /* Allow cards to be dragged outside this container */
}

/* Subtle background pattern */
.case-studies-draggable::before {
    content: none !important;
}

/* Individual Drag Indicators for each card */
.case-card-drag {
    position: absolute;
    width: 480px;
    cursor: grab;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    top: 0; /* Start from top */
    left: 0; /* Start from left */
    /* Remove transform centering */
    z-index: 10; /* Between drag area and header */
}

.case-card-drag.has-been-dragged .drag-me-indicator {
    opacity: 0;
    transform: translateX(-50%) scale(0.8);
}

.drag-me-badge {
    background: #FFB347;
    color: #1a1a1a;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 800;

    letter-spacing: 0.02em;
    box-shadow: 
        0 4px 12px rgba(255, 179, 71, 0.3),
        0 0 0 3px #FEF7E7,
        0 0 0 6px #FFB347;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transform: rotate(-5deg);
    animation: bounceFloat 2s ease-in-out infinite;
}

/* Playful cursor icon */
.drag-me-badge::before {
    content: '👆';
    font-size: 1.25rem;
    animation: wiggle 2s ease-in-out infinite;
}

/* Arrow pointing down to card */
.drag-me-badge::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #FFB347;
}

@keyframes bounceFloat {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    50% { transform: rotate(-5deg) translateY(-10px); }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

/* Section Header - Reduce spacing */
.case-studies-draggable .section-header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 20; /* Higher z-index */
    padding: 0 2rem;
    pointer-events: none; /* Allow dragging through header */
}

.case-studies-draggable .section-header * {
    pointer-events: auto; /* But keep text/links clickable */
}

.case-studies-draggable .section-title {
    font-size: clamp(2.5rem, 6vw, 4rem); /* Reduced from clamp(3rem, 8vw, 6rem) */
    font-weight: 900;

    letter-spacing: -0.04em;
    line-height: 0.9;
    color: #1a1a1a;
    margin: 0 0 1rem 0; /* Reduced bottom margin */
    position: relative;
    display: inline-block;
}

/* Fun underline decoration */
.case-studies-draggable .section-title::after {
    content: '';
    position: absolute;
    bottom: -5px; /* Moved closer from -10px */
    left: 0;
    width: 100%;
    height: 6px; /* Slightly thinner */
    background: #FFB347;
    border-radius: 3px;
    transform: skewY(-2deg);
}

.case-studies-draggable .section-description {
    font-size: 1rem; /* Reduced from 1.375rem */
    line-height: 1.4; /* Tighter line height */
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
    
    /* Limit to 3 lines with ellipsis if too long */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Drag Area - Adjust height */
.content-drag-area {
    position: absolute; /* Changed from relative */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    padding: 0; /* Remove padding */
    z-index: 1; /* Below header and instructions */
}

/* Modern Playful Cards - LARGER SIZE */
.case-card-drag {
    position: absolute;
    width: 480px; /* Increased from 400px */
    cursor: grab;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.case-card-drag:active {
    cursor: grabbing;
}

/* Card with thick border and rounded corners */
.case-card-inner {
    background: white;
    border: 4px solid #1a1a1a;
    border-radius: 32px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    transform-style: preserve-3d;
    box-shadow: 
        8px 8px 0 #1a1a1a,
        8px 8px 20px rgba(0, 0, 0, 0.1);
}

/* Color accents for different cards */
.case-card-drag[data-index="0"] .case-card-inner { border-color: #FFB347; box-shadow: 8px 8px 0 #FFB347, 8px 8px 20px rgba(255, 179, 71, 0.2); }
.case-card-drag[data-index="1"] .case-card-inner { border-color: #47B3FF; box-shadow: 8px 8px 0 #47B3FF, 8px 8px 20px rgba(71, 179, 255, 0.2); }
.case-card-drag[data-index="2"] .case-card-inner { border-color: #FF47B3; box-shadow: 8px 8px 0 #FF47B3, 8px 8px 20px rgba(255, 71, 179, 0.2); }
.case-card-drag[data-index="3"] .case-card-inner { border-color: #B347FF; box-shadow: 8px 8px 0 #B347FF, 8px 8px 20px rgba(179, 71, 255, 0.2); }
.case-card-drag[data-index="4"] .case-card-inner { border-color: #47FFB3; box-shadow: 8px 8px 0 #47FFB3, 8px 8px 20px rgba(71, 255, 179, 0.2); }
.case-card-drag[data-index="5"] .case-card-inner { border-color: #FFE747; box-shadow: 8px 8px 0 #FFE747, 8px 8px 20px rgba(255, 231, 71, 0.2); }

/* Hover effects */
.case-card-drag:hover .case-card-inner {
    transform: translateY(-4px) rotate(1deg);
    box-shadow: 
        12px 12px 0 currentColor,
        12px 12px 30px rgba(0, 0, 0, 0.15);
}

/* Dragging state */
.case-card-drag.is-dragging .case-card-inner {
    transform: scale(1.05) rotate(-2deg);
    box-shadow: 
        0 0 0 currentColor,
        0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Card Image Container - LARGER */
.case-card-image {
    position: relative;
    width: 100%;
    height: 320px; /* Increased from 260px */
    overflow: hidden;
    background: #f5f5f5;
}

/* Image styling */
.case-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.case-card-drag:hover .case-card-image img {
    transform: scale(1.05);
}

/* Fun image overlay on hover */
.case-card-image::after {
    content: '👀';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.9);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.case-card-drag:hover .case-card-image::after {
    transform: translate(-50%, -50%) scale(1);
}

/* Card Content - ADJUSTED FOR LARGER CARDS */
.case-card-content {
    padding: 2.5rem; /* Increased from 2rem */
    background: white;
    position: relative;
    min-height: 160px; /* Increased from 140px */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Playful typography - LARGER */
.case-card-title {
    font-size: 2.25rem; /* Increased from 2rem */
    font-weight: 900;

    letter-spacing: -0.03em;
    line-height: 1;
    margin: 0 0 1.5rem 0;
    color: #1a1a1a;
    position: relative;
    z-index: 1;
}

.case-card-title a {
    color: inherit;
    text-decoration: none;
    position: relative;
    display: inline-block;
    transition: color 0.3s ease;
}

/* Underline animation on hover */
.case-card-title a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 4px;
    background: currentColor;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.case-card-title a:hover {
    color: #FFB347;
}

.case-card-title a:hover::after {
    width: 100%;
}

/* Colorful Tags */
.case-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
}

.case-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #1a1a1a;
    border-radius: 50px;
    font-size: 0.8rem; /* Slightly larger */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

/* Alternating tag colors */
.case-tag:nth-child(1) { background: #FFB347; color: #1a1a1a; }
.case-tag:nth-child(2) { background: #47B3FF; color: white; }
.case-tag:nth-child(3) { background: #FF47B3; color: white; }
.case-tag:nth-child(4) { background: #B347FF; color: white; }

.case-tag:hover {
    transform: translateY(-2px) rotate(-2deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Remove drag-instructions styles */
.drag-instructions {
    display: none !important;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .case-card-drag {
        width: 340px; /* Still larger than original 320px */
    }
    
    .case-card-image {
        height: 240px;
    }
    
    .case-card-title {
        font-size: 1.75rem;
    }
    
    .case-card-content {
        padding: 2rem;
        min-height: 140px;
    }
    
    .case-tag {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }
    

    
    .case-card-inner {
        box-shadow: 
            6px 6px 0 currentColor,
            6px 6px 15px rgba(0, 0, 0, 0.1);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .case-card-drag.is-loaded,
    .drag-indicator,
    .drag-me-badge {
        animation: none;
    }
    

}


/* For larger screens, ensure cards don't go too far */
@media (min-width: 1400px) {
    .content-drag-area {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* ==========================================================================
   Case Studies Showcase - Grown-up Stacked Cards (Simple Layout)
   ========================================================================== */

.case-studies-grownup {
    position: relative;
    background: #ededed;
    min-height: 900px !important;
    padding: 0 0 1rem 0; /* Reduce bottom padding */
    overflow: visible; /* Allow cards to be dragged within the entire section */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.case-studies-header-on-circle {
    position: relative;
    z-index: 20;
    width: 100%;
    text-align: center;
    margin-bottom: 2rem;
    margin-top: 3rem;
    pointer-events: none; /* Allow dragging through header */
}

.case-studies-header-on-circle * {
    pointer-events: auto; /* But keep text clickable */
}

.case-studies-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: #222;
    letter-spacing: 0.04em;
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    line-height: 1.1;
}

.case-studies-description {
    font-size: 1.15rem;
    color: #444;
    max-width: 600px;
    margin: 0 auto;
    font-weight: 400;
    opacity: 0.95;
}

.case-studies-stack-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    gap: 2.5rem;
    margin-top: 0;
    padding-top: 2rem; /* Add space from top */
    pointer-events: none; /* Allow dragging through this container */
}

/* Ensure background image displays properly on the draggable area */
.case-studies-stack-area[style*="background-image"] {
    background-attachment: fixed;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

.case-card-grownup {
    position: absolute;
    width: 520px;
    height: auto;
    min-height: 0;
    max-width: 98vw;
    max-height: 98vw;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 1rem;
    pointer-events: auto; /* Re-enable pointer events for cards */
    cursor: grab;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.case-card-grownup:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.15);
}

.case-card-grownup:active {
    cursor: grabbing;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1), 0 3px 10px rgba(0, 0, 0, 0.08);
}

.card-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
}
.card-row-title-tags {
    padding: 1.1rem 2rem 0.7rem 2rem;
    border-bottom: 1px solid #eee;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    background: white;
    border-radius: 1rem 1rem 0 0;
}
.card-title {
    font-size: 1.7rem;
    font-weight: 900;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.18;
}
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.card-tag {
    font-size: 0.92rem;
    font-weight: 700;
    padding: 0.32rem 1.05rem;
    border-radius: 1rem;
    letter-spacing: 0.04em;
    color: black;
    background: transparent !important;
    border: 2px solid black;
    transition: all 0.3s ease;
}

.card-tag:hover {
    background: black !important;
    color: white;
}
.card-row-image {
    width: 100%;
    justify-content: center;
    align-items: center;
    padding: 0;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}
.card-row-image img {
    width: 100%;
    height: 392px;
    min-height: 320px;
    max-height: 440px;
    object-fit: cover;
    border-radius: 0 0 0 0;
}
.card-row-button {
    padding: 0.7rem 0 0.9rem 2rem;
    width: 100%;
    justify-content: flex-start;
    align-items: center;
    border-top: 1px solid #eee;
    background: white;
    border-radius: 0 0 1rem 1rem;
}
.card-link-btn {
    font-size: 1.08rem;
    font-weight: 700;
    padding: 0;
    color: #1a1a1a;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.7em;
}
.arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.8em;
    height: 1.7em;
    font-size: 1.25em;
    font-weight: 900;
    margin-left: 0.4em;
    color: #111;
    border: 2px solid #111;
    border-radius: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
    line-height: 1;
}
.card-link-btn:hover .arrow-btn {
    background: #111;
    color: #fff;
    border-color: #111;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}

/* Remove accent/vertical/horizontal split styles */
.card-accent-vertical, .card-accent-horizontal, .card-main-horizontal, .align-bottom-right, .align-bottom-center {
    display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
    .case-card-grownup {
        width: 95vw;
        height: 95vw;
        min-width: 0;
        min-height: 0;
        max-width: 420px;
        max-height: 420px;
        border-radius: 1rem;
    }
    .card-row-image img {
        height: 220px;
        min-height: 140px;
        max-height: 260px;
    }
    .card-row-title-tags {
        padding: 0.7rem 1rem 0.4rem 1rem;
    }
    .card-row-button {
        padding: 0.5rem 0 0.7rem 1rem;
    }
    .card-title {
        font-size: 1.25rem;
    }
    .arrow-btn {
        width: 2em;
        height: 1.2em;
        font-size: 1em;
        margin-left: 0.3em;
        border-radius: 2rem;
    }
}
@media (max-width: 600px) {
    .case-studies-title {
        font-size: 2.1rem;
    }
    .case-card-grownup {
        width: 99vw;
        height: 99vw;
        max-width: 98vw;
        max-height: 98vw;
        border-radius: 1rem;
    }
    .card-row-title-tags {
        padding: 0.5rem 0.7rem 0.3rem 0.7rem;
    }
    .card-row-image img {
        height: 110px;
        min-height: 70px;
        max-height: 140px;
    }
    .card-row-button {
        padding: 0.4rem 0 0.5rem 0.7rem;
    }
    .card-title {
        font-size: 1.08rem;
    }
    .arrow-btn {
        width: 1.3em;
        height: 0.8em;
        font-size: 0.85em;
        margin-left: 0.2em;
        border-radius: 2rem;
    }
}

/* Pin-spacer background now copied via JS; keep it transparent by default */
.pin-spacer {
    background: transparent;
}

/* --------------------------------------------------------------------------
   Section-wide background – single fixed layer (image + optional pattern)
   -------------------------------------------------------------------------- */
.case-studies-showcase {
    position: relative;
    min-height: 100vh;
    height: 100vh !important; /* override ScrollTrigger inline height */
    padding-bottom: 1rem; /* keeps slight gap for cards shadow */
}

/* One fixed pseudo-element holds the real background artwork so it doesn't move
   when the section is pinned/unpinned. We read the URL from the inline
   CSS variable `--case-bg` that PHP injects. The subtle radial-gradient
   pattern is layered on top (first background-image layer). */
.case-studies-showcase::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1; /* behind everything */
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 179, 71, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(71, 179, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 71, 179, 0.08) 0%, transparent 50%),
        var(--case-bg, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: var(--bg-opacity, 1);
    transform: scale(var(--bg-scale, 1));
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ==========================================================================
   Firefox-specific fixes for macOS drag functionality
   ========================================================================== */
@supports (-moz-appearance: none) {
    .case-card-drag,
    .case-card-grownup {
        /* Force hardware acceleration in Firefox */
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        -moz-backface-visibility: hidden;
        perspective: 1000px;
        /* Prevent text/image selection during drag */
        -moz-user-select: none;
        -moz-user-drag: none;
    }
    
    .case-card-drag *,
    .case-card-grownup * {
        /* Prevent child elements from being draggable */
        -moz-user-select: none;
        -moz-user-drag: none;
    }
    
    /* Ensure proper cursor in Firefox */
    .case-card-drag:hover,
    .case-card-grownup:hover {
        cursor: -moz-grab;
        cursor: grab;
    }
    
    .case-card-drag:active,
    .case-card-grownup:active {
        cursor: -moz-grabbing;
        cursor: grabbing;
    }
    
    /* Fix for transform rendering issues in Firefox */
    .case-studies-draggable {
        transform-style: preserve-3d;
        -moz-transform-style: preserve-3d;
    }
    
    /* Optimize rendering performance */
    .case-card-drag img,
    .case-card-grownup img {
        transform: translateZ(0);
        -moz-transform: translateZ(0);
    }
}