/*
 * Case Studies (new) — page-case-studies-new.php
 * Figma: file TtcElVBB8zSMtMk2WR2VFf, node 22029:20619 (Desktop 22134:1413, Mobile 22134:2167).
 * Type sizes come from sd-type-* (css/typography.css), the tag/tabs/button primitives from
 * css/style.min.css (.sd-tag, .sd-tabs, .sd-button) and the card from the global
 * template-parts/components/case-study-card — this file only lays the page out.
 * Font: body.case-studies-new is registered in typography.css's Google Sans Flex list.
 */

html:has(body.case-studies-new),
body.case-studies-new {
    overflow-x: hidden;
}

body.case-studies-new {
    background: #fff;
}

.case-studies-new-page {
    background: #fff;
    color: #262626;
}

/* Section padding from the per-row --ns-* vars (page-case-studies-new.php). */
.case-studies-new-page .csn-spacing {
    padding-top: var(--ns-desktop-padding-top, 0);
    padding-bottom: var(--ns-desktop-padding-bottom, 0);
}

/* ---------- Hero ---------- */

.csn-hero {
    padding-right: 64px;
    padding-left: 64px;
    background: linear-gradient(180deg, #faf7f5 0%, rgba(250, 247, 245, 0) 100%), #fff;
}

.csn-hero__container {
    display: flex;
    flex-direction: column;
    gap: 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.csn-hero__intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
    max-width: 720px;
}

.csn-hero__copy {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.csn-hero__title,
.csn-hero__description {
    max-width: 560px;
    margin: 0;
}

.csn-hero__title {
    color: #262626;
}

.csn-hero__description {
    color: rgba(0, 0, 0, .75);
}

/* Persona cards: one row of five on desktop (Figma 16px gap, 222.8:280 cards). */
.csn-hero__personas {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.csn-hero__persona-item {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.csn-hero__persona-item::before,
.csn-hero__persona-item::marker {
    content: none;
}

.csn-persona {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    aspect-ratio: 222.8 / 280;
    overflow: hidden;
    border-radius: 12px;
    background: #efe8e2;
    color: #fff;
    text-decoration: none;
    filter: drop-shadow(0 1px .5px rgba(0, 0, 0, .04));
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}

.csn-persona__photo {
    position: absolute;
    inset: 0;
    z-index: -1;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transition: transform .4s ease;
}

.csn-persona__logo {
    position: absolute;
    top: 11px;
    left: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}

.csn-persona__logo img {
    display: block;
    flex: 0 0 auto;
    max-width: 44px;
    max-height: 44px;
}

/* Caption band — Figma "overlay" (component 7980:5793 / hover 7980:5792):
   - 88px tall, 130px on Hover (20px vertical padding) — same effect in both states;
   - fill: linear black 0% → 40%, top → bottom, over the WHOLE band (not masked);
   - effect: PROGRESSIVE background blur, radius 0 at 29% of the band height → 40 at the
     bottom (Figma radius 40 ≈ CSS blur(20px)).
   CSS has no progressive backdrop blur, so it is rebuilt from five stacked blur layers
   (1.25 / 2.5 / 5 / 10 / 20px), each masked to the band where Figma's radius passes that
   value: r(y) = 20px · (y − 29%) / 71%  →  1.25px @ 33.4%, 2.5 @ 37.9%, 5 @ 46.8%,
   10 @ 64.5%, 20 @ 100%. Positions are percentages, so the hover band scales with it. */
.csn-persona__overlay {
    position: relative;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 100%;
    height: 88px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .4) 100%);
    transition: height .3s ease, padding .3s ease;
}

.csn-persona__blur {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.csn-persona__blur > i {
    position: absolute;
    inset: 0;
}

.csn-persona__blur > i:nth-child(1) {
    -webkit-backdrop-filter: blur(1.25px);
    backdrop-filter: blur(1.25px);
    -webkit-mask-image: linear-gradient(180deg, transparent 29%, #000 33.4%, #000 37.9%, transparent 46.8%);
    mask-image: linear-gradient(180deg, transparent 29%, #000 33.4%, #000 37.9%, transparent 46.8%);
}

.csn-persona__blur > i:nth-child(2) {
    -webkit-backdrop-filter: blur(2.5px);
    backdrop-filter: blur(2.5px);
    -webkit-mask-image: linear-gradient(180deg, transparent 33.4%, #000 37.9%, #000 46.8%, transparent 64.5%);
    mask-image: linear-gradient(180deg, transparent 33.4%, #000 37.9%, #000 46.8%, transparent 64.5%);
}

.csn-persona__blur > i:nth-child(3) {
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    -webkit-mask-image: linear-gradient(180deg, transparent 37.9%, #000 46.8%, #000 64.5%, transparent 100%);
    mask-image: linear-gradient(180deg, transparent 37.9%, #000 46.8%, #000 64.5%, transparent 100%);
}

.csn-persona__blur > i:nth-child(4) {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    -webkit-mask-image: linear-gradient(180deg, transparent 46.8%, #000 64.5%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 46.8%, #000 64.5%, #000 100%);
}

.csn-persona__blur > i:nth-child(5) {
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    -webkit-mask-image: linear-gradient(180deg, transparent 64.5%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 64.5%, #000 100%);
}

.csn-persona__overlay > :not(.csn-persona__blur) {
    position: relative;
    z-index: 1;
}

.csn-persona__name,
.csn-persona__company {
    display: block;
    color: #fff;
    overflow-wrap: break-word;
}

.csn-persona__name {
    margin-bottom: -2px;
}

.csn-persona__company {
    opacity: .8;
}

/* Figma persona Hover: photo eases in, taller blurred caption (130px, 20px vertical padding). */
@media (hover: hover) {
    a.csn-persona:hover .csn-persona__photo {
        transform: scale(1.06);
    }

    a.csn-persona:hover .csn-persona__overlay {
        height: 130px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
}

a.csn-persona:focus {
    outline: none;
}

a.csn-persona:focus-visible {
    outline: 2px solid #262626;
    outline-offset: 2px;
}

/* ---------- Case studies grid ---------- */

.csn-cases {
    padding-right: 64px;
    padding-left: 64px;
}

.csn-cases__container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
}

.csn-cases__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.csn-cases__card.is-collapsed,
.csn-cases__card.is-filtered {
    display: none;
}

.csn-cases__empty {
    margin: 0;
    color: rgba(0, 0, 0, .55);
}

.csn-cases__more {
    display: flex;
    justify-content: center;
}

.csn-cases__more[hidden],
.csn-cases__empty[hidden] {
    display: none;
}

@media (max-width: 1023px) {
    .csn-hero,
    .csn-cases {
        padding-right: 32px;
        padding-left: 32px;
    }

    /* Five portraits no longer fit one row — switch to the mobile carousel early. */
    .csn-hero__personas {
        margin: 0 -32px;
        padding: 0 32px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 32px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .csn-hero__personas::-webkit-scrollbar {
        display: none;
    }

    .csn-hero__persona-item {
        flex: 0 0 200px;
        scroll-snap-align: start;
    }
}

@media (max-width: 767px) {
    .case-studies-new-page .csn-spacing {
        padding-top: var(--ns-mobile-padding-top, 0);
        padding-bottom: var(--ns-mobile-padding-bottom, 0);
    }

    .csn-hero,
    .csn-cases {
        padding-right: 20px;
        padding-left: 20px;
    }

    .csn-hero__container {
        gap: 32px;
    }

    /* Mobile carousel: 200px cards, 16px gap, next card peeks; bleeds to the screen edge. */
    .csn-hero__personas {
        margin: 0 -20px;
        padding: 0 20px;
        scroll-padding-left: 20px;
    }

    /* Match the homepage: scroll to the viewport edges, retaining content gutters. */
    .case-studies-new-page .csn-cases__tabs {
        width: auto;
        max-width: none;
        margin-left: -20px;
        margin-right: -20px;
    }

    .case-studies-new-page .csn-cases__tabs .sd-tabs__list {
        box-sizing: border-box;
        padding-left: 20px;
        padding-right: 20px;
    }
    .csn-cases__grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .csn-cases__more .sd-button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .csn-persona__photo,
    .csn-persona__overlay {
        transition: none;
    }
}
