/* Projects & Digital Marketing CSS */

/* Hero Carousel */
.hero-carousel-container {
    position: relative;
    height: 480px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    perspective: 1200px;
    margin-bottom: 2rem;
    overflow: visible;
}

.hero-carousel {
    position: relative;
    width: 360px;
    height: 456px;
    transform-style: preserve-3d;
}

.hero-carousel-card {
    position: absolute;
    width: 312px;
    height: 432px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    top: 50%;
    left: 50%;
    transform-origin: center center; /* better for the flip effect */
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.6s, z-index 0.6s;
    overflow: hidden;
    cursor: pointer;
    margin-left: -156px; /* half of width */
    margin-top: -216px; /* half of height */
    will-change: transform, opacity;
}

.hero-carousel-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none; /* Prevent image drag */
}

/* Card states based on offset from active center card */
.hero-carousel-card[data-offset="-2"] {
    transform: translate(-260px, 50px) rotate(-15deg) scale(0.85);
    z-index: 1;
    opacity: 0.6;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.hero-carousel-card[data-offset="-1"] {
    transform: translate(-140px, 25px) rotate(-7.5deg) scale(0.92);
    z-index: 2;
    opacity: 0.85;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}
.hero-carousel-card[data-offset="0"] {
    transform: translate(0, 0) rotate(0deg) scale(1.05);
    z-index: 5;
    opacity: 1;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.hero-carousel-card[data-offset="1"] {
    transform: translate(140px, 25px) rotate(7.5deg) scale(0.92);
    z-index: 2;
    opacity: 0.85;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}
.hero-carousel-card[data-offset="2"] {
    transform: translate(260px, 50px) rotate(15deg) scale(0.85);
    z-index: 1;
    opacity: 0.6;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .hero-carousel-container {
        height: 300px;
    }
    .hero-carousel-card {
        width: 180px;
        height: 250px;
        margin-left: -90px;
        margin-top: -125px;
    }
    
    .hero-carousel-card[data-offset="-2"] {
        transform: translate(-100px, 30px) rotate(-15deg) scale(0.85);
    }
    .hero-carousel-card[data-offset="-1"] {
        transform: translate(-60px, 15px) rotate(-7.5deg) scale(0.92);
    }
    .hero-carousel-card[data-offset="0"] {
        transform: translate(0, 0) rotate(0deg) scale(1.05);
    }
    .hero-carousel-card[data-offset="1"] {
        transform: translate(60px, 15px) rotate(7.5deg) scale(0.92);
    }
    .hero-carousel-card[data-offset="2"] {
        transform: translate(100px, 30px) rotate(15deg) scale(0.85);
    }
}

/* Grid and Layouts */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.social-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.project-card {
    position: relative;
    border-radius: 16px;
    background: #fff;
    /* Remove padding to allow image to bleed to edges */
    padding: 0;
    height: 350px;
    overflow: hidden; /* Rounds the outer corners */
    box-shadow: none;
}

.project-card:hover {
    transform: none;
    box-shadow: none;
}

/* Mask the antialiased media edge that can appear below the button notch. */
.project-card::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    height: 2px;
    background: #fff;
    pointer-events: none;
}

.card-link {
    position: absolute;
    inset: 0;
    z-index: 3;
    text-decoration: none;
    color: inherit;
}

.card-media {
    position: relative;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
}

.card-media img,
.card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .card-media img {
    transform: scale(1.05);
}

/* The White Cutout (Notch) */
.notch-wrapper {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 190px;
    height: 70px;
    background: #fff; /* Matches page background to look like a cutout */
    border-top-left-radius: 20px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Inverted rounded corners for the fluid notch effect */
.notch-wrapper::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 25px;
    height: 25px;
    background: transparent;
    border-bottom-right-radius: 25px;
    box-shadow: 10px 10px 0 10px #fff;
    pointer-events: none;
}

.notch-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 100%;
    width: 25px;
    height: 25px;
    background: transparent;
    border-bottom-right-radius: 25px;
    box-shadow: 10px 10px 0 10px #fff;
    pointer-events: none;
}

