/* Case study template — link on case study pages with styles.css + tokens.css */

:root {
    --case-study-content-width: 565px;
    --case-study-hero-width: 1000px; /* tune: ~115px wider, or try 720px */
    --case-study-section-gap: 3.5rem;
    --case-study-jump-nav-top: 1rem;
    --case-study-scroll-offset: 4.5rem;
    --case-study-bleed-image-height: 60vh;
    --case-study-bleed-image-max-width: 95vw;
    --case-study-bleed-band-pad-y: 24px;
}



/* ----- Case study site header + floating jump nav ----- */
.site-header--case-study {
    border-bottom: 1px solid var(--color-border-grey);
}

/* ----- Jump nav slot (between site header and case study title) ----- */
.case-study-jump-nav-slot {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 4rem;
    box-sizing: border-box;
}

/* ----- Section jump nav: in-flow at start, fixed when scrolled ----- */
@keyframes case-study-jump-nav-enter {
    from {
        opacity: 0;
        transform: translateX(-100vw);
    }

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

.case-study-jump-nav {
    position: relative;
    z-index: 110;
    display: flex;
    justify-content: center;
    width: min(100% - 2rem, 100vw);
    box-sizing: border-box;
    pointer-events: none;
    opacity: 0;
    transform: translateX(-100vw);
    transition: opacity 0.22s ease;
}

.case-study-jump-nav.is-enter-ready {
    animation: case-study-jump-nav-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.case-study-jump-nav.is-enter-complete {
    opacity: 1;
    transform: translateX(0);
}

.case-study-jump-nav.is-pinned {
    position: fixed;
    top: var(--case-study-jump-nav-top);
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 2rem);
    animation: none;
    opacity: 1;
    transform: translateX(-50%);
    transition: opacity 0.22s ease;
}

.case-study-jump-nav.is-pinned.is-scroll-hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-0.65rem);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

.case-study-jump-nav.is-scroll-hidden:not(.is-pinned) {
    animation: none;
    opacity: 0;
    transform: translateY(-0.65rem);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

.case-study-jump-nav.is-scroll-hidden .case-study-jump-nav-track {
    pointer-events: none;
}

.case-study-jump-nav-track {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    max-width: 100%;
    padding: 0.35rem 0.45rem;
    background: var(--color-soft-black);
    border-radius: 9999px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.14);
}

.case-study-jump-nav-track::-webkit-scrollbar {
    display: none;
}

.case-study-jump-link {
    flex-shrink: 0;
    padding: 0.4rem 0.85rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    border-radius: 9999px;
    white-space: nowrap;
    transition:
        color 0.1s ease,
        background-color 0.1s ease,
        font-weight 0.1s ease;
}

.case-study-jump-link:hover,
.case-study-jump-link:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
}

.case-study-jump-link.is-active,
.case-study-jump-link[aria-current='true'] {
    color: var(--color-soft-black);
    background: #fff;
    font-weight: 600;
}

.case-study-jump-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ----- Page shell ----- */
.case-study-page {
    min-height: 100vh;
    padding-bottom: 5rem;
}

.case-study-rail {
    width: 100%;
    max-width: var(--case-study-content-width);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* ----- Hero ----- */
.case-study-hero {
    padding: 2.5rem 4rem 4rem;
    box-sizing: border-box;
    margin-top: 1rem;
}

.case-study-page-title {
    color: var(--color-soft-black);
    font-family: 'Gilda Display', serif;
    font-weight: 400;
    line-height: 1.1;
}
.case-study-hero .case-study-rail {
    max-width: var(--case-study-hero-width);
    text-align: center;
}

/* ----- Sections ----- */
.case-study-section {
    padding: var(--case-study-section-gap) 4rem 0;
    scroll-margin-top: var(--case-study-scroll-offset);
    box-sizing: border-box;
}

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

.case-study-section-heading {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-soft-black);
    margin: 0;
}

.case-study-lede {
    margin: 0.75rem 0 0;
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--color-soft-black);
}

.case-study-rail > p,
.case-study-rail > ul,
.case-study-rail > ol {
    margin-top: 1.5rem;
}

.case-study-rail > p:first-of-type,
.case-study-rail > .case-study-lede + p {
    margin-top: 1.25rem;
}

.case-study-rail > ul,
.case-study-rail > ol {
    padding-left: 1.25rem;
}

.case-study-rail > * + .case-study-media--inline {
    margin-top: 2rem;
}

/* ----- Inline media ----- */
.case-study-media--inline {
    margin: 0;
    border-radius: 4px;
    overflow: hidden;
    background: #ffffff;
}

.case-study-media--inline img {
    display: block;
    width: 100%;
    height: auto;
}

/* ----- Full-bleed bands ----- */
.case-study-bleed {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    box-sizing: border-box;
}

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

