/* --- Reset & Base --- */
:root {
    /* Color Palette */
    --primary-color: #111;
    /* Near Black */
    --secondary-color: #db008b;
    /* Pink accent */
    --accent-color: #fedd3c;
    /* Yellow accent */
    --accent-color-2: #ff9a42;
    /* Orange accent */
    --text-color: #333;
    /* Dark Gray for body text */
    --heading-color: #111;
    /* Near Black for headings */
    --light-gray: #f8f8f8;
    /* Off-white background */
    --medium-gray: #eee;
    /* Light borders/lines */
    --dark-gray: #222;
    /* Dark background */
    --white: #fff;

    /* Fonts */
    --heading-font: 'Mulish', sans-serif;
    --body-font: 'Mulish', sans-serif;

    /* Layout Variables */
    --base-font-size: 16px;
    --container-width: 1100px;
    --case-study-container-width: 900px;
    /* Narrower width for text */
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    font-size: var(--base-font-size);
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
    font-family: var(--heading-font);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.8em;
    color: var(--heading-color);
}

/* Using 900 weight for H1 */
h1 {
    font-size: 2.8rem;
    font-weight: 900;
}

h2 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5em;
    font-weight: 700;
}

h3 {
    font-size: 1.5rem;
    margin-top: 1.5em;
    margin-bottom: 0.6em;
    font-weight: 700;
}

h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5em;
    font-weight: 700;
}

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

a:hover,
a:focus {
    color: var(--primary-color);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul {
    list-style: none;
    margin-bottom: 1em;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* --- Header --- */
.site-header {
    background-color: var(--white);
    padding: 1em 0;
    border-bottom: 1px solid var(--medium-gray);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--heading-color);
}

.main-nav ul {
    display: flex;
    gap: 1.5em;
    padding-left: 0;
}

/* Ensure ul padding reset */
.main-nav a {
    font-weight: 500;
    color: var(--text-color);
    padding-bottom: 0.3em;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

.main-nav a:hover::after,
.main-nav a:focus::after {
    width: 100%;
}

/* --- Hero Section --- */
.hero-section {
    background-color: var(--light-gray);
    padding: 6em 0;
    text-align: center;
    overflow: hidden;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2em;
}

.hero-text {
    max-width: 700px;
}

.hero-text h1 {
    color: var(--heading-color);
    margin-bottom: 0.5em;
}

.hero-text .subtitle {
    font-size: 1.2rem;
    color: #555;
    margin-bottom: 1.5em;
    line-height: 1.6;
}

/* Added line-height */
.hero-image img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--white);
    box-shadow: var(--box-shadow);
}

/* --- Hero Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in-up {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.8s ease forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

.delay-3 {
    animation-delay: 0.6s;
}

.delay-4 {
    animation-delay: 0.5s;
}

/* --- Call to Action Button --- */
.cta-button {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white);
    padding: 0.8em 1.8em;
    border-radius: var(--border-radius);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--secondary-color);
    cursor: pointer;
}

.cta-button:hover,
.cta-button:focus {
    color: var(--white);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background-color: #c4007b;
    border-color: #c4007b;
}

.cta-button.secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.cta-button.secondary:hover,
.cta-button.secondary:focus {
    background-color: var(--primary-color);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* --- Portfolio Section --- */
.portfolio-section {
    padding: 5em 0;
}

.portfolio-item {
    display: flex;
    gap: 3em;
    align-items: flex-start;
    margin-bottom: 5em;
    background-color: var(--white);
    padding: 2.5em;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    border: 1px solid var(--medium-gray);
}

.portfolio-item.reverse {
    flex-direction: row-reverse;
}

.portfolio-image {
    flex: 1 1 55%;
    overflow: hidden;
}

.portfolio-image img {
    border-radius: calc(var(--border-radius) / 2);
    transition: transform 0.4s ease-out;
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.03);
}

.portfolio-description {
    flex: 1 1 45%;
}

.portfolio-description h3 {
    color: var(--heading-color);
    margin-bottom: 0.6em;
}

