/* ==========================================================================
   CASE STUDY STYLES - Shared between Bunnings and TravelPerk
   ========================================================================== */

/* Contact Section - ensure light grey background on case study pages */
.contact-section {
    background-color: #F7F7F9;
}

/* Hide static header on case study pages - only show sticky header on scroll */
.header-container {
    display: none;
}

/* Sticky Header (Advanced version with dark mode + progress bar) */
.header-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.header-sticky-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 48px;
    display: flex;
    align-items: center;
    position: relative;
}

.header-sticky .back-link-sticky {
    position: absolute;
    left: 48px;
    margin-bottom: 0;
}

.header-sticky .header-container {
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

.header-sticky.visible {
    transform: translateY(0);
    opacity: 1;
}

.header-sticky.dark {
    background-color: rgba(0, 0, 0, 0.85);
}

.header-sticky.dark .back-link-sticky {
    color: rgba(255, 255, 255, 0.6);
}

.header-sticky.dark .back-link-sticky:hover {
    color: #ffffff;
}

.header-sticky.dark .back-link-sticky svg {
    color: rgba(255, 255, 255, 0.6);
}

.header-sticky.dark .time {
    color: rgba(255, 255, 255, 0.6);
    opacity: 0.5;
}

.header-sticky.dark nav a {
    color: rgba(255, 255, 255, 0.6);
}

.header-sticky.dark nav a.active {
    color: #ffffff;
    opacity: 1;
}

.header-sticky.dark nav a:hover {
    color: #ffffff;
}

.header-sticky.dark .hamburger span {
    background-color: #ffffff;
}

/* Progress Bar */
.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background-color: #000000;
    opacity: 1;
    width: 0%;
    transition: width 0.1s ease-out;
    z-index: 101;
}

.header-sticky.dark .progress-bar {
    background-color: #ffffff;
    opacity: 1;
}

/* Static Header */
header {
    padding: 32px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    z-index: 100;
    position: relative;
}

/* Navigation */
nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

nav a {
    color: #919191;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    transition: color 0.2s;
}

nav a.active {
    color: #1D1D1D;
}

nav a:hover {
    color: #1D1D1D;
}

/* Title Section */
.title-section {
    margin-top: 80px;
    margin-bottom: 48px;
}

.title-section h1 {
    margin-bottom: 16px;
}

