/* Shared editorial layouts. Keep introductions, reading copy and collections
   distinct, and let available reading width determine the number of columns. */
body.site-white[data-page] main :is(
  .service-intro-grid, .section-heading, .case-section-heading,
  .split-copy, .rich-copy, .coverage-card, .case-section-copy,
  .case-panel, .statement-card, .process-step, .service-card, .guide-summary
) {
  min-width: 0;
}

/* Long introductions belong above the article, not in a narrow sticky rail. */
body.site-white[data-page] main .service-intro-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(24px, 3vw, 40px);
}

body.site-white[data-page] main .service-intro-grid > .sticky-label {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(24rem, calc((100% - 40px) / 2))), 1fr));
  align-items: start;
  gap: 16px 40px;
  position: static;
  inset: auto;
  width: 100%;
  padding: 0 0 clamp(24px, 3vw, 36px);
  border: 0;
  border-bottom: 1px solid var(--white-line, #d8e2e6);
  border-radius: 0;
  transform: none !important;
}

body.site-white[data-page] main .service-intro-grid > .sticky-label > .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
}

body.site-white[data-page] main .service-intro-grid > .sticky-label > h2 {
  max-width: 30ch;
  margin: 0;
  font-size: clamp(1.5rem, 2.2vw, 2rem) !important;
  line-height: 1.25;
  text-wrap: pretty;
}

body.site-white[data-page] main .service-intro-grid > .sticky-label > p {
  max-width: 62ch;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.7;
}

body.site-white.site-refined[data-page] main .service-intro-grid > .rich-copy {
  width: 100%;
  max-width: 80ch;
  margin-inline: auto;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
}

body.site-white[data-page] main :is(.rich-copy, .split-copy) > h2 {
  max-width: 32ch;
  margin-bottom: 24px;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  line-height: 1.2;
  text-wrap: pretty;
}

body.site-white[data-page] main :is(.rich-copy, .split-copy, .coverage-card) > p {
  max-width: 70ch;
  font-size: 1.0625rem;
  line-height: 1.75;
}

body.site-white[data-page] main :is(.rich-copy, .split-copy, .coverage-card) > p + p {
  margin-top: 1.15em;
}

/* Section titles and their supporting introduction share a balanced row.
   auto-fit also reflows at enlarged text sizes, between device breakpoints. */
body.site-white[data-page] main .section-heading,
body.site-white[data-page-detail="case-study"] main .case-section-heading {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  align-items: start;
  gap: clamp(20px, 3vw, 40px);
}

body.site-white[data-page] main .section-heading h2,
body.site-white[data-page-detail="case-study"] main .case-section-heading h2 {
  max-width: 32ch;
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  line-height: 1.2;
  text-wrap: pretty;
}

body.site-white[data-page] main .section-heading > p {
  max-width: 65ch;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 1.0625rem;
  line-height: 1.75;
}

/* The navigation script wraps these titles in a sticky track. Keep its
   scrolling behaviour, but do not bottom-align an inactive title. */
body.site-white[data-page] main .section-heading > .scroll-follow-track {
  justify-content: flex-start;
}

body.site-white[data-page-detail="case-study"] main .case-section-heading > .case-section-copy {
  align-self: start;
  justify-content: flex-start;
  gap: 18px;
}

body.site-white[data-page-detail="case-study"] main .case-section-copy > p {
  max-width: 68ch;
  font-size: 1.0625rem;
  line-height: 1.75;
}

/* Text plus supporting information: natural card heights, generous columns.
   Illustrations, agency identity and interactive preview layouts are excluded. */
body.site-white[data-page] main .split:has(> .split-copy):has(> .coverage-card) {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  align-items: start;
  gap: clamp(24px, 4vw, 48px);
}

body.site-white[data-page] main .split > .coverage-card {
  align-self: start;
  min-width: 0;
  min-height: 0;
  padding: clamp(20px, 3vw, 32px);
}

body.site-white[data-page] main .split > .coverage-card :is(h2, h3) {
  max-width: 32ch;
  font-size: clamp(1.375rem, 2vw, 1.75rem) !important;
  line-height: 1.3;
  text-wrap: pretty;
}

body.site-white[data-page] main .split > .coverage-card .feature-list {
  margin-block: 24px;
}

/* Informative grids retain their sequence, with enough width for real copy. */
body.site-white[data-page] main .statements-grid:not(.compact-panel-grid),
body.site-white[data-page] main .cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  align-items: start;
  gap: clamp(18px, 2vw, 28px);
}

/* Expanded panels keep a comfortable reading measure within their full row. */
body.site-white[data-page] main .statements-grid.compact-panel-grid .compact-panel-body {
  padding-top: 16px;
}

body.site-white[data-page] main .statements-grid.compact-panel-grid .compact-panel-body > p {
  max-width: 70ch;
}

/* All service collections contain four entries: keep complete rows of two
   instead of leaving a fourth card alone below a three-column row. */
