/* T28 - layout sections and per-block style tokens (v2026.11-T28). Loaded after mflow-site.css.
   Blocks live inside .flow, so selectors are prefixed with .flow to out-rank .flow p / .flow h2 rules. */

/* ---- features: column count ---- */
.flow .blk-features.cols-2 .fgrid{grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr))}
.flow .blk-features.cols-3 .fgrid{grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr))}
.flow .blk-features.cols-4 .fgrid{grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr))}
@media (min-width:900px){
  .flow .blk-features.cols-2 .fgrid{grid-template-columns:repeat(2,1fr)}
  .flow .blk-features.cols-3 .fgrid{grid-template-columns:repeat(3,1fr)}
  .flow .blk-features.cols-4 .fgrid{grid-template-columns:repeat(4,1fr)}
}

/* ---- columns: plain text columns, no cards ---- */
.flow .blk-columns{background:var(--mf-bg)}
.flow .blk-columns h2{text-align:center}
.flow .cgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));gap:var(--sp-6);margin-top:var(--sp-6)}
@media (min-width:760px){
  .flow .blk-columns.cols-2 .cgrid{grid-template-columns:repeat(2,1fr)}
  .flow .blk-columns.cols-3 .cgrid{grid-template-columns:repeat(3,1fr)}
}
.flow .ccol h3{margin-top:0;padding-top:var(--sp-3);border-top:3px solid var(--mf-accent)}
.flow .ccol p{margin:0;color:var(--mf-text-2)}

/* ---- split: text beside an image ---- */
.flow .blk-split{background:var(--mf-bg)}
.flow .split-in{display:grid;gap:var(--sp-6);align-items:center}
.flow .blk-split.has-img .split-in{grid-template-columns:1fr 1fr}
.flow .blk-split.has-img.side-start .split-media{order:-1}
.flow .split-copy h2{margin-top:0;text-align:start}
.flow .split-copy p{color:var(--mf-text-2)}
.flow .split-media img{width:100%;height:auto;display:block;border-radius:var(--mf-r-lg);border:1px solid var(--mf-border);box-shadow:var(--mf-shadow-md)}
@media (max-width:760px){.flow .blk-split.has-img .split-in{grid-template-columns:1fr}.flow .blk-split.has-img.side-start .split-media{order:0}}

/* ---- hero: centered variant ---- */
.flow .blk-hero.hero-center .hero-in{grid-template-columns:1fr;text-align:center;justify-items:center}
.flow .blk-hero.hero-center .hero-copy{max-width:760px}
.flow .blk-hero.hero-center .btn-row{justify-content:center}
.flow .blk-hero.hero-center .hero-img{max-width:860px;width:100%}

/* ---- CTA band variants (default stays the existing brand band) ---- */
.flow .blk-cta.cta-dark{background:var(--mf-hero-bg);color:#E6EBF5}
.flow .blk-cta.cta-dark h2,.flow .blk-cta.cta-dark p{color:#E6EBF5}
.flow .blk-cta.cta-soft{background:var(--mf-primary-soft);color:var(--mf-text)}
.flow .blk-cta.cta-soft h2,.flow .blk-cta.cta-soft p{color:var(--mf-text)}
.flow .blk-cta.cta-soft .btn-light{background:var(--mf-primary);color:var(--mf-on-primary);border-color:var(--mf-primary)}

/* ===== T29 layout fix: ONE shared column + ONE vertical rhythm for article / page flow =====
   Problems fixed: (1) loose text, callouts and images used a 740px column while features/steps/columns/faq/split
   used the 1120px container, so their edges did not line up; (2) sections had no outside margin (text touched the band
   edge, 48px+ on the other side), h2 had extra padding, pre/list margins were browser defaults; (3) start/end images were
   sized (45%) and placed from the full container instead of the text column and never cleared. */

/* 1) the column: --col is used by text, header, hero image, floated images and the inner wrapper of content sections */
.flow{--measure:740px;--col:min(var(--measure),100% - 40px);--fl-sec:var(--sp-7)}
.flow.tpl-wide{--measure:var(--maxw)}
.flow.pd-body{--col:100%}
.flow>:not(.blk),.flow>.page-head,.flow>.art-head,.flow>figure.art-hero{width:var(--col)}

/* content sections (features, steps, columns, faq, split) inside a reading flow (a flow that has loose text) share the
   text column: the band stays full-bleed, its content lines up with the text. Landing/home keep the wide 1120 layout.
   hero and cta stay wide banners. A per-block width token (mfs-w-*) still wins because it is defined further down. */
.flow:where(:not(.tpl-landing,.is-home):has(>p,>ul,>ol,>h2,>h3,>h4,>hgroup,>blockquote,>.callout,>pre)) :is(.blk-features,.blk-steps,.blk-columns,.blk-faq,.blk-split)>.sc{width:var(--col)}
.flow.pd-body :is(.blk-features,.blk-steps,.blk-columns,.blk-faq,.blk-split)>.sc{width:100%}
@media (min-width:640px){
  .flow:where(:not(.tpl-landing,.is-home):has(>p,>ul,>ol,>h2,>h3,>h4,>hgroup,>blockquote,>.callout,>pre)) .blk-features.cols-3 .fgrid{grid-template-columns:repeat(3,1fr)}
}
@media (min-width:600px){
  .flow:where(:not(.tpl-landing,.is-home):has(>p,>ul,>ol,>h2,>h3,>h4,>hgroup,>blockquote,>.callout,>pre)) .blk-features.cols-4 .fgrid{grid-template-columns:repeat(2,1fr)}
}
.flow:where(:not(.tpl-landing,.is-home):has(>p,>ul,>ol,>h2,>h3,>h4,>hgroup,>blockquote,>.callout,>pre)) .blk-steps .steps{grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr))}