/* Hero Image */
.hero-image {
    width: 100%;
    max-width: 860px;
    margin: 0 auto 80px auto;
    aspect-ratio: 16/10;
    background-color: #F7F7F9;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Case Study Sections */
.case-study-section {
    width: 100%;
    padding: 120px 0;
    scroll-margin-top: 80px;
}

.case-study-section.bg-white {
    background-color: #FFFFFF;
}

.case-study-section.bg-gray {
    background-color: #F7F7F9;
}

.case-study-section.bg-dark {
    background-color: #000000;
}

.case-study-section.bg-dark h1,
.case-study-section.bg-dark h2,
.case-study-section.bg-dark h3,
.case-study-section.bg-dark h4 {
    color: #FFFFFF;
}

.case-study-section.bg-dark .subtitle,
.case-study-section.bg-dark .body-text {
    color: rgba(255, 255, 255, 0.8);
}

.case-study-section.bg-dark .content-image {
    background-color: #000000;
}

.case-study-section.bg-dark .fade-left-consistency {
    background: linear-gradient(to right, #000000 0%, rgba(0, 0, 0, 0) 100%);
}

.case-study-section.bg-dark .fade-right-consistency {
    background: linear-gradient(to left, #000000 0%, rgba(0, 0, 0, 0) 100%);
}

.case-study-section.bg-dark .scroll-arrow {
    background: #000000;
    border: 1px solid rgba(29, 29, 29, 0.1);
    color: #FFFFFF;
}

.case-study-section.bg-dark .scroll-arrow:hover {
    background-color: #000000;
}

.case-study-section:first-of-type {
    padding-top: 80px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
    margin-top: 48px;
    margin-bottom: 32px;
}

.stat-item {
    text-align: left;
}

.stat-label {
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Inter', sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6em;
    color: #919191;
}

/* Info Section (Problem/Role/Approach/Outcome sections) */
.info-section {
    margin-bottom: 48px;
}

.info-section h3 {
    margin-bottom: 16px;
}

.info-section .body-text {
    font-size: 20px;
}

/* Approach List (numbered list for approach sections) */
.approach-list {
    margin-bottom: 48px;
}

.approach-item {
    margin-bottom: 32px;
}

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

.approach-item h3 {
    margin-top: 0;
    margin-bottom: 16px;
}

.approach-item .body-text {
    margin-bottom: 0;
}

/* Content Images */
.content-image {
    width: 100%;
    max-width: 860px;
    margin: 80px auto;
    aspect-ratio: auto;
    background-color: #F7F7F9;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.content-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
}

/* Image Grid (Side by Side) */
.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 48px;
}

.image-grid .content-image {
    margin-bottom: 0;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1D1D1D;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    transition: color 0.2s;
    margin-bottom: 48px;
}

.back-link:hover {
    color: #1D1D1D;
    opacity: 0.7;
}

.back-link svg {
    width: 16px;
    height: 16px;
    transform: rotate(180deg);
}

/* Quote Box */
.quote-box {
    background-color: #F7F7F9;
    border-left: 4px solid #1D1D1D;
    padding: 24px 32px;
    margin: 48px 0;
    border-radius: var(--radius-sm);
}

.quote-box h4 {
    margin-bottom: 16px;
    font-size: 16px;
    color: #919191;
}

.quote-box .body-text {
    margin-bottom: 0;
    color: #1D1D1D;
    font-style: italic;
}

/* SPACING FIX: Consistent spacing for section-content blocks */
/* Add margin-top to section-content when it follows a video or gallery */
.case-study-video + .section-content,
.consistency-gallery-container + .section-content,
.guidelines-cards-container + .section-content,
.before-after-container + .section-content {
    margin-top: 80px;
}

/* Add margin-top to videos and galleries when they follow section-content */
.section-content + .case-study-video,
.section-content + .consistency-gallery-container,
.section-content + .guidelines-cards-container,
.section-content + .before-after-container {
    margin-top: 80px;
}

/* Consistency Gallery */
.consistency-gallery-container {
    position: relative;
    margin-top: 48px;
    margin-bottom: 80px;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.consistency-gallery-scroll {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: 16px;
}

.consistency-gallery-scroll::-webkit-scrollbar {
    display: none;
}

.consistency-gallery-scroll .content-image {
    flex: 0 0 calc(100% - 120px);
    margin: 0;
    border: none;
}

.case-study-section.bg-dark .consistency-gallery-scroll .content-image {
    border: none;
}

/* Fade overlays for consistency gallery */
.fade-left-consistency,
.fade-right-consistency {
    position: absolute;
    top: 0;
    bottom: 56px;
    width: 120px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
}

.fade-left-consistency {
    left: 0;
    background: linear-gradient(to right, #F7F7F9 0%, rgba(247, 247, 249, 0) 100%);
    opacity: 0;
}

.fade-left-consistency.visible {
    opacity: 1;
}

.fade-right-consistency {
    right: 0;
    background: linear-gradient(to left, #F7F7F9 0%, rgba(247, 247, 249, 0) 100%);
}

.fade-right-consistency.hidden {
    opacity: 0;
}

/* Arrows container at bottom right */
.consistency-gallery-arrows {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    padding-right: 0;
}

/* Consistency gallery arrow styles */
.consistency-gallery-arrows .scroll-arrow {
    position: static;
    transform: none;
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 1px solid #919191;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.3s, background-color 0.2s;
    color: #1D1D1D;
    font-family: 'Inter', sans-serif;
}

/* Dark section: ensure visible keyline (bg-dark .scroll-arrow overrides with nearly-invisible rgba) */
.case-study-section.bg-dark .consistency-gallery-arrows .scroll-arrow {
    border: 1px solid #919191;
}

.case-study-section .container + .case-study-video {
    margin-top: 80px;
}

.case-study-video + .container .section-content {
    margin-top: 80px;
}

/* Gallery Video - for videos inside consistency galleries */
.consistency-gallery-scroll .content-image .gallery-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
/* Guidelines Cards Gallery (TravelPerk only) */
.guidelines-cards-container {
    position: relative;
    margin-top: 48px;
    margin-bottom: 80px;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.guidelines-cards-scroll {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.guidelines-cards-scroll::-webkit-scrollbar {
    display: none;
}

.guidelines-card {
    flex: 0 0 420px;
    background: #F7F7F9;
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guidelines-card-title {
    margin-bottom: 8px;
}

.guidelines-card-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guidelines-card-list li {
    font-family: 'Inter', sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.5em;
    color: #919191;
    padding-left: 16px;
    position: relative;
}

.guidelines-card-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #919191;
}

/* Fade overlays for guidelines */
.fade-left-guidelines,
.fade-right-guidelines {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s;
}

.fade-left-guidelines {
    left: 0;
    background: linear-gradient(to right, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
}

.fade-left-guidelines.visible {
    opacity: 1;
}

.fade-right-guidelines {
    right: 0;
    background: linear-gradient(to left, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
}

.fade-right-guidelines.hidden {
    opacity: 0;
}

/* Navigation arrows for guidelines */
.guidelines-cards-container .scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 1px solid rgba(29, 29, 29, 0.1);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: opacity 0.3s, background-color 0.2s;
    color: #1D1D1D;
    font-family: 'Inter', sans-serif;
}

.guidelines-cards-container .scroll-arrow svg {
    width: 16px;
    height: 16px;
}

.guidelines-cards-container .scroll-arrow:hover {
    background-color: #F7F7F9;
}

.scroll-arrow-left-guidelines {
    left: 0;
    opacity: 0;
    pointer-events: none;
}

.scroll-arrow-left-guidelines.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-arrow-right-guidelines {
    right: 0;
}

.scroll-arrow-right-guidelines.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Dark section variant */
.case-study-section.bg-dark .guidelines-card-image {
    background: #000000;
}

.case-study-section.bg-dark .guidelines-card-image-caption {
    color: rgba(255, 255, 255, 0.8);
}

.guidelines-card .body-text {
    margin-bottom: 0px;
    display: flex;
    gap: 16px;
}

.guidelines-card .body-text:last-child {
    margin-bottom: 16px;
}

.guidelines-card img {
    margin-top: 16px;
}

/* Before/After Slider - reusable across case studies */
.before-after-container {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 80px auto;
    aspect-ratio: 16/10;
    border-radius: 16px;
    overflow: hidden;
    background-color: #F7F7F9;
    cursor: ew-resize;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.before-after-container.dragging {
    cursor: grabbing;
}

.ba-before-wrapper,
.ba-after-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.ba-before-wrapper {
    clip-path: inset(0 50% 0 0); /* 50% initial - JS will sync */
    z-index: 2;
}

.ba-after-wrapper {
    clip-path: inset(0 0 0 50%); /* 50% initial - JS will sync */
    z-index: 1;
}

.ba-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ba-slider-track {
    position: absolute;
    top: 0;
    left: 50%;
    width: 0;
    height: 100%;
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ba-divider-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: #ffffff;
    transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

.ba-slider-button {
    position: relative;
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
    flex-shrink: 0;
    align-self: center;
    aspect-ratio: 1;
    background: #ffffff;
    border: 1px solid #919191;
    border-radius: var(--radius-full, 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    color: #1D1D1D;
}

.ba-slider-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background-color: #F7F7F9;
}

.ba-slider-button:active,
.before-after-container.dragging .ba-slider-button {
    cursor: grabbing;
    transform: scale(1.02);
}

.ba-caret {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ba-caret svg {
    width: 16px;
    height: 16px;
}

.ba-label {
    position: absolute;
    top: 24px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    color: #1D1D1D;
    pointer-events: none;
    border: 1px solid rgba(29, 29, 29, 0.1);
}

.ba-before-wrapper .ba-label-before {
    left: 24px;
}

.ba-after-wrapper .ba-label-after {
    right: 24px;
}

/* Case Study Video - full-width video component */
.case-study-video {
    width: 100%;
    max-width: 1080px;
    margin: 48px auto;
    display: block;
    border-radius: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .guidelines-card {
        flex: 0 0 340px;
        padding: 32px;
    }

    .guidelines-card-list li {
        font-size: 16px;
    }

    .guidelines-card-image {
        flex: 0 0 340px;
    }

    .before-after-container .ba-slider-button {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .before-after-container .ba-caret svg {
        width: 14px;
        height: 14px;
    }

    .ba-label {
        font-size: 12px;
        padding: 8px 16px;
        top: 16px;
    }

    .ba-before-wrapper .ba-label-before {
        left: 16px;
    }

    .ba-after-wrapper .ba-label-after {
        right: 16px;
    }

    .case-study-video {
        margin: 32px auto;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .guidelines-card {
        flex: 0 0 300px;
        padding: 24px;
    }

    .guidelines-card-list li {
        font-size: 15px;
    }

    .guidelines-card-image {
        flex: 0 0 300px;
    }

    .before-after-container .ba-slider-button {
        width: 48px;
        height: 48px;
        min-width: 48px;
        min-height: 48px;
    }

    .before-after-container .ba-caret svg {
        width: 12px;
        height: 12px;
    }

    .ba-label {
        font-size: 11px;
        padding: 4px 10px;
        top: 16px;
    }

    .ba-before-wrapper .ba-label-before {
        left: 16px;
    }

    .ba-after-wrapper .ba-label-after {
        right: 16px;
    }

    .case-study-video {
        margin: 24px auto;
        border-radius: 8px;
    }
}

.consistency-gallery-arrows .scroll-arrow svg {
    width: 16px;
    height: 16px;
}

.consistency-gallery-arrows .scroll-arrow:hover {
    background-color: #F7F7F9;
}

.consistency-gallery-arrows .scroll-arrow-left-guidelines {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}

.consistency-gallery-arrows .scroll-arrow-left-guidelines.visible {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.consistency-gallery-arrows .scroll-arrow-right-guidelines {
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
}

.consistency-gallery-arrows .scroll-arrow-right-guidelines.hidden {
    opacity: 0.3;
    pointer-events: none;
    cursor: default;
}

/* Responsive - Case Studies */
@media (max-width: 860px) {
    /* Mobile sticky header - simplified layout */
    .header-sticky-wrapper {
        padding: 24px;
        justify-content: space-between;
    }

    .header-sticky .back-link-sticky {
        position: static;
        display: flex;
    }

    .header-sticky .header-container {
        max-width: none;
        width: auto;
        margin: 0;
        justify-content: flex-end;
    }

    header nav,
    .header-sticky nav {
        display: none !important;
    }

    /* Keep time visible on mobile */
    .time {
        display: block;
    }

    .case-study-section {
        padding: 48px 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }
}
