/* templates/case-study.css — Part 7 of portfolio-page-style, implemented exactly.
   Layer 1: .cs-* primitives for new pages built on templates/case-study.html.
   Layer 2: adapter that binds the live site's .sp__ structure to the same values.
   The ONLY pixel literals in this file are the custom property definitions below. */
:root{
  --s-4:4px;--s-8:8px;--s-12:12px;--s-16:16px;--s-24:24px;--s-32:32px;--s-48:48px;--s-64:64px;--s-96:96px;--s-128:128px;
  --measure:940px;--wide:940px;
  --gut-s:24px;--gut-m:44px;--gut-l:44px;
  --ring:2px;--hairline:1px;--touch:44px;
  --gap-section:var(--s-96);--gut:var(--gut-l);
}
@media(max-width:1024px){:root{--gap-section:var(--s-64);--gut:var(--gut-m);}}
@media(max-width:640px){:root{--gap-section:var(--s-48);--gut:var(--gut-s);}}

/* ===== Layer 1 · primitives ===== */
.cs-page{max-width:var(--wide);margin:0 auto;padding-left:var(--gut);padding-right:var(--gut);}
.cs-section{margin-bottom:var(--gap-section);}
.cs-section>:last-child{margin-bottom:0;}
.cs-page :is(h1,h2,h3,p,figure,table,ol,ul,blockquote,div){margin-top:0;}
.cs-eyebrow{font-size:0.75em;letter-spacing:0.08em;text-transform:uppercase;margin-bottom:var(--s-16);}
.cs-h1,.cs-h2{line-height:1.15;margin-bottom:var(--s-24);max-width:var(--measure);}
.cs-h3{line-height:1.15;margin-bottom:var(--s-16);max-width:var(--measure);}
.cs-standfirst{max-width:var(--measure);margin-bottom:var(--s-24);}
.cs-p{line-height:1.6;max-width:var(--measure);margin-bottom:var(--s-24);}
.cs-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--s-16);margin-bottom:var(--s-24);}
.cs-card{padding:var(--s-24);border:var(--hairline) solid currentColor;margin-bottom:0;}
@media(max-width:768px){.cs-cards{grid-template-columns:1fr;gap:var(--s-12);}}
.cs-section>:has(+ .cs-fig){margin-bottom:var(--s-64);}
.cs-fig{max-width:var(--wide);margin:0 0 var(--s-48);}
.cs-fig>*:not(figcaption){margin-bottom:var(--s-16);}
.cs-fig figcaption{font-size:0.875em;line-height:1.5;max-width:var(--measure);margin-bottom:0;}
.cs-fig--framed{padding:var(--s-16);border:var(--hairline) solid currentColor;}
.cs-fig--bleed{width:100vw;max-width:100vw;margin-left:calc(50% - 50vw);}/* the only permitted negative offset */
.cs-section>:has(+ .cs-pull){margin-bottom:var(--s-48);}
.cs-pull{max-width:var(--measure);padding-left:var(--s-32);margin:0 0 var(--s-48);}
.cs-section>:has(+ .cs-callout){margin-bottom:var(--s-32);}
.cs-callout{padding:var(--s-24);margin:0 0 var(--s-32);}
.cs-section>:has(+ .cs-table),.cs-section>:has(+ table){margin-bottom:var(--s-48);}
.cs-table,.cs-page table{max-width:var(--wide);margin:0 0 var(--s-48);border-collapse:collapse;}
.cs-table th,.cs-table td,.cs-page table th,.cs-page table td{padding:var(--s-12) var(--s-16);}
.cs-page pre,.cs-code{padding:var(--s-16);max-width:var(--wide);margin:0 0 var(--s-24);}
.cs-page li{margin-bottom:var(--s-12);}
.cs-page li:last-child{margin-bottom:0;}
.cs-multiples{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--s-24);max-width:var(--wide);margin-bottom:var(--s-48);}
@media(max-width:1024px){.cs-multiples{grid-template-columns:1fr;}}
.cs-pair{display:grid;grid-template-columns:repeat(2,1fr);gap:var(--s-16);margin-bottom:var(--s-24);}

