/* ─────────────────────────────────────────────────────────────
   Case page
   Narrow reading column, full-bleed imagery that breaks out of it,
   and a meta grid between the lede and the body.
   ───────────────────────────────────────────────────────────── */

.case-page {
    /* Shared by .case-pair columns and the .case-body rows */
    --case-gap: 12px;
    /* The wider rhythm that prose keeps, as a top-up on --case-gap */
    --case-prose-gap: 36px;
}

.case-page .shell {
    padding-bottom: 0;
}


.case-unlock { position: relative; min-height: 680px; overflow: hidden; border-radius: var(--r-lg); }
.case-unlock__preview { display: flex; flex-direction: column; gap: 40px; filter: blur(16px); opacity: 0.45; pointer-events: none; user-select: none; mask-image: linear-gradient(#000 10%, transparent 95%); }
.case-unlock__preview img { width: 100%; height: 440px; object-fit: cover; }
.case-unlock__lines { display: grid; gap: 16px; padding-inline: 24px; }
.case-unlock__lines span { height: 12px; border-radius: 4px; background: var(--text-tertiary); }
.case-unlock__lines span:last-child { width: 65%; }
.case-unlock__prompt { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 20px; padding-top: 170px; }
.case-unlock__mark { width: 56px; height: 56px; }
.case-unlock__button { min-height: 46px; padding: 12px 20px; border: 0; border-radius: 999px; background: var(--btn-bg); color: var(--btn-fg); font: 500 15px var(--font-sans); cursor: pointer; box-shadow: var(--tray-shadow); }
@media (max-width: 559px) { .case-unlock { min-height: 520px; } .case-unlock__preview img { height: 320px; } .case-unlock__prompt { padding-top: 120px; } }

/* ── Hero ────────────────────────────────────────────────── */

/* Breaks the reading column and runs to the viewport edges, as the
   reference does. The negative inset is capped so it never exceeds the
   gutter on wide screens. */
.case-hero {
    margin: 16px calc(50% - 50vw) 0;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
    background: var(--surface);
}

.case-hero img,
.case-hero video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 72vh;
    object-fit: cover;
}

/* Cadana: animated logo construction in place of the static hero */
.cadana-hero {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 72vh;
}

.cadana-hero__guides path {
    stroke-dasharray: 1;
    animation: cadana-draw 1.1s cubic-bezier(0.65, 0, 0.35, 1) calc(0.15s + var(--i) * 0.06s) backwards;
}

.cadana-hero__trace path {
    stroke-dasharray: 1;
    opacity: 0;
    animation:
        cadana-draw 1.3s cubic-bezier(0.65, 0, 0.35, 1) 0.7s backwards,
        cadana-trace 2.6s linear 0.7s;
}

.cadana-hero__sweep {
    stroke-dasharray: 1;
    animation: cadana-draw 0.9s cubic-bezier(0.7, 0, 0.3, 1) 1.8s backwards;
}

.cadana-hero__mark {
    transform-origin: 801px 450px;
    animation: cadana-settle 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 1.8s backwards;
}

@keyframes cadana-draw {
    from { stroke-dashoffset: 1; }
    to { stroke-dashoffset: 0; }
}

/* Outline shows while drawing, then hands off to the fill */
@keyframes cadana-trace {
    0%, 75% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes cadana-settle {
    from { transform: scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
    .cadana-hero * { animation: none !important; }
}

@media (min-width: 840px) {
    .case-hero {
        margin-inline: -24px;
        width: auto;
        border-radius: var(--r-lg);
    }
}

/* ── Lede ────────────────────────────────────────────────── */

.case-intro {
    margin-top: 56px;
}

.case-headline {
    font-size: 28px;
    line-height: 1.22;
    letter-spacing: -0.012em;
    text-wrap: balance;
}

@media (min-width: 640px) {
    .case-headline {
        font-size: 34px;
    }
}

.case-prose {
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 17px;
    line-height: 1.55;
    color: var(--text-secondary);
    text-wrap: pretty;
}

.case-lede {
    margin-top: 24px;
}

/* ── Meta grid ───────────────────────────────────────────── */

.case-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px 24px;
    /* The gap alone sets this apart; it had a rule across the top. */
    margin: 72px 0 0;
}

.case-meta dt {
    margin-bottom: 4px;
    font-size: 15px;
    color: var(--text-tertiary);
}

.case-meta dd {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}

/* ── Body ────────────────────────────────────────────────── */

/* Stacked imagery sits on the same gap as the columns inside a pair, so a
   run of images reads as one grid rather than a list of separate figures.
   Prose keeps the wider rhythm, added back as margin on the text blocks
   and on whatever follows them. */
.case-body {
    display: flex;
    flex-direction: column;
    gap: var(--case-gap);
    margin-top: 72px;
}

.case-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Text blocks, and anything following one, get the wider spacing back */
.case-body > :is(.case-block, .case-callout, .case-quotes),
.case-body > :is(.case-block, .case-callout, .case-quotes) + * {
    margin-top: var(--case-prose-gap);
}

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

.case-block__title {
    font-size: 20px;
    line-height: 1.3;
}

.case-figure {
    margin: 0;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--tray-shadow);
}

.case-figure img,
.case-figure video {
    display: block;
    width: 100%;
    height: auto;
}

.case-figure--sized img {
    height: 100%;
    object-fit: var(--case-image-fit, cover);
}

@font-face {
    font-family: SterlingYouth;
    src: url('/assets/card-studio/fonts/Youth-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
.sterling-card {
    position: relative;
    aspect-ratio: 1671 / 1182;
    min-height: 300px;
    background: #dedede;
    color: #515151;
}
.sterling-card__scene {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    perspective: 1100px;
}
.sterling-card__object { z-index: 1; }
.sterling-card__scene.is-webgl:has(.sterling-card__object:focus-visible) .sterling-card__canvas { filter: brightness(1.12); }
.sterling-card__object {
    position: relative;
    display: block;
    width: 44%;
    aspect-ratio: 1.586;
    padding: 0;
    border: 0;
    border-radius: 3.715% / 5.891%;
    background: transparent;
    transform-style: preserve-3d;
    transform: rotateX(var(--card-x, 0deg)) rotateY(var(--card-y, 0deg));
    transition: transform 360ms ease-out;
    cursor: grab;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}
.sterling-card__object.is-dragging { cursor: grabbing; transition: none; }
.sterling-card__object:focus { outline: none; }
.sterling-card__object:focus-visible { filter: brightness(1.12) drop-shadow(0 0 12px #7b151c80); }
.sterling-card__face {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    container-type: inline-size;
    background: #bf323d;
    box-shadow: 0 30px 90px -20px #b52a3438, 0 45px 150px 10px #b52a3426;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.sterling-card__face::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(ellipse 130% 150% at var(--light-x, 50%) var(--light-y, 35%), #ffffff52 0%, #ffffff26 35%, #ffffff08 70%, transparent 100%),
        linear-gradient(115deg, #ffffff0d, transparent 45%, #49061133);
}
.sterling-card__face::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .17;
    background-image: url('/assets/sterling-card-grain.svg');
    mix-blend-mode: soft-light;
}
.sterling-card__front { transform: translateZ(1px); }
.sterling-card__back { transform: rotateY(180deg) translateZ(1px); }
.sterling-card .sterling-card__brand { position: absolute; top: 6%; right: 4.5%; width: 28%; height: auto; }
.sterling-card .sterling-card__chip { position: absolute; top: 37.42%; left: 11.33%; width: 14.6%; height: auto; }
.sterling-card .sterling-card__network { position: absolute; bottom: 6%; right: 4.5%; width: 19%; height: auto; }
.sterling-card__stripe { position: absolute; background: #100f0f; }
.sterling-card .sterling-card__back-art { position: absolute; object-fit: contain; }
.sterling-card__text { position: absolute; overflow: hidden; white-space: nowrap; color: #fff; font-family: SterlingYouth, sans-serif; font-weight: 700; line-height: 1.2; }
.sterling-card__help {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
@media (max-width: 600px) {
    .sterling-card__object { width: 70%; }
}
@media (prefers-reduced-motion: reduce) {
    .sterling-card__object { transition: none; }
}

.case-studio { margin: 0; scroll-margin-top: 88px; }
.case-studio__frame {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: #202020;
    box-shadow: var(--tray-shadow);
}
.case-studio iframe {
    display: block;
    position: absolute;
    inset: 0;
    width: 1440px;
    height: 810px;
    border: 0;
    transform: scale(var(--studio-scale, 0.466667));
    transform-origin: top left;
}
.case-studio__poster { display: none; width: 100%; height: 100%; object-fit: cover; }
.case-studio__caption-mobile { display: none; }
.case-studio__caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 16px;
    max-width: calc(var(--content-width) - 2 * var(--gutter));
    margin: 12px auto 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-tertiary);
}
.case-studio__caption a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 767px) {
    .case-studio iframe, .case-studio__caption-live { display: none; }
    .case-studio__poster, .case-studio__caption-mobile { display: block; }
}

@media print {
    .case-studio__frame { display: none; }
}

.case-pair {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--case-gap);
}

@media (min-width: 560px) {
    .case-pair {
        grid-template-columns: 1fr 1fr;
    }
}

/* A video beside an image fills its half rather than leaving a gap when
   the two are cut to different proportions. */
.case-pair video {
    height: 100%;
    object-fit: cover;
}

.case-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-actions .chip {
    margin-inline: 0;
    translate: none;
    padding: 6px 12px;
    font-size: 15px;
}

.case-note {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ── Callout ─────────────────────────────────────────────── */

.case-callout {
    padding: 24px;
    border-radius: var(--r-lg);
    background: var(--surface);
}

.case-callout__label {
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-tertiary);
}

.case-callout__body {
    font-size: 19px;
    line-height: 1.4;
    color: var(--text-primary);
    text-wrap: pretty;
}

/* ── Quotes ──────────────────────────────────────────────── */

.case-quotes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .case-quotes {
        grid-template-columns: 1fr 1fr;
    }
}

.case-quote {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--surface);
}

.case-quote blockquote {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    text-wrap: pretty;
}

.case-quote__who {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    font-size: 14px;
}

.case-quote__who img {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 999px;
    object-fit: cover;
}

.case-quote__who span {
    display: flex;
    flex-direction: column;
    line-height: 1.35;
}

.case-quote__who strong {
    font-weight: 500;
    color: var(--text-primary);
}

.case-quote__role {
    color: var(--text-tertiary);
}

/* ── Metrics ─────────────────────────────────────────────── */

.case-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 8px;
}

@media (min-width: 640px) {
    .case-metrics {
        grid-template-columns: repeat(3, 1fr);
    }
}

.case-metrics li {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    border-radius: var(--r-lg);
    background: var(--surface);
}

.case-metric__value {
    font-size: 28px;
    font-weight: 500;
    line-height: 1.1;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.case-metric__text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text-secondary);
}