/* The Button inside the Notch */
.btn-notch {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 20px;
    width: 166px;
    height: 46px; /* approximate button height */
    background: #0C3C01;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 150%;
    text-align: center;
    color: #FFFFFF;
    text-decoration: none;
    z-index: 10;
    transition: background-color 0.2s ease, transform 0.2s ease;
    box-shadow: none;
}

.project-card:hover .btn-notch,
.project-card:focus-within .btn-notch {
    background: #072501;
    transform: translateY(-0.1875rem);
}

.project-card:hover .btn-notch::after,
.project-card:focus-within .btn-notch::after {
    opacity: 1;
    animation: sweep-move 1s linear infinite alternate;
}

.project-card:active .btn-notch {
    transform: translateY(0) scale(0.98);
}

.card-link:focus-visible {
    outline: 3px solid #2f7d32;
    outline-offset: -4px;
    border-radius: 16px;
}

/* Social Card */
.social-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    background: #000;
    box-shadow: none;
    aspect-ratio: 1 / 1;
}

.social-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-card-content {
    padding: 20px;
    text-align: center;
}

.social-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* slightly lighter overlay */
    display: flex;
    align-items: center;
    justify-content: flex-end; /* align to the right */
    padding-right: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.social-icons {
    display: flex;
    flex-direction: column; /* Stack vertically */
    gap: 15px;
    transform: translateX(20px); /* Slide in from right */
    transition: transform 0.3s ease;
}

.social-icons a {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
}

.social-icons a:hover {
    background: #28a745;
    color: #fff;
}

.social-card:hover .social-card-overlay {
    opacity: 1;
}

.social-card:hover .social-icons {
    transform: translateX(0); /* Slide to normal position */
}

/* Touch Device Fallback for Social Cards */
@media (hover: none) {
    .social-card-overlay {
        opacity: 1;
        background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
        top: auto;
        height: 100px;
    }

    .social-icons {
        transform: none;
    }
}

/* Filters */
.category-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 8px 20px;
    border-radius: 25px;
    background: #fff;
    color: #555;
    border: 1px solid #ddd;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s ease, border-color 0.2s ease,
                color 0.2s ease, transform 0.2s ease;
    font-weight: 500;
}

.btn-filter.active,
.btn-filter:hover {
    background: #145a20; /* Darker green to match UI */
    color: #fff;
    border-color: #145a20;
}

.btn-filter:hover {
    transform: translateY(-2px);
}

.btn-filter:active {
    transform: translateY(0) scale(0.97);
}

.btn-filter:focus-visible,
.pagination .page-link:focus-visible {
    outline: 3px solid rgba(20, 90, 32, 0.35);
    outline-offset: 3px;
}

.project-listing {
    transition: opacity 0.18s ease;
}

.project-listing.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.project-filter-status {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .project-card,
    .card-media img,
    .btn-notch,
    .btn-filter,
    .project-listing {
        transition: none;
    }
}

/* Media Elements */
.media-element {
    width: 100%;
    border-radius: 8px;
    max-height: 500px;
    object-fit: cover;
}

