.case-study {
    padding: calc(60px + 0.75rem) 0 0.75rem;
    height: 100vh;
    height: 100dvh;
    background: var(--dark-blue-grey);
    display: flex;
    flex-direction: column;
}

.case-study h1 {
    flex: 0 0 auto;
    text-align: center;
    margin-bottom: 0.85rem;
    color: var(--heading-color);
    font-size: clamp(1.5rem, 3.4vw, 2.4rem);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-family: var(--header-font);
    font-weight: 500;
    position: relative; /* Ensure it's above other elements */
    z-index: 2;
}

/* Carousel Styles — flex fills the remaining height so a slide is one screen */
.case-study-carousel {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    background: rgba(123, 140, 222, 0.2);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.case-study-carousel > .swiper-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* Force each fade slide to the carousel width (Swiper's inline px width can go
   stale on resize/init and let a wide screenshot overflow the viewport) */
.case-study-carousel .swiper-slide {
    width: 100% !important;
}

.swiper-slide {
    background: transparent;
    height: 100%;
}

.slide-content {
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
}

/* Base image styles — capped to the viewport so image + caption fit one screen */
.slide-images {
    width: 100%;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.slide-images img {
    border-radius: 8px;
    border: 1px solid rgba(232, 224, 209, 0.14);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 42vh;
    max-height: 42dvh;
    object-fit: contain;
}

/* Single large image — cap the container width; the img stays within 100% of it */
.slide-images:not(.dual):not(.mobile-screenshot) {
    max-width: 900px;
    margin: 0 auto;
}

/* Dual images */
.slide-images.dual {
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.slide-images.dual img {
    min-width: 0;
    width: auto;
    max-width: 450px;
}

/* Mobile screenshots */
.slide-images.mobile-screenshot img {
    width: auto;
    max-width: 300px;
}

.slide-text {
    flex: 0 0 auto;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.slide-text h2 {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    margin-bottom: 0.75rem;
    color: var(--heading-color);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    font-family: var(--header-font);
    font-weight: 500;
}

.slide-text p {
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.5;
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    max-width: 1000px;
    margin: 0 auto;
}

.link-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.link-separator {
    color: var(--primary-color);
    opacity: 0.7;
}

.slide-link {
    color: var(--highlight-color);
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.3s ease;
}

.slide-link:hover {
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--highlight-color);
}

/* Navigation Buttons */
.swiper-button-next,
.swiper-button-prev {
    color: var(--primary-color);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    color: var(--highlight-color);
}

.case-study-carousel .swiper-pagination {
    position: static;
    flex: 0 0 auto;
    margin-top: 0.75rem;
}

.swiper-pagination-bullet {
    background: var(--primary-color);
    opacity: 0.7;
}

.swiper-pagination-bullet-active {
    background: var(--highlight-color);
    opacity: 1;
}

/* Coming Soon Animation */
.coming-soon {
    position: relative;
    overflow: hidden;
    background: linear-gradient(45deg, #2c3e50, #3498db);
    border-radius: 8px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
}

.coming-soon::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(45deg);
    animation: shine 3s infinite;
}

.coming-soon h3 {
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    animation: pulse 2s infinite;
    z-index: 1;
}

@keyframes shine {
    0% {
        transform: translateX(-50%) translateY(-50%) rotate(45deg);
    }
    100% {
        transform: translateX(150%) translateY(150%) rotate(45deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .case-study {
        padding-top: calc(60px + 1rem);
    }

    .case-study h1 {
        padding: 0 1rem;
        margin-top: 0;
        margin-bottom: 1rem;
    }

    .case-study-carousel {
        margin-top: 0;
        padding: 1rem;
    }

    /* Narrow screens wrap captions to more lines, so give the image less height */
    .slide-images img {
        max-height: 36vh;
        max-height: 36dvh;
    }

    /* Stack the paired images and split the smaller budget between them */
    .slide-images.dual {
        flex-direction: column;
        gap: 0.75rem;
    }

    .slide-images.dual img {
        width: 100%;
        max-width: 100%;
        max-height: 26vh;
        max-height: 26dvh;
    }
}

/* Short viewports: keep the caption on-screen by shrinking the image */
@media (max-height: 820px) {
    .slide-images img {
        max-height: 38vh;
        max-height: 38dvh;
    }
}

@media (max-height: 700px) {
    .slide-content {
        gap: 0.85rem;
    }

    .slide-images img {
        max-height: 32vh;
        max-height: 32dvh;
    }
}

@media (max-height: 600px) {
    .slide-content {
        gap: 0.6rem;
    }

    .case-study h1 {
        font-size: 1.4rem;
        margin-bottom: 0.5rem;
    }

    .slide-images img {
        max-height: 26vh;
        max-height: 26dvh;
    }
}

/* Fullscreen Image Viewer */
.image-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.fullscreen-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.image-container:hover .fullscreen-indicator {
    opacity: 1;
}

.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fullscreen-overlay.active {
    display: flex;
    opacity: 1;
}

.fullscreen-image {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.fullscreen-overlay.active .fullscreen-image {
    transform: scale(1);
    opacity: 1;
}

.close-fullscreen {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    padding: 10px;
    z-index: 1001;
    opacity: 0;
    transition: color 0.3s ease, opacity 0.3s ease;
}

.fullscreen-overlay.active .close-fullscreen {
    opacity: 1;
}

.close-fullscreen:hover {
    color: var(--highlight-color);
} 