/* ── Next ────────────────────────────────────────────────── */

.case-next {
    margin-top: 96px;
    padding-top: 24px;
}

.case-next a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 0;
}

.case-next__label {
    font-size: 14px;
    color: var(--text-tertiary);
}

.case-next__name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
}

.case-next__name svg {
    width: 18px;
    height: 18px;
    transition: translate 0.15s ease-out;
}

.case-next a:hover svg {
    translate: 3px 0;
}

.case-fallback {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-fallback .chip {
    margin-inline: 0;
    translate: none;
    padding: 6px 12px;
    font-size: 15px;
}

/* ECB's presentation cards retain their artwork colours in either theme. */
[data-case="etihad"] .case-body {
    container-type: inline-size;
}

[data-case="etihad"] .case-callout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.7cqw;
    padding: 10% 6.7% 14.1%;
    background: #ffcf23;
    text-align: center;
}

[data-case="etihad"] .case-callout__label {
    margin: 0;
    font-size: clamp(14px, 2cqw, 24px);
    line-height: 1.33;
    font-weight: 500;
    color: #0a0a0a;
}

[data-case="etihad"] .case-callout__body {
    max-width: min(920px, 77cqw);
    font-size: clamp(22px, 3.36cqw, 40px);
    line-height: 1.15;
    font-weight: 500;
    color: #0a0a0a;
    text-wrap: initial;
}

