/**
 * Gutenberg home layout bridge (v0.3.9)
 *
 * WP Group blocks wrap children in .wp-block-group__inner-container, which
 * breaks theme grids/flex that expect .hero > .wrap, .scope-grid > .scope-card,
 * etc. display:contents promotes real children back to the group level so
 * assets/css/style.css selectors work again.
 *
 * v0.3.4: scope-card selectors pierce inner-container; quality actions gap; header/WhatsApp via style.css.
 * v0.3.3: restore vertical rhythm lost when neutralizing WP group/heading
 * margins after display:contents (full-page spacing pass).
 *
 * Loaded only on the front page (see functions.php).
 */

/* ------------------------------------------------------------------ */
/* 0) Neutralize block chrome (do NOT kill layout margins)             */
/* ------------------------------------------------------------------ */
/* Only kill WP default group margins that fight section stacking.
   Layout classes re-declare margin below - specificity must win. */
.page-home .wp-block-group:not(.sec-head):not(.home-intro-media):not(.home-evidence-strip):not(.home-feature-layout):not(.home-feature-copy):not(.svs-da-outer):not(.direct-answer):not(.proof-strip) {
  margin-block: 0;
}

/* Headings: keep side margins free for card pads; restore block rhythm
   via section rules below instead of a global margin:0 wipe. */
.page-home .wp-block-heading {
  margin-inline: 0;
}
.page-home .wp-block-columns {
  margin-bottom: 0;
}
.page-home .wp-block-image {
  margin: 0;
}
.page-home .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
}
.page-home .wp-block-quote {
  quotes: none;
}
.page-home .wp-block-list {
  margin-block: 0;
}

/* ------------------------------------------------------------------ */
/* 1) Collapse Gutenberg inner wrappers (core fix)                     */
/* ------------------------------------------------------------------ */
.page-home .wp-block-group > .wp-block-group__inner-container {
  display: contents;
}

