/**
 * Case studies overview — custom template, modernised (0.9.0).
 *
 * Started as a 1-on-1 port of Elementor page 5411 (post-5411.css), section 5428
 * and loop-item 5431. Since 0.9.0 in the design language of the expertise pages
 * (expertise-single.css): sharp edges, the 60° corner cut of the hero slice on
 * the card images, gold-rule eyebrows, left-aligned text at a readable measure.
 * New: a sticky category filter bar and numbered pagination with previous/next.
 * The sharp card (r4y-case-card--overview) lives in case-study-card.css (shared with the detail page).
 *
 * Breakpoints: laptop ≤1366, tablet ≤1024, mobile ≤767.
 */

.r4y-template--case_study_archive {
    --r4y-gutter: 60px;
    --r4y-cs-space: clamp(64px, 7vw, 104px);
    --r4y-cs-header: 90px; /* height of the fixed header (header.css) */
}
/* The line drawing and the slice run past the viewport edge on purpose. */
.r4y-template .r4y-case-studies {
    overflow-x: clip;
}

/* ── Hero (Elementor #d6d8625): the fixed header overlays the top ────── */
.r4y-template .r4y-case-studies__hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 600px;
    padding: 0 var(--r4y-gutter) 90px; /* same left edge as the intro, filter and cards */
    overflow: hidden; /* clips the slice */
    isolation: isolate;
}
/* Featured image of page 5411 as <img> (LCP, srcset), a cream gradient from the left over it. */
.r4y-template .r4y-case-studies__hero-image {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
}
.r4y-template .r4y-case-studies__hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(90deg, #FFFAF7 20%, #FBF8F600 100%);
}
.r4y-template .r4y-case-studies__hero-inner {
    position: relative;
}
.r4y-template .r4y-case-studies .r4y-case-studies__title {
    position: relative;
    font-family: var(--r4y-font-heading);
    font-size: 80px;
    font-weight: var(--r4y-fw-light);
    line-height: 1;
    letter-spacing: -0.015em;
    color: var(--r4y-kit-primary);
}
/* The slice: a 1000×500 white block in a wrapper rotated −60°, clipped by the hero. */
.r4y-template .r4y-case-studies__hero-slice {
    rotate: -60deg;
    pointer-events: none;
}
.r4y-template .r4y-case-studies__hero-slice > div {
    position: absolute;
    top: 33vw;
    right: -20vw;
    width: 1000px;
    height: 500px;
    background: var(--r4y-kit-white);
}

