/* =====================================================================
   SELECTED WORK - pinned 3D card deck
   Without JS (or on mobile) the cards simply stack in a column.
   With .is-3d (desktop + GSAP) they become a deck that flips through on scroll.
   ===================================================================== */
.cases3d { position: relative; padding: 110px 0 100px; overflow: hidden; }
.cases3d::before { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(50% 50% at 50% 55%, rgba(32,156,207,.08), transparent 70%); }
.c3-pin { position: relative; }
.c3-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 46px; }
.c3-heading { margin: 14px 0 0; font-family: 'Instrument Serif', serif; font-weight: 400; font-size: clamp(2.6rem, 4.6vw, 4.8rem); line-height: 1; letter-spacing: -.02em; color: #fff; }
.c3-progress { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 4px 8px; min-width: 150px; }
.c3-cur { font-family: 'Instrument Serif', serif; font-size: 3.2rem; line-height: 1; color: #c7cf15; }
.c3-of { font-family: 'Space Grotesk', sans-serif; font-size: .9rem; color: rgba(255,255,255,.5); letter-spacing: .1em; }
.c3-track { grid-column: 1 / -1; height: 2px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.c3-fill { display: block; height: 100%; width: 25%; background: linear-gradient(90deg, #e3ea6e, #c7cf15); transition: width .4s; }

/* ---- deck (fallback = column) ---- */
.c3-deck { display: grid; gap: 28px; }
.c3-card {
    display: grid; grid-template-columns: 1.05fr 1fr; min-height: 440px; border-radius: 30px; overflow: hidden;
    background: linear-gradient(140deg, #141416 0%, #0c0c0d 100%);
    border: 1px solid rgba(32,156,207,.22);
    box-shadow: 0 50px 100px -40px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,255,255,.06);
}
/* photo: shown whole (contain) over a blurred copy, so faces are never cropped */
.c3-media { position: relative; overflow: hidden; background: #040404; min-height: 300px; }
.c3-blur { position: absolute; inset: -10%; width: 120%; height: 120%; object-fit: cover; filter: blur(28px) brightness(.45) saturate(1.2); transform: scale(1.1); }
.c3-img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; }
.c3-media::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: linear-gradient(90deg, transparent 70%, rgba(9,9,10,.9)); }

.c3-body { position: relative; padding: clamp(28px, 3.6vw, 54px); display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.c3-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.c3-badge { display: inline-flex; gap: 8px; align-items: center; padding: 7px 14px; border-radius: 999px; font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: #c7cf15; background: rgba(32,156,207,.08); border: 1px solid rgba(32,156,207,.3); }
.c3-n { font-family: 'Instrument Serif', serif; font-size: 4.4rem; line-height: .8; color: transparent; -webkit-text-stroke: 1px rgba(32,156,207,.45); }
.c3-title { margin: 6px 0 0; font-family: 'Instrument Serif', serif; font-weight: 400; font-size: clamp(1.9rem, 2.7vw, 2.8rem); line-height: 1.05; color: #fff; letter-spacing: -.01em; }
.c3-inst { font-size: .98rem; color: #e3ea6e; font-weight: 600; }
.c3-text { margin: 0; font-size: 1.02rem; line-height: 1.75; color: rgba(255,255,255,.72); }

/* ---- 3D deck mode ---- */
.c3-deck.is-3d { display: block; position: relative; height: 470px; perspective: 1800px; perspective-origin: 50% 0%; }
.c3-deck.is-3d .c3-card { position: absolute; inset: 0; transform-style: preserve-3d; backface-visibility: hidden; will-change: transform, opacity; transform-origin: 50% 0%; }
.cases3d.is-pinned .c3-pin { min-height: 100vh; display: flex; align-items: center; }

/* ---- clients + button ---- */
.c3-foot { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 28px; margin-top: 60px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,.08); }
.c3-clients { display: grid; gap: 14px; }
.c3-clients-label { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.c3-clients ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.c3-clients li { padding: 9px 16px; border-radius: 999px; font-size: .86rem; color: rgba(255,255,255,.85); background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.12); transition: .3s; }
.c3-clients li:hover { border-color: rgba(32,156,207,.6); color: #fff; transform: translateY(-2px); }
.c3-btn { display: inline-flex; gap: 10px; align-items: center; }

@media (max-width: 900px) {
    .c3-card { grid-template-columns: 1fr; min-height: 0; }
    .c3-media { aspect-ratio: 4 / 3; min-height: 0; }
    .c3-media::after { background: linear-gradient(180deg, transparent 70%, rgba(9,9,10,.9)); }
    .c3-progress { display: none; }
    .c3-n { font-size: 3.2rem; }
}

/* ===== Pinned mode: the whole section fits exactly one screen ===== */
.cases3d.is-pinned { padding-top: 0; }
.cases3d.is-pinned .c3-pin {
    height: 100vh; height: 100svh; min-height: 0; box-sizing: border-box;
    display: flex; align-items: stretch; padding: 104px 0 28px;          /* top clears the floating navbar */
}
.cases3d.is-pinned .c3-pin > .section-container { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; }
.cases3d.is-pinned .c3-head { margin-bottom: clamp(14px, 2.6vh, 30px); flex: none; }
.cases3d.is-pinned .c3-heading { font-size: clamp(2rem, 5.2vh, 3.6rem); margin-top: 8px; }
.cases3d.is-pinned .c3-cur { font-size: clamp(2rem, 4.6vh, 3.2rem); }
/* deck takes whatever height is left; bottom gap shows the cards stacked behind */
.cases3d.is-pinned .c3-deck.is-3d { flex: 1; height: auto; min-height: 0; }
.cases3d.is-pinned .c3-deck.is-3d .c3-card { inset: 0 0 64px 0; min-height: 0; }
/* card content scales with screen height so nothing spills out */
.cases3d.is-pinned .c3-body { padding: clamp(20px, 3.6vh, 50px) clamp(24px, 3vw, 50px); gap: clamp(8px, 1.6vh, 16px); overflow: hidden; }
.cases3d.is-pinned .c3-title { font-size: clamp(1.5rem, 4.2vh, 2.7rem); }
.cases3d.is-pinned .c3-text { font-size: clamp(.88rem, 2vh, 1.02rem); line-height: 1.6; }
.cases3d.is-pinned .c3-inst { font-size: clamp(.85rem, 1.9vh, .98rem); }
.cases3d.is-pinned .c3-n { font-size: clamp(2.6rem, 7vh, 4.4rem); }
.cases3d.is-pinned .c3-media { min-height: 0; }
.cases3d.is-pinned .c3-foot { margin-top: 40px; }

/* ===== v2: full-cover photos + bigger headings ===== */
.c3-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.04); transition: transform 1.2s cubic-bezier(.2,.8,.2,1); }
.c3-card:hover .c3-img { transform: scale(1.09); }
.c3-media::after { background: linear-gradient(90deg, rgba(9,9,10,0) 55%, rgba(9,9,10,.95) 100%), linear-gradient(0deg, rgba(3,3,3,.45), transparent 40%); }
.c3-heading { font-size: clamp(3rem, 6vw, 6rem); }
.cases3d.is-pinned .c3-heading { font-size: clamp(2.8rem, 7.6vh, 5.4rem); }
.c3-title { font-size: clamp(2.1rem, 3.1vw, 3.2rem); }
.cases3d.is-pinned .c3-title { font-size: clamp(1.8rem, 5vh, 3.2rem); }
@media (max-width: 900px) { .c3-media::after { background: linear-gradient(180deg, transparent 65%, rgba(9,9,10,.95)); } }

/* =====================================================================
   v3 layout (desktop): photo bleeds across ~72% of the card, a glass
   panel floats over its right edge at a different depth = 3D layering
   ===================================================================== */
@media (min-width: 901px) {
    .c3-card { display: block; position: relative; padding: 0; min-height: 460px; transform-style: preserve-3d; }
    .c3-deck.is-3d .c3-card { min-height: 0; }
    .c3-media { position: absolute !important; left: 0; top: 0; bottom: 0; width: 72%; min-height: 0 !important; aspect-ratio: auto !important; border-radius: 30px 0 0 30px; }
    .c3-img { inset: 0; transform: translate3d(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -10px), 0) scale(1.08); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
    .c3-card:hover .c3-img { transform: translate3d(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -10px), 0) scale(1.12); }
    /* image melts into the card on the right, darkens a little at the bottom */
    .c3-media::after { background:
        linear-gradient(90deg, rgba(9,9,10,0) 50%, rgba(9,9,10,.75) 80%, #0f0f10 100%),
        linear-gradient(0deg, rgba(3,3,3,.55) 0%, rgba(3,3,3,0) 35%); }

    .c3-body {
        position: absolute; right: 3.2%; top: 50%; width: 44%; max-height: 86%;
        transform: translate3d(calc(var(--mx, 0) * 16px), calc(-50% + var(--my, 0) * 12px), 70px);
        transition: transform .6s cubic-bezier(.2,.8,.2,1);
        padding: clamp(24px, 3.4vh, 44px) clamp(24px, 2.6vw, 44px) !important;
        border-radius: 26px; overflow: hidden;
        background: linear-gradient(145deg, rgba(22,22,24,.82), rgba(8,8,9,.72));
        backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
        border: 1px solid rgba(32,156,207,.3);
        box-shadow: 0 40px 80px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.08);
    }
    /* big floating number between photo and panel */
    .c3-n { position: absolute; top: -6px; right: 18px; font-size: clamp(4rem, 11vh, 7rem) !important; opacity: .9; }
    .c3-top { justify-content: flex-start; }
}

/* bigger section heading */
.c3-heading { font-size: clamp(3.4rem, 7vw, 7rem) !important; line-height: .95; }
.cases3d.is-pinned .c3-heading { font-size: clamp(3.2rem, 10.5vh, 7.4rem) !important; }
.c3-head { align-items: center; }
.c3-heading em { font-style: italic; color: #c7cf15; }

/* mobile / tablet: photo on top, text below, full cover */
@media (max-width: 900px) {
    .c3-media { position: relative; aspect-ratio: 16 / 10; }
    .c3-img { position: absolute; inset: 0; }
}

/* ---- fix: panel was hidden under the photo.
   translateZ + backdrop-filter inside a 3D (preserve-3d) card makes Chrome sort the layers wrongly.
   The card is flattened and the stacking is done with z-index; depth now comes from the pointer parallax. ---- */
@media (min-width: 901px) {
    .c3-card, .c3-deck.is-3d .c3-card { transform-style: flat; isolation: isolate; }
    .c3-media { z-index: 1; }
    .c3-body {
        z-index: 3;
        transform: translate3d(calc(var(--mx, 0) * 16px), calc(-50% + var(--my, 0) * 12px), 0) !important;
    }
}

/* =====================================================================
   v4 (desktop): no card-inside-card. Photo fills the left 54% edge to edge,
   text sits directly on the card on the right.
   ===================================================================== */
@media (min-width: 901px) {
    .c3-media { width: 54% !important; border-radius: 30px 0 0 30px; }
    .c3-media::after { background:
        linear-gradient(90deg, rgba(16,16,18,0) 82%, rgba(16,16,18,.9) 100%),
        linear-gradient(0deg, rgba(3,3,3,.35) 0%, rgba(3,3,3,0) 30%) !important; }
    .c3-img { transform: translate3d(calc(var(--mx, 0) * -12px), calc(var(--my, 0) * -8px), 0) scale(1.06) !important; }
    .c3-card:hover .c3-img { transform: translate3d(calc(var(--mx, 0) * -12px), calc(var(--my, 0) * -8px), 0) scale(1.1) !important; }

    .c3-body {
        left: 54%; right: 0; top: 0; bottom: 0; width: auto; max-height: none;
        transform: translate3d(calc(var(--mx, 0) * 8px), calc(var(--my, 0) * 6px), 0) !important;
        background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important;
        backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
        padding: clamp(28px, 4.5vh, 56px) clamp(32px, 4vw, 64px) !important;
        display: flex; flex-direction: column; justify-content: center; gap: clamp(10px, 2vh, 18px); overflow: visible;
    }
    .c3-top { position: static; }
    .c3-n { top: clamp(18px, 3vh, 30px) !important; right: clamp(24px, 2.6vw, 40px) !important; line-height: 1; opacity: .75; }
}
/* text arrangement */
.c3-title { max-width: 16ch; }
.c3-inst { display: flex; align-items: center; gap: 12px; }
.c3-inst::before { content: ""; width: 34px; height: 1px; background: #209ccf; flex: none; }
.c3-text { max-width: 46ch; }

/* =====================================================================
   Institutions: tidy "credential wall" directly under the deck
   left = label + note + button, right = 3 x 2 grid of names
   ===================================================================== */
.c3-foot {
    display: grid !important; grid-template-columns: minmax(240px, 320px) 1fr; grid-template-areas: "label list" "note list" "btn list";
    align-items: start; column-gap: clamp(30px, 5vw, 80px); row-gap: 14px;
    margin-top: 10px !important; padding: clamp(28px, 4vw, 48px) !important;
    border: 1px solid rgba(32,156,207,.18) !important; border-radius: 30px;
    background: linear-gradient(135deg, rgba(20,20,22,.7), rgba(6,6,7,.6));
    box-shadow: 0 40px 80px -40px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.05);
}
.c3-clients { display: contents; }
.c3-clients-label { grid-area: label; align-self: end; font-size: .74rem; letter-spacing: .2em; color: #c7cf15 !important; }
.c3-foot::before {
    content: "Institutions, foundations and employers the work has been done with."; grid-area: note;
    font-family: 'Instrument Serif', serif; font-size: clamp(1.4rem, 2vw, 1.9rem); line-height: 1.15; color: #fff;
}
.c3-btn { grid-area: btn; justify-self: start; margin-top: 12px; }

.c3-clients ul {
    grid-area: list; display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 0 !important;
    border-top: 1px solid rgba(255,255,255,.1); border-left: 1px solid rgba(255,255,255,.1); border-radius: 18px; overflow: hidden;
}
.c3-clients li {
    position: relative; display: flex; align-items: center; min-height: 96px; padding: 20px 24px !important;
    border: 0 !important; border-right: 1px solid rgba(255,255,255,.1) !important; border-bottom: 1px solid rgba(255,255,255,.1) !important;
    border-radius: 0 !important; background: transparent !important;
    font-family: 'Instrument Serif', serif; font-size: clamp(1.15rem, 1.5vw, 1.45rem) !important; line-height: 1.15; color: rgba(255,255,255,.82) !important;
    transition: background .35s, color .35s !important;
}
.c3-clients li::before {
    content: ""; position: absolute; left: 24px; top: 18px; width: 18px; height: 2px; background: #209ccf; opacity: .6; transition: width .35s, opacity .35s;
}
.c3-clients li:hover { background: rgba(32,156,207,.07) !important; color: #fff !important; transform: none !important; }
.c3-clients li:hover::before { width: 40px; opacity: 1; }

@media (max-width: 900px) {
    .c3-foot { grid-template-columns: 1fr; grid-template-areas: "label" "note" "list" "btn"; }
    .c3-clients ul { grid-template-columns: repeat(2, 1fr); }
    .c3-clients li { min-height: 78px; padding: 18px !important; font-size: 1.1rem !important; }
    .c3-clients li::before { left: 18px; top: 14px; }
}
/* smaller empty band between the last card and the institutions wall */
.cases3d.is-pinned .c3-deck.is-3d .c3-card { inset: 0 0 46px 0; }
.cases3d.is-pinned .c3-pin { padding-bottom: 16px; }