.project-challenge {
    font-style: normal;
    color: #555;
    margin-bottom: 1.5em;
    border-left: 3px solid var(--accent-color);
    padding-left: 1em;
}

.project-logo {
    max-width: 120px;
    height: auto;
    display: block;
    margin-top: 0.5em;
    margin-bottom: 1.5em;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 1.5em;
    padding-left: 0;
}

/* Ensure ul padding reset */
.tags li {
    background-color: var(--light-gray);
    color: #555;
    padding: 0.3em 0.8em;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--medium-gray);
}

/* --- Testimonials Section --- */
.testimonials-section {
    background-color: var(--light-gray);
    padding: 5em 0;
    text-align: center;
}

.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2em;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

.testimonial {
    background-color: var(--white);
    padding: 2em;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--medium-gray);
}

.testimonial blockquote {
    margin-bottom: 1.5em;
    font-style: normal;
    color: #555;
    flex-grow: 1;
    position: relative;
    padding-left: 2em;
    font-size: 1rem;
    line-height: 1.6;
}

/* Added line-height */
.testimonial blockquote::before {
    content: '“';
    position: absolute;
    left: -0.1em;
    top: -0.2em;
    font-size: 3.5em;
    color: var(--secondary-color);
    opacity: 0.3;
    font-family: serif;
}

.testimonial figcaption {
    display: flex;
    align-items: center;
    gap: 1em;
    margin-top: auto;
    border-top: 1px solid var(--medium-gray);
    padding-top: 1em;
}

.testimonial-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.testimonial cite {
    font-weight: 700;
    font-style: normal;
    display: block;
    color: var(--heading-color);
}

.testimonial span {
    font-size: 0.9rem;
    color: #777;
}

/* --- Contact Section --- */
.contact-section {
    padding: 5em 0;
    text-align: center;
    background-color: var(--dark-gray);
    color: var(--light-gray);
}

.contact-section h2 {
    color: var(--white);
    margin-bottom: 0.5em;
}

.contact-section p {
    font-size: 1.1rem;
    margin-bottom: 2em;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    color: #ccc;
}

.contact-section .cta-button {
    background: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
    box-shadow: 0 4px 10px rgba(255, 255, 255, 0.1);
}

.contact-section .cta-button:hover,
.contact-section .cta-button:focus {
    background: #c4007b;
    border-color: #c4007b;
    color: var(--white);
}

/* --- Footer --- */
.site-footer {
    background-color: var(--dark-gray);
    color: #999;
    padding: 1.5em 0;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid #444;
}

.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-to-top {
    color: #999;
    font-size: 1.5rem;
    transition: color 0.3s ease;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    text-decoration: none;
}

.back-to-top:hover,
.back-to-top:focus {
    color: var(--white);
    background-color: #444;
}

/* ======================================================== */
/* === START: General Case Study Page Specific Styles === */
/* ======================================================== */

.case-study-page {
    /* Optional wrapper styles */
}

.case-study-hero {
    padding: 4em 0 3em 0;
    text-align: center;
    background-color: var(--white);
    border-bottom: 1px solid var(--medium-gray);
    overflow: hidden;
    /* Contain hero animations */
}

.case-study-hero h1 {
    font-size: 2.6rem;
    margin-bottom: 0.5em;
    line-height: 1.2;
}

/* Adjusted line-height */

.case-study-subtitle {
    font-size: 1.2rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto 1.5em auto;
    line-height: 1.6;
}

.case-study-details {
    display: flex;
    justify-content: center;
    gap: 2em;
    margin-bottom: 2em;
    font-size: 0.9rem;
    color: #666;
    flex-wrap: wrap;
    line-height: 1.5;
    /* Added line height */
}

.case-study-details strong {
    color: var(--text-color);
    font-weight: 700;
}

/* Styles for visual placeholder - Keep for placeholders */
.visual-placeholder {
    border: 1px dashed var(--medium-gray);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1em;
    background-color: #f0f0f0;
    /* Light background */
    transition: background-color 0.3s ease, border-color 0.3s ease;
    min-height: 200px;
    /* Default minimum height */
}