/* ── Intro: eyebrow + lead ────────────────────────────────────────────── */
.r4y-template .r4y-case-studies__intro {
    padding-block: var(--r4y-cs-space) calc(var(--r4y-cs-space) * 0.6);
}
.r4y-template .r4y-case-studies__intro-inner {
    position: relative;
}
/* Gold lines (Elementor #dc82021). */
.r4y-template .r4y-case-studies__intro-decor {
    position: absolute;
    top: -280px;
    right: -60px;
    line-height: 0;
    pointer-events: none;
}
/* Eyebrow: a short gold rule + small caps (as .r4y-expertise__eyebrow). */
.r4y-template .r4y-case-studies .r4y-case-studies__eyebrow {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    font-family: var(--r4y-font-body);
    font-size: 13px;
    font-weight: var(--r4y-fw-semibold);
    line-height: 1.3;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-case-studies__eyebrow::before {
    content: "";
    flex: 0 0 32px;
    height: 1px;
    background-color: currentColor;
}
.r4y-template .r4y-case-studies__lead {
    position: relative;
    max-width: 62ch;
    font-family: var(--r4y-font-heading);
    font-size: clamp(22px, 2vw, 28px);
    font-weight: var(--r4y-fw-light);
    line-height: 1.35;
    color: var(--r4y-kit-primary);
}

/* ── Filter bar: sticky under the fixed header ────────────────────────── */
.r4y-template .r4y-cs-filter {
    position: sticky;
    top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--r4y-cs-header));
    z-index: 5; /* under the header (10) */
    padding-inline: var(--r4y-gutter);
    border-block: 1px solid var(--r4y-color-field-border);
    background-color: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.r4y-template .r4y-cs-filter__inner {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 72px;
    padding-block: 14px;
}
.r4y-template .r4y-case-studies .r4y-cs-filter__label,
.r4y-template .r4y-cs-filter__label {
    flex: none;
    font-family: var(--r4y-font-body);
    font-size: 13px;
    font-weight: var(--r4y-fw-semibold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-cs-filter__nav {
    flex: 1 1 auto;
    min-width: 0;
}
.r4y-template .r4y-main .r4y-cs-filter__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.r4y-template a.r4y-cs-filter__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--r4y-color-field-border);
    background-color: var(--r4y-kit-white);
    font-family: var(--r4y-font-body);
    font-size: var(--r4y-fs-sm);
    font-weight: var(--r4y-fw-medium);
    line-height: 1.2;
    white-space: nowrap;
    color: var(--r4y-kit-primary);
    text-decoration: none;
    transition: border-color var(--r4y-transition), background-color var(--r4y-transition), color var(--r4y-transition);
}
.r4y-template a.r4y-cs-filter__chip:hover {
    border-color: var(--r4y-kit-secondary);
    color: var(--r4y-kit-primary);
}
.r4y-template a.r4y-cs-filter__chip:focus-visible {
    outline: 2px solid var(--r4y-kit-secondary);
    outline-offset: 2px;
}
.r4y-template a.r4y-cs-filter__chip.is-active,
.r4y-template a.r4y-cs-filter__chip.is-active:hover {
    border-color: var(--r4y-kit-primary);
    background-color: var(--r4y-kit-primary);
    color: var(--r4y-kit-white);
}
.r4y-template .r4y-cs-filter__count {
    font-size: 12px;
    font-weight: var(--r4y-fw-semibold);
    font-variant-numeric: tabular-nums;
    color: var(--r4y-color-muted);
}
.r4y-template .r4y-cs-filter__chip.is-active .r4y-cs-filter__count {
    color: var(--r4y-kit-secondary);
}
.r4y-template .r4y-case-studies .r4y-cs-filter__status {
    flex: none;
    font-size: var(--r4y-fs-sm);
    font-weight: var(--r4y-fw-light);
    color: var(--r4y-color-muted);
}

/* ── Results ──────────────────────────────────────────────────────────── */
.r4y-template .r4y-case-studies__list {
    padding-block: 48px var(--r4y-cs-space);
}
.r4y-template .r4y-case-studies__results {
    transition: opacity var(--r4y-transition);
}
.r4y-template .r4y-case-studies__results.is-loading {
    opacity: 0.4;
    pointer-events: none;
}
.r4y-template .r4y-case-studies__results:focus {
    outline: none;
}
.r4y-template .r4y-cs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px 24px;
}

/* ── Pagination: sharp 44px squares, previous/next ───────────────────── */
.r4y-template .r4y-cs-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 64px;
    font-family: var(--r4y-font-body);
}
.r4y-template .r4y-main .r4y-cs-pagination__pages {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.r4y-template .r4y-cs-pagination__item,
.r4y-template .r4y-cs-pagination__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 44px;
    height: 44px;
    border: 1px solid var(--r4y-color-field-border);
    background-color: var(--r4y-kit-white);
    font-size: var(--r4y-fs-sm);
    font-weight: var(--r4y-fw-medium);
    font-variant-numeric: tabular-nums;
    color: var(--r4y-kit-primary);
    text-decoration: none;
    transition: border-color var(--r4y-transition), color var(--r4y-transition);
}
.r4y-template .r4y-cs-pagination__step {
    padding: 0 18px;
}
.r4y-template a.r4y-cs-pagination__item:hover,
.r4y-template a.r4y-cs-pagination__step:hover {
    border-color: var(--r4y-kit-secondary);
    color: var(--r4y-kit-primary);
}
.r4y-template a.r4y-cs-pagination__item:focus-visible,
.r4y-template a.r4y-cs-pagination__step:focus-visible {
    outline: 2px solid var(--r4y-kit-secondary);
    outline-offset: 2px;
}
.r4y-template .r4y-cs-pagination__item.is-current {
    border-color: var(--r4y-kit-primary);
    background-color: var(--r4y-kit-primary);
    color: var(--r4y-kit-white);
}
.r4y-template .r4y-cs-pagination__step--prev { margin-right: 8px; }
.r4y-template .r4y-cs-pagination__step--next { margin-left: 8px; }

