/* Case Study Page Styles */

/* Hero Section */
.case-study-hero {
    padding: 140px 0 80px;
    background: var(--bg-primary);
    position: relative;
    z-index: 1;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.breadcrumb a:hover {
    color: var(--accent-cyan);
}

.breadcrumb span {
    color: var(--text-secondary);
    opacity: 0.5;
}

.hero-header {
    margin-bottom: 48px;
}

.case-study-title {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.case-study-subtitle {
    font-size: clamp(18px, 2.5vw, 24px);
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 800px;
}

.case-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    padding: 32px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meta-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.meta-value {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Case Section Base */
.case-section {
    padding: 80px 0;
    background: var(--bg-primary);
    position: relative;
    z-index: 1;
}

.section-heading {
    font-size: clamp(32px, 4vw, 42px);
    font-weight: 700;
    margin-bottom: 48px;
    color: var(--text-primary);
    text-align: left;
}

.section-content {
    max-width: 1200px;
}

/* Overview Section */
.overview-section {
    background: var(--bg-secondary);
}

/* Layout for Overview: place two .container children side-by-side on wide screens */
.overview-feature {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 48px;
    align-items: start;
}

.overview-feature .section-content {
    max-width: none;
}

.overview-feature .features-list-wrapper {
    max-width: none;
}

@media (max-width: 992px) {
    .overview-feature {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* Ensure the two inner .container children align with the page padding and don't cause nested horizontal offsets */
    .overview-feature > .container {
        width: 100%;
        max-width: 100%;
        padding-left: 24px; /* match global .container */
        padding-right: 24px;
        box-sizing: border-box;
    }

    .overview-feature .section-heading {
        margin-bottom: 20px;
    }

    /* Make feature list fit naturally on mobile */
    .features-list-wrapper {
        max-width: 100%;
        padding: 0;
    }

    .features-list {
        gap: 14px;
    }

    .feature-list-item {
        padding: 16px;
        gap: 12px;
    }

    .overview-text {
        margin-bottom: 24px;
    }

    /* Prevent images/SVGs inside the overview/feature columns from overflowing */
    .overview-feature img,
    .overview-feature svg,
    .features-list img,
    .features-list svg {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Allow flex children to shrink to avoid overflowing on narrow screens */
    .feature-list-item,
    .feature-list-body {
        min-width: 0;
    }

    /* Ensure feature-list-body text wraps and doesn't force horizontal scroll */
    .feature-list-body {
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }
}

/* Tablet / iPad and medium desktop adjustments */
@media (max-width: 1200px) {
    /* Make overview columns proportionally smaller so text doesn't overflow */
    .overview-feature {
        grid-template-columns: 1fr 420px; /* text + narrower features column */
        gap: 36px;
    }

    /* Reduce challenges min card width so two-column fits naturally */
    .challenges-list {
        grid-template-columns: repeat(2, minmax(300px, 1fr));
        gap: 28px;
        width: calc(100% + 48px);
    }

    .solutions-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px;
        width: calc(100% + 48px);
    }
}

@media (max-width: 1024px) {
    /* iPad landscape and smaller laptops: avoid the full-bleed trick which can cause horizontal scroll */
    .challenges-list,
    .solutions-content {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        max-width: none;
        grid-template-columns: repeat(2, minmax(260px, 1fr));
        gap: 28px;
    }

    /* Slightly reduce padding inside challenge/solution cards on tablet */
    .challenge-item,
    .solution-block {
        padding: 24px;
    }

    /* Overview: if features column is too tight, collapse to single column */
    .overview-feature {
        grid-template-columns: 1fr 360px;
        gap: 28px;
    }
}

.overview-text {
    max-width: 900px;
    margin-bottom: 64px;
}

.overview-text p {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.key-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    margin-top: 48px;
}

.stat-card {
    background: rgba(24, 224, 224, 0.05);
    border: 1px solid rgba(24, 224, 224, 0.2);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(24, 224, 224, 0.1);
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(24, 224, 224, 0.15);
}

.stat-number {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 8px;
    font-family: var(--font-heading);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Features Section */
.features-section {
    background: var(--bg-primary);
}

.features-grid-case {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.feature-item-case {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    transition: all 0.3s ease;
}

.feature-item-case:hover {
    background: rgba(24, 224, 224, 0.05);
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
}

.feature-icon-case {
    width: 56px;
    height: 56px;
    background: rgba(24, 224, 224, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--accent-cyan);
}

.feature-item-case h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.feature-item-case p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Bullet-style Key Features List */
.features-list-wrapper {
    max-width: 900px;
}

.features-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-list-item {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 22px;
}

.feature-bullet {
    width: 12px;
    height: 12px;
    background: var(--accent-cyan);
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.feature-list-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-primary);
}

.feature-list-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .feature-list-item {
        padding: 16px;
        gap: 12px;
    }
    .feature-bullet {
        width: 10px;
        height: 10px;
        margin-top: 4px;
    }
}

@media (max-width: 992px) {
    .challenges-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
        max-width: 1000px;
    }
}

@media (max-width: 768px) {
    .challenges-list {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 100%;
    }
}

/* Challenges Section */
.challenges-section {
    background: var(--bg-secondary);
}

.challenges-list {
    display: grid;
    /* two wider columns so cards appear bigger */
    grid-template-columns: repeat(2, minmax(360px, 1fr));
    gap: 32px;
    /* offset container padding so grid fills the visible content area without right gutter */
    width: calc(100% + 48px);
    max-width: none;
    margin-left: -24px;
    margin-right: -24px;
    align-items: start;
}

.challenge-item {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    transition: all 0.3s ease;
    height: 100%;
}

.challenge-item:hover {
    background: rgba(255, 69, 69, 0.05);
    border-color: rgba(255, 69, 69, 0.3);
}

.challenge-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: rgba(255, 69, 69, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF4545;
}

.challenge-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.challenge-content p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Solutions Section */
.solutions-section {
    background: var(--bg-primary);
}

.solutions-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 48px;
    width: calc(100% + 48px);
    max-width: none;
    margin-left: -24px;
    margin-right: -24px;
    align-items: start;
}

.solution-block {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    height: 100%;
}

/* If the last row has a single .solution-block, center it while keeping the same width as other items */
.solutions-content > .solution-block:only-child,
.solutions-content > .solution-block:nth-last-child(1):nth-child(odd) {
    /* span the full grid so we can center the block */
    grid-column: 1 / -1;
    /* keep flex layout for internal alignment, constrain width to one column and center */
    display: flex;
    box-sizing: border-box;
    max-width: calc((100% - 48px) / 2);
    margin: 0 auto;
}

.solution-number {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    background: var(--accent-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--black);
    font-family: var(--font-heading);
}

.solution-text h3 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.solution-text p {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Results & Values Section */
.results-values-section {
    background: var(--bg-secondary);
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

.value-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    transition: all 0.3s ease;
}

.value-card:hover {
    background: rgba(24, 224, 224, 0.05);
    border-color: var(--accent-cyan);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(24, 224, 224, 0.15);
}

.value-icon {
    width: 48px;
    height: 48px;
    background: rgba(24, 224, 224, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
    margin-bottom: 20px;
}

.value-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.value-card p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Conclusion Section */
.conclusion-section {
    background: var(--bg-primary);
}

.conclusion-content {
    max-width: 900px;
}

.conclusion-text p {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* CTA Section */
.case-cta-section {
    padding: 100px 0;
    background: var(--bg-secondary);
    position: relative;
    z-index: 1;
}

.case-cta-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.case-cta-content h2 {
    font-size: clamp(32px, 4vw, 42px);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.case-cta-content p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .case-study-hero {
        padding: 120px 0 60px;
    }

    .case-meta {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .case-section {
        padding: 60px 0;
    }

    .section-heading {
        margin-bottom: 32px;
    }

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

    .features-grid-case {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .challenge-item,
    .solution-block {
        flex-direction: column;
        gap: 20px;
    }

    .solution-number {
        width: 56px;
        height: 56px;
        font-size: 20px;
    }

    .values-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    /* Collapse solutions to a single column on small screens */
    .solutions-content {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    /* Ensure the final solution block is the same size/flow as the others on mobile */
    .solutions-content > .solution-block:only-child,
    .solutions-content > .solution-block:nth-last-child(1):nth-child(odd) {
        grid-column: auto !important;
        max-width: none !important;
        margin: 0 !important;
        display: flex !important;
    }

    /* Re-enable full-width container padding alignment for lists on small screens */
    .challenges-list,
    .solutions-content {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .case-cta-section {
        padding: 60px 0;
    }

    /* Tighter spacing for small phones */
    .overview-feature > .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .feature-list-item {
        padding: 12px;
        gap: 10px;
    }

    .feature-bullet {
        margin-top: 4px;
    }

    /* Make sure headings inside overview/features scale down and wrap */
    .overview-feature .section-heading,
    .feature-list-title {
        font-size: 20px;
        line-height: 1.25;
        word-break: break-word;
    }
}

/* Center footer sections on small screens */
@media (max-width: 768px) {
    .footer .footer-content {
        display: block;
    }

    .footer .footer-section {
        text-align: center;
        margin-bottom: 20px;
    }

    /* Specifically center company and get-in-touch blocks */
    .footer-company,
    .footer-get-in-touch {
        margin-left: auto;
        margin-right: auto;
        display: block;
    }

    .footer-company ul,
    .footer-get-in-touch ul {
        padding: 0;
        margin: 8px auto 0 auto;
        list-style: none;
        display: inline-block; /* shrink to content and allow centering */
        text-align: left; /* keep links stacked but centered as a block */
    }

    .footer-company ul li,
    .footer-get-in-touch ul li {
        margin: 6px 0;
    }
}

    /* Very small screens (approx 390x840 and similar small phones) */
    @media (max-width: 400px) and (max-height: 860px) {
        .case-study-hero { padding: 90px 0 40px; }

        .case-study-title { font-size: 28px; }
        .case-study-subtitle { font-size: 14px; }

        .section-heading { font-size: 22px; margin-bottom: 16px; }

        .overview-text p { font-size: 16px; line-height: 1.6; }

        .stat-number { font-size: 36px; }
        .stat-card { padding: 20px 16px; }

        .feature-list-title { font-size: 16px; }
        .feature-list-item { padding: 10px; gap: 10px; }

        .challenge-item, .solution-block { padding: 14px; gap: 12px; }

        .solution-number { width: 48px; height: 48px; font-size: 18px; }

        .case-cta-content { padding-left: 12px; padding-right: 12px; }

        /* Ensure nothing overspills horizontally */
        html, body { overflow-x: hidden; }
        .container { padding-left: 12px; padding-right: 12px; }
    }

/* Day Mode Adjustments */
body.day-mode .case-study-hero,
body.day-mode .case-section {
    background: #FFFFFF;
}

body.day-mode .overview-section,
body.day-mode .challenges-section,
body.day-mode .results-values-section,
body.day-mode .case-cta-section {
    background: #FAFAFA;
}

body.day-mode .stat-card,
body.day-mode .feature-item-case,
body.day-mode .challenge-item,
body.day-mode .value-card {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.08);
}

body.day-mode .stat-card:hover,
body.day-mode .feature-item-case:hover,
body.day-mode .value-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 32px rgba(24, 224, 224, 0.1);
}

body.day-mode .challenge-item:hover {
    border-color: rgba(255, 69, 69, 0.3);
}

/* Final mobile override: ensure Overview and Key Features always stack on narrow screens */
@media (max-width: 992px) {
    .overview-feature {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        align-items: start !important;
    }

    /* Make the features column flow naturally beneath the overview text */
    .overview-feature .features-list-wrapper {
        order: 2; /* if the containers are flexed later, ensure features are second */
        width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .overview-feature > .container:first-child {
        order: 1;
    }
}
