/* case-studies.css
   Responsive sticky sequential images section optimized for mobile & desktop.
   Important: keep media queries at the bottom for overrides.
*/

/* Reset & globals */
html, body { height: 100%; margin: 0; padding: 0; }
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background: #071426; color: #fff; overflow-x: hidden; }

/* Case Studies Section */
.case-studies-section {
    background: linear-gradient(135deg, #000428, #004e92);
    position: relative;
    padding: 36px 0 80px 0;
    min-height: auto;
    backface-visibility: hidden;
}

/* Container (centered content) */
.case-studies-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.case-studies-header {
    position: relative;
    padding: 16px 20px 10px 20px;
    text-align: center;
    z-index: 10;
    margin-bottom: 6px;
}

.case-studies-title {
    font-family: 'Six Caps', sans-serif;
    font-size: 5rem;
    font-weight: 400;
    letter-spacing: 4px;
    margin: 0 0 18px 0;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.case-studies-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #c4c5c7;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin: 0;
}

/* Sequential wrapper (stacked sticky items) */
.sequential-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 90vh;
    padding: 0 20px 100px 20px;
}

/* Each sticky item */
.sequential-item {
    position: sticky;
    top: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1 !important;
    visibility: hidden;
    transform: translate3d(0, 25vh, 0);
    transition: visibility 0s linear 0s; /* Turn off transform/opacity transitions */
    will-change: transform, visibility, opacity;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    padding: 4vh 0;
}

.sequential-item.visible {
    visibility: visible;
    transform: translate3d(0, 0, 0);
    opacity: 1 !important;
}

/* Image wrapper — JS controls width; provide safe defaults */
.sequential-image-wrapper {
    position: relative;
    height: 84vh;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0,0,0,0.45);
    background: #000;
    will-change: width, transform;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 300ms ease;
}

/* Images */
.sequential-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    border-radius: 0;
    opacity: 1 !important;
    backface-visibility: hidden;
    image-rendering: optimizeQuality;
    -webkit-user-drag: none;
    user-select: none;
    pointer-events: none;
}

/* overlay & content */
.sequential-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.45) 65%);
    padding: 0; color: white;
    border-radius: 0;
    opacity: 1 !important;
    will-change: opacity;
    display: block;
}

.sequential-content { position: relative; width: 100%; height: 100%; margin: 0; padding: 0; }

.sequential-title {
    position: absolute;
    top: 36px; left: 36px;
    font-family: 'Six Caps', sans-serif !important;
    font-size: 3.5rem;
    font-weight: 400;
    letter-spacing: 4px;
    margin: 0;
    color: #ffffff;
    line-height: 0.9;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.5);
}

.sequential-meta { position: absolute; bottom: 36px; left: 36px; display:flex; flex-direction:column; gap:10px; }

.sequential-location,
.sequential-date {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: #ffffff;
    font-weight: 400;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(6px);
    padding: 8px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.14);
}

/* small visual niceties */
.sequential-image-wrapper:focus { outline: none; }

/* ----------------------------
   MOBILE / TABLET ADJUSTMENTS
   ---------------------------- */
@media (max-width: 991px) {
    .case-studies-title { font-size: 3.4rem; }
    .sequential-wrapper { gap: 42vh; }
    .sequential-image-wrapper { height: 74vh; border-radius: 4px; box-shadow: 0 12px 48px rgba(0,0,0,0.5); }
    .sequential-title { font-size: 2.4rem; top: 22px; left: 18px; }
    .sequential-meta { bottom: 22px; left: 18px; }

    /* IMPORTANT: remove performance rules that can break sticky on mobile */
    .case-studies-section, .case-studies-container { contain: none; transform: none; }
}

@media (max-width: 767px) {
    .case-studies-title { font-size: 2.2rem; letter-spacing: 2px; }
    .sequential-wrapper { gap: 34vh; padding-bottom: 72px; }
    .sequential-image-wrapper { height: 68vh; }
    .sequential-title { font-size: 1.8rem; top: 18px; left: 14px; }
    .sequential-meta { bottom: 18px; left: 14px; }
}

/* optional: reduce pointer capture so swipes feel native on mobile */
@media (pointer: coarse) {
    .sequential-item { -webkit-tap-highlight-color: transparent; }
}
