/*
 * LexActa HERO variant 2.
 * The renderer preserves the original element, ID, attributes and textContent.
 * Only explicitly marked HERO titles receive this presentation.
 * Load after the existing theme styles as a blocking stylesheet.
 */
body .lex-hero-title-v2.lex-hero-title-v2 {
  --lex-hero-v2-main-size: clamp(2rem, calc(1.125rem + 3.75vw), 3.75rem);
  --lex-hero-v2-secondary-size: clamp(1.35rem, 3vw, 1.75rem);
  --lex-hero-v2-secondary-gap: clamp(1rem, 1.65vw, 1.5rem);
  box-sizing: border-box;
  display: block;
  position: relative;
  flex-basis: 100%;
  width: 100%;
  min-width: 0;
  max-width: none !important;
  margin-inline: 0;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  font-size: var(--lex-hero-v2-main-size) !important;
  font-weight: 700 !important;
  letter-spacing: normal;
  line-height: 1.06 !important;
  text-align: left !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: manual;
  text-wrap: wrap;
  overflow: visible;
}

body .lex-hero-title-v2 .lex-hero-title-v2__main,
body .lex-hero-title-v2 .lex-hero-title-v2__secondary {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: none;
  color: #fff !important;
  -webkit-text-fill-color: #fff;
  font-family: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-align: left;
  text-transform: inherit;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: manual;
  text-wrap: wrap;
}

body .lex-hero-title-v2 .lex-hero-title-v2__main {
  font-size: var(--lex-hero-v2-main-size);
  line-height: 1.06;
}

body .lex-hero-title-v2 .lex-hero-title-v2__secondary {
  margin-top: var(--lex-hero-v2-secondary-gap);
  font-size: var(--lex-hero-v2-secondary-size);
  line-height: 1.25;
}

/* Preserve existing inline markup and explicit <br> without retaining old accent colors. */
body .lex-hero-title-v2 :is(.lex-hero-title-v2__main, .lex-hero-title-v2__secondary) :is(span, strong, b, em, i, a) {
  color: inherit !important;
  -webkit-text-fill-color: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

/* The original separator and its spaces remain in the accessibility tree. */
body .lex-hero-title-v2 .lex-hero-title-v2__separator {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 1024px) {
  body .lex-hero-title-v2.lex-hero-title-v2 {
    --lex-hero-v2-main-size: clamp(3.75rem, 4.4vw, 4.5rem);
    --lex-hero-v2-secondary-size: clamp(1.75rem, 2.2vw, 2.125rem);
    --lex-hero-v2-secondary-gap: clamp(1.25rem, 1.65vw, 1.5rem);
  }
}

/* Full-width titles over existing background photographs; lead widths are unchanged. */
body.page-template-template-service .lex-service-v3-hero__content:has(> .lex-hero-title-v2),
body.page-id-2273 .lex-team-hero__copy:has(> .lex-hero-title-v2) {
  width: 100%;
  min-width: 0;
  max-width: none;
}

body.page-template-template-service .lex-service-v3-hero__content:has(> .lex-hero-title-v2) > .lex-service-v3-hero__actions {
  max-width: 850px;
}

body.page-id-2273 .lex-team-hero__copy:has(> .lex-hero-title-v2) > .lex-team-hero__actions {
  max-width: 900px;
}

/*
 * Editorial variants include Blog, articles, cases, contact, cities, FAQ and legal pages.
 * The pure copy wrapper becomes transparent to grid; .lex-hero-v2-body keeps all
 * original lead/actions/meta/disclosure children together below the title.
 */
body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2),
body.page-id-1385 .lex-about-hero__layout:has(> .lex-about-hero__copy > .lex-hero-title-v2) {
  align-items: start;
  align-content: start;
  row-gap: 0;
  grid-template-rows: auto auto auto auto;
}

body .lex-editorial-hero__copy:has(> .lex-hero-title-v2),
body.page-id-1385 .lex-about-hero__copy:has(> .lex-hero-title-v2) {
  display: contents;
}

body .lex-editorial-hero__copy:has(> .lex-hero-title-v2) > .lex-editorial-hero__breadcrumbs,
body.page-id-1385 .lex-about-hero__copy:has(> .lex-hero-title-v2) > .lex-about-hero__breadcrumbs {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
}

body .lex-editorial-hero__copy:has(> .lex-hero-title-v2) > .lex-editorial-hero__eyebrow,
body.page-id-1385 .lex-about-hero__copy:has(> .lex-hero-title-v2) > .lex-about__eyebrow {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  justify-self: start;
}

body .lex-editorial-hero__copy > .lex-hero-title-v2,
body.page-id-1385 .lex-about-hero__copy > .lex-hero-title-v2 {
  grid-column: 1 / -1;
  grid-row: 3;
}

