/* Case-study layout, shared by every case page. Loaded after bright.css.
   One container that lines up with the site header and footer, one vertical rhythm,
   and an editorial grid on wide screens: section heading on the left (sticky), content on the right. */

html.b-case{
  --cw:1320px;                              /* same as .b-wrap in the header/footer */
  --cp:var(--b-pad,clamp(20px,3.2vw,40px)); /* same side padding as the header/footer */
  --cgap:clamp(32px,5vw,96px);
  --csec:clamp(48px,5.5vw,84px);
  --measure:68ch;
}
html.b-case body{font-size:17px;line-height:1.65}

/* ---------- leftovers from earlier themes that fight the current one ---------- */
html.b-case .loader,
html.b-case .spin-star,
html.b-case .proj-mq{display:none!important}
html.b-case.show-loader body{overflow:auto!important}
/* the old "theme flip" turned the whole page dark mid-scroll; keep the page light */
html:root:root.b-case.flip.flip{
  --bg:#ffffff; --surface:#f3f3ff; --ink:#140f4f; --muted:#55588a; --line:#e2e2f4;
  --accent:#2121ff; --accent-ink:#ffffff; --chip:#ececff; --accent-soft:#e7e7ff; --sunk:#ececff;
}

/* ---------- one container ---------- */
html.b-case :is(.col,.wide,.block > .wide){max-width:var(--cw);margin-inline:auto;padding-inline:var(--cp);box-sizing:border-box}
html.b-case :is(.col,.wide) :is(.col,.wide){max-width:none;padding-inline:0;margin-inline:0}

/* ---------- vertical rhythm ---------- */
html.b-case main > section{padding-block:var(--csec)!important;margin-block:0!important;border-top:0}
html.b-case main > section + section{position:relative}
html.b-case main > section + section::before{content:"";position:absolute;top:0;left:var(--cp);right:var(--cp);max-width:calc(var(--cw) - 2 * var(--cp));margin-inline:auto;height:1px;background:var(--line)}
html.b-case main > section.block > .wide{padding-block:0}

/* ---------- hero ---------- */
html.b-case header.hero{padding-top:clamp(40px,6vw,88px)!important;padding-bottom:clamp(40px,5vw,72px)!important}
html.b-case header.hero h1{font-size:clamp(52px,8.2vw,128px)!important;line-height:.92!important;max-width:16ch}
html.b-case header.hero :is(.thesis,.id,.lede,.sub,.intro){max-width:44ch;font-size:clamp(19px,1.7vw,24px);line-height:1.4}
html.b-case header.hero :is(.facts,.meta){margin-top:clamp(24px,3vw,40px)}
html.b-case header.hero :is(.heroimg,.hero-vis,.hero-img){margin-top:clamp(32px,4vw,56px)}

/* ---------- type scale ---------- */
html.b-case main h2{font-size:clamp(34px,3.6vw,54px)!important;line-height:.98!important}
html.b-case main h3{font-size:clamp(18px,1.4vw,21px);line-height:1.3}
html.b-case main :is(.sec-title,.sechead){display:grid;gap:12px;margin:0 0 clamp(24px,3vw,40px)}
html.b-case main :is(.sec-title,.sechead) > p{font-size:17px;line-height:1.55;color:var(--muted);max-width:52ch}
html.b-case main :is(.prose p,.stack > p,section.col > p,.lead){max-width:var(--measure)}
html.b-case main .lead{font-size:clamp(18px,1.5vw,21px);line-height:1.55}

/* ---------- editorial grid on wide screens ---------- */
@media (min-width:1100px){
  /* reading sections: heading left (sticky), content right */
  html.b-case main > section.col{display:grid;grid-template-columns:minmax(0,4fr) minmax(0,8fr);column-gap:var(--cgap);align-items:start}
  html.b-case main > section.col > *{grid-column:2;min-width:0}
  html.b-case main > section.col > :is(.sec-title,.sechead):first-child{grid-column:1;grid-row:1 / span 40;position:sticky;top:112px;margin:0}
  html.b-case main > section.col > * + *:not(:nth-child(2)){margin-top:clamp(24px,2.6vw,36px)}

  /* wide sections: heading and intro on one line, the big content below at full width */
  html.b-case main > section.wide > .col:first-child > :is(.sec-title,.sechead):first-child{grid-template-columns:minmax(0,4fr) minmax(0,8fr);column-gap:var(--cgap);align-items:end}
  html.b-case main > section.wide > .col:first-child > :is(.sec-title,.sechead):first-child > *{grid-column:1}
  html.b-case main > section.wide > .col:first-child > :is(.sec-title,.sechead):first-child > p{grid-column:2;grid-row:1 / span 3;align-self:end;max-width:60ch}
}

/* ---------- components: consistent radius, spacing and surfaces ---------- */
html.b-case main :is(.tldr article,.method,.principle,.result,.road article,.survey,.ba,.tbl-wrap,.story-stage,.insight,.promise){border-radius:16px}
html.b-case main figure{margin:0}
html.b-case main figure img{border-radius:14px}
html.b-case main :is(figcaption,.cap){font-size:15px;line-height:1.5}
html.b-case main .story-grid{gap:clamp(32px,5vw,80px)}
html.b-case main .story-step{min-height:62vh}
html.b-case main .story-step:last-child{min-height:40vh}
html.b-case main table{font-size:15px}

/* ---------- mobile ---------- */
@media (max-width:1099px){
  html.b-case main > section.col > :is(.sec-title,.sechead):first-child{position:static}
}
@media (max-width:820px){
  html.b-case body{font-size:16px}
}
html.b-case .morph-bg{display:none!important}

/* ---------- shorter pages: tighter story steps, long sections fold ---------- */
html.b-case main .story-step{min-height:46vh}
html.b-case main .story-step:last-child{min-height:30vh}
html.b-case main > section.fold:not(.open){max-height:calc(var(--fold-h) + var(--csec));overflow:hidden}
html.b-case .fold-more{position:absolute;left:0;right:0;bottom:0;z-index:5;display:flex;justify-content:center;align-items:flex-end;height:180px;padding-bottom:28px;background:linear-gradient(180deg,transparent,var(--fold-bg,#fff) 62%);pointer-events:none}
html.b-case section.fold.open > .fold-more{position:static;height:auto;background:none;padding:28px 0 0;grid-column:1 / -1}
html.b-case .fold-btn{pointer-events:auto;display:inline-flex;align-items:center;gap:10px;min-height:48px;padding:0 22px;border-radius:999px;border:1.5px solid var(--b-blue,#2121ff);background:var(--bg,#fff);color:var(--b-blue,#2121ff);font:600 15px/1 var(--body,inherit);cursor:pointer;box-shadow:0 8px 24px -10px rgba(20,15,79,.35);transition:background .2s,color .2s}
html.b-case .fold-btn:hover{background:var(--b-blue,#2121ff);color:#fff}
html.b-case .fold-btn svg{width:14px;height:14px;transition:transform .25s}
html.b-case section.fold.open .fold-btn svg{transform:rotate(180deg)}
@media print{html.b-case main > section.fold{max-height:none!important}html.b-case .fold-more{display:none}}
html.b-case main > section.fold{position:relative}