/* 2) vertical rhythm: every gap is the larger of the two neighbouring margins (siblings collapse), so
   text -> section band and section band -> text get the same 48px, and a callout/quote/image/code box gets 24px above AND below */
.flow>.callout,.flow>blockquote,.flow>figure:not(.img-start):not(.img-end):not(.art-hero){margin-block:var(--sp-5)}
.flow>:where(:not(.blk))+.blk{margin-top:var(--fl-sec)}
.flow>.blk+:where(:not(.blk)){margin-top:var(--fl-sec)}
.flow h2{padding-top:0}
.flow>pre,.flow>.video{margin-block:var(--sp-5)}
.flow>ul,.flow>ol{margin-block:0 var(--sp-4)}
.flow:has(>.blk:last-child){padding-bottom:0}
.flow::after{content:"";display:block;clear:both}

/* 3) images inside the text: start/end images are a share of the text COLUMN, start at the column edge, and
   everything that cannot sit beside a float (headings, boxes, sections) clears it */
.flow figure.img-start,.flow figure.img-end{float:inline-start;width:calc(var(--col) * .42);margin-block:var(--sp-1) var(--sp-3)}
.flow figure.img-start{float:inline-start;margin-inline-start:calc((100% - var(--col)) / 2);margin-inline-end:var(--sp-5)}
.flow figure.img-end{float:inline-end;margin-inline-end:calc((100% - var(--col)) / 2);margin-inline-start:var(--sp-5)}
.flow figure.img-start img,.flow figure.img-end img{width:100%;display:block}
.flow figure.img-center img,.flow figure.img-wide img{display:block}
.flow>:is(h2,h3,h4,hgroup,hr,pre,blockquote,.callout,.video,.btn-wrap,ul,ol,.blk,figure.img-center,figure.img-wide){clear:both}
@media (max-width:760px){
  .flow figure.img-start,.flow figure.img-end{float:none;width:var(--col);margin-inline:auto;margin-block:var(--sp-5)}
}