.visual-placeholder:hover {
    background-color: #e9e9e9;
    border-color: #ccc;
}

.visual-placeholder p {
    color: #999;
    font-size: 0.9rem;
    padding: 1em;
    text-align: center;
}

/* Styles for actual visuals replacing placeholders */
/* Targeting image directly within hero visual container */
.case-study-hero .container>img {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    /* Remove inline styles from HTML if possible */
    /* display: flex; align-items: center; justify-content: center; */
    margin: 2em auto 0 auto;
    /* Adjusted margin for centering */
    display: block;
    /* Ensure block display */
    max-width: 100%;
    /* Ensure responsiveness */
}


/* Case Study Section Layout */
.case-study-section {
    padding: 4em 0;
    /* NOTE: Animations currently disabled here by removing opacity/transform */
    /* If re-enabling, ensure JS works */
    opacity: 1;
    transform: translateY(0);
    /* transition: opacity 0.6s ease-out, transform 0.6s ease-out; */
}

/* Keep visible class rule in case JS is fixed later */
.case-study-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.case-study-section.alternate-bg {
    background-color: var(--light-gray);
    border-top: 1px solid var(--medium-gray);
    border-bottom: 1px solid var(--medium-gray);
}

/* Container widths for case study text vs visuals */
.case-study-container {
    max-width: var(--case-study-container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.case-study-container-large {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

.case-study-container .section-text {
    margin-bottom: 2em;
}

.case-study-container .section-text:last-child {
    margin-bottom: 0;
}

/* Left-aligned H2 with accent underline */
.case-study-container h2,
.case-study-container-large h2 {
    text-align: left;
    margin-bottom: 1em;
    position: relative;
    padding-bottom: 0.5em;
}

.case-study-container h2::after,
.case-study-container-large h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--secondary-color);
    /* Pink */
}

/* Case study list styles */
.case-study-page ul:not(.tags) {
    padding-left: 0;
}

/* Reset default padding */
.case-study-page ul:not(.tags) li {
    position: relative;
    padding-left: 1.5em;
    margin-bottom: 0.6em;
}

.case-study-page ul:not(.tags) li strong {
    font-weight: 700;
    color: var(--heading-color);
}

/* Style strong tag */
.case-study-page ul:not(.tags) li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.2em;
    line-height: 1;
}

.method-list li::before {
    content: '✓';
    color: var(--secondary-color);
}

/* Visual Grid Layouts */
.visual-grid {
    display: grid;
    gap: 1.5em;
    margin-top: 2em;
    align-items: start;
}

