:root {
    --rw-burgundy: #800000;
    --rw-black: #111111;
    --rw-gray: #6f6f6f;
    --rw-line: #dddddd;
    --rw-soft: #f4f4f4;
    --rw-white: #ffffff;
}

body.single-case_study {
    background: #fff;
}

.rw-case-page {
    width: 100%;
    overflow: hidden;
    color: var(--rw-black);
}

.rw-case-page__inner {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
}

.rw-case-hero {
    padding: 74px 0 58px;
    border-bottom: 1px solid var(--rw-line);
}

.rw-case-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(420px, 1.18fr);
    gap: 54px;
    align-items: center;
}

.rw-case-hero__copy {
    min-width: 0;
}

.rw-case-kicker {
    margin: 0 0 18px;
    color: var(--rw-burgundy);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.rw-case-title {
    margin: 0;
    max-width: 760px;
    color: var(--rw-black);
    font-size: clamp(42px, 5.7vw, 82px);
    line-height: .94;
    letter-spacing: -.045em;
    text-wrap: balance;
}

.rw-case-summary {
    max-width: 650px;
    margin: 24px 0 0;
    color: #4f4f4f;
    font-size: clamp(17px, 1.55vw, 22px);
    line-height: 1.5;
}

.rw-case-services {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 30px;
}

.rw-case-services span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 11px;
    border: 1px solid #cfcfcf;
    background: #fff;
    color: #262626;
    font-size: 12px;
    line-height: 1.2;
}

.rw-case-live {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 34px;
    padding: 12px 0 9px;
    border-bottom: 2px solid var(--rw-burgundy);
    color: var(--rw-burgundy);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .05em;
    text-decoration: none;
    text-transform: uppercase;
}

.rw-case-live::after {
    content: '';
    width: 18px;
    height: 1px;
    background: currentColor;
    box-shadow: 7px -3px 0 -0.3px currentColor;
    transform: rotate(-8deg);
}

.rw-case-hero__media {
    min-width: 0;
}

.rw-case-main-visual {
    margin: 0;
    padding: 14px;
    border: 1px solid #d4d4d4;
    background: #f1f1f1;
}

.rw-case-main-visual img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 760px;
    object-fit: contain;
    background: #fff;
}

.rw-case-content {
    padding: 64px 0 20px;
}

.rw-case-description {
    width: min(860px, 100%);
    margin: 0 auto;
    font-size: 18px;
    line-height: 1.72;
    color: #292929;
}

.rw-case-description > :first-child {
    margin-top: 0;
}

.rw-case-description h2,
.rw-case-description h3 {
    color: var(--rw-black);
    letter-spacing: -.025em;
}

.rw-case-description h2 {
    margin: 58px 0 18px;
    font-size: clamp(30px, 4vw, 48px);
    line-height: 1.05;
}

.rw-case-description h3 {
    margin: 38px 0 14px;
    font-size: clamp(22px, 2.8vw, 32px);
    line-height: 1.15;
}

.rw-case-description p,
.rw-case-description ul,
.rw-case-description ol {
    margin-top: 0;
    margin-bottom: 20px;
}

.rw-case-gallery {
    padding: 54px 0 86px;
}

.rw-case-gallery__head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--rw-line);
}

.rw-case-gallery__head h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 54px);
    line-height: 1;
    letter-spacing: -.035em;
}