/* ── Empty state ──────────────────────────────────────────────────────── */
.r4y-template .r4y-cs-empty {
    padding: 64px 32px;
    border-top: 2px solid var(--r4y-kit-secondary);
    background-color: var(--r4y-kit-accent);
    text-align: center;
}
.r4y-template .r4y-case-studies .r4y-cs-empty__title {
    margin-bottom: 24px;
    font-family: var(--r4y-font-heading);
    font-size: var(--r4y-fs-2xl);
    color: var(--r4y-kit-primary);
}

/* ── Widescreen ≥2400 ─────────────────────────────────────────────────── */
@media (min-width: 2400px) {
    .r4y-template .r4y-case-studies__hero { padding: 120px var(--r4y-gutter) 0; }
    .r4y-template .r4y-case-studies__intro-decor { right: -3px; }
}

/* ── Laptop ≤1366 ─────────────────────────────────────────────────────── */
@media (max-width: 1366px) {
    .r4y-template .r4y-case-studies__hero {
        min-height: 300px;
        padding: 120px var(--r4y-gutter) 0;
    }
    .r4y-template .r4y-case-studies .r4y-case-studies__title { font-size: 48px; }
    .r4y-template .r4y-case-studies__intro-decor { right: -90px; }
}

/* ── Tablet ≤1024 ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .r4y-template--case_study_archive { --r4y-gutter: 30px; }
    .r4y-template .r4y-case-studies__intro-decor { top: -260px; right: -110px; }
    .r4y-template .r4y-cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    /* Filter: one row of chips that scrolls sideways, so the sticky bar stays one row high. */
    .r4y-template .r4y-cs-filter__label { display: none; }
    .r4y-template .r4y-cs-filter { padding-inline: 0; }
    .r4y-template .r4y-cs-filter__inner { min-height: 0; padding-block: 12px; }
    .r4y-template .r4y-cs-filter__nav {
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scroll-padding-inline: var(--r4y-gutter);
        scrollbar-width: none;
    }
    .r4y-template .r4y-cs-filter__nav::-webkit-scrollbar { display: none; }
    .r4y-template .r4y-main .r4y-cs-filter__chips {
        flex-wrap: nowrap;
        width: max-content;
        padding-inline: var(--r4y-gutter);
    }
    .r4y-template .r4y-cs-filter__chips > li { scroll-snap-align: start; }
    /* The count stays for screen readers (aria-live); the chips carry the numbers. */
    .r4y-template .r4y-case-studies .r4y-cs-filter__status {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
}

/* ── Mobile ≤767 ───────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .r4y-template--case_study_archive {
        --r4y-gutter: 15px;
        --r4y-cs-header: 84px; /* header.css: 84px row on mobile */
    }
    .r4y-template .r4y-case-studies__hero {
        min-height: 500px;
        padding: 90px var(--r4y-gutter) 60px;
        /* Same angle as the slice, as on the expertise overview. */
        clip-path: polygon(0 0, 100% 0, 100% calc(100% - 104px), calc(100% - 60px) 100%, 0 100%);
    }
    .r4y-template .r4y-case-studies .r4y-case-studies__title { padding-bottom: 30px; font-size: var(--r4y-fs-4xl); }
    .r4y-template .r4y-case-studies__hero-slice,
    .r4y-template .r4y-case-studies__intro-decor { display: none; }
    .r4y-template .r4y-case-studies__lead { font-size: 20px; }

    .r4y-template .r4y-case-studies__list { padding-top: 32px; }
    .r4y-template .r4y-cs-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .r4y-template .r4y-cs-pagination { margin-top: 40px; }
    .r4y-template .r4y-cs-pagination__step { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
    .r4y-template .r4y-case-studies__results { transition: none; }
}