/* Optional custom band texture: style="--case-study-bleed-bg: url('images/your-texture.png');" */
.case-study-bleed--tint {
    background-color: var(--color-light-grey);
    background-image: var(--case-study-bleed-bg, none);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

.case-study-bleed-inner {
    padding: var(--case-study-bleed-band-pad-y) 0;
    box-sizing: border-box;
}

.case-study-bleed-scroll {
    display: flex;
    justify-content: center;
    width: 100%;
    height: var(--case-study-bleed-image-height);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

.case-study-bleed-scroll.is-overflowing {
    display: block;
}

.case-study-bleed-scroll:focus {
    outline: none;
}

.case-study-bleed-scroll:focus-visible {
    outline: 2px solid var(--color-soft-black);
    outline-offset: 2px;
}

.case-study-bleed-scroll::-webkit-scrollbar {
    height: 6px;
}

.case-study-bleed-scroll::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.22);
    border-radius: 9999px;
}

.case-study-bleed-figure {
    margin: 0;
    display: block;
    width: max-content;
    height: 100%;
}

.case-study-bleed-figure img {
    display: block;
    width: auto;
    height: 100%;
    max-width: none;
    object-fit: contain;
    object-position: center center;
}

.case-study-bleed-scroll.is-overflowing .case-study-bleed-figure img {
    object-position: left center;
}

/* Contained bleed: 95vw × 60vh caps on all viewports; no horizontal scroll */
.case-study-bleed--contained .case-study-bleed-scroll {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

.case-study-bleed--contained .case-study-bleed-figure {
    width: auto;
    height: auto;
    max-width: var(--case-study-bleed-image-max-width);
    max-height: var(--case-study-bleed-image-height);
}

.case-study-bleed--contained .case-study-bleed-figure img {
    width: auto;
    height: auto;
    max-width: var(--case-study-bleed-image-max-width);
    max-height: var(--case-study-bleed-image-height);
}

/* Constrained bleed: same caps on desktop only; mobile keeps full-width scroll */
@media (min-width: 1025px) {
    .case-study-bleed--constrained:not(.case-study-bleed--contained) .case-study-bleed-scroll {
        display: flex;
        justify-content: center;
        align-items: center;
        overflow-x: hidden;
    }

    .case-study-bleed--constrained:not(.case-study-bleed--contained) .case-study-bleed-figure {
        width: auto;
        height: auto;
        max-width: var(--case-study-bleed-image-max-width);
        max-height: var(--case-study-bleed-image-height);
    }

    .case-study-bleed--constrained:not(.case-study-bleed--contained) .case-study-bleed-figure img {
        width: auto;
        height: auto;
        max-width: var(--case-study-bleed-image-max-width);
        max-height: var(--case-study-bleed-image-height);
    }
}

/* ----- Callout (optional background) ----- */
.case-study-callout-grid,
ul.case-study-callout-grid {
    display: grid;
    gap: 1.5rem 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.case-study-callout-item {
    margin: 0;
}

.case-study-callout-num {
    display: block;
    font-family: 'Gilda Display', serif;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 400;
    line-height: 1;
    color: var(--color-soft-black);
    margin-bottom: 0.35rem;
}

.case-study-callout-title {
    margin: 0 0 0.35rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--color-soft-black);
}

.case-study-callout-text {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 300;
    line-height: 1.5;
    color: var(--color-accessible-grey);
}

@media (max-width: 1024px) {
    :root {
        --case-study-jump-nav-top: 0.75rem;
        --case-study-scroll-offset: 4.75rem;
    }

    .case-study-jump-nav-slot {
        padding: 1rem 1rem;
    }

    .case-study-jump-nav {
        width: min(100% - 1.25rem, 100vw);
    }

    .case-study-jump-nav-track {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start;
        scroll-snap-type: x proximity;
    }

    .case-study-jump-link {
        scroll-snap-align: center;
    }

    .case-study-hero {
        padding: 1.5rem 1rem 2.5rem;
    }

    .case-study-section {
        padding: 2.5rem 1rem 0;
    }

    .case-study-bleed-inner {
        padding: var(--case-study-bleed-band-pad-y) 0;
    }

    .case-study-callout-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .case-study-jump-nav,
    .case-study-jump-nav.is-enter-ready,
    .case-study-jump-nav.is-enter-complete {
        opacity: 1;
        transform: none;
        animation: none;
        transition: opacity 0.08s ease;
    }

    .case-study-jump-nav.is-pinned {
        width: max-content;
        max-width: calc(100vw - 1.25rem);
        transform: translateX(-50%);
    }

    .case-study-jump-link {
        transition: color 0.08s ease, background-color 0.08s ease;
    }
}