.rw-case-gallery__head span {
    color: var(--rw-burgundy);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.rw-case-gallery__list {
    display: grid;
    gap: 28px;
}

.rw-case-media-frame {
    margin: 0;
    padding: 14px;
    border: 1px solid #d7d7d7;
    background: var(--rw-soft);
}

.rw-case-media-frame img,
.rw-case-media-frame video {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    background: #fff;
}

.rw-case-media-frame .wp-video,
.rw-case-media-frame .mejs-container {
    width: 100% !important;
    max-width: 100% !important;
}

.rw-case-embeds {
    display: grid;
    gap: 28px;
    padding-bottom: 80px;
}

.rw-case-embed {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%;
    background: #111;
}

.rw-case-embed iframe,
.rw-case-embed video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.rw-case-back {
    padding: 0 0 80px;
}

.rw-case-back a {
    color: var(--rw-black);
    text-decoration: none;
    border-bottom: 1px solid var(--rw-black);
}

@media (max-width: 900px) {
    .rw-case-page__inner {
        width: min(100% - 32px, 1240px);
    }

    .rw-case-hero {
        padding-top: 48px;
    }

    .rw-case-hero__grid {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .rw-case-hero__media {
        order: 2;
    }
}

@media (max-width: 600px) {
    .rw-case-page__inner {
        width: min(100% - 24px, 1240px);
    }

    .rw-case-hero {
        padding: 36px 0 38px;
    }

    .rw-case-title {
        font-size: clamp(38px, 12vw, 58px);
    }

    .rw-case-summary {
        margin-top: 18px;
        font-size: 17px;
    }

    .rw-case-main-visual,
    .rw-case-media-frame {
        padding: 8px;
    }

    .rw-case-content {
        padding-top: 44px;
    }

    .rw-case-description {
        font-size: 17px;
    }

    .rw-case-gallery {
        padding-top: 42px;
    }
}

/* ===== v5: full-page screenshot handling ===== */
.rw-case-hero__grid--tall-shot {
    grid-template-columns: minmax(0, 1fr);
    gap: 38px;
    align-items: start;
}

.rw-case-hero__grid--tall-shot .rw-case-hero__copy {
    width: min(980px, 100%);
}

.rw-case-hero__grid--tall-shot .rw-case-hero__media {
    width: 100%;
}

.rw-case-main-visual--tall,
.rw-case-media-frame--tall {
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #cfcfcf;
}

.rw-case-preview-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 46px;
    padding: 10px 14px;
    border-bottom: 1px solid #d8d8d8;
    background: #f5f5f5;
}

.rw-case-preview-bar::before {
    content: "";
    flex: 0 0 auto;
    width: 34px;
    height: 8px;
    margin-right: 2px;
    background:
        radial-gradient(circle at 4px 4px, #800000 0 3px, transparent 3.2px),
        radial-gradient(circle at 17px 4px, #9b9b9b 0 3px, transparent 3.2px),
        radial-gradient(circle at 30px 4px, #c2c2c2 0 3px, transparent 3.2px);
}

.rw-case-preview-bar__label {
    margin-right: auto;
    color: #4f4f4f;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.rw-case-preview-bar a {
    color: #800000;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .06em;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.rw-case-preview-bar a:hover,
.rw-case-preview-bar a:focus-visible {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rw-case-scrollshot {
    width: 100%;
    height: min(78vh, 860px);
    min-height: 520px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: #ffffff;
}

.rw-case-scrollshot img,
.rw-case-main-visual--tall .rw-case-scrollshot img,
.rw-case-media-frame--tall .rw-case-scrollshot img {
    display: block;
    width: 100%;
    height: auto;
    max-height: none;
    margin: 0;
    object-fit: initial;
    object-position: top center;
    background: #ffffff;
}

.rw-case-scrollshot:focus-visible {
    outline: 2px solid rgba(128, 0, 0, .35);
    outline-offset: -2px;
}

@media (max-width: 900px) {
    .rw-case-hero__grid--tall-shot {
        gap: 30px;
    }

    .rw-case-scrollshot {
        height: 72vh;
        min-height: 460px;
    }
}

@media (max-width: 600px) {
    .rw-case-preview-bar {
        min-height: 42px;
        padding: 9px 10px;
        gap: 10px;
    }

    .rw-case-preview-bar::before {
        width: 28px;
        background:
            radial-gradient(circle at 4px 4px, #800000 0 2.5px, transparent 2.7px),
            radial-gradient(circle at 14px 4px, #9b9b9b 0 2.5px, transparent 2.7px),
            radial-gradient(circle at 24px 4px, #c2c2c2 0 2.5px, transparent 2.7px);
    }

    .rw-case-preview-bar__label {
        font-size: 9px;
    }

    .rw-case-preview-bar a {
        font-size: 9px;
    }

    .rw-case-scrollshot {
        height: 68vh;
        min-height: 390px;
    }
}
