/* Editorial wrapping: normal word boundaries, balanced headings and no last-word runts. */
body :is(main, #smouha-footer-clean) :is(p, li, dd, dt, figcaption, label, h1, h2, h3, h4, h5, h6) {
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
}
body :is(main, #smouha-footer-clean) :is(p, li, dd, figcaption) {
  text-wrap: pretty;
}
body :is(main, #smouha-footer-clean) :is(h1, h2, h3, h4, h5, h6) {
  text-wrap: balance;
}
/* A four-card collection is 2 x 2 on desktop, including filtered collections. */
@media (min-width: 1024px) {
  body :is(#main-content, #smf-home, #smdev-directory, #smdev-profile, #sme-main, #sm-seller)
  :is(.sm-r8-grid, .sm-r8-tags, .sm-r8-landmarks, .sm-r8-timeline,
      .sm-uc-grid, .sm-clean-unit-grid, .sm-offer-grid, .sm-unit-grid,
      .sm-project-facts, .sm-facts, .sm-overview-facts, .sm31-paths, .sm31-finance-grid,
      .smn-gallery-grid, .smn-listings, .smp-grid, .smf-project-grid,
      .smdev-directory-grid, .smdev-project-grid, .sme-grid, .ss-grid):has(> :nth-child(4 of :not([hidden])):nth-last-child(1 of :not([hidden]))) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Contrast corrections for legacy templates sharing the native shell. */
body :is(main figcaption, .sm-spec-label, .sm-breadcrumbs, .sm-breadcrumbs a, .sm-breadcrumbs .current),
body #smdev-directory label > span,
body #smdev-profile figcaption,
body #sm-seller article > small,
body .project-title > small,
body main .cr-unit-code {
  color: #545754 !important;
}
body .sm-status-badge {
  color: #333635 !important;
  background: #C4A347 !important;
}
body .sm-down-payment {
  color: #F4F3EF !important;
  background: #333635 !important;
}
body .sm-btn-call {
  color: #F4F3EF !important;
  background: #333635 !important;
}
body .fluentform .ff-el-input--label label {
  color: #333635 !important;
}
body .fluentform .ff-btn-submit {
  color: #333635 !important;
  background: #C4A347 !important;
}
/* Direct area values sit on pale cards; nested area values keep their dark card treatment. */
.smn-project-content .sm-uc-card > .sm-uc-area {
  color: #545754;
}

/* Dark photo captions keep light copy; plan notes use the same readable muted ink. */
body #creeks-page .cr-location-caption { color: #F4F3EF !important; }
body #creeks-page .cr-plan-item > span { color: #545754 !important; }
@media (min-width: 1024px) {
  body #sme-main .smi-group > ul:has(> :nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.smn-project-content .smn-map .smn-muruj-map { display: block; width: 100%; height: 100%; }
@media (max-width: 767px) {
  .smn-project-content .smn-map:has(.smn-muruj-map) { aspect-ratio: 1000 / 1100; }
}