/* Added align-items */
.visual-grid.two-col {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.visual-grid.three-col {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (min-width: 768px) {
    .visual-grid.two-col {
        grid-template-columns: 1fr 1fr;
    }

    .visual-grid.three-col {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

/* Ensure images in grids scale correctly */
.visual-grid img {
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}


/* Feature Highlight Layout */
.feature-highlight {
    display: flex;
    gap: 2em;
    align-items: center;
    margin-top: 3em;
    padding: 2em 0;
    /* Remove side padding */
}

.feature-highlight:not(:first-child) {
    margin-top: 4em;
}

/* Increase top margin */
.feature-highlight.alternate-bg {
    background-color: var(--light-gray);
    padding: 2em;
    border-radius: var(--border-radius);
    border: 1px solid var(--medium-gray);
}

/* Add background style */

.feature-highlight.reverse {
    flex-direction: row-reverse;
}

.feature-text {
    flex: 1 1 45%;
}

.feature-visual {
    flex: 1 1 55%;
    margin-top: 0;
    border-radius: var(--border-radius);
    line-height: 0;
    /* Prevent extra space */
}

.feature-visual img,
.feature-visual video {
    /* Apply to both image and video */
    width: 100%;
    /* Ensure media fills container */
    height: auto;
    /* Maintain aspect ratio */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--medium-gray);
    display: block;
}

.feature-highlight h4 {
    margin-top: 0;
    color: var(--secondary-color);
}

/* Case Study Footer Nav */
.case-study-footer {
    padding: 3em 0;
    text-align: center;
    border-top: 1px solid var(--medium-gray);
}

/* Video Container (for standalone videos, e.g., Collaboration section) */
.video-container {
    margin-top: 2em;
    border-radius: var(--border-radius);
    overflow: hidden;
    line-height: 0;
    /* Prevent extra space */
    box-shadow: var(--box-shadow);
    border: 1px solid var(--medium-gray);
}

.video-container video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* ====================================================== */
/* === END: General Case Study Page Specific Styles === */
/* ====================================================== */


/* ============================================================= */
/* === START: Appended James Avery Case Study Specific Styles === */
/* ============================================================= */

/* Optional: Specific tweaks for JA hero if needed */
.ja-hero {
    /* background-color: var(--white); */
}

.ja-hero-visual {
    /* background-color: var(--light-gray) !important; */
}

/* Example override */

/* Two Column Layout for Deep Dives */
.two-col-layout {
    display: flex;
    gap: 2.5em;
    /* Gap between columns */
    align-items: flex-start;
    /* Align columns to the top */
    margin-top: 2em;
}

.two-col-layout .col {
    flex: 1;
    /* Make columns share space equally */
    min-width: 0;
    /* Prevent flexbox overflow issues */
}

.two-col-layout .col h3 {
    margin-top: 0;
    /* Remove top margin from h3 inside columns */
    text-align: left;
    /* Ensure left align */
}

.two-col-layout .col h3::after {
    /* Remove global underline from h3 in this layout */
    display: none;
}

/* Remove top margin for first element after h3 in two-col */
.two-col-layout .col h3+* {
    margin-top: 0;
}

.two-col-layout img {
    /* Style images within this layout */
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--medium-gray);
    margin-top: 1em;
    /* Add space above images */
}


/* =========================================================== */
/* === END: Appended James Avery Case Study Specific Styles === */
/* =========================================================== */


/* ============================================================= */
/* === START: Appended Creative Ops Case Study Specific Styles === */
/* ============================================================= */

/* Optional: Specific tweaks for Creative Ops hero */
.creative-ops-hero h4 {
    /* Style for Role Title above H1 */
    color: var(--secondary-color);
    /* Pink */
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5em;
}

/* Highlighted challenge box style */
.challenge-box {
    border: 2px solid var(--secondary-color);
    /* Pink border */
    padding: 1.5em;
    margin-top: 2em;
    border-radius: var(--border-radius);
    background-color: var(--white);
}

.challenge-box h3 {
    margin-top: 0;
    color: var(--secondary-color);
    /* Pink heading */
    text-align: left;
    /* Ensure left align */
}

.challenge-box h3::after {
    /* Remove global underline */
    display: none;
}


/* Numbered list style */
ol.numbered-list {
    list-style: none;
    counter-reset: item;
    padding-left: 0;
    margin-top: 1.5em;
    margin-bottom: 1em;
    /* Ensure consistent bottom margin */
}

ol.numbered-list li {
    counter-increment: item;
    margin-bottom: 1em;
    padding-left: 3em;
    /* Indent text */
    position: relative;
}

ol.numbered-list li::before {
    content: counter(item);
    display: inline-block;
    position: absolute;
    left: 0;
    top: -2px;
    /* Adjust vertical alignment */
    width: 1.8em;
    /* Circle size */
    height: 1.8em;
    /* Circle size */
    line-height: 1.8em;
    /* Center number vertically */
    text-align: center;
    font-weight: 700;
    color: var(--white);
    background-color: var(--secondary-color);
    /* Pink circle */
    border-radius: 50%;
    font-size: 0.9rem;
    /* Size of number */
}

/* Icon list style - Requires font icon library or SVGs */
ul.icon-list {
    padding-left: 0;
    margin-top: 1.5em;
    margin-bottom: 1em;
}

ul.icon-list li {
    padding-left: 2.5em;
    margin-bottom: 0.8em;
    position: relative;
}

ul.icon-list li i {
    /* Assuming FontAwesome or similar <i> tags */
    position: absolute;
    left: 0;
    top: 2px;
    /* Adjust alignment */
    font-size: 1.3em;
    color: var(--secondary-color);
    /* Pink icon */
    width: 1.5em;
    /* Ensure space */
    text-align: center;
}

/* Add actual FontAwesome/SVG includes in your <head> if using this */


/* Results Section - Stats Grid */
.results-section h2 {
    text-align: center;
}

/* Center heading */
.results-section h2::after {
    left: 50%;
    transform: translateX(-50%);
}

/* Center underline */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2em;
    margin-top: 3em;
    text-align: center;
}

.stat-item {
    padding: 1.5em;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 1px solid var(--medium-gray);
}

.stat-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--secondary-color);
    /* Pink number */
    line-height: 1.1;
    margin-bottom: 0.2em;
}

