/* Keep off-canvas motion and full-bleed sections from creating page-wide side scroll on phones. */
@media (max-width: 760px) {
  html {
    overflow-x: clip;
    overscroll-behavior-x: none;
  }

  body {
    overflow-x: clip !important;
  }
}

/* Keep the article index sticky without letting a tall sidebar cover the reading column. */
@media (max-width: 760px) {
  .mp-article-layout {
    display: flex !important;
    flex-direction: column;
    min-width: 0;
    align-items: stretch !important;
  }

  .mp-article-layout > .mp-article-content {
    align-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .mp-article-aside.mp-article-toc {
    order: -1;
    position: sticky !important;
    z-index: 20;
    top: 66px !important;
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    max-width: 100%;
    height: 52px;
    max-height: 52px;
    margin: 0 0 20px;
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(23, 25, 29, .12);
    border-radius: 12px;
    background: rgba(243, 240, 232, .97);
    box-shadow: 0 8px 24px rgba(23, 25, 29, .06);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    backdrop-filter: blur(12px);
  }

  .mp-article-aside.mp-article-toc::-webkit-scrollbar {
    display: none;
  }

  .mp-article-aside.mp-article-toc > span {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .mp-article-aside.mp-article-toc nav {
    display: flex !important;
    flex: 0 0 auto;
    gap: 7px;
    width: max-content;
    margin: 0 !important;
  }

  .mp-article-aside.mp-article-toc nav a,
  .mp-article-aside.mp-article-toc > a {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(23, 25, 29, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .68);
    color: var(--mp-ink);
    font-size: 10px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
  }

  .mp-article-content {
    min-width: 0;
  }

  .mp-post [id] {
    scroll-margin-top: 132px;
  }
}

@media (max-width: 640px) {
  .quality-story-pin {
    top: 66px;
    height: calc(100svh - 66px);
    min-height: 454px;
  }
}

@media (max-width: 760px) {
  /* Keep the legal destinations visually distinct in the compact footer. */
  .sp-footer-legal {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 12px;
    row-gap: 6px;
  }

  .sp-footer-legal a {
    flex: 0 0 auto;
  }
}

/* Keep the mobile quote action identical on the homepage and inner pages. */
@media (max-width: 760px) {
  .site-header .header-cta {
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 10px !important;
    font-size: 11px !important;
    font-weight: 700;
    line-height: 1 !important;
    white-space: nowrap;
  }

  .site-header .header-cta .header-cta-label {
    font-size: 11px !important;
    line-height: 1.1 !important;
  }

  .site-header .header-cta > span[aria-hidden="true"] {
    flex: 0 0 auto;
    font-size: 15px;
    line-height: 1;
  }

  /* Keep hero text from showing through the open mobile navigation. */
  .site-header .main-nav {
    background: rgba(249, 247, 241, .985) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .site-header .main-nav .nav-dropdown-panel {
    background: rgba(249, 247, 241, .975) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Keep the shared inner-page header within the phone viewport. */
@media (max-width: 760px) {
  .mp-body .site-header {
    box-sizing: border-box !important;
    width: calc(100% - 20px) !important;
    margin-inline: 10px !important;
  }
}


/* Prevent the shared header controls from squeezing together on 320-360px phones. */
@media (max-width: 360px) {
  .site-header {
    gap: 6px !important;
    padding-left: 10px !important;
    padding-right: 8px !important;
  }

  .site-header .brand-logo {
    width: 100px !important;
    max-width: 100px !important;
  }

  .site-header .mobile-menu-toggle {
    box-sizing: border-box !important;
    flex: 0 0 36px !important;
    width: 36px !important;
    height: 36px !important;
    margin: 0 !important;
    padding: 8px !important;
  }

  .site-header .header-cta {
    flex: 0 0 auto !important;
    gap: 4px !important;
    min-width: 0 !important;
    padding-left: 7px !important;
    padding-right: 7px !important;
    font-size: 10px !important;
  }

  .site-header .header-cta .header-cta-label {
    font-size: 10px !important;
  }
}


/* Keep long article titles readable and fully visible on compact phones. */
@media (max-width: 430px) {
  .mp-article-hero h1 {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    font-size: clamp(31px, 9.75vw, 40px) !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}


/* Article reading stays still; keep reveal motion off on every post. */
.mp-post .site-reveal {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
  animation: none !important;
}


/* Let the homepage hero shrink to the phone width instead of inheriting the press scene's intrinsic width. */
@media (max-width: 760px) {
  body:not(.mp-body) .hero {
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
  }

  body:not(.mp-body) .hero > * {
    box-sizing: border-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:not(.mp-body) .hero-copy,
  body:not(.mp-body) .hero-visual,
  body:not(.mp-body) .scene-wrap,
  body:not(.mp-body) .press-card-group,
  body:not(.mp-body) .scene-card,
  body:not(.mp-body) #hero-film {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body:not(.mp-body) .hero-line,
  body:not(.mp-body) .hero-script {
    box-sizing: border-box !important;
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  body:not(.mp-body) .hero-actions {
    width: 100%;
    min-width: 0 !important;
    max-width: 100% !important;
    flex-wrap: wrap;
  }
}

/* Reduce scrolling work on phones: remove the fixed SVG grain texture and lower sticky-header blur. */
@media (max-width: 760px) {
  .page-grain {
    display: none !important;
    background-image: none !important;
  }

  .site-header {
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}


/* Keep the expanded phone menu fully opaque so page copy never shows through it. */
@media (max-width: 760px) {
  .site-header .main-nav,
  .site-header .main-nav .nav-dropdown-panel {
    background: #f9f7f1 !important;
    background-image: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}


/* Keep phones smooth: the SVG turbulence grain sits in a fixed pseudo-element and can repaint during every scroll. */
@media (max-width: 760px) {
  body::before {
    display: none !important;
    background-image: none !important;
  }

  .mp-article-aside.mp-article-toc {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* Mobile entrance reveal: avoid blur repaints while preserving opacity/position motion. */
@media (max-width: 760px) {
  body.intro-complete .eyebrow,
  body.intro-complete .hero-description,
  body.intro-complete .hero-actions,
  body.intro-complete .hero-proof,
  body.intro-complete .press-card-group,
  body.intro-complete .visual-caption,
  body.intro-complete .scroll-cue,
  .site-reveal,
  .capabilities.is-in-view .capabilities-eyebrow,
  .capabilities.is-in-view .capabilities-heading-row,
  .capabilities.is-in-view .capabilities-footer {
    filter: none !important;
  }
}
