/* ==========================================================================
   Case Study Pages — themed to match home.css design system
   ========================================================================== */

.case-study {
    padding: calc(5.5rem + 0.75rem) var(--page-pad) 0.75rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.case-study h1 {
    flex: 0 0 auto;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--fg);
    font-size: clamp(1.5rem, 3.4vw, 2.8rem);
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* --- Genesis-style static layout --- */
.cs-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 0 3rem;
}

.cs-intro {
    max-width: 900px;
    margin: 0 auto 3rem;
    text-align: center;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.8;
    color: var(--fg-dim);
}

.cs-block {
    max-width: 1200px;
    margin: 0 auto 3rem;
}
.cs-block h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--fg);
    margin-bottom: 2rem;
    text-align: left;
    letter-spacing: -0.01em;
}
.cs-block h2::after { display: none; }

.cs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    align-items: start;
}

.cs-col {
    margin: 0;
    text-align: center;
}

.cs-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.32rem 0.9rem;
    border-radius: 20px;
    margin-bottom: 0.9rem;
}
.cs-tag--before {
    background: var(--bg-elev);
    color: var(--fg-dim);
    border: 1px solid var(--line-strong);
}
.cs-tag--after {
    background: var(--blue);
    color: #fff;
}

.cs-img-wrap img {
    border-radius: 10px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    width: 100%;
    height: auto;
    display: block;
}

.cs-caption {
    max-width: 950px;
    margin: 1.5rem auto 0;
    text-align: center;
    color: var(--fg-dim);
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.75;
}

.cs-cta {
    text-align: center;
    margin-top: 1rem;
}

/* --- Carousel layout (TranspaRENT) --- */
.case-study-carousel {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    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;
}

.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;
}

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

.slide-images img {
    border-radius: 10px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 42vh;
    max-height: 42dvh;
    object-fit: contain;
}

.slide-images:not(.dual):not(.mobile-screenshot) {
    max-width: 900px;
    margin: 0 auto;
}

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

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

.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-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.1rem);
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--fg);
    letter-spacing: -0.01em;
    text-align: center;
}
.slide-text h2::after { display: none; }

.slide-text p {
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.6;
    color: var(--fg-dim);
    max-width: 1000px;
    margin: 0 auto;
}

/* Navigation */
.case-study-carousel .swiper-button-next,
.case-study-carousel .swiper-button-prev {
    color: var(--fg-dim);
    transition: color 0.25s var(--ease);
}
.case-study-carousel .swiper-button-next:hover,
.case-study-carousel .swiper-button-prev:hover {
    color: var(--blue);
}

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

.case-study-carousel .swiper-pagination-bullet {
    background: var(--fg-faint);
    opacity: 1;
    transition: all 0.25s var(--ease);
}

.case-study-carousel .swiper-pagination-bullet-active {
    background: var(--blue);
    width: 24px;
    border-radius: 4px;
}

/* Fullscreen Image Viewer */
.slide-images img {
    cursor: pointer;
}

.fullscreen-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s var(--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 var(--ease), opacity 0.3s var(--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 var(--ease), opacity 0.3s var(--ease);
}
.fullscreen-overlay.active .close-fullscreen { opacity: 1; }
.close-fullscreen:hover { color: var(--blue); }

/* Responsive */
@media (max-width: 768px) {
    .case-study {
        padding-top: calc(5.5rem + 1rem);
    }
    .case-study h1 {
        padding: 0 1rem;
        margin-bottom: 1rem;
    }
    .case-study-carousel {
        padding: 1rem;
    }
    .slide-images img {
        max-height: 36vh;
        max-height: 36dvh;
    }
    .slide-images.dual {
        flex-direction: column;
        gap: 0.75rem;
    }
    .slide-images.dual img {
        width: 100%;
        max-width: 100%;
        max-height: 26vh;
        max-height: 26dvh;
    }
    .cs-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .cs-block h2 {
        font-size: 1.7rem;
    }
}

@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;
    }
}
