/**
 * Smiles To Miles - Public shell authority
 * Shared responsive and accessibility compatibility layer.
 * Public website only: no Admin or CRM selectors.
 */
:root {
  --stm-public-header-clearance: 118px;
  --stm-public-focus-ring: 0 0 0 3px rgba(245, 154, 27, .38);
}

html body.stm-site :is(a, button, input, select, textarea):focus-visible {
  outline: 0 !important;
  box-shadow: var(--stm-public-focus-ring) !important;
}

/* 1280px previously fell just outside the compact-header breakpoint. */
@media (min-width: 1280px) and (max-width: 1365px) {
  html body #stmPublicHeader.stm-header-v4305 {
    top: 10px !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-nav-shell.stm-container {
    width: calc(100% - 24px) !important;
    min-height: 78px !important;
    height: 78px !important;
    grid-template-columns: minmax(270px, 310px) minmax(0, 1fr) 42px max-content !important;
    gap: 9px !important;
    padding: 0 11px !important;
    position: relative !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-brand {
    grid-area: 1 / 1 !important;
    min-width: 0 !important;
    max-width: 310px !important;
    gap: 7px !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-header-logo-shell {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    flex-basis: 52px !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-header-logo-shell img {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-compact-nav {
    grid-area: 1 / 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    justify-self: stretch !important;
    min-width: 0 !important;
    gap: 0 !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-compact-nav > a {
    min-height: 40px !important;
    padding-inline: 5px !important;
    font-size: .59rem !important;
    white-space: nowrap !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-nav-toggle {
    grid-area: 1 / 3 !important;
    display: block !important;
    justify-self: end !important;
    width: 42px !important;
    height: 42px !important;
    margin: 0 !important;
    padding: 8px !important;
    border: 1px solid rgba(255, 255, 255, .11) !important;
    border-radius: 11px !important;
    background: rgba(255, 255, 255, .043) !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-nav-toggle span {
    display: block !important;
    width: 21px !important;
    height: 2px !important;
    margin: 4px auto !important;
    border-radius: 999px !important;
    background: #fff !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-primary-nav {
    position: absolute !important;
    left: 10px !important;
    right: 10px !important;
    top: calc(100% + 9px) !important;
    z-index: 10010 !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: auto !important;
    max-width: none !important;
    max-height: calc(100dvh - 104px) !important;
    overflow: auto !important;
    gap: 2px !important;
    padding: 10px !important;
    border: 1px solid rgba(255, 255, 255, .11) !important;
    border-radius: 16px !important;
    background: linear-gradient(145deg, #3f4045, #24262a) !important;
    box-shadow: 0 24px 62px rgba(18, 18, 20, .3) !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-primary-nav.is-open {
    display: flex !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-primary-nav > a {
    justify-content: flex-start !important;
    min-height: 44px !important;
    padding: 0 11px !important;
    font-size: .68rem !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-nav-actions {
    grid-area: 1 / 4 !important;
    gap: 6px !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-global-search-button {
    display: none !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-nav-quote {
    height: 42px !important;
    min-height: 42px !important;
    padding-inline: 11px !important;
    font-size: .59rem !important;
  }

  html body #stmPublicHeader.stm-header-v4305 .stm-account-button {
    height: 42px !important;
    min-height: 42px !important;
    padding-right: 8px !important;
  }
}

/* The assistant stays above page content but never above a modal or its backdrop. */
html body #stm-ai-chatbot {
  right: max(12px, env(safe-area-inset-right)) !important;
  bottom: max(12px, env(safe-area-inset-bottom)) !important;
  z-index: 1030 !important;
}

html body.modal-open #stm-ai-chatbot {
  visibility: hidden !important;
  pointer-events: none !important;
}

html body #stm-ai-chatbot .stm-chat-panel {
  width: min(430px, calc(100dvw - 24px)) !important;
  height: min(720px, calc(100dvh - 112px)) !important;
  max-height: calc(100dvh - 112px) !important;
  min-height: 0 !important;
  bottom: 72px !important;
  overscroll-behavior: contain;
}

@media (max-width: 575px) {
  :root {
    --stm-public-header-clearance: 88px;
  }

  html body #stm-ai-chatbot .stm-chat-panel {
    width: calc(100dvw - 24px) !important;
    height: calc(100dvh - 96px - env(safe-area-inset-bottom)) !important;
    max-height: calc(100dvh - 96px - env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
    bottom: 64px !important;
    border-radius: 18px !important;
  }

  html body #stm-ai-chatbot :is(.stm-chat-launcher, .stm-chat-close, .stm-chat-input > button),
  html body #stmPublicHeader .stm-nav-toggle,
  html body #stmPublicHeader .stm-account-button {
    min-width: 44px !important;
    min-height: 44px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body.stm-site {
    scroll-behavior: auto !important;
  }
}


/* Home hero laptop controls: keep navigation clear of the reading column. */
@media (min-width: 821px) and (max-width: 1439px) {
  html body.stm-home .stm-hero.stm-central-hero .stm-hero-arrow {
    top: calc(var(--stm-public-header-clearance, 118px) - 10px) !important;
    margin-top: 0 !important;
  }
}