/* Evidence items are layout shells for figure + caption */
.page-home .wp-block-group.svs-evidence-item {
  display: block;
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line, #e6e0d4);
  border-radius: 4px 18px 4px 4px;
  background: #dfdbd2;
}
.page-home .svs-evidence-item > .wp-block-group__inner-container {
  display: contents;
}
.page-home .svs-evidence-item .wp-block-image {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}
.page-home .svs-evidence-item .wp-block-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.page-home .svs-evidence-item .svs-figcaption {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  margin: 0;
  padding: 30px 17px 14px;
  background: linear-gradient(transparent, rgba(12, 21, 31, 0.84));
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

@media (max-width: 640px) {
  .page-home .svs-evidence-item,
  .page-home .home-evidence-strip .svs-evidence-item {
    aspect-ratio: 16 / 10;
  }
}

/* ------------------------------------------------------------------ */
/* 1b) Full-page vertical rhythm (after display:contents)              */
/* ------------------------------------------------------------------ */
/* Section shells already use theme section{padding}. Restore the
   inner stack that margin-block:0 + heading wipe had flattened. */

.page-home .wp-block-group.sec-head {
  margin-block: 0 clamp(32px, 4vw, 50px);
}
.page-home .sec-head > .kicker,
.page-home .sec-head > p.kicker {
  margin: 0 0 12px;
}
.page-home .sec-head > h2.wp-block-heading {
  margin: 0 0 14px;
}
.page-home .sec-head > h3:not(:where(.svs-h4)).wp-block-heading {
  margin: 0 0 12px;
  font-size: clamp(18px, 1.6vw, 22px);
  font-weight: 650;
  color: var(--ink, #131c28);
}
.page-home .sec-head > p:not(.kicker) {
  margin: 0;
  max-width: 820px;
}

/* Media strips / feature rows → following grid/cards */
.page-home .wp-block-group.home-intro-media {
  margin-block: 0 40px;
}
.page-home .wp-block-group.home-evidence-strip {
  margin-block: 0 36px;
}
.page-home .home-product-visuals {
  margin: 0 0 28px;
}
.page-home .wp-block-group.home-feature-layout,
.page-home .wrap.home-feature-layout {
  margin-block: 0;
}
.page-home .home-feature-copy .sec-head {
  margin-bottom: 24px;
}

/* Shortcode / CPT grids after sec-head */
.page-home .project-type-grid,
.page-home .featured-project-grid,
.page-home .home-resources-grid,
.page-home .role-grid,
.page-home .testimonial-grid,
.page-home .steps,
.page-home .grid.grid-2,
.page-home .grid.grid-3,
.page-home .grid.grid-4,
.page-home .scope-grid {
  margin-top: 0;
}

/* Disclosure / note / CTA lines under grids */
.page-home p.scope-disclosure,
.page-home p.project-type-disclosure,
.page-home p.role-disclosure,
.page-home .section-link,
.page-home p.section-link,
.page-home p.inline-cta,
.page-home .inline-cta {
  margin-top: 24px;
  margin-bottom: 0;
}
.page-home .section-link {
  text-align: center;
}

/* Generic card text stack when body wrapper is missing */
.page-home .card > h3:not(:where(.svs-h4)).wp-block-heading,
.page-home .card > :is(h4, .svs-h4).wp-block-heading {
  margin: 0 0 10px;
}
.page-home .card > p {
  margin: 0;
}
.page-home .card > p + p {
  margin-top: 10px;
}
/* Plain text cards (Engineering / Quality etc.): no fixed height, no text clip.
   Media cards (scope/role/resource) keep overflow:hidden for image radius. */
.page-home .wp-block-group.card:not(.scope-card):not(.role-card):not(.home-resource-card):not(.project-type-card):not(.testimonial-card) {
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 26px 24px 24px;
}

/* Engineering / Quality 4-up: prevent clip + horizontal crush */
.page-home .home-engineering-section .grid.grid-4,
.page-home .home-quality-section .grid.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}
.page-home .home-engineering-section .grid.grid-4 > .card,
.page-home .home-quality-section .grid.grid-4 > .card {
  min-width: 0;
  height: auto;
  overflow: visible;
  padding: 24px 22px 22px;
}
.page-home .home-engineering-section .grid.grid-4 > .card > :is(h4, .svs-h4),
.page-home .home-quality-section .grid.grid-4 > .card > :is(h4, .svs-h4) {
  margin: 0 0 10px;
  line-height: 1.3;
}
.page-home .home-engineering-section .grid.grid-4 > .card > p,
.page-home .home-quality-section .grid.grid-4 > .card > p {
  margin: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 960px) {
  .page-home .home-engineering-section .grid.grid-4,
  .page-home .home-quality-section .grid.grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .page-home .home-engineering-section .grid.grid-4,
  .page-home .home-quality-section .grid.grid-4 {
    grid-template-columns: 1fr;
  }
  .page-home .wp-block-group.home-intro-media {
    margin-block: 0 28px;
  }
  .page-home .wp-block-group.home-evidence-strip {
    margin-block: 0 28px;
  }
}

/* Role / testimonial bodies keep internal pad when contents-promoted */
.page-home .role-card > .role-body,
.page-home .wp-block-group.role-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px;
  margin: 0;
}
.page-home .role-body > h3:not(:where(.svs-h4)).wp-block-heading {
  margin: 6px 0 10px;
}
.page-home .role-body > p {
  margin: 0 0 18px;
}
.page-home .testimonial-card > .testimonial-body,
.page-home .wp-block-group.testimonial-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 24px;
  margin: 0;
}
.page-home .step > :is(h4, .svs-h4).wp-block-heading {
  margin: 0 0 8px;
}
.page-home .step > p {
  margin: 0;
}

/* FAQ / CTA band copy rhythm */
.page-home .cta-band h2.wp-block-heading {
  margin: 0 0 16px;
}
.page-home .cta-band > .wrap > p,
.page-home .cta-band .wrap > p {
  margin: 0 auto 30px;
}
.page-home .faq-section .sec-head {
  margin-bottom: clamp(28px, 3.5vw, 40px);
}