/* ===== Layer 2 · adapter: live .sp__ structure onto the same values ===== */
.sp__right>.sp__sec,.sp__right>section.sp__next{padding-left:max(var(--gut),calc((100% - var(--wide))/2));padding-right:max(var(--gut),calc((100% - var(--wide))/2));}
.sp__right>.sp__sec{padding-top:0;padding-bottom:0;margin-bottom:var(--gap-section);}
.sp__right>.sp__sec:first-child{padding-top:var(--gap-section);}
.sp__right>.sp__sec:last-of-type{margin-bottom:var(--gap-section);}
.sp__sec>:last-child,.sp__cin__txt>:last-child{margin-bottom:0;}
.sp__right :is(h1,h2,h3,p,figure,table,ol,ul,.sp__stats,.sp__meta,.sp__tools,.repo-grid,.cad-grid,.acc-list,.sp__formulae,.reflist,.callout,.honesty){margin-top:0;}
.sp__right .sp__sh,.sp__sec .sp__sh{font-size:0.75em;letter-spacing:0.08em;margin-bottom:var(--s-16);}
.sp__right .sp__h,.sp__sec .sp__h{line-height:1.15;margin-bottom:var(--s-24);max-width:var(--measure);}
.sp__right .sp__h3,.sp__sec .sp__h3{line-height:1.15;margin-bottom:var(--s-16);max-width:var(--measure);}
.sp__right .sp__p,.sp__sec .sp__p{line-height:1.6;max-width:var(--measure);margin-bottom:var(--s-24);}
.sp__chapter{margin-bottom:var(--s-48);}
.sp__sec>:has(+ .pfig),.sp__sec>:has(+ .fig),.sp__sec>:has(+ figure){margin-bottom:var(--s-64);}
.pfig,.fig{max-width:var(--wide);margin:0 0 var(--s-48);}
.pfig>*:not(figcaption),.fig>*:not(figcaption){margin-bottom:var(--s-16);}
.sp__right .pfig figcaption,.sp__right .fig figcaption,.sp__sec .pfig figcaption,.sp__sec .fig figcaption{font-size:0.875em;line-height:1.5;max-width:var(--measure);margin-top:0;margin-bottom:0;}
.sp__sec>:has(+ .callout){margin-bottom:var(--s-32);}
.callout{padding:var(--s-24);margin:0 0 var(--s-32);}
.sp__sec>:has(+ .ptbl){margin-bottom:var(--s-48);}
.ptbl{max-width:var(--wide);margin:0 0 var(--s-48);}
.ptbl th{padding:0 var(--s-16) var(--s-12) 0;}
.ptbl td{padding:var(--s-12) var(--s-16) var(--s-12) 0;}
.sp__stats,.sp__meta{display:grid;grid-template-columns:repeat(3,1fr);gap:var(--s-16);margin-bottom:var(--s-24);max-width:var(--measure);}
.sp__stats .sp__stat{padding:var(--s-24);border:var(--hairline) solid var(--bd,currentColor);margin:0;}
.sp__meta>div{padding:var(--s-16);margin:0;}
@media(max-width:768px){.sp__stats,.sp__meta{grid-template-columns:1fr;gap:var(--s-12);}}
.sp__right .reflist{max-width:var(--measure);margin:0 0 var(--s-24);}
.sp__right .reflist li{margin-bottom:var(--s-12);}
.sp__right .reflist li:last-child{margin-bottom:0;}
.sp__duo{gap:var(--s-16);}
.cs-pullquote,.sp__sec .cs-pull{max-width:var(--measure);padding-left:var(--s-32);margin:0 0 var(--s-48);}
.repo-grid{gap:var(--s-16);margin:0 0 var(--s-24);}
.repo-card{padding:var(--s-24);}
:is(a,button,input,select,textarea,summary,[tabindex]):focus-visible{outline:var(--ring) solid var(--accent,#b8860a);outline-offset:var(--ring);}
.acc__head,.nav__burger,.fig__databtn{min-height:var(--touch);}

/* ===== Part 7 audit block =====
   The scale ..................... :root --s-4..--s-128 (sole pixel literals, with --measure/--wide/--gut-*/--ring/--hairline/--touch)
   Widths ........................ .cs-page/.cs-p/.cs-h* and adapter .sp__p/.sp__h* (--measure 940, the landing track), figures/tables (--wide 940), .cs-fig--bleed (100vw, the one negative offset), pull quote inset (--s-32)
   Page gutters .................. :root --gut swaps 44/44/24 at 1024/640; applied in .cs-page and .sp__right>.sp__sec padding-inline
   Vertical rhythm ............... --gap-section 96/64/48 (.cs-section/.sp__sec margin-bottom); eyebrow>H2 16 (.cs-eyebrow/.sp__sh); H2>p 24 (.cs-h2/.sp__h); p>p 24 (.cs-p/.sp__p); H3>p 16 (.cs-h3/.sp__h3); above figure 64 (:has(+ fig)); fig>caption 16 (fig>*:not(figcaption)); below caption 48 (figure margin-bottom); pull quote 48/48; callout 32/32; table 48/48; list items 12 (li)
   Single direction margins ...... all rules margin-bottom only; margin-top:0 blanket on both layers; section :last-child zeroed
   Internal padding .............. stat card 24 (.cs-card/.sp__stat); callout 24; table cell 12/16; code 16; framed figure 16
   Grids ......................... stat cards 3/16 then 1/12 at 768 (.cs-cards/.sp__stats); small multiples 3/24 then 1/24 at 1024 (.cs-multiples); photo pair 2/16 (.cs-pair/.sp__duo)
   Type .......................... body 1.6, headings 1.15, caption 1.5 at 0.875em, eyebrow 0.75em ls 0.08em
   Interaction ................... focus ring 2px offset 2px (:focus-visible, never removed); touch 44px min on controls
   Forbidden ..................... no negative margins except .cs-fig--bleed; no fixed heights here; no margin-top declarations in this file
*/