.stat-label {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.4;
}

/* Full width visual section for emails */
.full-width-visual {
    margin-top: 2em;
    /* Space above the image */
    line-height: 0;
    /* Prevent extra space from baseline */
}

.full-width-visual img {
    width: 100%;
    /* Make image span its container */
    border-radius: var(--border-radius);
    /* Optional: consistent corners */
    box-shadow: var(--box-shadow);
    /* Optional: consistent shadow */
    border: 1px solid var(--medium-gray);
    /* Optional: consistent border */
}

.campaign-hero {
    padding-bottom: 2em;
    /* Less padding if no hero visual */
}

.campaign-item h2 {
    text-align: left;
    margin-bottom: 0.8em;
}

.campaign-item h2::after {
    display: none;
}


.campaign-item {
    padding-top: 5em;
}

/* Remove the border-top rules as padding now handles separation */
/*
.campaign-item:not(.alternate-bg) {
    border-top: 1px solid var(--medium-gray);
}
.campaign-showcase-page > .campaign-item:first-of-type {
     border-top: none;
}
*/

.campaign-details {
    max-width: none;
}

.campaign-details p {
    margin-bottom: 0.8em;
    color: #555;
    /* Slightly lighter text for details */
    font-size: 1rem;
}

.campaign-details p strong {
    color: var(--text-color);
    font-weight: 700;
    margin-right: 0.5em;
}

.campaign-visual {
    margin-top: 2em;
    line-height: 0;
}

.campaign-visual img {
    width: 100%;
}

/* --- Responsive Design --- */
@media (max-width: 992px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    .portfolio-item,
    .portfolio-item.reverse {
        flex-direction: column;
        gap: 2em;
        text-align: center;
        align-items: center;
    }

    .portfolio-description {
        max-width: 600px;
        margin: 0 auto;
    }

    .project-challenge {
        margin-left: auto;
        margin-right: auto;
        text-align: left;
        border-left-width: 0;
        padding-left: 0;
    }

    .project-logo {
        margin-left: auto;
        margin-right: auto;
    }

    .tags {
        justify-content: center;
    }

    .cta-button.secondary {
        margin: 0 auto;
    }

    /* Case Study Specific */
    .case-study-hero h1 {
        font-size: 2.2rem;
    }

    .case-study-subtitle {
        font-size: 1.1rem;
    }

    .feature-highlight,
    .feature-highlight.reverse {
        flex-direction: column;
        text-align: center;
    }

    .feature-text {
        text-align: left;
        width: 100%;
    }

    /* Ensure text block takes full width when stacked */
    .feature-visual {
        width: 100%;
    }

    /* Ensure visual block takes full width when stacked */

}

