/* ═══════════════════════════════════════════════════════════
   FinoMind — Mobile Navigation (mobile-nav.css)
   At 900px and below the desktop #notch pill is replaced by a
   fixed white bar: logo on the left, hamburger on the right,
   and a dropdown menu. Classes are prefixed fm-mobile- / fm-menu-
   so they work on pages with or without css/variables.css.
   ═══════════════════════════════════════════════════════════ */

.fm-mobile-header,
.fm-menu-backdrop {
  display: none;
}

@media (max-width: 900px) {
  /* ── Desktop pill is replaced by the mobile bar ── */
  #notch {
    display: none;
  }

  /* Keep in-page anchors (#cta, #services) clear of the fixed bar */
  html {
    scroll-padding-top: 76px;
  }

  /* Hero starts below the bar (64px bar + 12px gap), so its rounded
     top corners stay visible and the old pill clearance isn't needed */
  #hero {
    margin-top: 76px;
  }

  #hero-content {
    padding-top: 40px;
  }

  /* ── Bar ── */
  .fm-mobile-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 900;
    display: block;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  }

  .fm-mobile-header,
  .fm-mobile-header * {
    box-sizing: border-box;
  }

  .fm-bar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 10px 0 16px;
    background: #fff;
    box-shadow: 0 2px 14px rgba(10, 22, 40, 0.12);
  }

  .fm-mobile-logo {
    display: block;
    line-height: 0;
    border-radius: 6px;
  }

  .fm-mobile-logo img {
    display: block;
    width: auto;
    height: 52px;
  }

  /* ── Hamburger button ── */
  .fm-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #1A5276;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .2s ease;
  }

  .fm-menu-btn:hover {
    background: #E0F7FC;
  }

  .fm-menu-icon {
    position: relative;
    display: block;
    width: 22px;
    height: 16px;
  }

  .fm-menu-icon span {
    position: absolute;
    left: 0;
    display: block;
    width: 100%;
    height: 2.5px;
    border-radius: 2px;
    background: currentColor;
    transition: top .25s ease, transform .25s ease, opacity .2s ease;
  }

  .fm-menu-icon span:nth-child(1) { top: 0; }
  .fm-menu-icon span:nth-child(2) { top: 6.75px; }
  .fm-menu-icon span:nth-child(3) { top: 13.5px; }

  .fm-menu-open .fm-menu-icon span:nth-child(1) {
    top: 6.75px;
    transform: rotate(45deg);
  }

  .fm-menu-open .fm-menu-icon span:nth-child(2) {
    opacity: 0;
  }

  .fm-menu-open .fm-menu-icon span:nth-child(3) {
    top: 6.75px;
    transform: rotate(-45deg);
  }

  /* ── Dropdown menu ── */
  .fm-mobile-menu {
    position: absolute;
    top: 64px;
    right: 0;
    left: 0;
    z-index: 1;
    display: none;
    max-height: calc(100vh - 64px);
    max-height: calc(100dvh - 64px);
    padding: 8px 12px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 18px 40px rgba(10, 22, 40, 0.25);
  }

  .fm-mobile-header.fm-menu-open .fm-mobile-menu {
    display: block;
    animation: fm-menu-drop .25s cubic-bezier(.16, 1, .3, 1) both;
  }

  .fm-mobile-link {
    display: block;
    padding: 0 14px;
    font-size: 16px;
    font-weight: 600;
    line-height: 52px;
    color: #2C3E50;
    text-decoration: none;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    transition: background .2s ease, color .2s ease;
  }

  .fm-mobile-link + .fm-mobile-link {
    margin-top: 2px;
  }

  .fm-mobile-link:hover {
    color: #007B9E;
    background: rgba(0, 123, 158, 0.06);
  }

  .fm-mobile-link.active {
    color: #007B9E;
    background: rgba(0, 123, 158, 0.08);
  }

  .fm-menu-btn:focus-visible,
  .fm-mobile-logo:focus-visible,
  .fm-mobile-link:focus-visible {
    outline: 3px solid rgba(0, 174, 239, .55);
    outline-offset: 2px;
  }

  /* ── Dim behind the open menu ── */
  .fm-menu-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 899;
    display: block;
    background: rgba(10, 22, 40, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility 0s linear .25s;
  }

  .fm-menu-backdrop.fm-menu-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s ease;
  }
}

@keyframes fm-menu-drop {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: none; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .fm-menu-btn,
  .fm-menu-icon span,
  .fm-mobile-link,
  .fm-menu-backdrop {
    transition: none !important;
  }

  .fm-mobile-header.fm-menu-open .fm-mobile-menu {
    animation: none !important;
  }
}