/* ------------------------------------------------------------------ */
/* 2) Hero                                                             */
/* ------------------------------------------------------------------ */
.page-home .wp-block-group.hero.visual-hero {
  position: relative;
  overflow: hidden;
}
/* Fallback if contents is unsupported / inner still present */
.page-home .hero.visual-hero > .wp-block-group__inner-container > .wrap,
.page-home .hero.visual-hero > .wrap,
.page-home .hero.visual-hero .wrap {
  display: block;
  position: static;
  z-index: 2;
  width: min(100%, 1260px);
  max-width: 1260px;
  margin-inline: 0; /* grid-item auto margins caused centered shrink-wrap */
  justify-self: center;
  box-sizing: border-box;
  text-align: left;
}
.page-home .hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0;
  text-align: left;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-inline: 0 !important;
}
.page-home .hero.visual-hero h1.wp-block-heading,
.page-home .hero.visual-hero p.eyebrow,
.page-home .hero.visual-hero p.lede,
.page-home .hero.visual-hero p.hero-actions {
  text-align: left;
  margin-left: 0 !important;
  margin-right: auto !important;
}
.page-home .hero.visual-hero p.eyebrow {
  margin: 0 0 26px;
}
.page-home .hero.visual-hero h1.wp-block-heading {
  margin: 0;
}
.page-home .hero.visual-hero p.lede {
  margin: 26px 0 0;
  max-width: 590px;
}
.page-home .hero.visual-hero p.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 36px 0 0;
}
.page-home .hero.visual-hero .hero-actions a.btn + a.btn {
  margin-left: 0;
}