.youtube-container {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.youtube-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Project Detail Hero */
.project-detail-hero .hero-media-wrapper {
    max-height: 60vh;
    overflow: hidden;
}

.project-detail-hero .hero-media-wrapper img,
.project-detail-hero .hero-media-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-meta {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
}

/* Utilities */
.bg-light {
    background-color: #f8f9fa;
}

.py-5 {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

/* The shared navbar is fixed, so the Projects hero must reserve its height
   before applying the hero's own vertical padding. */
.project-hero.py-5 {
    padding-top: calc(64px + 3rem);
}

@media (max-width: 600px) {
    .project-hero.py-5 {
        padding-top: calc(60px + 3rem);
    }
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-5 {
    margin-top: 3rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-5 {
    margin-bottom: 3rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.w-100 {
    width: 100%;
}

.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #28a745;
    color: white;
}

.btn-primary:hover {
    background-color: #218838;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline-primary {
    border: 2px solid #28a745;
    color: #28a745;
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: #28a745;
    color: white;
}

/* Flexbox Grid (Simple) */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col-md-6 {
    width: 50%;
    padding: 0 15px;
}

.col-md-8 {
    width: 66.666%;
    padding: 0 15px;
}

.justify-content-center {
    justify-content: center;
}

.flex-md-row-reverse {
    flex-direction: row-reverse;
}

@media (max-width: 768px) {

    .col-md-6,
    .col-md-8 {
        width: 100%;
    }

    .flex-md-row-reverse {
        flex-direction: column;
    }

    .text-content {
        margin-bottom: 20px;
    }

    .filters {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* Project Sections Styling (Figma match) */
.project-section h2 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #000;
}

.project-section .content-body {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #4a4a4a;
}

.project-section .media-content {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.project-section .media-content img, 
.project-section .media-content video {
    width: 100%;
    display: block;
}

.layout-text_left_media_right .text-content {
    padding-right: 5%;
}

.layout-media_left_text_right .text-content {
    padding-left: 5%;
}

.project-media-frame {
    position: relative;
    width: 100%;
}

.media-placeholder {
    width: 100%;
    min-height: 220px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2eb, #d8e0d3);
    color: #0c3c01;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.btn-play-video {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 4;
    width: 64px;
    height: 64px;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #ffffff;
    background: rgba(12, 60, 1, 0.88);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.btn-play-video:hover,
.btn-play-video:focus-visible {
    background: #0c3c01;
    outline: 3px solid rgba(255, 255, 255, 0.9);
    outline-offset: 3px;
}

.btn-play-video.is-playing {
    opacity: 0;
}

.card-media:hover .btn-play-video.is-playing,
.btn-play-video.is-playing:focus-visible {
    opacity: 1;
}

/* Website project case study */
.website-case-study-page { background: #fff; overflow-x: clip; }
.case-study {
    --case-study-inline-space: clamp(16px, 4vw, 48px);
    --case-study-section-space: clamp(36px, 5vw, 64px);
    padding: clamp(88px, 8vw, 112px) 0 clamp(72px, 8vw, 112px);
    color: #111;
    overflow: clip;
}
.case-study__container {
    width: min(1240px, calc(100% - (var(--case-study-inline-space) * 2)));
    margin-inline: auto;
}
.case-study__hero {
    width: min(1240px, calc(100% - (var(--case-study-inline-space) * 2)));
    aspect-ratio: 1240 / 503;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 24px;
    background: #eef2eb;
}
.case-study__image { display: block; width: 100%; height: 100%; object-fit: cover; }
.case-study__hero > .case-study__image,
.case-study__showcase > .case-study__image,
.case-study__next > .case-study__image { object-fit: contain; }
.object-position-center { object-position: center; }
.object-position-top { object-position: top; }
.object-position-bottom { object-position: bottom; }
.object-position-left { object-position: left; }
.object-position-right { object-position: right; }
.case-study__placeholder {
    display: grid; width: 100%; height: 100%; min-height: 260px; place-items: center;
    padding: 24px; background: linear-gradient(135deg, #eef2eb, #d8e0d3);
    color: #0c3c01; font-weight: 600; text-align: center;
}
.case-study__intro { padding-block: clamp(20px, 3vw, 34px) clamp(30px, 4vw, 48px); text-align: center; }
.case-study__intro h1 {
    max-width: 980px;
    margin: 0 auto;
    font-size: clamp(2.1rem, 4.1vw, 3.75rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
    text-wrap: balance;
}
.case-study__summary { max-width: 760px; margin: 18px auto 0; color: #434343; font-size: 1.05rem; line-height: 1.65; }
.case-study__meta { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 28px 0 0; }
.case-study__meta div { min-width: 145px; max-width: 270px; padding: 14px 18px; border: 1px solid #dfe5da; border-radius: 12px; background: #f9fbf8; }
.case-study__meta dt { color: #55704d; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.case-study__meta dd { margin: 5px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.case-study__split, .case-study__story-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(28px, 4vw, 52px);
    align-items: start;
}
.case-study__split { padding-block: var(--case-study-section-space); }
.case-study__copy { min-width: 0; padding-top: 8px; }
.case-study__copy h2, .case-study__related > h2 { margin: 0 0 18px; font-size: clamp(1.75rem, 2.4vw, 2rem); line-height: 1.25; }
.case-study__body { max-width: 68ch; color: #2d2d2d; font-size: clamp(.96rem, .4vw + .88rem, 1.05rem); line-height: 1.72; overflow-wrap: anywhere; }
.case-study__body p { margin: 0 0 16px; }
.case-study__body a { color: #0c3c01; font-weight: 650; text-underline-offset: 3px; }
.case-study__media { overflow: hidden; border-radius: 24px; background: #eef2eb; }
.case-study__media--square { aspect-ratio: 608 / 503; }
.case-study__media--story { aspect-ratio: 608 / 503; }
.case-study__showcase, .case-study__next { position: relative; aspect-ratio: 1240 / 535; overflow: hidden; border-radius: 24px; background: #eef2eb; }
.case-study__showcase { aspect-ratio: 1240 / 503; }
.case-study__showcase { margin-top: 0; }
.case-study__showcase > .case-study__image { object-fit: cover; }
.case-study__story { padding-block: var(--case-study-section-space); }
.case-study__story-row { margin-bottom: var(--case-study-section-space); align-items: center; }
.case-study__story-row:last-child { margin-bottom: 0; }
@media (min-width: 901px) {
    .case-study__split .case-study__copy { padding-top: 0; }
    .case-study__story-row--media-left { align-items: start; }
    .case-study__story-row--media-left .case-study__copy { padding-top: 32px; }
}
.case-study__notch {
    position: absolute; right: 0; bottom: 0; z-index: 3; width: 214px; height: 66px;
    display: flex; align-items: center; justify-content: flex-end; padding: 10px 8px 8px 14px;
    border-top-left-radius: 22px; background: #fff;
}
.case-study__notch::before, .case-study__notch::after { content: ''; position: absolute; width: 24px; height: 24px; background: transparent; border-bottom-right-radius: 24px; box-shadow: 10px 10px 0 10px #fff; }
.case-study__notch::before { right: 0; bottom: 100%; }
.case-study__notch::after { right: 100%; bottom: 0; }
.case-study__notch-button {
    position: relative; z-index: 1; display: inline-flex; width: 192px; min-height: 46px;
    align-items: center; justify-content: center; overflow: hidden; padding: 10px 16px;
    border: 1px solid #5b6d49; border-radius: 8px; background: #0c3c01;
    color: #fff; font-weight: 500; line-height: 1.4; text-align: center; text-decoration: none;
}
.case-study__notch-button:hover, .case-study__notch-button:focus-visible { transform: translateY(-3px); background: #145607; }
.case-study__notch-button:active { transform: scale(.96); }
.case-study__notch-button:focus-visible { outline: 3px solid rgba(12, 60, 1, .3); outline-offset: 3px; }
.case-study__next { margin-top: 0; }
.case-study__related { padding-top: clamp(64px, 7vw, 96px); }
.case-study__related-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.case-study__related-heading h2 { margin: 0; font-size: clamp(1.75rem, 2.4vw, 2rem); line-height: 1.25; }
.case-study__related-eyebrow { margin: 0 0 6px; color: #55704d; font-size: .75rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.case-study__related-controls { display: none; gap: 10px; }
.case-study__related.is-enhanced .case-study__related-controls { display: flex; }
.case-study__rail-button {
    width: 46px; height: 46px; display: inline-grid; place-items: center;
    border: 1px solid #cbd5c6; border-radius: 50%; background: #fff; color: #0c3c01;
    font: inherit; font-size: 1.25rem; cursor: pointer; transition: background-color .2s ease, color .2s ease, transform .2s ease;
}
.case-study__rail-button:hover, .case-study__rail-button:focus-visible { background: #0c3c01; color: #fff; transform: translateY(-2px); }
.case-study__rail-button:focus-visible { outline: 3px solid rgba(12, 60, 1, .3); outline-offset: 3px; }
.case-study__related .project-grid.case-study__related-rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 48px) / 3);
    grid-template-columns: none;
    gap: 24px;
    margin-top: 0;
    padding: 4px 4px 18px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scroll-padding-inline: 4px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.case-study__related .project-grid.case-study__related-rail::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.case-study__related-item { min-width: 0; scroll-snap-align: start; }
.case-study__related-item[hidden] { display: none; }
.case-study__related .project-card { height: auto; aspect-ratio: 397 / 408; }
.case-study__related-more-wrap { display: flex; justify-content: center; margin-top: 20px; }
.case-study__related-more {
    min-height: 48px; padding: 10px 20px; border: 1px solid #0c3c01; border-radius: 9px;
    background: #0c3c01; color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.case-study__related-more:focus-visible { outline: 3px solid rgba(12, 60, 1, .3); outline-offset: 3px; }
.case-study__visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
    .case-study { --case-study-inline-space: 20px; padding-top: 84px; }
    .case-study__container, .case-study__hero { width: min(100% - 40px, 760px); }
    .case-study__hero { aspect-ratio: auto; min-height: 0; border-radius: 18px; }
    .case-study__hero > .case-study__image { height: auto; aspect-ratio: auto; }
    .case-study__split, .case-study__story-row { grid-template-columns: 1fr; gap: 24px; }
    .case-study__split { padding-block: 38px 44px; }
    .case-study__split .case-study__copy,
    .case-study__story-row .case-study__copy { width: min(100%, 680px); }
    .case-study__showcase, .case-study__next { aspect-ratio: auto; min-height: 0; }
    .case-study__showcase > .case-study__image,
    .case-study__next > .case-study__image { height: auto; aspect-ratio: auto; }
    .case-study__related { padding-top: 64px; }
    .case-study__related .project-grid.case-study__related-rail { grid-auto-columns: calc((100% - 20px) / 2); gap: 20px; }
}

@media (max-width: 600px) {
    .case-study { --case-study-inline-space: 12px; padding-block: 78px 64px; }
    .case-study__container, .case-study__hero { width: calc(100% - 24px); }
    .case-study__hero { border-radius: 14px; }
    .case-study__intro { padding-block: 16px 28px; text-align: left; }
    .case-study__intro h1 { margin-inline: 0; font-size: clamp(1.85rem, 9vw, 2.5rem); }
    .case-study__summary { margin-top: 14px; font-size: 1rem; line-height: 1.6; }
    .case-study__meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .case-study__meta div { min-width: 0; max-width: none; padding: 12px; }
    .case-study__copy h2, .case-study__related > h2 { font-size: 1.55rem; }
    .case-study__body { font-size: 1rem; line-height: 1.68; }
    .case-study__media { border-radius: 16px; }
    .case-study__showcase, .case-study__next { overflow: visible; margin-bottom: 66px; border-radius: 16px; }
    .case-study__showcase > .case-study__image,
    .case-study__next > .case-study__image { overflow: hidden; border-radius: 16px; }
    .case-study__notch {
        right: 0;
        bottom: -58px;
        width: min(190px, calc(100% - 24px));
        height: 58px;
        padding: 8px 0 0 8px;
        border-top-left-radius: 18px;
    }
    .case-study__notch::before { display: none; }
    .case-study__notch::after { width: 18px; height: 18px; }
    .case-study__notch-button { width: 100%; min-height: 48px; padding: 9px 12px; font-size: .88rem; }
    .case-study__story { padding-block: 36px; }
    .case-study__story-row { margin-bottom: 36px; }
    .case-study__split,
    .case-study__story-row { display: grid; grid-template-columns: minmax(0, 1fr); }
    .case-study__split .case-study__copy,
    .case-study__story-row .case-study__copy { display: contents; }
    .case-study__split .case-study__copy h2,
    .case-study__story-row .case-study__copy h2 { grid-row: 1; margin-bottom: 0; }
    .case-study__split .case-study__media,
    .case-study__story-row .case-study__media { grid-row: 2; }
    .case-study__split .case-study__body,
    .case-study__story-row .case-study__body { grid-row: 3; max-width: none; }
    .case-study__related-heading { align-items: center; }
    .case-study__related-controls { display: none !important; }
    .case-study__related .project-grid.case-study__related-rail { grid-auto-columns: min(86%, 340px); gap: 14px; }
    .case-study__related-rail { scrollbar-width: none; }
    .case-study__related-rail::-webkit-scrollbar { display: none; }
}

@media (max-width: 380px) {
    .case-study__meta { grid-template-columns: 1fr; }
    .case-study__meta div { padding: 11px 12px; }
    .case-study__notch { width: min(180px, calc(100% - 16px)); }
    .case-study__notch-button { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
    .case-study__notch-button, .case-study__notch-button::after, .case-study__rail-button { animation: none !important; transition: none !important; }
    .case-study__related-rail { scroll-behavior: auto !important; }
}


/* Phase 4 responsive containment */
@media (max-width: 768px) {
  .project-hero { overflow-x: clip; }
  .project-hero .hero-title {
    font-size: clamp(2rem, 10vw, 3rem) !important;
    overflow-wrap: anywhere;
  }
  .hero-carousel-container { width: 100%; overflow: clip; }
  .hero-carousel { width: min(360px, 100%); }
  .project-grid, .social-grid { grid-template-columns: minmax(0, 1fr); }
  .category-filters { width: 100%; }
  .btn-filter { min-height: 44px; display: inline-flex; align-items: center; }
}
/* Keep every transformed carousel card inside narrow phone viewports. */
@media (max-width: 400px) {
  .hero-carousel-card[data-offset="-2"] { transform: translate(-80px, 24px) rotate(0) scale(.70); }
  .hero-carousel-card[data-offset="-1"] { transform: translate(-48px, 12px) rotate(0) scale(.82); }
  .hero-carousel-card[data-offset="0"]  { transform: translate(0, 0) rotate(0) scale(1); }
  .hero-carousel-card[data-offset="1"]  { transform: translate(48px, 12px) rotate(0) scale(.82); }
  .hero-carousel-card[data-offset="2"]  { transform: translate(80px, 24px) rotate(0) scale(.70); }
}

/* Scalable project collection: responsive grid, category rail and Load More. */
.project-hero {
    overflow-x: clip;
}

.project-hero .hero-title {
    font-size: clamp(2rem, 4.4vw, 3rem) !important;
    text-wrap: balance;
}

.project-listing .container {
    width: min(1200px, calc(100% - clamp(30px, 5vw, 80px)));
    max-width: none;
    padding-inline: 0;
}

.filters {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.category-filter-scroll {
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
}

.category-filter-scroll::-webkit-scrollbar {
    display: none;
}

.category-filter-scroll:focus-visible {
    outline: 3px solid rgba(12, 60, 1, .24);
    outline-offset: 3px;
    border-radius: 12px;
}

.category-filters {
    width: max-content;
    min-width: 100%;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 10px;
}

.filter-label {
    flex: 0 0 auto;
    padding-block: 8px;
    font-size: 18px;
    font-weight: 650;
}

.btn-filter {
    flex: 0 0 auto;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.project-results-summary {
    margin: 4px 0 18px;
    color: #5d655f;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
}

.project-results-summary strong {
    color: #0c3c01;
}

.project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(18px, 2.2vw, 30px);
    margin-top: 0;
}

.project-card {
    width: 100%;
    height: auto;
    min-height: 260px;
    aspect-ratio: 397 / 350;
    contain: layout paint;
}

.notch-wrapper {
    width: clamp(156px, 48%, 190px);
}

.btn-notch {
    width: calc(100% - 24px);
    min-width: 132px;
    font-size: clamp(13px, 1.4vw, 16px);
}

.project-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: clamp(30px, 4vw, 48px);
}

.project-load-more {
    min-width: 168px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border: 1px solid #0c3c01;
    border-radius: 9px;
    background: #0c3c01;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: transform .25s ease, background-color .25s ease, box-shadow .25s ease;
}

.project-load-more:hover,
.project-load-more:focus-visible {
    background: #082901;
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(12, 60, 1, .2);
}

.project-load-more:focus-visible {
    outline: 3px solid rgba(12, 60, 1, .32);
    outline-offset: 4px;
}

.project-load-more.is-loading {
    opacity: .7;
    pointer-events: none;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hero-carousel-container { height: 390px; overflow: clip; }
    .hero-carousel { width: 300px; height: 360px; }
    .hero-carousel-card {
        width: 240px;
        height: 332px;
        margin-left: -120px;
        margin-top: -166px;
    }
    .hero-carousel-card[data-offset="-2"] { transform: translate(-180px, 38px) rotate(-10deg) scale(.78); }
    .hero-carousel-card[data-offset="-1"] { transform: translate(-98px, 20px) rotate(-5deg) scale(.9); }
    .hero-carousel-card[data-offset="1"] { transform: translate(98px, 20px) rotate(5deg) scale(.9); }
    .hero-carousel-card[data-offset="2"] { transform: translate(180px, 38px) rotate(10deg) scale(.78); }
}

@media (max-width: 1023px) {
    .project-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .project-hero.py-5 {
        padding-top: calc(60px + 2rem);
        padding-bottom: 2rem;
    }
    .project-hero .hero-title {
        margin-block: 1.5rem !important;
        font-size: clamp(1.85rem, 9.5vw, 2.55rem) !important;
    }
    .hero-carousel-container {
        width: 100%;
        height: 205px;
        margin-top: 1rem;
        margin-bottom: 0;
        overflow: visible;
    }
    .hero-carousel {
        width: min(300px, 100%);
        height: 190px;
    }
    .hero-carousel-card {
        width: 132px;
        height: 183px;
        margin-left: -66px;
        margin-top: -91.5px;
        border-radius: 14px;
    }
    .hero-carousel-card[data-offset="-2"],
    .hero-carousel-card[data-offset="2"] {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
    .hero-carousel-card[data-offset="-1"] {
        transform: translate(-104px, 12px) rotate(-4deg) scale(.58);
        opacity: .82;
    }
    .hero-carousel-card[data-offset="0"] {
        transform: translate(0, 0) rotate(0) scale(1);
    }
    .hero-carousel-card[data-offset="1"] {
        transform: translate(104px, 12px) rotate(4deg) scale(.58);
        opacity: .82;
    }
    .project-listing.py-5 {
        padding-block: 2.25rem;
    }
    .project-listing .container {
        width: calc(100% - 24px);
    }
    .filters {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        overflow: visible;
    }
    .category-filter-scroll {
        margin-right: -2px;
    }
    .category-filters {
        padding-bottom: 8px;
    }
    .filter-label {
        font-size: 15px;
    }
    .btn-filter {
        padding-inline: 16px;
        font-size: 13px;
    }
    .project-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }
    .project-card {
        max-width: 520px;
        margin-inline: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-load-more { transition: none; }
    .project-load-more:hover,
    .project-load-more:focus-visible { transform: none; }
}
