/* Case study layout: 1184px shell, 12-col grid; text/media start at column 5; full-bleed + carousel rails stay viewport-wide */
/* 100vw bleeds are wider than the layout when a vertical scrollbar is present — clip, don’t scroll horizontally */
html:has(body.case-study-body) {
    overflow-x: clip;
}

body.case-study-body {
    /* Shell gutter: must match .cs-page padding-inline and .site-header__inner (styles.css) */
    --page-pad-x: clamp(1rem, 4vw, 1.5rem);
    max-width: none;
    margin: 0;
    padding: 0;
    /* Clear fixed site header with generous gap before shell content */
    padding-top: clamp(5.5rem, 9vw, 7.5rem);
    overflow-x: clip;
    line-height: 1.65;
    --cs-gap-heading-to-body: 1.5rem;
    --cs-gap-paragraph: 1.25rem;
    --cs-gap-section: clamp(5.5rem, 11vw, 9rem);
}

main.cs-main {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Password gate: same shell width as .cs-page + comfortable inner padding for the form */
body.case-study-body main.cs-main > .case-study-gate {
    width: calc(100% - 2 * var(--page-pad-x));
    max-width: 1184px;
    margin-left: auto;
    margin-right: auto;
    margin-top: clamp(1.75rem, 5vw, 2.75rem);
    margin-bottom: clamp(2rem, 6vw, 3rem);
    padding: clamp(1.85rem, 4vw, 2.75rem) clamp(1.35rem, 4vw, 2rem);
    box-sizing: border-box;
}

@media (min-width: 1200px) {
    body.case-study-body main.cs-main > .case-study-gate {
        width: 100%;
        padding: clamp(2rem, 4.5vw, 3rem) clamp(1.75rem, 4vw, 2.5rem);
    }
}

.cs-page {
    --cs-shell-max: 1184px;
    /* Column 5–12 = main content (8 cols); used for carousel / caption math */
    --cs-content-start: 5;
    --cs-content-cols: 8;
    /* Breathing room between copy and the right edge of the shell (reference layouts) */
    --cs-copy-rail-end: clamp(2rem, 7vw, 4.5rem);

    width: 100%;
    max-width: var(--cs-shell-max);
    margin-inline: auto;
    padding-bottom: clamp(1.5rem, 4vw, 2.5rem);
    padding-inline: var(--page-pad-x);
    box-sizing: border-box;
    container-type: inline-size;
    container-name: cs-page;

    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 0;
}

/* Prose rhythm: links, strong, code in body copy */
.cs-page a {
    font-family: inherit;
}

.cs-page strong,
.cs-page b {
    font-weight: 600;
}

.cs-page .cs-prose {
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    width: auto;
}

@supports (grid-template-columns: subgrid) {
    /* Back link: full shell width */
    .cs-page > .cs-prose:first-child {
        grid-column: 1 / -1;
    }

    .cs-page > section.cs-mod {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > section.cs-mod > .cs-prose,
    .cs-page > section.cs-mod > .cs-offset-inner {
        grid-column: 5 / -1;
    }

    /* Module label (col 1–4) + body (col 5–12): bullets, step nav */
    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose,
    .cs-page > nav.cs-mod-stepnav > .cs-prose {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > h2.cs-mod-title,
    .cs-page > nav.cs-mod-stepnav > .cs-prose > h2.cs-mod-title {
        grid-column: 1 / 5;
        align-self: start;
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > *:not(h2.cs-mod-title),
    .cs-page > nav.cs-mod-stepnav > .cs-prose > *:not(h2.cs-mod-title) {
        grid-column: 5 / -1;
    }

    /* Inverted bullets: viewport-wide band, shell matches page grid */
    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band {
        grid-column: 1 / -1;
    }

    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        column-gap: 0;
        width: 100%;
        max-width: var(--cs-shell-max);
        margin-inline: auto;
        padding-inline: var(--page-pad-x);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title {
        grid-column: 1 / 5;
        align-self: start;
    }

    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > *:not(h2.cs-mod-title) {
        grid-column: 5 / -1;
    }

    /* Three-column context: equal thirds (~4/12 each) with real gutters (parent grid has column-gap: 0) */
    .cs-page > section.cs-mod-threecol > .cs-threecol {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        column-gap: var(--cs-threecol-gap);
        row-gap: clamp(1.5rem, 4vw, 2.25rem);
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-threecol > .cs-threecol > .cs-threecol__col {
        grid-column: auto;
        min-width: 0;
        padding-inline: clamp(0.2rem, 0.75vw, 0.45rem);
        box-sizing: border-box;
    }

    /* Step article sections: title in col 1–4, blocks in 5–12 */
    .cs-page > .cs-mod-stepsections > .cs-step-section {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section > h2.cs-step-title {
        grid-column: 1 / 5;
        align-self: start;
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section > *:not(h2.cs-step-title) {
        grid-column: 5 / -1;
    }

    .cs-page > section.cs-mod > .cs-bleed {
        grid-column: 1 / -1;
    }

    /* Process gallery: full shell width for horizontal bleed */
    .cs-page > section.cs-mod-carousel-scroll-wrap > .cs-carousel-scroll-spacer {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
    }

    .cs-page > section.cs-mod > .cs-prose,
    .cs-page > section.cs-mod > .cs-offset-inner,
    .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose,
    .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose {
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section > *:not(h2.cs-step-title) {
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-band > .cs-band-inner {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose {
        grid-column: 5 / -1;
    }

    .cs-page > section.cs-mod-bleed {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > section.cs-mod-bleed > .cs-bleed-video-wrap,
    .cs-page > section.cs-mod-bleed > .cs-bleed-figure {
        grid-column: 1 / -1;
    }

    .cs-page > nav.cs-mod {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
    }

    .cs-page > .cs-mod-stepsections {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: subgrid;
        row-gap: var(--cs-gap-section);
    }
}

/* Full-bleed captions: align to columns 5–12 within the figure */
.cs-page .cs-mod-bleed figcaption.cs-prose {
    width: calc(100% * var(--cs-content-cols) / 12);
    max-width: none;
    margin-left: calc(100% * (var(--cs-content-start) - 1) / 12);
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

@supports not (grid-template-columns: subgrid) {
    .cs-page > .cs-prose:first-child {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .cs-page > section.cs-mod:not(.cs-mod-bullets--inverted) > .cs-prose,
    .cs-page > section.cs-mod > .cs-offset-inner,
    .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose {
        width: calc(100% * var(--cs-content-cols) / 12);
        margin-left: calc(100% * (var(--cs-content-start) - 1) / 12);
        margin-right: 0;
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        margin-bottom: var(--cs-gap-section);
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section:last-child {
        margin-bottom: 0;
    }

    .cs-page > section.cs-mod-carousel-scroll-wrap > .cs-carousel-scroll-spacer {
        width: 100%;
        margin-left: 0;
    }

    .cs-page > section.cs-mod > .cs-prose,
    .cs-page > section.cs-mod > .cs-offset-inner,
    .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose,
    .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose {
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section > *:not(h2.cs-step-title) {
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose,
    .cs-page > nav.cs-mod-stepnav > .cs-prose {
        width: 100%;
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 1rem clamp(1.25rem, 3vw, 2rem);
    }

    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose {
        width: 100%;
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 1rem clamp(1.25rem, 3vw, 2rem);
    }

    .cs-page > section.cs-mod-threecol > .cs-threecol {
        width: 100%;
        margin-left: 0;
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: var(--cs-threecol-gap, clamp(1.5rem, 4vw, 2.75rem));
        padding-right: var(--cs-copy-rail-end);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-threecol > .cs-threecol > .cs-threecol__col {
        flex: 1 1 0;
        min-width: 0;
        max-width: 100%;
        padding-inline: clamp(0.2rem, 0.75vw, 0.45rem);
        box-sizing: border-box;
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > h2.cs-mod-title,
    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title,
    .cs-page > nav.cs-mod-stepnav > .cs-prose > h2.cs-mod-title {
        flex: 0 0 calc(33.333% - 1rem);
        min-width: 9rem;
        max-width: 14rem;
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > *:not(h2.cs-mod-title),
    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > *:not(h2.cs-mod-title),
    .cs-page > nav.cs-mod-stepnav > .cs-prose > *:not(h2.cs-mod-title) {
        flex: 1 1 55%;
        min-width: 0;
    }

    .cs-page > section.cs-mod-band > .cs-band-inner {
        display: block;
    }
}

.cs-prose--tight {
    padding-top: 0.5rem;
}

.cs-back {
    display: block;
    width: 100%;
    margin-top: 0;
    margin-bottom: 2rem;
    text-align: left;
    /* Override global `a` underline border on this page */
    border-bottom: none;
    padding-bottom: 0;
    transition: color 0.2s ease;
}

.cs-back:hover {
    border-bottom: none;
    color: var(--color-link-hover);
}

.cs-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;
}

/* M1 Hero */
.cs-mod-hero {
    padding-top: clamp(2.75rem, 4.5vw, 3.5rem);
    padding-bottom: clamp(1.25rem, 3vw, 2.25rem);
}

.cs-hero-heading {
    font-size: clamp(3rem, 7vw, 4.35rem);
    font-weight: 400;
    line-height: 1.05;
    margin: 0 0 var(--cs-gap-heading-to-body);
    color: var(--color-heading);
    border: none;
    padding: 0;
}

.cs-hero-heading--logo {
    font-size: 0;
    line-height: 0;
    margin-bottom: clamp(1rem, 2.5vw, 1.35rem);
}

.cs-hero-logo-wrap {
    display: block;
    line-height: 0;
}

.cs-hero-logotext {
    display: block;
    letter-spacing: 0.02em;
}

.cs-hero-logo {
    max-height: clamp(2.75rem, 7vw, 4.25rem);
    width: auto;
    max-width: min(18rem, 100%);
    height: auto;
    display: block;
}

[data-theme="light"] .cs-mod-hero .cs-hero-logo {
    filter: brightness(0) saturate(100%);
}

.cs-hero-strap {
    font-family: "EB Garamond", Georgia, "Times New Roman", serif;
    font-size: clamp(1.35rem, 2.75vw, 1.75rem);
    font-weight: 400;
    line-height: 1.45;
    margin: 0;
    max-width: min(40rem, 100%);
    color: var(--color-text);
    letter-spacing: 0.01em;
}

/* Extra vertical rhythm between logo image and strapline (padding avoids margin collapse with h1) */
.cs-mod-hero:has(.cs-hero-heading--logo) .cs-hero-heading--logo {
    margin-bottom: 0;
}

.cs-mod-hero:has(.cs-hero-heading--logo) .cs-hero-strap {
    padding-top: clamp(2.25rem, 5.5vw, 3.75rem);
    margin-bottom: clamp(1rem, 2.25vw, 1.625rem);
}

/* M2 Offset media */
.cs-mod-offset {
    margin-bottom: var(--cs-gap-section);
}

.cs-offset-inner {
    max-width: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Optional art-direction: keep slight inset within cols 5–12 */
.cs-mod-offset--right .cs-offset-inner {
    margin-right: 0;
    margin-left: 0;
}

.cs-mod-offset--left .cs-offset-inner {
    margin-left: 0;
    margin-right: 0;
}

.cs-offset-figure {
    margin: 0;
}

.cs-offset-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

/* Offset: minimal autoplay video (native <video> + custom ring / play-pause) */
.cs-offset-video-shell {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 2px;
    overflow: hidden;
}

.cs-offset-video-el {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: middle;
    object-fit: contain;
}

.cs-offset-video-el::-webkit-media-controls {
    display: none !important;
}

.cs-offset-video-el::-webkit-media-controls-enclosure {
    display: none !important;
}

.cs-offset-video-ctrl {
    position: absolute;
    right: clamp(0.5rem, 2vw, 0.875rem);
    bottom: clamp(0.5rem, 2vw, 0.875rem);
    width: 52px;
    height: 52px;
    pointer-events: none;
}

.cs-offset-video-ring {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.cs-offset-video-ring__track,
.cs-offset-video-ring__prog {
    fill: none;
    stroke-width: 1.25;
}

.cs-offset-video-ring__track {
    stroke: rgba(255, 255, 255, 0.22);
}

.cs-offset-video-ring__prog {
    stroke: rgba(255, 255, 255, 0.92);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.12s linear;
}

.cs-offset-video-toggle {
    pointer-events: auto;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 2rem;
    height: 2rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.62);
    cursor: pointer;
    box-sizing: border-box;
}

.cs-offset-video-toggle:hover {
    background: rgba(0, 0, 0, 0.78);
}

.cs-offset-video-toggle:focus-visible {
    outline: 2px solid var(--color-focus, #fff);
    outline-offset: 2px;
}

.cs-offset-video-icon {
    grid-area: 1 / 1;
}

.cs-offset-video-icon[hidden] {
    display: none !important;
}

/* M3 Bullets */
.cs-mod-bullets {
    margin-bottom: var(--cs-gap-section);
}

/* "What we did" (inverted): viewport-wide band + shell matches page grid (see bullets.njk) */
.cs-bullets-inverted__shell {
    max-width: var(--cs-shell-max);
    margin-inline: auto;
    padding-inline: var(--page-pad-x);
    box-sizing: border-box;
}

.cs-bullets-inverted__band {
    padding-block: clamp(4.5rem, 11vw, 7.5rem);
    box-sizing: border-box;
}

[data-theme="dark"] .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band {
    background: #faf9f6;
}

[data-theme="dark"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose {
    color: #2c2c2c;
}

[data-theme="dark"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title {
    color: #141414;
}

[data-theme="dark"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list {
    color: #2c2c2c;
}

[data-theme="dark"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list li::marker {
    color: #5c5c5c;
}

[data-theme="light"] .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band {
    background: #121212;
}

[data-theme="light"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose {
    color: #e1e1e1;
}

[data-theme="light"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title {
    color: #f5f5f5;
}

[data-theme="light"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list {
    color: #e1e1e1;
}

[data-theme="light"] .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list li::marker {
    color: #a8a8a8;
}

.cs-mod-title {
    font-size: 2.125rem;
    font-weight: 400;
    color: var(--color-heading);
    margin: 0 0 var(--cs-gap-heading-to-body);
    line-height: 1.2;
}

/* Visible bullets (global styles.css resets ul — override in .cs-page) */
.cs-page ul.cs-bullet-list {
    list-style-type: disc;
    list-style-position: outside;
    margin: 0.25rem 0 0;
    padding-left: 1.35rem;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--color-text);
}

.cs-page ul.cs-bullet-list li {
    display: list-item;
    margin-bottom: 0.85rem;
    padding-left: 0.35rem;
}

.cs-page ul.cs-bullet-list li:last-child {
    margin-bottom: 0;
}

.cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > ul.cs-bullet-list,
.cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list {
    margin-top: 0.15rem;
}

/* M3b Three columns (business / user / role) */
.cs-mod-threecol {
    --cs-threecol-gap: clamp(1.5rem, 4vw, 2.75rem);
    margin-bottom: var(--cs-gap-section);
}

/* Small caps headings — same rail treatment as bullets + step nav titles */
.cs-page > section.cs-mod-threecol .cs-threecol__col > h2.cs-mod-title,
.cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > h2.cs-mod-title,
.cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title,
.cs-page > nav.cs-mod-stepnav > .cs-prose > h2.cs-mod-title {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.35;
    margin: 0;
    padding-right: clamp(0.75rem, 2vw, 1.25rem);
    text-align: left;
    color: var(--color-heading);
}

.cs-page > section.cs-mod-threecol .cs-threecol__col > h2.cs-mod-title {
    margin: 0 0 var(--cs-gap-heading-to-body);
    padding-right: 0;
}

.cs-page > section.cs-mod-threecol .cs-threecol__col.cs-prose p {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.72;
    color: var(--color-text);
    margin: 0 0 var(--cs-gap-paragraph);
}

.cs-page > section.cs-mod-threecol .cs-threecol__col.cs-prose p:last-child {
    margin-bottom: 0;
}

/* M4 Band + details + CTAs */
.cs-mod-band {
    margin-bottom: var(--cs-gap-section);
}

.cs-band-inner {
    background: transparent;
    border-top: 1px solid var(--color-border-subtle);
    border-bottom: none;
    /* Border → teaser copy ≈ inner bottom + section gap before next module (all breakpoints) */
    --cs-band-inner-y: clamp(3.25rem, 12vw, 5.5rem);
    padding-top: calc(var(--cs-band-inner-y) + var(--cs-gap-section));
    padding-bottom: var(--cs-band-inner-y);
}

.cs-page > section.cs-mod-band .cs-details {
    margin-top: 0;
}

.cs-page > section.cs-mod-band .cs-details__summary {
    margin-top: 0;
    padding-top: 0;
}

.cs-band-context {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
}

/* Subtle entrance when the band scrolls into view (JS adds .is-revealed) */
.cs-band-context[data-band-reveal]:not(.is-revealed) {
    opacity: 0;
    transform: translate3d(0, 14px, 0);
}

.cs-band-context[data-band-reveal].is-revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition:
        opacity 0.75s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
    .cs-band-context[data-band-reveal]:not(.is-revealed),
    .cs-band-context[data-band-reveal].is-revealed {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.cs-details {
    margin-bottom: 0;
}

.cs-mod-band .cs-details__summary {
    position: relative;
    cursor: pointer;
    list-style: none;
    display: block;
    font-weight: 400;
    color: inherit;
    line-height: 1.65;
}

.cs-mod-band .cs-details__summary::-webkit-details-marker {
    display: none;
}

/* Stacked labels: fade Read more / Show less + teaser (avoid display:none) */
.cs-mod-band .cs-details__label--collapsed,
.cs-mod-band .cs-details__label--expanded {
    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.cs-mod-band .cs-details__label--expanded {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.cs-mod-band .cs-details:not([open]) .cs-details__label--collapsed {
    display: block;
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cs-mod-band .cs-details:not([open]) .cs-details__label--expanded {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: inline-block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cs-mod-band .cs-details[open] .cs-details__label--collapsed {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cs-mod-band .cs-details[open] .cs-details__label--expanded {
    display: inline-block;
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.cs-details__teaser {
    position: relative;
    display: block;
    margin-bottom: 0.5rem;
}

.cs-details__preview-out {
    display: block;
    max-height: clamp(4.75rem, 18vw, 6.8rem);
    overflow: hidden;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-text);
    transition:
        max-height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease,
        margin 0.35s ease;
    /* Fade out the last ~2 lines (~3.4em at line-height 1.7) */
    -webkit-mask-image: linear-gradient(
        to bottom,
        #000 0%,
        #000 calc(100% - 3.4em),
        transparent 100%
    );
    mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 3.4em), transparent 100%);
}

.cs-mod-band .cs-details[open]:not(.cs-details--closing) .cs-details__preview-out {
    max-height: 0 !important;
    opacity: 0;
    margin-bottom: 0;
    -webkit-mask-image: none;
    mask-image: none;
}

/* While panel collapses, bring teaser + Read more back with a transition */
.cs-mod-band .cs-details--closing[open] .cs-details__label--collapsed {
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

.cs-mod-band .cs-details--closing[open] .cs-details__label--expanded {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cs-mod-band .cs-details--closing[open] .cs-details__preview-out {
    max-height: clamp(4.75rem, 18vw, 6.8rem);
    opacity: 1;
    margin-bottom: 0;
    -webkit-mask-image: linear-gradient(
        to bottom,
        #000 0%,
        #000 calc(100% - 3.4em),
        transparent 100%
    );
    mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 3.4em), transparent 100%);
}

@supports (height: 1lh) {
    .cs-mod-band .cs-details--closing[open] .cs-details__preview-out {
        -webkit-mask-image: linear-gradient(
            to bottom,
            #000 0%,
            #000 calc(100% - 2lh),
            transparent 100%
        );
        mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 2lh), transparent 100%);
    }
}

@supports (height: 1lh) {
    .cs-details__preview-out {
        -webkit-mask-image: linear-gradient(
            to bottom,
            #000 0%,
            #000 calc(100% - 2lh),
            transparent 100%
        );
        mask-image: linear-gradient(to bottom, #000 0%, #000 calc(100% - 2lh), transparent 100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cs-details__preview-out {
        -webkit-mask-image: none;
        mask-image: none;
        transition: none;
    }

    .cs-mod-band .cs-details__label--collapsed,
    .cs-mod-band .cs-details__label--expanded {
        transition: none;
    }

    .cs-mod-band .cs-details[open] .cs-details__preview-out,
    .cs-mod-band .cs-details[open]:not(.cs-details--closing) .cs-details__preview-out {
        transition: none;
    }
}

.cs-details__preview-out p {
    margin: 0 0 0.75rem;
}

.cs-details__preview-out p:last-child {
    margin-bottom: 0;
}

.cs-details__read-more {
    display: inline-block;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    margin-top: 0.15rem;
}

.cs-mod-band .cs-details__summary:hover .cs-details__read-more,
.cs-mod-band .cs-details__summary:hover .cs-details__label--expanded {
    color: var(--color-link-hover);
}

.cs-band-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
}

/* Expand/collapse panel height is driven by JS; overflow clips during animation */
.cs-details__panel {
    overflow: hidden;
}

.cs-details__body {
    margin-top: var(--cs-gap-heading-to-body);
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--color-text);
}

.cs-details__body p {
    margin: 0 0 var(--cs-gap-paragraph);
}

.cs-details__body p:last-child {
    margin-bottom: 0;
}

.cs-details__body code {
    font-size: 0.9em;
}

/* Lists inside collapsible / rich HTML */
.cs-page .cs-details__body ul {
    list-style-type: disc;
    list-style-position: outside;
    margin: 0 0 var(--cs-gap-paragraph);
    padding-left: 1.35rem;
}

.cs-page .cs-details__body ul li {
    display: list-item;
    margin-bottom: 0.65rem;
}

.cs-page .cs-details__body ol {
    list-style-type: decimal;
    list-style-position: outside;
    margin: 0 0 var(--cs-gap-paragraph);
    padding-left: 1.35rem;
}

.cs-page .cs-details__body ol li {
    display: list-item;
    margin-bottom: 0.65rem;
}

.cs-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.cs-cta {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--color-link-border);
    border-radius: 9999px;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-link);
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cs-cta:hover {
    color: var(--color-link-hover);
    background: var(--color-toggle-hover);
}

.cs-cta--primary {
    background: var(--color-heading);
    color: var(--color-bg);
    border-color: var(--color-heading);
    font-weight: 600;
}

.cs-cta--primary:hover {
    color: var(--color-bg);
    background: var(--color-link-hover);
    border-color: var(--color-link-hover);
}

/* M5 Video */
.cs-mod-video {
    margin-bottom: var(--cs-gap-section);
}

.cs-video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--color-toggle-bg);
    border-radius: 4px;
    overflow: hidden;
}

.cs-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.cs-native-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.cs-caption {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--color-footer);
    margin: 0.65rem 0 0;
}

/* M6 Full bleed */
.cs-bleed {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    box-sizing: border-box;
}

.cs-mod-bleed {
    margin-bottom: var(--cs-gap-section);
}

.cs-bleed-figure {
    margin: 0;
}

.cs-bleed-figure img {
    width: 100%;
    height: auto;
    display: block;
}

.cs-bleed-video-wrap {
    position: relative;
    aspect-ratio: 21 / 9;
    min-height: 12rem;
    background: #000;
}

/* Full-bleed minimal player (autoplay + ring; same controls as offset media) */
.cs-bleed-video-wrap--minimal {
    aspect-ratio: auto;
    min-height: 0;
    overflow: hidden;
}

.cs-bleed-video-wrap--minimal .cs-offset-video-shell {
    border-radius: 0;
}

.cs-embed--bleed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.cs-bleed-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cs-bleed .cs-caption {
    padding: 0.75rem clamp(1rem, 4vw, 1.5rem) 0;
}

/* M7 Pull quote */
.cs-mod-pullquote {
    margin: var(--cs-gap-section) 0;
}

.cs-pullquote {
    margin: 0;
    padding: 1.5rem 0 1.5rem 1.25rem;
    border-left: 3px solid var(--color-border-subtle);
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 1.1875rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--color-heading);
}

.cs-pullquote p {
    margin: 0 0 var(--cs-gap-paragraph);
}

.cs-pullquote p:last-of-type {
    margin-bottom: 0;
}

.cs-pullquote__attr {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-footer);
    font-style: normal;
    margin-top: 1rem;
}

/* M7A Step nav */
.cs-mod-stepnav {
    margin-bottom: var(--cs-gap-section);
}

.cs-stepnav-heading {
    margin-bottom: var(--cs-gap-heading-to-body);
    line-height: 1.2;
}

/* Vertical list, same rhythm as .cs-bullet-list (global ul reset overridden in .cs-page) */
.cs-page ul.cs-stepnav-list {
    list-style-type: disc;
    list-style-position: outside;
    margin: 0.25rem 0 0;
    padding-left: 1.35rem;
    display: block;
}

.cs-page ul.cs-stepnav-list li {
    display: list-item;
    margin-bottom: 0.85rem;
    padding-left: 0.35rem;
}

.cs-page ul.cs-stepnav-list li:last-child {
    margin-bottom: 0;
}

.cs-stepnav-link {
    font-family: "Poppins", system-ui, sans-serif;
    text-decoration: none;
    border-bottom: none;
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.65;
    transition: color 0.2s ease;
}

.cs-stepnav-link:hover {
    color: var(--color-link-hover);
    border-bottom: none;
    text-decoration: none;
}

.cs-stepnav-link.is-active {
    font-weight: 600;
    color: var(--color-heading);
    border-bottom: none;
    text-decoration: none;
}

/* M7B Step sections — panel modules with border + spacing */
.cs-mod-stepsections {
    margin-bottom: var(--cs-gap-section);
}

.cs-step-section {
    margin: 0;
    /* Space above grid: label rail + body column both start below the top rule */
    padding-top: clamp(3.5rem, 8.5vw, 5.75rem);
    padding-inline: clamp(1.75rem, 4vw, 2.5rem);
    padding-bottom: clamp(1.75rem, 4vw, 2.5rem);
    /* Shared drop from row start so left label and right column align (subgrid shares one row) */
    --cs-step-rail-inset: clamp(1.35rem, 3.25vw, 2.25rem);
    scroll-margin-top: 5rem;
    border: none;
    border-top: 1px solid var(--color-border-subtle);
    border-radius: 0;
    background: transparent;
    box-sizing: border-box;
}

.cs-step-title {
    font-size: 1.875rem;
    font-weight: 400;
    color: var(--color-heading);
    margin: 0 0 var(--cs-gap-heading-to-body);
    line-height: 1.25;
}

.cs-page > .cs-mod-stepsections > .cs-step-section > h2.cs-step-title {
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    line-height: 1.35;
    margin: var(--cs-step-rail-inset) 0 0 0;
    padding-top: 0.15em;
    padding-right: clamp(0.75rem, 2vw, 1.25rem);
    text-align: left;
    color: var(--color-heading);
}

/* First body block: same inset as heading so both columns clear the row top together */
.cs-page > .cs-mod-stepsections > .cs-step-section > h2.cs-step-title + .cs-step-block {
    margin-top: var(--cs-step-rail-inset);
}

.cs-step-html {
    font-family: "Poppins", system-ui, sans-serif;
}

.cs-step-html p {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.7;
    margin: 0 0 var(--cs-gap-paragraph);
}

.cs-step-html p:last-child {
    margin-bottom: 0;
}

.cs-page .cs-step-html ul {
    list-style-type: disc;
    list-style-position: outside;
    margin: 0 0 var(--cs-gap-paragraph);
    padding-left: 1.35rem;
}

.cs-page .cs-step-html ul li {
    display: list-item;
    margin-bottom: 0.65rem;
    font-size: 1rem;
    line-height: 1.65;
}

.cs-page .cs-step-html ol {
    list-style-type: decimal;
    list-style-position: outside;
    margin: 0 0 var(--cs-gap-paragraph);
    padding-left: 1.35rem;
}

.cs-page .cs-step-html ol li {
    display: list-item;
    margin-bottom: 0.65rem;
}

.cs-step-figure {
    margin: 1.5rem 0;
}

/* Extra air between prose block and embedded video in step modules */
.cs-page > .cs-mod-stepsections > .cs-step-section .cs-step-html + .cs-video-frame {
    margin-top: clamp(2rem, 4.5vw, 3rem);
}

.cs-step-figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 2px;
}

/* Process gallery: sticky scroll-linked horizontal rail */
.cs-mod-carousel-scroll-wrap {
    --cs-scroll-gutter: max(0.75rem, min(1.25rem, 3.5vw));
    --cs-carousel-gap: clamp(0.75rem, 2vw, 1.25rem);
    /* Slide width: default matches .cs-carousel--gallery rail; override per module (e.g. phone mockups) */
    --cs-carousel-scroll-slide-w: min(90vw, 52rem);
    --cs-carousel-scroll-slide-max-h: none;
    /* Tighter than generic section gap — carousel is a dense visual strip */
    margin-bottom: clamp(2.25rem, 5vw, 4.5rem);
}

.cs-mod-carousel-scroll-wrap--no-header {
    margin-top: 0;
}

.cs-carousel-scroll-hint {
    margin: -0.5rem 0 1.25rem;
    font-family: "Poppins", system-ui, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--color-footer);
}

.cs-carousel-bleed--scroll {
    margin-top: 0;
    width: 100%;
}

.cs-carousel-scroll-spacer {
    position: relative;
    width: 100%;
    min-width: 0;
}

.cs-carousel-scroll-sticky {
    position: sticky;
    top: 0;
    /* Hug slide + toolbar; avoid a full-viewport band of empty space */
    min-height: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
    padding-block: clamp(0.35rem, 1.5vh, 0.85rem);
}

.cs-carousel-scroll-sticky__rail {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
}

.cs-carousel-scroll-viewport {
    overflow: hidden;
    outline: none;
    touch-action: none;
}

.cs-carousel-scroll-track {
    display: flex;
    gap: var(--cs-carousel-gap);
    width: max-content;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    padding-inline: var(--cs-scroll-gutter);
    box-sizing: border-box;
}

/* Beat .cs-carousel--gallery .cs-carousel__slide (same specificity, comes later in file) */
.cs-carousel--gallery .cs-carousel-scroll-track .cs-carousel__slide,
.cs-carousel-scroll-track .cs-carousel__slide {
    flex: 0 0 var(--cs-carousel-scroll-slide-w);
    margin: 0;
    scroll-snap-align: unset;
    scroll-snap-stop: normal;
}

.cs-carousel-scroll-track .cs-carousel__slide-frame img {
    max-height: var(--cs-carousel-scroll-slide-max-h, none);
    object-fit: contain;
}

.cs-carousel-scroll-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem 1.25rem;
    padding: 0 var(--cs-scroll-gutter);
}

.cs-carousel-scroll-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text);
    font-size: 1.125rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.cs-carousel-scroll-arrow:hover:not(:disabled) {
    color: var(--color-link-hover);
}

.cs-carousel-scroll-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cs-carousel-scroll-arrow:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.cs-carousel-scroll-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.cs-carousel-scroll-dot {
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--color-border);
    opacity: 0.45;
    cursor: pointer;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease,
        background-color 0.25s ease;
}

.cs-carousel-scroll-dot.is-active {
    opacity: 1;
    background: var(--color-heading);
    transform: scale(1.35);
}

.cs-carousel-scroll-dot:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* Process gallery: show controls only on hover / keyboard focus within */
@media (hover: hover) and (pointer: fine) {
    .cs-mod-carousel-scroll-wrap .cs-carousel-scroll-toolbar {
        opacity: 0;
        transition: opacity 0.22s ease;
    }

    .cs-mod-carousel-scroll-wrap:hover .cs-carousel-scroll-toolbar,
    .cs-mod-carousel-scroll-wrap:focus-within .cs-carousel-scroll-toolbar {
        opacity: 1;
    }
}

@media (hover: none) {
    .cs-mod-carousel-scroll-wrap .cs-carousel-scroll-toolbar {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cs-carousel-scroll-dot {
        transition: none;
    }

    .cs-mod-carousel-scroll-wrap .cs-carousel-scroll-toolbar {
        opacity: 1;
        transition: none;
    }
}

/* M8 / M9 Carousels — agency-style horizontal rail (inspired by together.agency case layouts) */
.cs-mod-carousel-wrap,
.cs-mod-related-wrap {
    --cs-carousel-gap: clamp(0.75rem, 2vw, 1.25rem);
}

.cs-mod-carousel-wrap {
    margin-bottom: var(--cs-gap-section);
}

/* Related work is usually last — avoid duplicating a full section gap under the rail */
.cs-mod-related-wrap {
    margin-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.cs-carousel-bleed {
    margin-top: 1.5rem;
    padding-bottom: 0.25rem;
}

.cs-carousel {
    position: relative;
    --cs-rail-inset: max(1rem, 4vw);
}

@supports (width: 1cqw) {
    .cs-page .cs-carousel {
        --cs-rail-inset: max(
            1rem,
            calc((100vw - 100cqw) / 2 + 100cqw * (var(--cs-content-start) - 1) / 12)
        );
    }
}

/* Rail padding: align first slide with grid column 5 of the case-study shell (container query) */
.cs-carousel__viewport {
    position: relative;
    overflow: hidden;
    mask-image: linear-gradient(
        to right,
        transparent,
        black 0.5rem,
        black calc(100% - 0.5rem),
        transparent
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent,
        black 0.5rem,
        black calc(100% - 0.5rem),
        transparent
    );
}

@supports not (mask-image: linear-gradient(red, red)) {
    .cs-carousel__viewport {
        mask-image: none;
        -webkit-mask-image: none;
    }
}

.cs-carousel__track {
    display: flex;
    gap: var(--cs-carousel-gap);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--cs-rail-inset) 1rem;
    padding-inline: var(--cs-rail-inset) 1rem;
    padding-block: 0.35rem 1.25rem;
    outline: none;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
    -webkit-overflow-scrolling: touch;
}

.cs-carousel__track::-webkit-scrollbar {
    height: 6px;
}

.cs-carousel__track::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 999px;
}

@media (prefers-reduced-motion: reduce) {
    .cs-carousel__track {
        scroll-behavior: auto;
    }
}

/* Gallery slides: large dominant frame + peek of next (Together-style) */
.cs-carousel--gallery .cs-carousel__slide {
    flex: 0 0 min(90vw, 52rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    margin: 0;
}

.cs-carousel__slide-frame {
    display: block;
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-toggle-bg);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    transform-origin: center center;
    transition:
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.45s ease,
        box-shadow 0.45s ease;
}

[data-theme="light"] .cs-carousel__slide-frame {
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.08);
}

.cs-carousel--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame,
.cs-embla--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame {
    opacity: 0.72;
    transform: scale(0.965);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .cs-carousel--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame,
[data-theme="light"] .cs-embla--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
}

.cs-carousel--gallery .cs-carousel__slide.is-active .cs-carousel__slide-frame,
.cs-embla--gallery .cs-carousel__slide.is-active .cs-carousel__slide-frame {
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .cs-carousel__slide-frame {
        transition: none;
    }

    .cs-carousel--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame,
    .cs-embla--gallery .cs-carousel__slide:not(.is-active) .cs-carousel__slide-frame {
        opacity: 0.9;
        transform: none;
    }
}

.cs-carousel__slide-frame img {
    width: 100%;
    height: auto;
    display: block;
}

.cs-carousel__slide-caption {
    margin: 0.65rem 0 0;
    font-size: 0.875rem;
    color: var(--color-footer);
    line-height: 1.4;
}

/* Toolbar: icon-only prev/next, right-aligned, no pill background */
.cs-carousel__toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-inline: var(--cs-rail-inset) 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.35rem;
}

/* Related strip: hide full-bleed scrollbar + arrows until hover / focus */
.cs-mod-related-wrap .cs-carousel__track {
    scrollbar-width: none;
    scrollbar-color: transparent transparent;
}

.cs-mod-related-wrap .cs-carousel__track::-webkit-scrollbar {
    height: 0;
}

.cs-mod-related-wrap .cs-carousel:hover .cs-carousel__track,
.cs-mod-related-wrap .cs-carousel:focus-within .cs-carousel__track {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.cs-mod-related-wrap .cs-carousel:hover .cs-carousel__track::-webkit-scrollbar,
.cs-mod-related-wrap .cs-carousel:focus-within .cs-carousel__track::-webkit-scrollbar {
    height: 6px;
}

@media (hover: hover) and (pointer: fine) {
    .cs-mod-related-wrap .cs-carousel__toolbar {
        opacity: 0;
        transition: opacity 0.22s ease;
    }

    .cs-mod-related-wrap .cs-carousel:hover .cs-carousel__toolbar,
    .cs-mod-related-wrap .cs-carousel:focus-within .cs-carousel__toolbar {
        opacity: 1;
    }
}

@media (hover: none) {
    .cs-mod-related-wrap .cs-carousel__toolbar {
        opacity: 1;
    }

    .cs-mod-related-wrap .cs-carousel__track {
        scrollbar-width: thin;
        scrollbar-color: var(--color-border) transparent;
    }

    .cs-mod-related-wrap .cs-carousel__track::-webkit-scrollbar {
        height: 6px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cs-mod-related-wrap .cs-carousel__toolbar {
        opacity: 1;
        transition: none;
    }
}

.cs-carousel__arrows {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.cs-carousel__arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.cs-carousel__arrow:hover:not(:disabled) {
    color: var(--color-link-hover);
    opacity: 0.92;
}

.cs-carousel__arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.cs-carousel__arrow:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

/* Related strip: slightly smaller cards, same motion */
.cs-carousel--related .cs-related-card {
    flex: 0 0 min(78vw, 20rem);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--color-link);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-toggle-bg);
    transition:
        border-color 0.3s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.35s ease,
        box-shadow 0.35s ease;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .cs-carousel--related .cs-related-card {
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.06);
}

.cs-carousel--related .cs-related-card:hover {
    border-color: var(--color-link-border);
}

.cs-carousel--related .cs-related-card:not(.is-active) {
    opacity: 0.78;
    transform: scale(0.97);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.cs-carousel--related .cs-related-card.is-active {
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .cs-carousel--related .cs-related-card {
        transition: border-color 0.2s ease;
    }

    .cs-carousel--related .cs-related-card:not(.is-active) {
        opacity: 0.92;
        transform: none;
    }
}

.cs-related-card__media img {
    width: 100%;
    aspect-ratio: 5 / 3;
    object-fit: cover;
    display: block;
}

.cs-related-card__title {
    padding: 0.85rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-top: 1px solid var(--color-border);
}

@media (min-width: 1200px) {
    .cs-page {
        padding-inline: 0;
    }
}

@media (max-width: 640px) {
    @supports (grid-template-columns: subgrid) {
        .cs-page > .cs-prose:first-child,
        .cs-page > section.cs-mod > .cs-prose,
        .cs-page > section.cs-mod > .cs-offset-inner,
        .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose,
        .cs-page > .cs-mod-stepsections > .cs-step-section {
            grid-column: 1 / -1;
        }

        .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose,
        .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose,
        .cs-page > nav.cs-mod-stepnav > .cs-prose {
            display: block;
        }

        .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > *,
        .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > *,
        .cs-page > nav.cs-mod-stepnav > .cs-prose > * {
            grid-column: auto;
        }

        .cs-page > section.cs-mod-threecol > .cs-threecol > .cs-threecol__col {
            grid-column: 1 / -1;
        }

        .cs-page > .cs-mod-stepsections > .cs-step-section {
            display: block;
        }

        .cs-page > .cs-mod-stepsections > .cs-step-section > * {
            grid-column: auto;
        }
    }

    @supports not (grid-template-columns: subgrid) {
        .cs-page > .cs-prose:first-child,
        .cs-page > section.cs-mod > .cs-prose,
        .cs-page > section.cs-mod > .cs-offset-inner,
        .cs-page > section.cs-mod-band > .cs-band-inner > .cs-prose,
        .cs-page > nav.cs-mod-stepnav > .cs-prose,
        .cs-page > .cs-mod-stepsections > .cs-step-section {
            width: 100%;
            margin-left: 0;
        }

        .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose,
        .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose,
        .cs-page > nav.cs-mod-stepnav > .cs-prose {
            display: block;
        }

        .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > h2.cs-mod-title,
        .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title,
        .cs-page > nav.cs-mod-stepnav > .cs-prose > h2.cs-mod-title,
        .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > *:not(h2.cs-mod-title),
        .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > *:not(h2.cs-mod-title),
        .cs-page > nav.cs-mod-stepnav > .cs-prose > *:not(h2.cs-mod-title) {
            flex: none;
            max-width: none;
            min-width: 0;
            width: 100%;
        }

        .cs-page > section.cs-mod-threecol > .cs-threecol > .cs-threecol__col {
            flex: 1 1 100%;
        }
    }

    /* Stacked label + body: same h2 → copy gap as .cs-threecol__col (desktop uses margin: 0 for the split layout) */
    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > h2.cs-mod-title,
    .cs-page > section.cs-mod-bullets--inverted > .cs-bullets-inverted__band > .cs-bullets-inverted__shell > .cs-prose > h2.cs-mod-title,
    .cs-page > nav.cs-mod-stepnav > .cs-prose > h2.cs-mod-title {
        margin-bottom: var(--cs-gap-heading-to-body);
    }

    .cs-page > section.cs-mod-bullets:not(.cs-mod-bullets--inverted) > .cs-prose > ul.cs-bullet-list,
    .cs-page > section.cs-mod-bullets--inverted .cs-bullets-inverted__shell > .cs-prose > ul.cs-bullet-list,
    .cs-page > nav.cs-mod-stepnav > .cs-prose > ul.cs-stepnav-list {
        margin-top: 0;
    }

    /* Three-col stacks full-width: widen row gap between each block (para → next h2) */
    .cs-page > section.cs-mod-threecol > .cs-threecol {
        row-gap: clamp(2.25rem, 7vw, 3.5rem);
    }

    .cs-page > .cs-mod-stepsections > .cs-step-section {
        padding-top: clamp(5.25rem, 18vw, 8.5rem);
        padding-bottom: clamp(2.75rem, 8vw, 4rem);
    }

    /*
     * Pull quote: tighter under the process carousel (margins collapse with the rail’s margin-bottom),
     * more air before step nav. Scroll rail: trim bottom margin on small screens so gap above quote isn’t
     * dominated by max(prev mb, pullquote mt).
     */
    .cs-page > section.cs-mod-carousel-scroll-wrap {
        margin-bottom: clamp(1.25rem, 4vw, 2.5rem);
    }

    .cs-page > section.cs-mod-pullquote {
        margin-top: clamp(0.75rem, 2.5vw, 1.25rem);
        margin-bottom: clamp(4rem, 11vw, 6.5rem);
    }

    .cs-page .cs-mod-bleed figcaption.cs-prose {
        width: 100%;
        margin-left: 0;
    }
}