/* ------------------------------------------------------------------ */
/* 3) Direct-answer                                                    */
/* ------------------------------------------------------------------ */
.page-home .direct-answer p.direct-answer-action {
  margin-top: 14px;
  margin-bottom: 0;
}
.page-home .direct-answer p.direct-answer-action a {
  color: var(--accent-dark, #84672d);
  font-weight: 700;
  text-decoration: none;
}
.page-home .direct-answer p.da-label {
  margin-bottom: 10px;
}
.page-home .wp-block-group.svs-da-outer {
  margin-block: 0;
}
.page-home .wp-block-group.direct-answer {
  margin-block: 0;
}
.page-home .wp-block-group.proof-strip {
  margin-block: 32px 0;
}

/* ------------------------------------------------------------------ */
/* 4) Proof strip (columns → 4-up grid matching static markup)         */
/* ------------------------------------------------------------------ */
.page-home .proof-strip .proof-grid.wp-block-group,
.page-home .proof-strip .wrap.proof-grid {
  display: block;
}
.page-home .proof-strip .wp-block-columns {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0 !important;
  align-items: center;
  margin: 0;
  flex-wrap: nowrap !important;
}
.page-home .proof-strip .wp-block-column {
  padding: 6px clamp(22px, 2.6vw, 44px);
  border-left: 1px solid #d4cab8;
  text-align: center;
  margin: 0 !important;
  flex-basis: auto !important;
  flex-grow: 0 !important;
  width: auto !important;
}
.page-home .proof-strip .wp-block-column:first-child {
  border-left: 0;
}
.page-home .proof-strip .wp-block-column p {
  margin: 0;
}
.page-home .proof-strip .wp-block-column strong {
  display: block;
  color: var(--ink, #131c28);
  font-size: 14px;
}
.page-home .proof-strip .wp-block-column span {
  display: block;
  color: var(--ink-soft, #5b6572);
  font-size: 12.5px;
  margin-top: 4px;
  line-height: 1.4;
}
@media (max-width: 800px) {
  .page-home .proof-strip .wp-block-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .page-home .proof-strip .wp-block-column:nth-child(2n + 1) {
    border-left: 0;
  }
}
@media (max-width: 520px) {
  .page-home .proof-strip .wp-block-columns {
    grid-template-columns: 1fr;
  }
  .page-home .proof-strip .wp-block-column {
    border-left: 0;
    border-bottom: 1px solid #d4cab8;
    padding: 12px 0;
    text-align: left;
  }
  .page-home .proof-strip .wp-block-column:last-child {
    border-bottom: 0;
  }
}

/* ------------------------------------------------------------------ */
/* 5) Scope cards (no .scope-body wrapper in Gutenberg markup)         */
/* Child rules must NOT rely on ">" — WP still inserts                 */
/* .wp-block-group__inner-container in the DOM (display:contents only  */
/* affects layout boxes, not CSS child combinators).                   */
/* ------------------------------------------------------------------ */
.page-home .scope-section .scope-card {
  overflow: hidden; /* clip top media to card radius */
  height: auto;
  min-height: 0;
  padding: 0 0 12px;
  display: flex;
  flex-direction: column;
}
.page-home .scope-card > .wp-block-group__inner-container {
  display: contents;
}
.page-home .scope-card .wp-block-image.scope-media,
.page-home .scope-card .scope-media {
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.page-home .scope-card .scope-media img {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  height: 100%;
}
.page-home .scope-card p.svs-figcaption,
.page-home .scope-card .svs-figcaption {
  margin: 22px 28px 0 !important;
  padding: 0;
  font-size: 12.5px;
  color: var(--ink-soft, #5b6572);
  line-height: 1.5;
}
.page-home .scope-card p.card-kicker,
.page-home .scope-card .card-kicker {
  margin: 16px 28px 0 !important;
  letter-spacing: 0.14em;
}
.page-home .scope-card h3:not(:where(.svs-h4)).wp-block-heading {
  margin: 8px 28px 0 !important;
  line-height: 1.28;
}
.page-home .scope-card .scope-list,
.page-home .scope-card ul.scope-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  grid-auto-rows: auto;
  align-content: start;
  align-items: start;
  row-gap: 6px;
  margin: 18px 28px 0 !important;
  padding-left: 0;
  flex: 0 0 auto; /* v0.4.10: never stretch; Explore link sinks via margin-top:auto */
}
.page-home .scope-card .scope-list li {
  padding: 3px 0 3px 14px;
  line-height: 1.45;
}
.page-home .scope-card p:has(a.scope-link),
.page-home .scope-card p:last-of-type:has(a.more) {
  margin-top: auto !important;
  margin-left: 28px !important;
  margin-right: 28px !important;
  margin-bottom: 0 !important;
  padding-top: 24px;
  padding-bottom: 22px;
}
@media (max-width: 960px) {
  .page-home .scope-card .scope-media img {
    aspect-ratio: 3 / 2;
  }
  .page-home .scope-card p.svs-figcaption,
  .page-home .scope-card .svs-figcaption,
  .page-home .scope-card p.card-kicker,
  .page-home .scope-card .card-kicker,
  .page-home .scope-card h3:not(:where(.svs-h4)).wp-block-heading,
  .page-home .scope-card .scope-list,
  .page-home .scope-card ul.scope-list,
  .page-home .scope-card p:has(a.scope-link),
  .page-home .scope-card p:last-of-type:has(a.more) {
    margin-left: 22px !important;
    margin-right: 22px !important;
  }
}
@media (max-width: 640px) {
  .page-home .scope-card .scope-list,
  .page-home .scope-card ul.scope-list {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 4px;
  }
}

.page-home p.card-kicker,
.page-home .card-kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent-dark, #84672d);
  margin: 0 0 8px;
}
.page-home p.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.page-home p.inline-cta,
.page-home .inline-cta {
  margin-top: 22px;
}

/* ------------------------------------------------------------------ */
/* 6) Whole-house / engineering media groups                           */
/* ------------------------------------------------------------------ */
.page-home .wp-block-group.home-feature-media,
.page-home .wp-block-group.home-support-media {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  border: 1px solid var(--line, #e6e0d4);
  border-radius: 4px 32px 4px 4px;
  background: #dfdbd2;
  box-shadow: var(--shadow, 0 18px 50px rgba(19, 28, 40, 0.08));
}
.page-home .home-feature-media .wp-block-image,
.page-home .home-support-media .wp-block-image {
  position: absolute;
  inset: 0;
  margin: 0;
  width: 100%;
  height: 100%;
}
.page-home .home-feature-media .wp-block-image img,
.page-home .home-support-media .wp-block-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.page-home .home-feature-media .svs-figcaption,
.page-home .home-support-media .svs-figcaption {
  position: absolute;
  z-index: 2;
  left: 16px;
  bottom: 14px;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(17, 27, 40, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  backdrop-filter: blur(6px);
}
@media (max-width: 1080px) {
  .page-home .wp-block-group.home-feature-media,
  .page-home .wp-block-group.home-support-media {
    width: 100%;
    max-width: 760px;
    border-radius: 4px 22px 4px 4px;
  }
}
@media (max-width: 640px) {
  .page-home .home-feature-media .svs-figcaption,
  .page-home .home-support-media .svs-figcaption {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
    border-radius: 8px;
  }
}

/* Generic figcaption-as-paragraph (non-overlay contexts) */
.page-home p.svs-figcaption {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft, #5b6572);
  line-height: 1.45;
}

/* ------------------------------------------------------------------ */
/* 7) Role / testimonial / steps polish                                */
/* ------------------------------------------------------------------ */
.page-home .role-card .wp-block-image.role-media {
  margin-bottom: 0;
  border-radius: 4px 18px 4px 4px;
  overflow: hidden;
  flex-shrink: 0;
}
.page-home .role-card .role-media img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.page-home .testimonial-card .testimonial-photo {
  margin: 0;
  flex-shrink: 0;
}
.page-home .testimonial-card .testimonial-photo img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
  width: 100%;
}
.page-home .testimonial-card .wp-block-quote {
  margin: 0 0 14px;
  padding: 0 0 0 14px;
  border: 0;
  border-left: 3px solid var(--accent, #a97e35);
  color: #e8eef5;
}
.page-home .testimonial-card .wp-block-quote p {
  margin: 0;
  color: #fff;
  font-size: 15.5px;
  line-height: 1.6;
  font-weight: 550;
}
.page-home .testimonial-card .testimonial-by {
  color: #d6b57a;
  font-weight: 700;
  margin: 0 0 4px;
}
.page-home .testimonial-card .testimonial-context {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}
.page-home .testimonial-card .more {
  margin-top: auto;
  color: #d6b57a;
}

/* Steps: theme .steps already grids; ensure step boxes fill after contents */
.page-home .wp-block-group.steps > .step,
.page-home .steps .step {
  background: #fff;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* 8) FAQ — Gutenberg details uses <p> instead of .faq-body            */
/* ------------------------------------------------------------------ */
.page-home .faq .wp-block-details > p,
.page-home .faq details.wp-block-details > p,
.page-home .faq details > p {
  padding: 16px 22px 20px;
  font-size: 15px;
  color: var(--ink-soft, #5b6572);
  margin: 0;
  line-height: 1.65;
}
.page-home .faq .wp-block-details > p + p,
.page-home .faq details > p + p {
  padding-top: 0;
  margin-top: -6px;
}

/* ------------------------------------------------------------------ */
/* 9) Mobile hero CTAs                                                 */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .page-home .hero.visual-hero p.hero-actions .btn {
    width: 100%;
    text-align: center;
  }
  .page-home .hero.visual-hero p.eyebrow {
    margin-bottom: 20px;
  }
  .page-home .hero.visual-hero p.lede {
    margin-top: 20px;
  }
  .page-home .hero.visual-hero p.hero-actions {
    margin-top: 28px;
  }
}

/* ------------------------------------------------------------------ */
/* 9) Quality evidence actions row + description breathing room        */
/* ------------------------------------------------------------------ */
.page-home .home-quality-section .grid.grid-4 {
  margin-bottom: 8px;
}
.page-home .home-quality-section p.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  margin: 32px 0 0 !important;
}
.page-home .home-quality-section p.actions .btn {
  margin: 0;
}
.page-home .home-quality-section p.actions + p {
  margin-top: 22px !important;
  margin-bottom: 0 !important;
  max-width: 920px;
  color: var(--ink-soft, #5b6572);
  font-size: 14.5px;
  line-height: 1.65;
}
.page-home .home-quality-section .home-evidence-strip {
  margin-bottom: 28px;
}

/* v0.3.5: styles previously illegally baked into group/image HTML */
.page-home .svs-da-outer {
  position: relative;
  z-index: 5;
}
.page-home .scope-card p.card-tag,
.page-home .scope-card .card-tag {
  margin: 8px 28px 0 !important;
}
.page-home .scope-card .card-tag .tag,
.page-home .card-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 7px;
  border-radius: 20px;
  vertical-align: middle;
  background: #eef1f6;
  color: var(--ink-soft, #5b6572);
}

/* FAQ details padding (0.4.2) — match marketing hubs; static had padded disclosures */
.page-home details.wp-block-details,
.page-home .faq details,
.page-home .faq-section details {
  border: 1px solid var(--line, #e6e0d4);
  border-radius: 4px;
  padding: 14px 18px;
  margin: 0 0 10px;
  background: #fff;
}
.page-home details.wp-block-details > summary,
.page-home .faq details > summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}
.page-home details.wp-block-details > summary::-webkit-details-marker {
  display: none;
}