/* Case Study detail page. Consumes theme.css tokens only — no root block, no hard-coded hex. */

/* ── Hero ─────────────────────────────────────────────── */
.case-detail-hero {
    position: relative;
    min-height: 48svh;
    overflow: hidden;
    /* 158px, matching .bpo-hero: the fixed site header (~83px) plus the child
       "subnav" strip (~73px) occupy ~156px on a case study, and the previous
       8.5rem/136px left the "All case studies" back link tucked underneath. */
    padding: 158px 0 4.4rem;
    color: var(--on-dark);
    background: var(--case-hero-background, linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 52%, var(--green-600) 100%));
}

.case-detail-hero::after {
    content: "";
    position: absolute;
    right: -220px;
    top: -350px;
    width: 760px;
    height: 760px;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 50%;
    box-shadow: 0 0 0 100px rgba(255, 255, 255, 0.025), 0 0 0 200px rgba(255, 255, 255, 0.015);
}

.case-detail-hero-inner {
    position: relative;
    z-index: 1;
}

.case-back-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    color: color-mix(in srgb, var(--on-dark) 72%, transparent);
    font-size: 12px;
    font-weight: 750;
    text-decoration: none;
    transition: gap var(--transition-fast), color var(--transition-fast);
}

.case-back-link:hover {
    gap: 14px;
    color: var(--on-dark);
}

.case-detail-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.7fr);
    gap: clamp(48px, 8vw, 120px);
    align-items: center;
    margin-top: clamp(40px, 7vh, 84px);
}

.case-detail-eyebrow {
    display: block;
    margin-bottom: var(--space-5);
    color: var(--green-300);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.case-detail-hero h1 {
    max-width: 900px;
    font-family: var(--font-display);
    font-size: clamp(38px, 5.4vw, 68px);
    line-height: 1;
    text-wrap: balance;
}

.case-client {
    margin-top: var(--space-5);
    color: color-mix(in srgb, var(--on-dark) 58%, transparent);
    font-size: 13px;
}

.case-client a {
    color: var(--on-dark);
    font-weight: 750;
}

.case-client a:hover {
    text-decoration: underline;
}

.case-detail-summary > p {
    max-width: 600px;
    color: color-mix(in srgb, var(--on-dark) 76%, transparent);
    font-size: clamp(16px, 1.3vw, 19px);
    line-height: 1.7;
}

.case-hero-button {
    margin-top: var(--space-6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--on-dark);
    background: rgba(255, 255, 255, 0.08);
}

.case-hero-button:hover {
    border-color: var(--on-dark);
    background: var(--on-dark);
    color: var(--green-800);
}

/* ── Gallery ──────────────────────────────────────────── */
.case-gallery-section {
    padding: 60px 0 72px;
    background: var(--surface);
}

.case-gallery {
    max-width: 1180px;
    margin: 0 auto;
}

.case-gallery-stage {
    position: relative;
    display: flex;
    min-height: 340px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: clamp(16px, 4vw, 46px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
}

.case-gallery-stage > img {
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    transition: opacity var(--transition-fast);
}

.case-gallery-controls {
    position: absolute;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-pill);
    color: var(--on-dark);
    background: rgba(19, 40, 16, 0.88);
    box-shadow: 0 12px 30px rgba(10, 28, 11, 0.2);
    backdrop-filter: blur(12px);
}

.case-gallery-controls button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--on-dark);
    background: transparent;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.case-gallery-controls button:hover {
    background: rgba(255, 255, 255, 0.12);
}

.case-gallery-controls span {
    min-width: 40px;
    text-align: center;
    font-size: 11px;
}

.case-gallery-thumbs {
    display: flex;
    gap: var(--space-3);
    justify-content: center;
    flex-wrap: wrap;
    margin-top: var(--space-5);
}

