/* AF-Health v27 - protected frontend regression guardrails.
   This file is intentionally loaded LAST on guest/public pages.

   PROTECTED FIX: Public provider-directory title copy must remain plain text
   beneath the media hero. It must NEVER become a card/panel, regardless of
   frontend theme, dark mode, or Theme Center custom CSS.

   Applies to Doctors, Laboratories, Hospitals, and Pharmacies. Keep this
   selector/component contract when changing public hero/theme styling. */

body[class*="frontend-theme-"]:not(.role-admin)
:is(
  .directory-hero-title-below-doctor,
  .directory-hero-title-below-laboratory,
  .directory-hero-title-below-hospital,
  .directory-hero-title-below-pharmacy
){
  background:transparent !important;
  box-shadow:none !important;
}

body[class*="frontend-theme-"]:not(.role-admin)
:is(
  .directory-hero-title-below-doctor,
  .directory-hero-title-below-laboratory,
  .directory-hero-title-below-hospital,
  .directory-hero-title-below-pharmacy
) .home-hero-title-below-inner{
  border:0 !important;
  border-radius:0 !important;
  outline:0 !important;
  background:transparent !important;
  background-image:none !important;
  box-shadow:none !important;
  -webkit-backdrop-filter:none !important;
  backdrop-filter:none !important;
  clip-path:none !important;
}

body[class*="frontend-theme-"]:not(.role-admin)
:is(
  .directory-hero-title-below-doctor,
  .directory-hero-title-below-laboratory,
  .directory-hero-title-below-hospital,
  .directory-hero-title-below-pharmacy
) .home-hero-title-below-inner::before,
body[class*="frontend-theme-"]:not(.role-admin)
:is(
  .directory-hero-title-below-doctor,
  .directory-hero-title-below-laboratory,
  .directory-hero-title-below-hospital,
  .directory-hero-title-below-pharmacy
) .home-hero-title-below-inner::after{
  content:none !important;
  display:none !important;
  background:none !important;
  box-shadow:none !important;
}

/* --------------------------------------------------------------------------
   PROTECTED FIX: Frontend background continuity (v21)

   The active frontend theme owns one page-level atmosphere/background wash.
   Shared public modules may style their inner panels/cards, but their OUTER
   section wrappers must not repaint the full page width. Repainting a wrapper
   restarts the wash at that section boundary and creates the visible horizontal
   "broken background" band seen on provider directories and other public pages.

   This used to be limited to route-home. The same reusable components are also
   rendered on Doctors, Laboratories, Hospitals, Pharmacies, Online Consultation,
   and authenticated frontend views, so the continuity contract now follows the
   component wherever it is a direct child of the page content root. This is
   deliberately theme-agnostic and applies to every current/future frontend theme
   plus light/dark mode. Inner panel/card backgrounds remain untouched.
   -------------------------------------------------------------------------- */
body[class*="frontend-theme-"]:not(.role-admin)
:is(.public-main,.page-content) > :is(
  .home-flat-slider-shell,
  .home-hero-title-below,
  .home-doctor-specialties,
  .home-provider-finder,
  .provider-directory-managed-html,
  .public-page-managed-html,
  .product-cta
){
  background:transparent !important;
  background-color:transparent !important;
  background-image:none !important;
}

/* Discovery themes expose --finder-section-bg and several themes assign an
   opaque/gradient section wash. When discovery sits at page level, inherit the
   page atmosphere instead; retain all finder panel/card tokens and effects. */
body[class*="frontend-theme-"]:not(.role-admin)
:is(.public-main,.page-content) > .home-doctor-specialties{
  --finder-section-bg:transparent !important;
}

/* --------------------------------------------------------------------------
   PROTECTED FIX: Unified public frontend width scale (v26)

   The hero slider, normal public content, and the complete public header share
   one 1054px maximum-width contract. This supersedes the earlier 1258px header
   maximum, so the header edges align exactly with the hero slider on every
   frontend theme. The same responsive side inset used by the slider is also
   used by the header.

   IMPORTANT: section wrappers remain full width. Only inner content and the
   floating header are narrowed, preserving the v21/v25 continuous page
   atmosphere and sticky-background fixes.
   -------------------------------------------------------------------------- */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin){
  --frontend-v26-content-max:1054px;
}

/* Remove the desktop status pill from the actual public header. The Blade
   markup is also removed; this rule is a regression guard if stale/custom
   header markup reintroduces it later. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-header .public-network-status{
  display:none !important;
}

/* Header width must always match the hero slider's own width expression,
   including tablet/mobile insets. Theme-specific full-width header rules are
   intentionally overridden here because this file loads last. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-header{
  width:min(var(--frontend-v26-content-max),calc(100% - clamp(24px,2.0834vw,32px))) !important;
  max-width:var(--frontend-v26-content-max) !important;
  margin-inline:auto !important;
}

body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-header > .container.public-nav{
  width:100% !important;
  max-width:none !important;
  margin-inline:auto !important;
}

@media (min-width:1100px){
  /* The slider partial historically carried an inline width declaration. Keep
     this explicit matching contract so future theme CSS cannot restore 1240px. */
  body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
  .home-flat-slider-shell > .container.home-flat-slider-frame{
    width:min(var(--frontend-v26-content-max),calc(100% - clamp(24px,2.0834vw,32px))) !important;
    max-width:var(--frontend-v26-content-max) !important;
    margin-inline:auto !important;
  }

  /* Hero title, discovery blocks, directory results, managed HTML, CTAs, and
     all other normal public-main content use the same 1054px content maximum. */
  body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
  .public-main .container{
    width:min(var(--frontend-v26-content-max),calc(100% - clamp(32px,5vw,72px))) !important;
    max-width:var(--frontend-v26-content-max) !important;
    margin-inline:auto !important;
  }
}
/* --------------------------------------------------------------------------
   PROTECTED FIX: One continuous public page atmosphere behind sticky chrome (v25)

   The page wash and decorative atmosphere must use the same viewport canvas
   above and below the sticky trust/header unit. v24 repainted only the wash on
   .public-sticky-shell; that covered the fixed atmosphere shapes/lines and
   produced a hard horizontal seam at the bottom of the header.

   v25 keeps the normal fixed atmosphere as the canonical public background and
   mirrors that exact viewport canvas inside a clipped background-only layer in
   the sticky shell. The mirror sits behind the trust strip and header, so page
   cards cannot bleed through while scrolling, but the user sees one continuous
   theme background with no restart at the sticky-shell boundary.
   -------------------------------------------------------------------------- */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