body.site-white[data-page] main .cards-grid {
  --readability-card-gap: clamp(18px, 2vw, 28px);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(24rem, calc((100% - var(--readability-card-gap)) / 2))), 1fr));
  align-items: stretch;
  gap: var(--readability-card-gap);
}

/* Keep auto-fit as the fallback when size container queries are unavailable. */
@supports (container-type: inline-size) {
  body.site-white[data-page] main .statements-grid:has(> .statement-card:nth-child(3):last-child) {
    container: readability-statements / inline-size;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

body.site-white[data-page] main :is(.statement-card, .cards-grid > .service-card) {
  grid-column: auto;
  min-height: 0;
  height: auto;
  padding: clamp(22px, 2.5vw, 32px);
}

body.site-white[data-page] main :is(.statement-card, .service-card, .process-step) h3 {
  font-size: clamp(1.25rem, 1.7vw, 1.5rem);
  line-height: 1.3;
  text-wrap: pretty;
}

body.site-white[data-page] main :is(.statement-card, .service-card, .process-step) > p {
  max-width: 70ch;
  font-size: 1rem;
  line-height: 1.7;
}

body.site-white[data-page] main .cards-grid > .service-card > .service-number {
  margin-bottom: 24px;
}

body.site-white[data-page] main .cards-grid > .service-card > p {
  margin-block: 0 1.15em;
}

/* Keep the existing numbered/subgrid rows, increasing each step's reading
   width for four-step processes rather than squeezing four narrow columns. */
body.site-white[data-page] main .process-grid:has(> .process-step:nth-child(4):last-child) {
  --reading-panel-span: 6;
}

body.site-white[data-page-detail="case-study"] main .case-two-col {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 25rem), 1fr));
  align-items: start;
  gap: 24px;
}

body.site-white[data-page-detail="case-study"] main .case-panel {
  min-height: 0;
  padding: clamp(22px, 3vw, 36px);
}

body.site-white[data-page-detail="case-study"] main .case-panel :is(h2, h3) {
  font-size: clamp(1.375rem, 2vw, 1.875rem);
  line-height: 1.3;
  text-wrap: pretty;
}

body.site-white[data-page-detail="case-study"] main .case-panel p {
  font-size: 1.0625rem;
  line-height: 1.75;
}

body.site-white[data-page-detail="case-study"] main .case-panel p + p {
  margin-top: 1em;
}

body.site-white[data-page-detail="case-study"] main .case-journey-item p {
  font-size: 1rem;
  line-height: 1.7;
}

/* This summary sits inside an article, so use its available width rather
   than the viewport to decide whether there is room for a second column. */
body.site-white[data-page="guide"] main .guide-summary {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  align-items: start;
  gap: 24px;
  padding: clamp(20px, 3vw, 32px);
}

body.site-white[data-page="guide"] main .guide-summary :is(p, li) {
  font-size: 1rem;
  line-height: 1.7;
}

@container readability-statements (max-width: 64rem) {
  body.site-white[data-page] main .statements-grid > .statement-card {
    grid-column: 1 / -1;
  }
}

@container reading-panels (max-width: 62rem) {
  body.site-white[data-page] main .process-grid:has(> .process-step:nth-child(3):last-child) > .process-step {
    --reading-panel-span: 12;
    display: flex;
    grid-row: auto;
  }
}

@container reading-panels (max-width: 40rem) {
  body.site-white[data-page] main .process-grid:has(> .process-step:nth-child(4):last-child) > .process-step {
    --reading-panel-span: 12;
    display: flex;
    grid-row: auto;
  }
}

@media (max-width: 700px) {
  body.site-white[data-page] main :is(.section-heading, .case-section-heading),
  body.site-white[data-page] main .service-intro-grid > .sticky-label,
  body.site-white[data-page] main .split:has(> .split-copy):has(> .coverage-card) {
    grid-template-columns: minmax(0, 1fr);
  }

  body.site-white[data-page] main :is(.section-heading, .case-section-heading) h2 {
    margin-bottom: 0;
  }

  body.site-white[data-page] main .split:has(> .coverage-card) > * {
    order: initial;
  }
}

/* Emergency wrapping only affects an individual token that cannot fit at
   narrow widths or enlarged text settings; normal words keep natural lines. */
body.site-white[data-page] main :is(
  .service-intro-grid, .section-heading, .case-section-heading,
  .split-copy, .coverage-card, .case-panel, .statement-card,
  .process-step, .cards-grid > .service-card, .guide-summary
) :is(h2, h3, h4, p, li, a) {
  overflow-wrap: anywhere !important;
}

@media print {
  body.site-white[data-page] main :is(.service-intro-grid, .section-heading, .case-section-heading, .case-two-col) {
    display: block;
  }

  body.site-white[data-page] main :is(.sticky-label, .case-panel, .statement-card, .process-step) {
    break-inside: avoid;
  }
}
