/* Shared refinements for the preview's standalone pages and embedded view. */
html, body { max-width: 100%; }
img { max-width: 100%; }

/* The owners' portrait should occupy the same visual band as the other topics,
   while preserving the complete photograph rather than cropping either face. */
body[data-page="why"]:has(.item[data-i="0"].active) .content #feature {
  width: 100%;
  height: 510px !important;
  max-height: 510px !important;
  object-fit: contain !important;
  object-position: center center;
  background: #fff;
}

@media (max-width: 850px) {
  body[data-page="why"] .layout,
  body[data-page="commercial"] .layout,
  body[data-page="residential"] .layout { min-width: 0; }
  body[data-page="why"] .content,
  body[data-page="commercial"] main,
  body[data-page="residential"] main { min-width: 0; }
}

@media (max-width: 620px) {
  .lang button { min-width: 44px !important; min-height: 44px !important; touch-action: manipulation; }
  .shell { padding-left: 18px; padding-right: 18px; }
  .utility .shell { gap: 8px; text-align: center; }
  header .shell { height: 68px; gap: 12px; }
  .brand img { width: 58px; height: 42px; }
  .brand span { font-size: 14px; }
  .links.open { top: 68px; max-height: calc(100dvh - 68px); overflow-y: auto; z-index: 30; }
  .menu { min-width: 44px; min-height: 44px; cursor: pointer; }
  .hero { min-height: 0; }
  .hero-copy { padding: 54px 18px 42px; }
  .hero h1 { font-size: clamp(36px, 10vw, 44px); letter-spacing: -1px; }
  .hero p { font-size: 16px; }
  .hero-actions .button { min-height: 48px; }
  .hero-media { padding: 0 12px 12px; }
  .photo { min-height: 190px; }
  .photo span { left: 12px; bottom: 12px; font-size: 15px; }
  .section { padding: 52px 0; }
  .section h2, .cta h2 { font-size: clamp(30px, 8vw, 40px); }
  .service-tile img { height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
  .service-tile .tile-body { padding: 22px; }
  .service-tile h3 { font-size: 27px; }
  .feature-image { min-height: 260px; box-shadow: 8px 8px 0 #d7e6de; }
  .book-card { padding: 18px; }
  .tabs { overflow-x: auto; }
  .tabs button { flex: 0 0 auto; min-height: 44px; }
  .cta-actions .button { width: 100%; max-width: 340px; }
  footer .shell { display: block; }

  /* Careers has a separate header, not the homepage hamburger. */
  body:has(.hiring-form) header .shell { height: auto; min-height: 68px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  body:has(.hiring-form) header .links {
    display: flex !important; position: static !important; order: 3;
    flex-direction: row !important; width: 100%; gap: 16px;
    margin: 0 !important; padding: 8px 0 3px !important;
    white-space: nowrap; overflow-x: auto; box-shadow: none !important;
    scrollbar-width: thin; font-size: 12px;
  }
  body:has(.hiring-form) header .links a { flex: 0 0 auto; min-height: 32px; }
  body:has(.hiring-form) header .links .button { padding: 7px 10px; min-height: 32px; font-size: 12px; }

  /* Detail pages retain a compact, horizontal service selector on phones. */
  body[data-page="commercial"] header .wrap,
  body[data-page="residential"] header .wrap,
  body[data-page="why"] header .wrap { flex-wrap: wrap; gap: 8px 12px; padding: 8px 16px; }
  body[data-page="commercial"] header nav,
  body[data-page="residential"] header nav,
  body[data-page="why"] header .nav {
    display: flex; order: 3; width: 100%; margin: 0;
    gap: 17px; overflow-x: auto; white-space: nowrap;
    padding: 6px 0 4px; font-size: 12px;
  }
  body[data-page="commercial"] header .btn,
  body[data-page="residential"] header .btn { margin-left: auto !important; padding: 9px 10px; font-size: 11px; }
  body[data-page="why"] header .nav .btn { padding: 7px 10px; }
  body[data-page="commercial"] .intro,
  body[data-page="residential"] .intro,
  body[data-page="why"] .intro { padding: 34px 18px; }
  body[data-page="commercial"] .intro h1,
  body[data-page="residential"] .intro h1,
  body[data-page="why"] .intro h1 { font-size: clamp(32px, 9vw, 42px); }
  body[data-page="commercial"] .layout,
  body[data-page="residential"] .layout,
  body[data-page="why"] .layout { padding: 16px 12px 50px; }
  body[data-page="commercial"] .layout,
  body[data-page="residential"] .layout { display: block; }
  body[data-page="commercial"] aside,
  body[data-page="residential"] aside {
    position: sticky; top: var(--detail-header-height, 112px); z-index: 9; display: flex;
    width: 100%; max-height: 125px; overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-inline: contain; scrollbar-width: thin;
    border-radius: 10px; margin-bottom: 15px; padding: 0 4px;
  }
  body[data-page="commercial"] aside .group,
  body[data-page="residential"] aside .group {
    display: flex; align-items: center; flex: 0 0 auto; min-width: 0;
    white-space: normal; border-right: 1px solid #dfe7e3;
  }
  body[data-page="commercial"] aside .group h2,
  body[data-page="residential"] aside .group h2 {
    width: 90px; flex: 0 0 90px; padding: 8px; font-size: 9px;
  }
  body[data-page="commercial"] aside .item,
  body[data-page="residential"] aside .item {
    display: flex; flex: 0 0 105px; width: 105px; min-width: 105px;
    max-width: 105px; height: 112px; padding: 7px; gap: 5px;
    white-space: normal; font-size: 11px; line-height: 1.2;
  }
  body[data-page="commercial"] aside .item img,
  body[data-page="residential"] aside .item img {
    width: 100%; height: 55px; flex: 0 0 55px; object-fit: cover;
  }
  body[data-page="commercial"] .content,
  body[data-page="residential"] .content { scroll-margin-top: calc(var(--detail-header-height, 112px) + 140px); }
  body[data-page="commercial"] .main-image,
  body[data-page="residential"] .main-image { width: calc(100% - 24px); height: auto; aspect-ratio: 16 / 9; margin-top: 12px; }
  body[data-page="commercial"] .detail-grid,
  body[data-page="residential"] .detail-grid { grid-template-columns: 1fr; gap: 12px; }
  body[data-page="commercial"] .gallery-grid,
  body[data-page="residential"] .gallery-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }

  body[data-page="why"] aside {
    position: sticky; top: var(--detail-header-height, 112px); z-index: 9; padding: 6px;
    margin-bottom: 14px; max-height: 65px; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin; border-radius: 10px;
  }
  body[data-page="why"] .item {
    min-width: max-content; min-height: 50px; width: auto;
    padding: 10px 12px; font-size: 12px; white-space: nowrap;
  }
  body[data-page="why"] .content #feature { height: 235px !important; max-height: 235px !important; }
  body[data-page="why"]:has(.item[data-i="0"].active) .content #feature {
    height: 235px !important; max-height: 235px !important; object-fit: contain !important;
  }
  body[data-page="why"] .content .inner { padding: 22px 18px; }
  body[data-page="why"] .four-landscape { padding: 10px; }
  body[data-page="why"] .system-step { padding: 16px 14px; }
}
