/* Final mobile QA pass for the six public pages. */
@media (max-width: 767px) {
  body.menu-open,
  body.maiva-site:has(.navlinks.open) {
    overflow: hidden;
  }

  .maiva-site {
    overflow-x: hidden;
  }

  .maiva-site h1,
  .maiva-site h2,
  .maiva-site h3 {
    overflow-wrap: anywhere;
  }

  /* Keep compact CTA headings from inheriting the larger desktop size. */
  .maiva-site.home .home-final-cta h2,
  .maiva-site.learning .learning-final-cta h2,
  .maiva-site.ai .ai-final-cta h2,
  .maiva-site.sources .sources-final-cta h2,
  .maiva-site.about .about-final-cta h2,
  .maiva-site.security .security-cta h2 {
    font-size: 29px;
    line-height: 1.08;
  }

  /* Prevent the full-width learning example from gaining a few stray pixels. */
  .maiva-site.learning .learning-focus-grid,
  .maiva-site.learning .learning-stage,
  .maiva-site.learning .learning-question {
    min-width: 0;
    box-sizing: border-box;
  }

  .maiva-site.learning .learning-stage {
    margin-inline: 0;
  }

  /* Text links should remain easy to tap without turning into extra cards. */
  .maiva-site .text-link,
  .maiva-site .approach-feature a,
  .maiva-site .learning-question footer a,
  .maiva-site .ai-learning-link .btn.secondary,
  .maiva-site.ai .source-paper > a {
    min-height: 40px;
    align-items: center;
  }

  .maiva-site .footer-navigation {
    gap: 2px 12px;
    font-size: 11px;
    line-height: 1.35;
  }

  .maiva-site .footer-navigation a {
    display: flex;
    min-height: 36px;
    align-items: center;
  }

  .maiva-site .copyright {
    font-size: 9px;
    line-height: 1.45;
  }

  /* Mobile navigation: warm editorial panel with a clear MAIVA hierarchy. */
  body.maiva-site.home .site-header,
  body.maiva-site.learning .site-header,
  body.maiva-site.ai .site-header,
  body.maiva-site.sources .site-header,
  body.maiva-site.about .site-header,
  body.maiva-site.security .site-header {
    inset: 0 0 auto;
    width: 100%;
    transform: none;
    z-index: 100;
  }

  body.maiva-site.menu-open .site-header {
    position: fixed;
    background: #fff;
    box-shadow: 0 1px 0 #e0ebf6;
  }

  .maiva-site .menu-btn {
    position: relative;
    z-index: 102;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 0;
    gap: 5px;
    border: 1px solid rgba(131, 169, 209, .26);
    background: radial-gradient(ellipse at 55% 0%, #29486d 0%, #09284d 54%, #04172e 100%);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, .24), 0 7px 18px rgba(6, 31, 61, .18);
    transition: transform .22s ease, box-shadow .22s ease;
  }

  .maiva-site .menu-btn span {
    position: absolute;
    left: 13px;
    width: 18px;
    height: 2px;
    background: #fff;
    transition: transform .24s ease, top .24s ease, opacity .18s ease;
  }

  .maiva-site .menu-btn span:nth-child(1) { top: 15px; }
  .maiva-site .menu-btn span:nth-child(2) { top: 21px; }
  .maiva-site .menu-btn span:nth-child(3) { top: 27px; }
  .maiva-site .menu-btn[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
  .maiva-site .menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .maiva-site .menu-btn[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

  .maiva-site .navlinks.open {
    counter-reset: mobile-navigation;
    position: fixed;
    inset: 78px 0 0;
    z-index: 101;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-height: none;
    margin: 0;
    padding: 25px 20px max(24px, env(safe-area-inset-bottom));
    overflow-y: auto;
    border: 0;
    border-radius: 0;
    background:
      radial-gradient(circle at 88% 16%, rgba(8, 119, 255, .12) 0 4px, transparent 5px),
      radial-gradient(circle at 88% 16%, transparent 0 18px, rgba(8, 119, 255, .09) 19px 20px, transparent 21px),
      linear-gradient(145deg, #fff 0%, #fbfdff 56%, #eff7ff 100%);
    box-shadow: 0 18px 38px rgba(7, 31, 62, .14);
  }

  .maiva-site .mobile-menu-intro {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0 0 19px;
    padding: 0 4px 18px;
    border-bottom: 1px solid #dce9f7;
  }

  .maiva-site .mobile-menu-intro span {
    color: #0877ff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .2em;
    text-transform: uppercase;
  }

  .maiva-site .mobile-menu-intro strong {
    color: #587194;
    font-size: 14px;
    font-weight: 500;
  }

  .maiva-site .navlinks.open > a:not(.mobile-menu-cta) {
    counter-increment: mobile-navigation;
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 20px;
    align-items: center;
    min-height: 60px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #e0ebf6;
    color: #0a2852;
    font-size: 21px;
    font-weight: 720;
    letter-spacing: -.025em;
  }

  .maiva-site .navlinks.open > a:not(.mobile-menu-cta)::before {
    content: "0" counter(mobile-navigation);
    color: #7e95b5;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
  }

  .maiva-site .navlinks.open > a:not(.mobile-menu-cta)::after {
    content: "→";
    color: #0877ff;
    font-size: 19px;
    font-weight: 500;
    text-align: right;
  }

  .maiva-site .navlinks.open > a.active:not(.mobile-menu-cta) {
    margin-inline: -4px;
    padding-inline: 14px;
    border-bottom-color: transparent;
    border-radius: 9px;
    background: #eaf5ff;
    color: #061d42;
    box-shadow: inset 3px 0 #0877ff;
  }

  .maiva-site .navlinks.open > a.active:not(.mobile-menu-cta)::before {
    color: #0877ff;
  }

  .maiva-site .mobile-menu-footer {
    display: grid;
    gap: 14px;
    margin-top: auto;
    padding: 26px 4px 0;
  }

  .maiva-site .mobile-menu-footer p {
    max-width: 260px;
    margin: 0;
    color: #526d92;
    font-size: 14px;
    line-height: 1.45;
  }

  .maiva-site .navlinks.open .mobile-menu-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 12px 17px;
    border-radius: 8px;
    background: radial-gradient(ellipse at 60% 0%, #284160 0%, #06182e 58%, #020d1e 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    box-shadow: inset 0 2px 3px rgba(128, 151, 182, .42), 0 8px 18px rgba(15, 49, 82, .15);
  }
}

@media (min-width: 768px) {
  .mobile-menu-intro,
  .mobile-menu-footer {
    display: none;
  }
}

@media (max-width: 420px) {
  .maiva-site.ai .ai-hero-copy h1 {
    max-width: 335px;
    font-size: clamp(34px, 9.6vw, 38px);
    line-height: 1;
    letter-spacing: -.045em;
    text-wrap: balance;
  }

  /* Bring the key object forward without distorting either source image. */
  .maiva-site.learning .learning-hero-picture > img {
    transform: scale(1.08);
    transform-origin: 72% 50%;
  }

  .maiva-site.ai .ai-hero-picture > img {
    transform: scale(1.06);
    transform-origin: 72% 50%;
  }
}