@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 0.8em;
    }

    .main-nav ul {
        gap: 1em;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-content {
        flex-direction: column-reverse;
    }

    h1 {
        font-size: 2.2rem;
    }

    .hero-text .subtitle {
        font-size: 1.1rem;
    }

    .testimonial-grid {
        grid-template-columns: 1fr;
        max-width: 500px;
    }

    .site-footer .container {
        flex-direction: column;
        gap: 0.5em;
    }

    .back-to-top {
        margin-top: 0.5em;
    }

    /* Case Study Specific */
    .case-study-hero h1 {
        font-size: 2rem;
    }

    .case-study-details {
        gap: 1em;
        justify-content: center;
    }

    .visual-grid.two-col,
    .visual-grid.three-col {
        grid-template-columns: 1fr;
    }

    /* Stack two-column layout */
    .two-col-layout {
        flex-direction: column;
        gap: 2em;
    }

    .two-col-layout .col {
        width: 100%;
    }

    .two-col-layout .col .visual-placeholder {
        margin-top: 1.5em;
    }

    .two-col-layout .col .visual-placeholder:first-child {
        margin-top: 0;
    }

    .two-col-layout img {
        margin-top: 1.5em;
    }

    /* Adjust img margin */
    .two-col-layout h3+img {
        margin-top: 1em;
    }

    /* Less margin if img directly follows h3 */

    /* Adjust stats grid */
    .stats-grid {
        grid-template-columns: 1fr;
        max-width: 350px;
        margin-left: auto;
        margin-right: auto;
    }

    /* Stack stats */

}

@media (max-width: 576px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
        margin-bottom: 1.5em;
    }

    h3 {
        font-size: 1.2rem;
    }

    .portfolio-item {
        padding: 1.5em;
    }

    .testimonial-grid {
        max-width: 100%;
    }

    /* Case Study Specific */
    .case-study-hero h1 {
        font-size: 1.8rem;
    }

    .case-study-subtitle {
        font-size: 1rem;
    }

    .case-study-details {
        flex-direction: column;
        gap: 0.5em;
        align-items: center;
    }

    .feature-highlight {
        padding: 1.5em 0;
    }

    /* Adjust stats */
    .stat-number {
        font-size: 2.5rem;
    }

    .stats-grid {
        gap: 1em;
    }

    .stat-item {
        padding: 1em;
    }
}

/* ======================================================== */
/* === START: Appended Web Optimization Grid Card Styles === */
/* ======================================================== */

.optimization-grid {
    /* Inherits .visual-grid styles */
    /* Override alignment if needed, default is 'start' */
    align-items: stretch;
    /* Make cards in same row equal height */
}

.optimization-card {
    display: flex;
    flex-direction: column;
    /* Stack content vertically */
    background-color: var(--white);
    border: 1px solid var(--medium-gray);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5em;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.optimization-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}


.optimization-card h4 {
    margin-top: 0;
    margin-bottom: 0.8em;
    font-size: 1.1rem;
    /* Slightly smaller heading */
    text-align: left;
    color: var(--primary-color);
}

.optimization-card h4::after {
    display: none;
    /* Remove global underline */
}

.optimization-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.6em;
    color: #555;
}

.optimization-card p:last-of-type {
    margin-bottom: 1.2em;
    /* Add space before images */
    flex-grow: 1;
    /* Allow text block to grow to push images down */
}

.optimization-card p strong {
    font-weight: 700;
    color: var(--text-color);
}

.ba-images {
    /* Before/After Image Container */
    display: flex;
    gap: 1em;
    /* Space between before/after images */
    margin-top: auto;
    /* Push images to bottom */
    padding-top: 1em;
    /* Space above images */
}

.ba-image-item {
    flex: 1;
    /* Equal width for before/after */
    min-width: 0;
    /* Prevent overflow */
}

.ba-image-item h5 {
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 0.5em;
    color: #888;
    font-weight: 500;
}

.ba-image-item img {
    width: 100%;
    border: 1px solid var(--medium-gray);
    border-radius: calc(var(--border-radius) / 2);
    background-color: var(--light-gray);
}

/* Responsive Adjustments for Optimization Cards */
@media (max-width: 768px) {

    /* Ensure grid stacks if visual-grid doesn't handle it */
    .optimization-grid.two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .optimization-card {
        padding: 1em;
    }

    .ba-images {
        /* Stack B/A images on smallest screens */
        /* flex-direction: column; */
        /* Optional: Uncomment to stack B/A vertically */
    }
}

/* ====================================================== */
/* === END: Appended Web Optimization Grid Card Styles === */
/* ====================================================== */