/* ==================================================================
   case.css — v8
   Case study long-form shell. No eyebrow rail, no 4-cell meta,
   no hairline before section labels.
   ================================================================== */

body.is-case,
body.home-v4,
body.home-v5 {
    background:
        radial-gradient(ellipse 70vw 45vh at 50% -10%, rgba(233, 240, 237, 0.04) 0%, transparent 60%),
        var(--void);
    overflow-x: clip;
}

.case {
    max-width: min(920px, 100% - 32px);
    margin: 0 auto;
    padding: clamp(120px, 15vh, 172px) 0 clamp(72px, 10vh, 120px);
    position: relative;
}

/* ---- Back link ---- */
.case-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--ink-3);
    margin-bottom: clamp(36px, 5vh, 56px);
    transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.case-back:hover { color: var(--ink); transform: translateX(-2px); }

/* ---- Head ---- */
.case-head {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 2.8vh, 28px);
    margin-bottom: clamp(40px, 6vh, 64px);
    padding-bottom: clamp(28px, 4vh, 40px);
    border-bottom: 1px solid var(--line);
}

.case-kicker {
    font-size: 13px;
    color: var(--ink-3);
    align-self: flex-start;
}

.case-title {
    font-family: var(--font-display);
    font-weight: 620;
    font-size: clamp(38px, 5.4vw, 76px);
    line-height: 0.97;
    letter-spacing: -0.036em;
    color: var(--ink);
    text-wrap: balance;
    max-width: 22ch;
}
.case-title em {
    font-style: normal;
    font-weight: 340;
    color: var(--ink-3);
}

.case-deck {
    font-size: clamp(16px, 1.35vw, 19px);
    line-height: 1.6;
    color: var(--ink-2);
    max-width: 62ch;
}
.case-deck strong { color: var(--ink); font-weight: 500; }

/* ---- Compact metadata line (replaces the 4-cell rail) ---- */
.case-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: 13.5px;
    color: var(--ink-3);
    margin-bottom: clamp(40px, 6vh, 64px);
    padding-bottom: clamp(20px, 3vh, 28px);
    border-bottom: 1px solid var(--line);
}
.case-meta > span { display: inline-flex; align-items: baseline; gap: 6px; }
.case-meta strong { color: var(--ink); font-weight: 500; }
.case-meta .sep { color: var(--ink-4); }

/* ---- Hero frame ---- */
.case-hero-frame {
    padding: var(--plate-pad);
    border-radius: var(--plate-outer-lg);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    box-shadow:
        inset 0 1px 0 var(--inner-hi),
        0 40px 90px -40px rgba(0, 0, 0, 0.75);
    margin-bottom: clamp(48px, 7vh, 72px);
    overflow: hidden;
}
.case-hero-frame img,
.case-hero-frame iframe {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--plate-inner-lg);
    background: var(--surface-3);
    border: 0;
}
.case-hero-frame iframe { aspect-ratio: 16 / 9; }
.case-hero-frame-contain img {
    object-fit: contain;
    max-height: 620px;
}

/* ---- Sections ---- */
.case-section { margin: clamp(56px, 8vh, 88px) 0; }
.case-pair {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: clamp(24px, 3vw, 48px);
    align-items: start;
}
.case-section-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-3);
    padding-top: 12px;
}

.case-section-h {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(26px, 3.2vw, 42px);
    line-height: 1.05;
    letter-spacing: -0.028em;
    color: var(--ink);
    margin-bottom: clamp(16px, 2vh, 22px);
    text-wrap: balance;
    max-width: 22ch;
}
.case-section-h em {
    font-style: normal;
    font-weight: 340;
    color: var(--ink-3);
}

.case-section p {
    font-size: 15.5px;
    line-height: 1.72;
    color: var(--ink-2);
    max-width: 64ch;
    margin-bottom: 16px;
}
.case-section p:last-child { margin-bottom: 0; }
.case-section p strong { color: var(--ink); font-weight: 500; }
.case-section ul {
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 16px;
}
.case-section ul li {
    position: relative;
    padding-left: 18px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink-2);
    max-width: 64ch;
}
.case-section ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 8px;
    height: 1px;
    background: var(--ink-3);
}
.case-section ul li strong { color: var(--ink); font-weight: 500; }
.case-section a {
    color: var(--ink);
    border-bottom: 1px solid var(--ink-3);
    padding-bottom: 1px;
    transition: border-color 0.25s var(--ease);
}
.case-section a:hover { border-color: var(--ink); }