/* Keep these three cards on the same grid rhythm as the image pair. */
[data-case="etihad"] .case-body > .case-callout + .case-pair {
    margin-top: 0;
}

.case-overlay {
    position: relative;
    display: grid;
    overflow: hidden;
    border-radius: var(--r-lg);
    background: #ffcf23;
    color: #0a0a0a;
    container-type: inline-size;
}

.case-overlay > .case-figure,
.case-overlay__content {
    grid-area: 1 / 1;
}

.case-overlay > .case-figure {
    position: absolute;
    inset: 0;
    border-radius: 0;
    box-shadow: none;
}

.case-overlay .case-figure img {
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.case-overlay__content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 2cqw;
    padding: 23% 4% 8.7%;
    text-align: center;
    background: linear-gradient(to bottom, #ffffff00 0%, #ffffffb8 50%, #fff 78%);
}

.case-overlay__label {
    font-size: clamp(14px, 2cqw, 24px);
    line-height: 1.33;
    color: inherit;
}

.case-overlay__body {
    max-width: 65cqw;
    font-size: clamp(16px, 2.35cqw, 28px);
    line-height: 1.43;
    font-weight: 500;
}

.case-overlay__note {
    font-size: clamp(12px, 1.35cqw, 16px);
    line-height: 1.5;
    font-weight: 500;
}

.case-overlay__contact {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #0a0a0a;
    color: #fff;
    font-size: clamp(12px, 1.35cqw, 16px);
    line-height: 1.5;
    font-weight: 500;
}

.case-overlay__contact:hover {
    background: #303030;
}

.case-overlay__content .case-actions {
    justify-content: center;
}

@media (max-width: 559px) {
    .case-overlay__content {
        gap: 16px;
        padding: 32% 6% 10%;
    }

    .case-overlay__body {
        max-width: 100%;
        font-size: 18px;
    }

    [data-case="etihad"] .case-callout__body {
        max-width: 100%;
    }
}

/* Clear the sticky header pill when jumping from the contents */
.case-page :is(#overview, .case-body [id]) {
    scroll-margin-top: 88px;
}
