/* ==========================================================================
   4Leaderz — blocks from the CMS
   1. Blocks the editor added (templates: text, columns, statement, cta)
   2. Style presets the editor can pick per block (data-style-*). They are a
      fixed, on-brand list; loaded last so they override the page styles.
   ========================================================================== */

/* --- 1. Added blocks ---------------------------------------------------- */

.cms-block {
  padding: var(--space-xl) 0;
}

.cms-block h2 {
  margin: 0 0 var(--space-m);
}

.cms-block-body p {
  font-size: var(--step-1);
  line-height: 1.7;
}

.cms-block-body p:last-child {
  margin-bottom: 0;
}

.cms-block-columns {
  display: grid;
  gap: var(--space-m) var(--space-xl);
}

@media (min-width: 760px) {
  .cms-block-columns {
    grid-template-columns: 1fr 1fr;
  }
}

.cms-block--statement {
  padding: var(--space-2xl) 0;
  background: var(--blue-deep);
}

.cms-block--statement h2 {
  max-width: 22ch;
  margin: 0;
  font-size: var(--step-6);
  font-weight: 560;
  line-height: 1.04;
  letter-spacing: -0.032em;
  color: var(--white);
}

.cms-block--statement p {
  max-width: 60ch;
  margin: var(--space-m) 0 0;
  font-size: var(--step-1);
  color: var(--blue-signal);
}

.cms-block-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m) var(--space-xl);
  padding: var(--space-xl) clamp(1.5rem, 5vw, 4.5rem);
  background: var(--paper-lift);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.cms-block-cta h2 {
  margin-bottom: var(--space-xs);
}

.cms-block-cta p {
  margin: 0;
  font-size: var(--step-1);
  color: var(--ink-muted);
}

/* Inside a coloured background the call-to-action panel steps aside. */
.cms-block--cta[data-style-bg] .cms-block-cta {
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none;
}

/* --- 2. Style presets ---------------------------------------------------- */

/* Background. Text colour follows, so contrast always holds. */
section[data-style-bg="paper"] { background: var(--paper) !important; }
section[data-style-bg="light"] { background: var(--paper-lift) !important; }
section[data-style-bg="white"] { background: var(--white) !important; }
section[data-style-bg="sand"] { background: var(--paper-2) !important; }
section[data-style-bg="blue"] { background: var(--blue-deep) !important; }
section[data-style-bg="ink"] { background: var(--ink) !important; }
section[data-style-bg="clay"] { background: var(--clay) !important; }

section:is([data-style-bg="paper"], [data-style-bg="light"], [data-style-bg="white"], [data-style-bg="sand"]) {
  color: var(--ink);
}

section:is([data-style-bg="paper"], [data-style-bg="light"], [data-style-bg="white"], [data-style-bg="sand"])
  :is(h1, h2, h3, h4, h2 span, p, li, em, strong, blockquote) {
  color: var(--ink) !important;
}

section:is([data-style-bg="paper"], [data-style-bg="light"], [data-style-bg="white"], [data-style-bg="sand"])
  :is(.lede, .hero-sub) {
  color: var(--ink-muted) !important;
}

section:is([data-style-bg="blue"], [data-style-bg="ink"], [data-style-bg="clay"]) {
  color: var(--on-dark);
}

section:is([data-style-bg="blue"], [data-style-bg="ink"], [data-style-bg="clay"])
  :is(h1, h2, h3, h4, h2 span, strong) {
  color: var(--white) !important;
}

section:is([data-style-bg="blue"], [data-style-bg="ink"], [data-style-bg="clay"])
  :is(p, li, em, blockquote, .lede, .hero-sub) {
  color: var(--on-dark) !important;
}

