/* Shared phone and tablet layer. Loaded last on every page by
   scripts/seo/inject-mobile-nav.mjs, after the inline styles and
   light-theme.css, so rules here have the final word below 900px. */

.nav-burger { display: none; }
.mnav { display: none; }

@media (max-width: 900px) {
  /* ── Top bar: logo left, sign-up and menu button right ── */
  nav { padding-left: 16px !important; padding-right: 8px !important; }
  nav .nav-links, nav .nav-login-hint, nav .nav-cta-free { display: none !important; }
  nav .nav-right, nav .nav-cta { margin-left: auto; flex: 0 0 auto; align-items: center !important; gap: 0; }
  nav .nav-right .btn-primary, nav .nav-cta .btn-primary {
    white-space: nowrap; font-size: 13.5px; line-height: 1; padding: 11px 14px; min-height: 38px;
    display: inline-flex; align-items: center;
  }
  .nav-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; margin-left: 4px; padding: 0; flex: 0 0 auto;
    background: transparent; border: 0; border-radius: 8px; color: #15181C; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-burger:focus-visible { outline: 2px solid #B45309; outline-offset: -2px; }
  .nav-burger svg { width: 22px; height: 22px; display: block; }
  .nav-burger .nb-close { display: none; }
  .nav-burger[aria-expanded="true"] .nb-open { display: none; }
  .nav-burger[aria-expanded="true"] .nb-close { display: block; }

  /* ── Menu panel ── */
  .mnav {
    position: fixed; left: 0; right: 0; bottom: 0; top: 64px; z-index: 99;
    background: #FBFAF7; color: #15181C;
    overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 6px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    font-family: inherit; text-align: left;
  }
  html.mnav-open .mnav { display: block; }
  html.mnav-open, html.mnav-open body { overflow: hidden; }
  .mnav a { text-decoration: none; color: #15181C; }
  .mnav-top, .mnav summary {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 54px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
    border-bottom: 1px solid rgba(20,24,28,0.09); cursor: pointer; list-style: none;
  }
  .mnav summary::-webkit-details-marker { display: none; }
  .mnav summary::after {
    content: ""; width: 9px; height: 9px; margin-right: 4px;
    border-right: 2px solid #59616B; border-bottom: 2px solid #59616B;
    transform: rotate(45deg) translateY(-3px); transition: transform 160ms ease;
  }
  .mnav details[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
  .mnav-group { padding: 6px 0 12px; border-bottom: 1px solid rgba(20,24,28,0.09); }
  .mnav-label {
    font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: #B45309; padding: 14px 0 4px;
  }
  .mnav-group a { display: flex; align-items: center; min-height: 44px; font-size: 15.5px; font-weight: 500; color: #2B3138; }
  .mnav-actions { display: flex; flex-direction: column; gap: 10px; padding-top: 22px; }
  .mnav-actions a {
    display: flex; align-items: center; justify-content: center; min-height: 48px;
    border-radius: 8px; font-size: 15.5px; font-weight: 600;
  }
  .mnav-actions .mnav-signup { background: #FF8C00; color: #15181C; }
  .mnav-actions .mnav-login { border: 1px solid rgba(20,24,28,0.18); background: #fff; }
  @media (prefers-reduced-motion: reduce) { .mnav summary::after { transition: none; } }
}

/* ── Horizontal overflow: nothing may be wider than the screen ── */
@media (max-width: 900px) {
  /* Decorative glows are wider than a phone; clip them to their section. */
  .hero, .zh-hero { overflow-x: clip; }
  .zh-card { overflow: hidden; }
  /* A single-column grid track still grows to its widest child unless the
     child may shrink. This is what let comparison tables widen blog posts. */
  .wp-layout > *, .post-layout > *, .hero-grid > * { min-width: 0; }
  /* Auto side margins make a grid item shrink-to-fit, so cap it to its track. */
  .wp-layout > * { max-width: 100%; box-sizing: border-box; }
  .post-body > table, .legal-wrap table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  code, kbd, .legal-wrap a, .post-body a { overflow-wrap: anywhere; }
  pre { max-width: 100%; overflow-x: auto; }
  img, video, svg, iframe { max-width: 100%; }
}

/* ── Small phones (320 to 480px) ── */
@media (max-width: 480px) {
  /* Three-column comparison tables: tighter cells, and long words may break. */
  .cmp-table th, .cmp-table td { padding: 10px 8px; overflow-wrap: anywhere; }
  /* Goal, KPI and project chips in the narrative editor wrap instead of
     pushing the editor wider than the screen. */
  .ne-chip { white-space: normal; }
  .ne-editor { box-sizing: border-box; }
}

/* ── Spacing and touch targets ── */
@media (max-width: 900px) {
  /* Section intros that sat flush against the screen edge. */
  .fx-narr-head, .how-narr-head { padding-left: 20px; padding-right: 20px; }
  /* Footer and back links: at least 40px tall so a thumb can hit them. */
  .nav-logo { min-height: 44px; }
  .footer-col ul { gap: 0 !important; }
  .footer-col li a { display: inline-flex; align-items: center; min-height: 40px; }
  .footer-bottom a { display: inline-flex; align-items: center; min-height: 40px; }
  .post-back { min-height: 44px; }
  .fs-link, .int-more, .fwm-cap-link { display: inline-flex; align-items: center; min-height: 40px; }
  .wp-toc a, .res-related a, .rel-cta a, .rel-hub a, .help-cats a { min-height: 40px; display: inline-flex; align-items: center; }
  .ne-example-btn, .tmpl-copy { min-height: 36px; }
  .mc-toggle-link, .mc-back-link { min-height: 40px; padding-top: 10px; padding-bottom: 10px; }
}