.case-gallery-thumbs button {
    width: 92px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.case-gallery-thumbs button.is-active {
    border-color: var(--accent);
}

.case-gallery-thumbs img {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
}

/* ── Story ────────────────────────────────────────────── */
.case-story-section {
    padding: 88px 0 96px;
    background: var(--bg);
}

.case-story-grid {
    display: grid;
    grid-template-columns: minmax(240px, 0.36fr) minmax(0, 1fr);
    gap: clamp(48px, 8vw, 120px);
    align-items: start;
}

.case-facts {
    position: sticky;
    top: 122px;
    display: grid;
    gap: 10px;
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.case-facts span {
    margin-top: var(--space-5);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.case-facts span:first-child {
    margin-top: 0;
}

.case-facts strong {
    color: var(--fg);
    font-family: var(--font-display);
    font-size: 14px;
    line-height: 1.55;
}

.case-story {
    max-width: 800px;
}

.case-story h2 {
    margin-bottom: var(--space-6);
    font-family: var(--font-display);
    font-size: clamp(30px, 3.6vw, 48px);
    line-height: 1.08;
    text-wrap: balance;
}

.case-story p {
    margin-top: var(--space-5);
    color: var(--fg-muted);
    font-size: 17px;
    line-height: 1.88;
}

.case-story p:first-of-type {
    color: var(--fg);
    font-size: 19px;
}

/* ── Highlights ───────────────────────────────────────── */
.case-highlights-section {
    padding: 84px 0 92px;
    background: var(--surface);
}

.case-highlight-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

.case-highlight-grid article {
    min-height: 240px;
    padding: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
}

.case-highlight-grid article > span {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.case-highlight-grid h3 {
    margin-top: var(--space-7);
    font-family: var(--font-display);
    font-size: 22px;
}

.case-highlight-grid p {
    margin-top: var(--space-3);
    color: var(--fg-muted);
    font-size: 14px;
    line-height: 1.75;
}

/* ── Technologies ─────────────────────────────────────── */
.case-technologies {
    padding: 60px 0 0;
}

.case-technologies-inner {
    display: grid;
    grid-template-columns: minmax(220px, 0.5fr) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: center;
}

.case-technologies h2 {
    font-family: var(--font-display);
    font-size: clamp(22px, 2.2vw, 30px);
}

.case-technologies-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    justify-content: flex-end;
}

.case-technologies-tags span {
    padding: 9px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--green-800);
    background: var(--bg-elevated);
    font-size: 10px;
    font-weight: 750;
}

body.dark-mode .case-technologies-tags span {
    color: var(--fg);
}

/* ── Pager ────────────────────────────────────────────── */
.case-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 64px 0;
}

.case-pager a {
    display: flex;
    min-height: 100px;
    flex-direction: column;
    justify-content: center;
    padding: var(--space-5) var(--space-6);
    border: 1px solid var(--border);
    /* An explicit base colour is required: the :hover rule below only wins once
       hovered, and without this the UA's default link colour (blue) applied at
       rest rather than the inherited body colour. */
    color: var(--fg);
    text-decoration: none;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.case-pager a:first-child {
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.case-pager a:last-child {
    align-items: flex-end;
    border-left: 0;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    text-align: right;
}

.case-pager a:hover {
    color: var(--accent-strong);
    background: var(--surface);
}

.case-pager span {
    margin-bottom: 7px;
    color: var(--fg-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.case-pager strong {
    font-family: var(--font-display);
    font-size: clamp(15px, 1.6vw, 20px);
}

/* ── CTA band (shared visual language with listing page) ── */
.case-cta-section {
    padding: 16px 0 92px;
    background: var(--bg);
}

.case-cta-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-6);
    align-items: end;
    overflow: hidden;
    padding: clamp(32px, 5.5vw, 64px);
    border-radius: var(--radius-lg);
    color: var(--on-brand);
    background: radial-gradient(circle at 90% 12%, rgba(255, 255, 255, 0.16), transparent 25%), linear-gradient(135deg, var(--surface-brand), var(--green-800));
    box-shadow: var(--shadow-lg);
}

.case-cta-card span {
    display: block;
    margin-bottom: var(--space-3);
    color: color-mix(in srgb, var(--on-brand) 72%, transparent);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.case-cta-card h2 {
    max-width: 760px;
    font-family: var(--font-display);
    font-size: clamp(28px, 3.6vw, 44px);
    line-height: 1.05;
}

.case-cta-card .btn {
    background: var(--bg-elevated);
    color: var(--green-800);
}

.case-cta-card .btn:hover {
    background: var(--surface);
}

@media (max-width: 900px) {
    .case-detail-hero-grid,
    .case-story-grid,
    .case-technologies-inner {
        grid-template-columns: 1fr;
    }

    .case-technologies-tags {
        justify-content: flex-start;
    }

    .case-highlight-grid {
        grid-template-columns: 1fr;
    }

    .case-facts {
        position: static;
    }

    .case-pager {
        grid-template-columns: 1fr;
    }

    .case-pager a:first-child {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .case-pager a:last-child {
        align-items: flex-start;
        border-left: 1px solid var(--border);
        border-top: 0;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        text-align: left;
    }

    .case-cta-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .case-detail-hero {
        padding-top: 7.2rem;
    }

    .case-gallery-stage {
        min-height: 260px;
    }
}
