/* Localsewa UI-01 / v32.9.22 — Customer/Public container alignment.
   Geometry-only patch. Does not change component design, functionality,
   header interactions, backend, Provider UI, or Admin UI.
   Loaded as the last stylesheet in the public index.html. */

/* Only customer/public pages using the deployed header may inherit these rules. */
#root:has(.ls-public-header) {
  --ls-layout-gutter: 12px;
  --ls-layout-content-max: 100%;
  --ls-layout-outer-max: calc(var(--ls-layout-content-max) + var(--ls-layout-gutter) + var(--ls-layout-gutter));
}

/* Container sizing: header and hero have internal padding; other home sections
   already have external padding, so their direct children do not add a second gutter. */
#root:has(.ls-public-header) .ls-public-header-inner,
#root:has(.ls-public-header) .ls-home-hero-inner {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--ls-layout-outer-max) !important;
  margin-inline: auto !important;
  padding-inline: var(--ls-layout-gutter) !important;
}

#root:has(.ls-public-header) .ls-home-popular,
#root:has(.ls-public-header) .ls-home-emergency,
#root:has(.ls-public-header) .ls-home-nearby {
  box-sizing: border-box;
  width: 100%;
  padding-inline: var(--ls-layout-gutter) !important;
}

#root:has(.ls-public-header) .ls-home-popular > div,
#root:has(.ls-public-header) .ls-home-nearby > div {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--ls-layout-content-max) !important;
  margin-inline: auto !important;
}


/* The small-screen emergency banner was intentionally narrower than the page.
   Preserve its established max-w-xl sizing below tablet width. */
#root:has(.ls-public-header) .ls-home-emergency > div {
  box-sizing: border-box;
  width: 100%;
  margin-inline: auto !important;
}
@media (min-width: 768px) {
  #root:has(.ls-public-header) .ls-home-emergency > div {
    max-width: var(--ls-layout-content-max) !important;
  }
}

/* Shared container fallback for customer subpages (services, bookings, saved).
   Deliberately excludes home/header wrappers whose gutters differ. */
#root:has(.ls-public-header) :is(main, section, header) > .mx-auto.max-w-7xl:not(.ls-public-header-inner):not(.ls-home-hero-inner),
#root:has(.ls-public-header) .ls-profile-layout {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--ls-layout-content-max) !important;
  margin-inline: auto !important;
}

/* Profile shell is one of the few customer pages with a different gutter family. */
#root:has(.ls-public-header) .ls-profile-shell {
  box-sizing: border-box;
  min-width: 0;
  padding-inline: var(--ls-layout-gutter) !important;
}

/* Restrict shrink behavior to documented public layout wrappers; do not clip
   intentional horizontal scroll (carousels/tables) or fixed overlays. */
#root:has(.ls-public-header) :is(
  .ls-public-header-inner, .ls-home-hero-inner, .ls-home-hero-layout,
  .ls-home-popular, .ls-home-emergency, .ls-home-nearby,
  .ls-home-category-grid, .ls-profile-layout
) {
  min-width: 0;
}

@media (min-width: 480px) {
  #root:has(.ls-public-header) { --ls-layout-gutter: 16px; }
}

@media (min-width: 768px) {
  #root:has(.ls-public-header) { --ls-layout-gutter: 24px; }
}

@media (min-width: 1024px) {
  #root:has(.ls-public-header) { --ls-layout-gutter: 28px; --ls-layout-content-max: 1180px; }
}

@media (min-width: 1440px) {
  #root:has(.ls-public-header) { --ls-layout-gutter: 32px; --ls-layout-content-max: 1320px; }
}

@media (min-width: 1920px) {
  #root:has(.ls-public-header) { --ls-layout-gutter: 40px; --ls-layout-content-max: 1440px; }
}

/* Touch-first tablets above 1024px should retain fluid tablet composition;
   do not let large desktop max widths force a desktop layout on iPad-class devices. */
@media (min-width: 1024px) and (max-width: 1439.98px) and (hover: none) and (pointer: coarse) {
  #root:has(.ls-public-header) {
    --ls-layout-gutter: 24px;
    --ls-layout-content-max: 100%;
  }
}