/* Code snippet */
.case-section code,
pre.code code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    padding: 2px 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
}
pre.code {
    display: block;
    margin: 20px 0 8px;
    padding: 18px 22px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--ink-2);
    overflow-x: auto;
    white-space: pre;
}
pre.code .c { color: var(--ink-4); }
pre.code .k { color: var(--ink); }
pre.code .s { color: var(--ink-2); }

/* Gallery */
.case-gallery {
    margin-top: clamp(24px, 3vh, 32px);
    padding: var(--plate-pad);
    border-radius: var(--plate-outer);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    box-shadow: inset 0 1px 0 var(--inner-hi), 0 24px 60px -30px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.case-gallery img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--plate-inner);
    background: var(--surface-3);
}
.case-gallery-contain img { object-fit: contain; max-height: 520px; }

/* Pull quote */
.case-quote {
    display: block;
    margin: clamp(56px, 8vh, 80px) 0;
    padding: clamp(28px, 4vh, 40px) clamp(24px, 3vw, 44px);
    border-left: 2px solid var(--ink-3);
    background: var(--surface);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(20px, 2.4vw, 30px);
    line-height: 1.35;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-wrap: balance;
    max-width: 46ch;
}
.case-quote em { font-style: normal; color: var(--ink-3); }

/* Sair-specific feature grid */
.sair-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: clamp(24px, 3vh, 32px);
}
.sair-cat {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 2.5vh, 28px) clamp(20px, 2.5vw, 30px);
    box-shadow: inset 0 1px 0 var(--inner-hi);
}
.sair-cat-accent {
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border-color: var(--line-3);
}
.sair-cat-h {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}
.sair-cat ul { list-style: none; padding: 0; margin: 0; }
.sair-cat li {
    position: relative;
    padding: 9px 0 9px 18px;
    font-size: 13.5px;
    color: var(--ink-2);
    line-height: 1.55;
    border-top: 1px dashed var(--line);
    max-width: none;
}
.sair-cat li:first-child { border-top: 0; }
.sair-cat li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1.1em;
    width: 8px;
    height: 1px;
    background: var(--ink-3);
}
.sair-cat li strong { color: var(--ink); font-weight: 500; }

/* NeuralEngine-specific grids */
.ne-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: clamp(24px, 3vh, 32px);
}
.ne-cat {
    background: var(--surface);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    padding: clamp(20px, 2.5vh, 28px) clamp(20px, 2.5vw, 30px);
    box-shadow: inset 0 1px 0 var(--inner-hi);
}
.ne-cat-h {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.ne-cat p {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ink-2);
    margin: 0;
    max-width: none;
}

.ne-chart {
    margin-top: clamp(24px, 3vh, 32px);
    padding: clamp(20px, 2.5vh, 28px);
    border: 1px solid var(--line-2);
    border-radius: var(--radius-lg);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ne-row {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr) 130px;
    gap: 14px;
    align-items: center;
    font-size: 13px;
}
.ne-row-label { color: var(--ink-3); }
.ne-bar-track {
    height: 8px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
}
.ne-bar {
    height: 100%;
    background: var(--ink-3);
    border-radius: 999px;
    transition: width 0.6s var(--ease);
}
.ne-row.is-best .ne-bar { background: var(--ink); }
.ne-row-val {
    text-align: right;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.ne-row-val span {
    color: var(--ink-3);
    font-size: 12px;
    margin-left: 6px;
}
.ne-chart-foot {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 4px;
}

/* ---- Mobile ---- */
@media (max-width: 760px) {
    .case { padding-top: 96px; }
    .case-title { font-size: clamp(32px, 9vw, 48px); }
    .case-pair { grid-template-columns: 1fr; gap: 8px; }
    .case-section-label { padding-top: 0; }
    .sair-grid, .ne-grid { grid-template-columns: 1fr; }
    .ne-row { grid-template-columns: 120px 1fr 100px; gap: 10px; font-size: 12px; }
}