/* style tokens come LAST so they out-rank the section backgrounds above */
.flow .mfs-bg-soft{background:var(--mf-bg-soft)}
.flow .mfs-bg-tint{background:var(--mf-primary-soft)}
.flow .mfs-bg-dark{background:var(--mf-hero-bg);color:#E6EBF5}
.flow .mfs-bg-dark :is(h1,h2,h3,h4,p,li,cite,figcaption,summary,div){color:#E6EBF5}
.flow .mfs-bg-dark a:not(.btn){color:#93C5FD}
.flow .mfs-bg-dark :is(.fcard,details){color:var(--mf-text)}
.flow .mfs-bg-dark :is(.fcard,details) :is(h2,h3,p,div,summary){color:var(--mf-text)}
.flow>.mfs:not(.blk){padding-inline:var(--sp-5);border-radius:var(--mf-r-md)}
.flow>.mfs-bg-soft:not(.blk),.flow>.mfs-bg-tint:not(.blk),.flow>.mfs-bg-dark:not(.blk){padding-block:var(--sp-4)}

.flow .mfs-sp-none{padding-block:0;margin-block:0}
.flow .mfs-sp-sm{padding-block:var(--sp-4)}
.flow .mfs-sp-md{padding-block:var(--sp-7)}
.flow .mfs-sp-lg{padding-block:calc(var(--sp-8) * 1.5)}

.flow .mfs-al-start,.flow .mfs-al-start :is(h2,h3,p,.lead){text-align:start}
.flow .mfs-al-center,.flow .mfs-al-center :is(h2,h3,p,.lead){text-align:center}
.flow .mfs-al-end,.flow .mfs-al-end :is(h2,h3,p,.lead){text-align:end}
.flow .mfs-al-center .lead,.flow .mfs-al-center .btn-row{margin-inline:auto;justify-content:center}

.flow>.mfs-w-narrow:not(.blk){width:min(560px,100% - 40px)}
.flow>.mfs-w-wide:not(.blk){width:min(var(--maxw),100% - 40px)}
.flow>.mfs-w-full:not(.blk){width:calc(100% - 40px)}
.flow .mfs-w-narrow .sc{width:min(760px,100% - 40px)}
.flow .mfs-w-full .sc{width:calc(100% - 40px)}


/* ---- E1: rich text inside block fields (classes allowed by Blocks::rich) ---- */
.flow .tx-primary{color:var(--mf-link)}
.flow .tx-accent{color:var(--mf-accent-text)}
.flow .tx-muted{color:var(--mf-text-2)}
.flow .fs-sm{font-size:.85em}
.flow .fs-lg{font-size:1.25em}
.flow .fs-xl{font-size:1.6em;line-height:1.3}
.flow mark{background:var(--mf-accent-soft);color:inherit;padding:0 .2em;border-radius:3px}
/* on the blue/dark bands the theme colours would vanish: keep the text readable there */
.flow .blk-cta :is(.tx-primary,.tx-accent,.tx-muted),.flow .blk-hero :is(.tx-primary,.tx-muted),.flow .mfs-bg-dark :is(.tx-primary,.tx-muted){color:inherit}
.flow .blk-cta .tx-accent,.flow .blk-hero .tx-accent,.flow .mfs-bg-dark .tx-accent{color:#6EE7B7}

/* ---- E4: CTA with several buttons (max 4). light = white pill, outline = transparent with a light border ---- */
.flow .blk-cta .cta-btns{justify-content:center;margin-top:var(--sp-3)}
.flow .blk-cta .cta-btns .btn{margin-top:0}
.btn-outline{background:transparent;color:#fff;border-color:rgba(255,255,255,.72)}
.btn-outline:hover{background:rgba(255,255,255,.16);color:#fff;border-color:#fff}
.flow .blk-cta.cta-soft .btn-outline{background:transparent;color:var(--mf-primary);border-color:var(--mf-primary)}
.flow .blk-cta.cta-soft .btn-outline:hover{background:var(--mf-primary);color:var(--mf-on-primary);border-color:var(--mf-primary)}

/* I5: form block (page editor) */
.blk-form .mf-iform{max-width:760px;margin-inline:auto;position:relative}
.blk-form .if-grid{display:flex;flex-wrap:wrap;gap:var(--sp-4,16px)}
.blk-form .if-f{flex:1 1 100%;min-width:0}
.blk-form .if-f.if-half{flex:1 1 calc(50% - var(--sp-4,16px) / 2)}
@media (max-width:640px){.blk-form .if-f.if-half{flex-basis:100%}}
.blk-form .if-f>label,.blk-form .if-lab{display:block;font-weight:600;margin-block-end:var(--sp-2,8px)}
.blk-form .if-f>label.check2{font-weight:400;margin:0}
.blk-form .if-req{color:#dc2626}
.blk-form .if-help{font-size:.88em;opacity:.75;margin-block-start:4px}
.blk-form .if-radios{display:grid;gap:6px}
.blk-form .if-err{color:#dc2626;font-size:.9em;margin-block-start:4px}
.blk-form .if-actions{margin-block:var(--sp-5,24px) 0}
.blk-form .if-hp{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);opacity:0;pointer-events:none}
.blk-form .if-msg{margin-block-start:var(--sp-4,16px);padding:12px 14px;border-radius:12px}
.blk-form .if-msg.if-bad{border:1px solid #dc2626;color:#dc2626}
.blk-form .if-msg.if-done{text-align:center;padding:24px}
.blk-form .if-ok{display:grid;justify-items:center;gap:8px;color:#10b981}
.blk-form .if-ok p{margin:0;color:inherit;font-weight:600}

/* I9: per-block visibility (guest = logged-out visitors, user = logged-in) */
body:not(.is-auth) .mfs-vis-user,body.is-auth .mfs-vis-guest{display:none!important}