section:is([data-style-bg="blue"], [data-style-bg="ink"], [data-style-bg="clay"]) a:not(.btn) {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

section:is([data-style-bg="blue"], [data-style-bg="ink"]) .btn-primary {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
}

section:is([data-style-bg="blue"], [data-style-bg="ink"], [data-style-bg="clay"]) .btn-outline {
  --btn-border: rgba(255, 255, 255, 0.55);
  --btn-fg: var(--white);
}

section[data-style-bg="clay"] .btn-accent,
section[data-style-bg="clay"] .btn-primary {
  --btn-bg: var(--ink);
  --btn-fg: var(--white);
}

/* Text width.
   Full: the text gets the whole width of the section. Layouts with a photo or form beside the
   text become one column (the photo goes underneath), and line-length limits are lifted.
   Half: text blocks are at most half the section wide (on wider screens). */
section[data-style-width="full"] :is(.container, .cta-panel, .contact-grid) {
  grid-template-columns: minmax(0, 1fr) !important;
}

section[data-style-width="full"] :is(.container, .cta-panel, .contact-grid) > * {
  grid-column: 1 / -1 !important;
  grid-row: auto !important;
}

/* A photo column that sticks while scrolling would slide over the text once stacked. */
section[data-style-width="full"] [class*="-media"] {
  position: relative !important;
  top: auto !important;
  width: 100%;
  max-width: 640px !important;
}

section[data-style-width="full"] .container :not(img, svg, svg *, picture, video, iframe, input, select, textarea, button, .btn, .frame, [class*="-media"]) {
  max-width: none !important;
}

section[data-style-width="half"] .container {
  container-type: inline-size;
}

@media (min-width: 760px) {
  section[data-style-width="half"] .container :is(h1, h2, h3, p, .lede, ul, ol, blockquote, .cms-block-body, .cms-block-columns) {
    max-width: 50cqi !important;
  }
}

/* Alignment. Text is aligned across the whole section: text blocks themselves move to the
   left, centre or right, not just the lines inside them. Where a photo or form sits beside the
   text, it aligns within its own column (choose "Volle breedte" to use the whole width). */
section[data-style-align="left"] .container { text-align: left; }
section[data-style-align="center"] .container { text-align: center; }
section[data-style-align="right"] .container { text-align: right; }

section[data-style-align="left"] .container :is(h1, h2, h3, p, .lede, ul, ol, blockquote, .audience-block, .privacy-body, .team-head, .method-statement, [class$="-copy"], .cms-block-body, .cms-block-columns) {
  text-align: left !important;
  margin-left: 0 !important;
  margin-right: auto !important;
}

section[data-style-align="center"] .container :is(h1, h2, h3, p, .lede, ul, ol, blockquote, .audience-block, .privacy-body, .team-head, .method-statement, [class$="-copy"], .cms-block-body, .cms-block-columns) {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

section[data-style-align="right"] .container :is(h1, h2, h3, p, .lede, ul, ol, blockquote, .audience-block, .privacy-body, .team-head, .method-statement, [class$="-copy"], .cms-block-body, .cms-block-columns) {
  text-align: right !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}

/* Text-only layouts: every part spans the full row, so alignment is relative to the section. */
section:is([data-style-align="center"], [data-style-align="right"]) :is(.container, .cta-panel):not(:has(img, iframe, form, .frame, .calendly-inline-widget)) > * {
  grid-column: 1 / -1 !important;
}

/* Buttons and button rows follow the alignment. */
section[data-style-align="left"] :is(.cms-block-cta, .cta-panel, .btn-row, .cta-actions, .newsletter-form) {
  justify-content: flex-start;
  justify-items: start;
}

section[data-style-align="center"] :is(.cms-block-cta, .cta-panel, .btn-row, .cta-actions, .newsletter-form) {
  justify-content: center;
  justify-items: center;
}

section[data-style-align="right"] :is(.cms-block-cta, .cta-panel, .btn-row, .cta-actions, .newsletter-form) {
  justify-content: flex-end;
  justify-items: end;
}

section:is([data-style-align="center"], [data-style-align="right"]) .cms-block-cta {
  flex-direction: column;
}

section[data-style-align="center"] .cms-block-cta { align-items: center; }
section[data-style-align="right"] .cms-block-cta { align-items: flex-end; }

/* The short decorative line above a title moves along with the text. */
section[data-style-align="left"] .audience-block::before {
  left: 0;
  right: auto;
  translate: none;
}

section[data-style-align="center"] .audience-block::before {
  left: 50%;
  right: auto;
  translate: -50% 0;
}

section[data-style-align="right"] .audience-block::before {
  left: auto;
  right: 0;
  translate: none;
}

/* A photo under full-width text follows the alignment too. */
section[data-style-align="center"][data-style-width="full"] [class*="-media"] {
  margin-left: auto;
  margin-right: auto;
}

section[data-style-align="right"][data-style-width="full"] [class*="-media"] {
  margin-left: auto;
  margin-right: 0;
}

/* Lists keep their bullets next to the text. */
section:is([data-style-align="center"], [data-style-align="right"]) .container :is(ul, ol) {
  list-style-position: inside;
}

/* Vertical alignment: where text sits beside a photo, form, buttons or a second column,
   it moves to the top, middle or bottom of that row. */
section[data-style-valign="top"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns, .cms-block-cta) {
  align-items: start !important;
}

section[data-style-valign="middle"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns, .cms-block-cta) {
  align-items: center !important;
}

section[data-style-valign="bottom"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns, .cms-block-cta) {
  align-items: end !important;
}

section[data-style-valign="top"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns) > * {
  align-self: start !important;
}

section[data-style-valign="middle"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns) > * {
  align-self: center !important;
}

section[data-style-valign="bottom"] :is(.container, .cta-panel, .contact-grid, .cms-block-columns) > * {
  align-self: end !important;
}

/* Text size */
section[data-style-size="small"] :is(p, li, .lede, .hero-sub) { font-size: var(--step-0) !important; }
section[data-style-size="small"] h1 { font-size: var(--step-4) !important; }
section[data-style-size="small"] h2 { font-size: var(--step-3) !important; }
section[data-style-size="small"] h3 { font-size: var(--step-1) !important; }

section[data-style-size="large"] :is(p, li, .lede, .hero-sub) { font-size: var(--step-2) !important; line-height: 1.55; }
section[data-style-size="large"] h1 { font-size: calc(var(--step-6) * 1.2) !important; }
section[data-style-size="large"] h2 { font-size: var(--step-6) !important; }
section[data-style-size="large"] h3 { font-size: var(--step-3) !important; }

/* Typeface: the two brand fonts only */
section[data-style-font="display"] :is(h1, h2, h3, h4, p, li, em, .lede) {
  font-family: var(--font-display) !important;
}

section[data-style-font="sans"] :is(h1, h2, h3, h4, p, li, em, .lede) {
  font-family: var(--font-sans) !important;
}

/* Space above and below */
section[data-style-space="compact"] {
  padding-top: var(--space-l) !important;
  padding-bottom: var(--space-l) !important;
}

section[data-style-space="roomy"] {
  padding-top: calc(var(--space-2xl) * 1.4) !important;
  padding-bottom: calc(var(--space-2xl) * 1.4) !important;
}