> .theme-atmosphere:not(.theme-atmosphere--sticky){
  background:var(--theme-page-wash,var(--bg)) !important;
  background-position:center top !important;
  background-repeat:no-repeat !important;
}

body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell{
  background:transparent !important;
  background-image:none !important;
}

body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > .public-sticky-background{
  position:absolute !important;
  inset:0 !important;
  z-index:0 !important;
  overflow:hidden !important;
  pointer-events:none !important;
}

body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > .public-sticky-background > .theme-atmosphere--sticky{
  position:absolute !important;
  top:0 !important;
  right:auto !important;
  bottom:auto !important;
  left:0 !important;
  width:100vw !important;
  height:100vh !important;
  min-height:100vh !important;
  z-index:0 !important;
  background:var(--theme-page-wash,var(--bg)) !important;
  background-position:center top !important;
  background-repeat:no-repeat !important;
  pointer-events:none !important;
}

/* Keep interactive sticky chrome above the clipped background mirror. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > :is(.public-trust-bar,.public-header){
  position:relative !important;
}

/* A dedicated Theme Center trust-strip color remains supported. With no custom
   strip color, Oceanic Pulse and Aether Glass reveal the shared atmosphere. */
body.guest-shell.ui-v2:is(
  .frontend-theme-oceanic_pulse,
  .frontend-theme-aether_glass
):not(.role-admin)
.public-sticky-shell > .public-trust-bar{
  background:var(--theme-trust-bar-bg,transparent) !important;
}

/* --------------------------------------------------------------------------
   PROTECTED FIX: Sticky/background canvas lock (v27)

   v26 correctly kept the v25 atmosphere mirror, but after the public header was
   narrowed to the 1054px hero width, large theme-specific header shadows made
   the bottom of the sticky unit read like a second background band. In addition,
   the sticky mirror and the fixed page atmosphere must always resolve the page
   wash against the same viewport-sized canvas.

   Contract for every public frontend theme:
   - the page atmosphere and sticky mirror paint the exact same viewport wash;
   - the sticky mirror is viewport-aligned even when the header itself is narrow;
   - the sticky shell/trust strip never introduce a second fallback wash;
   - the public-header card may keep its theme surface/border/backdrop, but its
     shadow may not spill far enough to tint the surrounding page background.

   This intentionally preserves v21 section continuity, v25 sticky continuity,
   and the v26 1054px header/hero/content width contract.
   -------------------------------------------------------------------------- */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
> .theme-atmosphere:not(.theme-atmosphere--sticky),
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > .public-sticky-background > .theme-atmosphere--sticky{
  box-sizing:border-box !important;
  width:100vw !important;
  max-width:100vw !important;
  height:100vh !important;
  min-height:100vh !important;
  background:var(--theme-page-wash,var(--bg)) !important;
  background-attachment:fixed !important;
  background-position:center top !important;
  background-repeat:no-repeat !important;
  background-size:100vw 100vh !important;
}

/* The clipping host itself must span the viewport rather than inheriting the
   reduced 1054px header geometry or any future theme/container constraint. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > .public-sticky-background{
  top:0 !important;
  right:auto !important;
  bottom:0 !important;
  left:50% !important;
  width:100vw !important;
  max-width:100vw !important;
  margin-left:-50vw !important;
  transform:none !important;
  background:transparent !important;
  background-image:none !important;
}

/* Never let a theme repaint the sticky shell as a separate page band. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell{
  background:transparent !important;
  background-color:transparent !important;
  background-image:none !important;
}

/* Oceanic/Aether use the shared atmosphere directly. Custom Theme Center
   trust-strip colors remain available through --theme-trust-bar-bg. */
body.guest-shell.ui-v2:is(
  .frontend-theme-oceanic_pulse,
  .frontend-theme-aether_glass
):not(.role-admin)
.public-sticky-shell > .public-trust-bar{
  background:var(--theme-trust-bar-bg,transparent) !important;
  background-image:none !important;
}

/* A 1054px floating header exposes much more background around its edges than
   the old 1258px shell. Huge theme shadows (some reached 70-90px) looked like a
   rectangular background change. Keep depth local to the navigation card so
   the page atmosphere remains visually continuous around it. */
body.guest-shell.ui-v2[class*="frontend-theme-"]:not(.role-admin)
.public-sticky-shell > .public-header{
  box-shadow:0 8px 24px color-mix(in srgb,var(--primary) 7%,transparent) !important;
}

