/* Mobile stability and sizing refinements. Loaded after the main styles. */
html,
body {
  max-width: 100%;
}

img,
svg,
iframe,
video {
  max-width: 100%;
}

@media (max-width: 900px) {
  :root {
    --mobile-header-height: 78px;
  }

  html {
    scroll-padding-top: calc(var(--mobile-header-height) + 16px);
  }

  body {
    overflow-x: hidden;
  }

  .site-frame {
    padding-top: var(--mobile-header-height);
  }

  .site-header {
    position: fixed;
    z-index: 1500;
    top: 0;
    right: 0;
    left: 0;
    width: 100%;
    background: #f8f4ed;
    box-shadow: 0 1px 0 rgba(36, 38, 35, 0.09);
  }

  .nav-shell {
    min-height: var(--mobile-header-height);
  }

  .mobile-nav,
  .mobile-nav summary {
    position: relative;
    z-index: 2;
  }

  .mobile-nav summary {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  .mobile-nav summary:focus-visible {
    outline-offset: 3px;
  }

  .mobile-nav-panel {
    position: fixed;
    z-index: 1;
    top: var(--mobile-header-height);
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 0;
    height: calc(100vh - var(--mobile-header-height));
    height: calc(100dvh - var(--mobile-header-height));
    padding: 24px max(20px, calc(50vw - 380px)) calc(28px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f4ed;
    box-shadow: 0 26px 60px rgba(45, 38, 32, 0.2);
  }

  .mobile-brand-row {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 12px;
    padding-bottom: 12px;
  }

  .mobile-nav-panel nav {
    width: 100%;
    max-width: 520px;
    margin: 0 auto 14px;
  }

  .mobile-nav-panel nav a {
    min-height: 46px;
    padding: 10px 2px;
    font-size: clamp(19px, 5.2vw, 24px);
    line-height: 1.15;
  }

  .mobile-nav-panel > .button {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
    min-height: 54px;
    margin: 0 auto;
    padding: 14px 18px;
    box-sizing: border-box;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
  }

  body.mobile-menu-open {
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  body.mobile-menu-open .mobile-action-bar {
    display: none;
  }

  .anchor-nav {
    top: var(--mobile-header-height);
  }

  .button,
  .mobile-action-bar a,
  .mobile-nav-panel nav a,
  summary {
    touch-action: manipulation;
  }

  input,
  select,
  textarea {
    max-width: 100%;
    font-size: 16px;
  }

  .home-insurance-logo img {
    width: auto;
    max-width: 100%;
    height: 4.75rem;
    max-height: 4.75rem;
    object-fit: contain;
    object-position: center;
  }

  .home-insurance-logo-stacked {
    align-content: center;
    gap: 0.55rem;
  }

  .home-insurance-logo-stacked span {
    color: #1b365d;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
  }
}

@media (max-width: 680px) {
  .section-pad,
  .home-section {
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .nav-logo {
    width: min(190px, calc(100vw - 92px));
  }

  .display-title,
  .interior-title,
  .article-hero h1,
  .legal-hero h1 {
    overflow-wrap: anywhere;
  }

  .home-hero,
  .home-hero-inner {
    min-height: 550px;
    height: auto;
  }

  .home-hero-inner {
    padding-top: 42px;
    padding-bottom: 64px;
  }

  .home-hero h1 {
    max-width: 11ch;
    font-size: clamp(2.45rem, 12vw, 3.6rem);
    line-height: 1;
  }

  .home-hero-points {
    margin-top: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .home-hero-actions {
    margin-top: 1.35rem;
  }

  .home-doctor-grid,
  .home-contact-grid {
    gap: 2.25rem;
  }

  .home-doctor-photo,
  .home-doctor-photo img {
    min-height: 24rem;
  }

  .home-doctor-photo img {
    max-height: 27rem;
  }

  .home-map iframe,
  .local-map,
  .local-map iframe,
  .map-embed,
  .map-embed iframe {
    min-height: 340px;
    height: 340px;
  }

  .home-contact-form,
  .contact-form,
  .form-confirmation {
    padding: 24px 20px;
  }

  .form-grid,
  .form-row {
    min-width: 0;
  }

  .care-detail-copy h2 {
    font-size: clamp(38px, 12vw, 48px);
  }

  .band-cta,
  .closing-cta {
    width: calc(100vw - 32px);
    margin-right: auto;
    margin-left: auto;
  }

  .band-cta {
    padding: 48px 24px;
  }

  .closing-cta {
    min-height: 0;
    padding: 52px 24px;
  }

  .closing-copy h2 {
    font-size: clamp(40px, 12vw, 48px);
  }

  .mobile-action-bar {
    z-index: 1400;
    height: calc(68px + env(safe-area-inset-bottom));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 460px) {
  :root {
    --shell: calc(100vw - 28px);
  }

  .nav-logo {
    width: min(174px, calc(100vw - 88px));
  }

  .mobile-nav summary {
    width: 44px;
    height: 44px;
  }

  .mobile-nav-panel {
    padding-top: 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .mobile-brand-row img {
    width: 46px;
    height: 46px;
  }

  .mobile-nav-panel nav a {
    min-height: 44px;
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: clamp(18px, 5.4vw, 21px);
  }

  .home-hero-actions {
    grid-template-columns: 1fr;
  }

  .home-hero-actions .button {
    width: 100%;
  }

  .home-insurance-grid {
    gap: 0.7rem;
  }

  .home-insurance-logo {
    min-height: 6rem;
    padding: 0.65rem;
  }

  .home-insurance-logo img {
    height: 4rem;
    max-height: 4rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-brand,
  .footer-contact {
    grid-column: auto;
  }

  .contact-methods > * {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .contact-methods strong {
    overflow-wrap: anywhere;
  }

  .legal-contact a,
  .footer-phone,
  .contact-final > a {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 360px) {
  .home-insurance-grid {
    grid-template-columns: 1fr;
  }

  .mobile-nav-panel {
    padding-right: 16px;
    padding-left: 16px;
  }
}
