/*
 * P1-03 — fluid type scale + body colour/measure.
 * Display: Halyard (ThemeREX Typekit). Body: self-hosted DM Sans.
 */

body,
.elementor-widget-text-editor,
.elementor-widget-text-editor p,
.entry-content,
.entry-content p,
.post_content,
.post_content p {
  font-family: var(--f-sans) !important; /* fight ThemeREX body font */
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--c-ink) !important; /* kill ThemeREX #3a414a grey */
  font-weight: 400;
}

/* Measure: readable line length on text blocks (not full-bleed bands) */
.elementor-widget-text-editor .elementor-widget-container,
.elementor-widget-theme-post-content .elementor-widget-container {
  max-width: var(--wrap-text);
}

/* Display / headings — Halyard stays via Typekit; size & colour from tokens */
h1,
.elementor-heading-title.elementor-size-xxl,
.elementor-heading-title.elementor-size-xl {
  font-family: var(--f-display) !important;
  font-size: var(--t-hero);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--c-navy);
}

h2,
.elementor-heading-title.elementor-size-large {
  font-family: var(--f-display) !important;
  font-size: var(--t-h1);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--c-navy);
}

h3,
.elementor-heading-title.elementor-size-medium {
  font-family: var(--f-display) !important;
  font-size: var(--t-h2);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 700;
  color: var(--c-navy);
}

h4,
h5,
h6,
.elementor-heading-title.elementor-size-default,
.elementor-heading-title.elementor-size-small {
  font-family: var(--f-display) !important;
  font-size: var(--t-h3);
  line-height: 1.25;
  font-weight: 700;
  color: var(--c-navy);
}

/* Lead / subheads under heroes often use default size — bump distinctly below h1 */
.elementor-element[data-widget_type="heading"] + .elementor-element[data-widget_type="heading"] .elementor-heading-title,
.sc_item_subtitle,
.elementor-widget-heading .elementor-heading-title[class*="elementor-size-"] {
  /* size already set by h* / size class above */
}

/* Kill light-grey body copy from theme options / Elementor globals */
.scheme_default,
body .content,
body .page_content_wrap,
.elementor-widget-text-editor,
.elementor-widget-text-editor p,
.elementor-widget-text-editor .elementor-widget-container {
  color: var(--c-ink);
}

/* Secondary/muted copy still needs AA — use muted ink, never theme grey */
.sc_item_descr,
.elementor-widget-text-editor .elementor-drop-cap,
.has-text-color[style*="color:#7A7A7A"],
.has-text-color[style*="color: #7A7A7A"] {
  color: var(--c-ink-muted) !important;
}

/* Sentence case already; ensure no accidental all-caps on body */
.elementor-widget-text-editor {
  text-transform: none;
}

/* -------------------------------------------------------------------------
 * P1-04 — layout primitives + section rhythm
 * Utilities are available for later partials; Elementor sections get the
 * same rhythm without structural edits.
 * ------------------------------------------------------------------------- */

.ms2-wrap {
  width: min(100% - 2 * var(--s-3), var(--wrap));
  margin-inline: auto;
}

.ms2-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--s-3);
  row-gap: var(--s-4);
}

.ms2-text {
  max-width: var(--wrap-text);
}

/* Align Elementor boxed containers to the design wrap */
.elementor-section.elementor-section-boxed > .elementor-container,
.e-con {
  max-width: var(--wrap) !important; /* fight Elementor kit 1320px */
}

/* Horizontal page gutter on narrow viewports */
.page_content_wrap .content .elementor > .elementor-top-section > .elementor-container {
  padding-inline: var(--s-3);
}

@media (min-width: 768px) {
  .page_content_wrap .content .elementor > .elementor-top-section > .elementor-container {
    padding-inline: var(--s-4);
  }
}

/*
 * Section vertical rhythm: one place only (--section-y on the section wrapper).
 * Skip hero slider and spacer-only bands. Title-only strips get top pad only so
 * the heading stays visually attached to the following content band.
 */
.page_content_wrap .content .elementor > .elementor-top-section {
  padding-block: var(--section-y) !important; /* fight Elementor zero/custom pad */
}

.page_content_wrap .content .elementor > .elementor-top-section:has(.rev_slider),
.page_content_wrap .content .elementor > .elementor-top-section:has(rs-module),
.page_content_wrap .content .elementor > .elementor-top-section:has(.tp-revslider-mainul) {
  padding-block: 0 !important;
}

/* Spacer-only top sections → no section-y (neighbours already carry it) */
.page_content_wrap .content .elementor > .elementor-top-section:has(.elementor-widget-spacer):not(:has(.elementor-widget-heading)):not(:has(.elementor-widget-text-editor)):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-icon-box)):not(:has(.elementor-widget-icon-list)):not(:has(.elementor-widget-button)):not(:has(.wpcf7)):not(:has(.elementor-widget-google_maps)):not(:has(.rev_slider)):not(:has(rs-module)):not(:has(.elementor-widget-image-carousel)):not(:has(.swiper)):not(:has(.elementor-widget-video)):not(:has(.elementor-widget-shortcode)):not(:has([class*="trx_sc_"])):not(:has(.gtranslate_wrapper)):not(:has(.gt_switcher)) {
  padding-block: 0 !important; /* fight inherited section-y */
}

/* Title-only strips (e.g. "Our Partners" / "They Trust Us" alone) */
.page_content_wrap .content .elementor > .elementor-top-section:has(.elementor-widget-heading):not(:has(.elementor-widget-text-editor)):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-icon-box)):not(:has(.elementor-widget-icon-list)):not(:has(.elementor-widget-button)):not(:has(.wpcf7)):not(:has(.elementor-widget-google_maps)):not(:has(.elementor-widget-image-carousel)):not(:has(.swiper)):not(:has([class*="trx_sc_"])) {
  padding-block: var(--section-y) 0 !important;
}

/* Content band immediately under a title-only strip — tight top, full bottom */
.page_content_wrap .content .elementor > .elementor-top-section:has(.elementor-widget-heading):not(:has(.elementor-widget-text-editor)):not(:has(.elementor-widget-image)):not(:has(.elementor-widget-icon-box)):not(:has(.elementor-widget-icon-list)):not(:has(.elementor-widget-button)):not(:has(.wpcf7)):not(:has(.elementor-widget-google_maps)):not(:has(.elementor-widget-image-carousel)):not(:has(.swiper)):not(:has([class*="trx_sc_"])) + .elementor-top-section {
  padding-top: var(--s-3) !important;
  padding-bottom: var(--section-y) !important;
}

/* When the section already carries --section-y, drop edge spacers that double the gap */
.page_content_wrap .content .elementor > .elementor-top-section > .elementor-container > .elementor-column > .elementor-widget-wrap > .elementor-widget-spacer:first-child .elementor-spacer-inner,
.page_content_wrap .content .elementor > .elementor-top-section > .elementor-container > .elementor-column > .elementor-widget-wrap > .elementor-widget-spacer:last-child .elementor-spacer-inner {
  height: 0 !important; /* fight Elementor spacer pixel height */
  min-height: 0 !important;
}
