/* v7 / 2026-11-11. Responsive geometry fixes, loaded LAST. */
:root { --mobile-safe-bottom: env(safe-area-inset-bottom, 0px); }

/* Prevent intrinsic-width content and controls from stretching the grid. */
main, main section, .section-heading, .service-details,
.service-detail, .quiz-invite, .contact, .dom-profile-card { min-width: 0; }
button, a { -webkit-tap-highlight-color: transparent; }

/* The newbuild information and CTA are one vertical reading sequence. */
.newbuild-hero > div { box-sizing: border-box; }
.newbuild-hero .lead-offer-note { display: block; }
.newbuild-hero .btn { max-width: 100%; margin-top: 20px; }
.newbuild-hero .quiz-note { display: block; max-width: 31rem; }

@media (max-width: 800px) {
  /* Keep long labels within buttons; allow natural text wrapping. */
  .btn { max-width: 100%; box-sizing: border-box; }
  .service-detail, .service-preview, .quiz-invite { overflow-wrap: break-word; }
}

@media (max-width: 700px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

  /* The fixed desktop header was covering titles while scrolling on iPhone.
     Mobile secondary pages use an in-flow header. The homepage retains its
     approved overlay header and the persistent consultation action. */
  body:not(.home) .header {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    width: calc(100% - 24px);
    margin: 12px auto 0;
    box-sizing: border-box;
    z-index: 50;
  }
  body:not(.home) main { padding-top: 0; }
  body:not(.home) .header nav { top: calc(100% + 10px); }

  /* On newbuild, visually float the in-flow header over the background,
     but make it scroll away WITH the hero, eliminating text-on-header overlap. */
  body:has(.newbuild-hero) main { display: flow-root; padding-top: 0; }
  .newbuild-hero {
    margin-top: -84px;
    min-height: 0;
    height: auto;
    overflow: hidden;
    border-radius: 0;
  }
  .newbuild-hero > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 132px 6% 100px;
    width: 100%;
  }
  .newbuild-hero .eyebrow {
    font-size: 10px;
    line-height: 1.5;
    letter-spacing: .12em;
    margin: 0 0 24px;
  }
  .newbuild-hero h1 {
    font-size: clamp(34px, 10.15vw, 43px);
    line-height: 1.045;
    letter-spacing: -.032em;
    font-weight: 300;
    max-width: 100%;
    margin: 0;
    text-wrap: balance;
  }
  .newbuild-hero h1 br { display: none; }
  .newbuild-hero p:not(.lead-offer-note) {
    width: 100%;
    max-width: 29rem;
    margin: 23px 0 0;
    font-size: 14px;
    line-height: 1.56;
  }
  .newbuild-hero .lead-offer-note {
    margin: 16px 0 0 !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
    max-width: 26rem;
    opacity: .84;
  }
  .newbuild-hero .btn {
    display: inline-flex;
    width: auto;
    min-height: 56px;
    max-width: 100%;
    margin: 24px 0 0;
    padding: 15px 20px;
    font-size: 13px;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
    gap: 16px;
    justify-content: space-between;
    text-align: left;
    flex-shrink: 0;
  }
  .newbuild-hero .btn span { flex-shrink: 0; }
  .newbuild-hero .quiz-note {
    margin: 14px 0 0;
    font-size: 11px;
    line-height: 1.55;
    max-width: 25rem;
    opacity: .9;
  }
  .newbuild-label { bottom: 22px; right: 6%; }

  /* Sticky actions never obscure the last content row and respect notches. */
  .mobile-action {
    display: flex;
    box-sizing: border-box;
    align-items: center;
    gap: 10px;
    padding: 10px 5% calc(10px + var(--mobile-safe-bottom));
    min-height: 64px;
    z-index: 40;
  }
  .mobile-action > a, .mobile-action > button {
    box-sizing: border-box;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    min-height: 44px;
    padding: 11px 12px;
    white-space: nowrap;
    border-radius: 999px;
    line-height: 1.25;
    font-size: clamp(11px, 3vw, 13px);
  }
  .mobile-action > button { min-width: 0; flex: 1 1 auto; }
  .mobile-action > a { flex: 0 0 auto; }
  footer { padding-bottom: calc(108px + var(--mobile-safe-bottom)); }

  /* More consistent mobile titles and cards across the other pages. */
  .page-title, .about-hero { box-sizing: border-box; }
  .page-title h1, .about-copy h1, .service-detail h2,
  .section-heading h2 { max-width: 100%; overflow-wrap: break-word; }
  .service-overview, .service-workspace, .living-grid, .journey-grid { min-width: 0; }
  .contact .quiz-invite { width: 100%; box-sizing: border-box; }
}

@media (max-width: 360px) {
  .newbuild-hero > div { padding-top: 128px; padding-bottom: 100px; }
  .newbuild-hero h1 { font-size: clamp(32px, 10.4vw, 37px); }
  .newbuild-hero .eyebrow { margin-bottom: 20px; }
  .newbuild-hero .btn { margin-top: 16px; }
  .newbuild-hero p:not(.lead-offer-note) { font-size: 13px; }
  .mobile-action { gap: 8px; padding-inline: 4%; }
  .mobile-action > a, .mobile-action > button { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .newbuild-hero h1, .newbuild-hero .btn { transition: none; }
}