body .lex-editorial-hero__copy:has(> .lex-hero-title-v2) > .lex-hero-v2-body,
body.page-id-1385 .lex-about-hero__copy:has(> .lex-hero-title-v2) > .lex-hero-v2-body {
  grid-column: 1;
  grid-row: 4;
  min-width: 0;
  align-self: start;
}

body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2) > .lex-editorial-hero__visual,
body.page-id-1385 .lex-about-hero__layout:has(> .lex-about-hero__copy > .lex-hero-title-v2) > .lex-about-hero__portrait {
  grid-column: 2;
  grid-row: 4;
  min-width: 0;
  align-self: start;
  margin-top: 1.45rem;
}

/* Older service hero: its note follows the readable body instead of narrowing H1. */
body.page-template-template-service .lex-service__intro-grid:has(> .lex-service__intro-copy > .lex-hero-title-v2) {
  display: block;
}

body.page-template-template-service .lex-service__intro-copy:has(> .lex-hero-title-v2) {
  width: 100%;
  max-width: none;
}

body.page-template-template-service .lex-service__intro-copy:has(> .lex-hero-title-v2) > :not(.lex-hero-title-v2) {
  max-width: 760px;
}

body.page-template-template-service .lex-service__intro-grid:has(> .lex-service__intro-copy > .lex-hero-title-v2) > .lex-service__notice {
  max-width: 760px;
  margin-top: 2rem;
}

/* Legacy page-header and home slider retain their existing container gutters. */
body .page-header > .row > .lex-hero-title-v2,
body .slider-photo .slide__title.lex-hero-title-v2 {
  width: 100%;
  max-width: none !important;
  text-align: left !important;
}

/* Landing: headline spans above the unchanged body, portrait, benefits and awards. */
body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  column-gap: clamp(1.5rem, 4vw, 3rem);
  row-gap: 0;
  align-items: start;
}

body .lp-hero__content:has(> .lex-hero-title-v2) {
  display: contents;
}

body .lp-hero__content > .lex-hero-title-v2 {
  grid-column: 1 / -1;
  grid-row: 1;
  position: relative;
  z-index: 2;
}

body .lp-hero__content:has(> .lex-hero-title-v2) > .lex-hero-v2-body {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  max-width: 590px;
  position: relative;
  z-index: 2;
}

body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__person {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  inset: auto;
  justify-self: end;
  align-self: end;
  width: auto;
  max-width: 100%;
  height: clamp(20rem, 36vw, 32rem);
  object-fit: contain;
}

body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__benefits {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
  flex-wrap: wrap;
}

body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__awards {
  grid-column: 1 / -1;
  grid-row: 4;
}

@media (max-width: 760px) {
  body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2),
  body.page-id-1385 .lex-about-hero__layout:has(> .lex-about-hero__copy > .lex-hero-title-v2) {
    grid-template-columns: minmax(0, 1fr);
  }

  body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2) > .lex-editorial-hero__visual,
  body.page-id-1385 .lex-about-hero__layout:has(> .lex-about-hero__copy > .lex-hero-title-v2) > .lex-about-hero__portrait {
    grid-column: 1;
    grid-row: 5;
    margin-top: 2.25rem;
  }
}

@media (max-width: 700px) {
  body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) {
    grid-template-columns: minmax(0, 1fr);
  }

  body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__person {
    grid-column: 1;
    grid-row: 3;
    height: clamp(15rem, 70vw, 24rem);
    margin-top: 1.5rem;
  }

  body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__benefits {
    grid-row: 4;
  }

  body .lp-hero > .lp-container:has(> .lp-hero__content > .lex-hero-title-v2) > .lp-hero__awards {
    grid-row: 5;
  }
}

/* Existing desktop navigation wraps below 1024px. Reserve its extra two rows
 * only above existing HERO sections; navigation and heading content stay intact. */
@media (min-width: 48rem) and (max-width: 63.9375rem) {
  body :is(.lex-service-v3-hero, .lex-about-hero, .lex-editorial-hero:has(#lex-faq-title, #lex-legal-title), .lp-hero, .page-header, .slider-photo):has(.lex-hero-title-v2) {
    border-top: 11.25rem solid transparent !important;
  }
}

/* Keep editorial breadcrumbs clear of the existing header at smaller widths. */
@media (max-width: 64rem) {
  body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2) {
    padding-top: calc(clamp(4.6rem, 8vw, 7rem) + 1.5rem);
  }
}

@media (max-width: 760px) {
  body .lex-editorial-hero__layout:has(> .lex-editorial-hero__copy > .lex-hero-title-v2) {
    padding-top: 5.25rem;
  }
}
