/* =============================================================
   sa-mobile-nav.css
   Single-hamburger mobile navigation for stevenabbott.co.uk
   -------------------------------------------------------------
   - Affects PHONES ONLY. Laptops and tablets are untouched.
   - The two existing .nav-banner bars are hidden on phones and
     replaced by one sticky hamburger that opens a single drawer
     containing the Main Menu and (on section pages) the section
     menu. The drawer is built by sa-mobile-nav.js from the menus
     already on the page, so nothing here needs editing per page.
   - Progressive enhancement: the legacy bars are only hidden when
     JavaScript is present (html.sa-mnav-js), so if JS is disabled
     the site behaves exactly as it does today.

   ONE KNOB:
     The breakpoint below is 768px (phones; typical tablets and up
     keep the current desktop menus). Change every occurrence of
     "768px" in this file if you want a different cut-off.
   ============================================================= */

:root {
  --sa-mnav-bg:          #005599;            /* drawer + bar background (matches dark Main bar) */
  --sa-mnav-bg-section:  #4d4d4d;            /* section heading band   (matches grey section bar) */
  --sa-mnav-fg:          #ffffff;
  --sa-mnav-fg-muted:    #c9c9c9;
  --sa-mnav-accent:      #b5121b;            /* focus ring / active — adjust to your brand red */
  --sa-mnav-line:        rgba(255, 255, 255, 0.14);
  --sa-mnav-sub-bg:      rgba(255, 255, 255, 0.045);
  --sa-mnav-drawer-w:    340px;
}

/* Hidden by default (laptop / tablet): only the original bars show. */
.sa-mnav-bar,
.sa-mnav-drawer,
.sa-mnav-overlay { display: none; }

@media (max-width: 768px) {

  /* 1 ── Hide the two stacked legacy bars (only when JS is active),
          so the app/content sits right at the top of the page. */
  html.sa-mnav-js .nav-banner { display: none !important; }

  /* 2 ── Sticky compact bar holding the single hamburger. */
  .sa-mnav-bar {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--sa-mnav-bg);
    border-bottom: 1px solid var(--sa-mnav-line);
  }
  .sa-mnav-burger {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 0;
    background: transparent;
    color: var(--sa-mnav-fg);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
  }
  .sa-mnav-burger-box {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 16px;
    flex: 0 0 auto;
  }
  .sa-mnav-burger-inner,
  .sa-mnav-burger-inner::before,
  .sa-mnav-burger-inner::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
  }
  .sa-mnav-burger-inner       { top: 50%; transform: translateY(-50%); }
  .sa-mnav-burger-inner::before { top: -7px; }
  .sa-mnav-burger-inner::after  { top:  7px; }
  .sa-mnav-burger-text { font-size: 1rem; letter-spacing: 0.02em; }

  /* 3 ── Dim overlay behind the drawer. Hidden until the drawer is open,
          otherwise it would sit on top of the page and absorb every tap. */
  .sa-mnav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
  }
  body.sa-mnav-open .sa-mnav-overlay { display: block; }

  /* 4 ── The single off-canvas drawer. */
  .sa-mnav-drawer {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; right: 0; bottom: 0;
    z-index: 1002;
    width: min(var(--sa-mnav-drawer-w), 86vw);
    background: var(--sa-mnav-bg);
    color: var(--sa-mnav-fg);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.30);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.sa-mnav-open .sa-mnav-drawer { transform: translateX(0); }
  body.sa-mnav-open { overflow: hidden; }   /* lock background scroll while open */

  .sa-mnav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--sa-mnav-line);
    position: sticky;
    top: 0;
    background: var(--sa-mnav-bg);
  }
  .sa-mnav-title { font-weight: 700; }
  .sa-mnav-close {
    border: 0;
    background: transparent;
    color: var(--sa-mnav-fg);
    font-size: 1.9rem;
    line-height: 1;
    padding: 0 0.25rem;
    cursor: pointer;
  }

  .sa-mnav-drawer-body { padding-bottom: 2rem; }

  /* Section heading band, e.g. "Main Menu", "Adhesion Menu". */
  .sa-mnav-section-title {
    margin: 0;
    padding: 0.6rem 1rem;
    background: var(--sa-mnav-bg-section);
    color: var(--sa-mnav-fg-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }

  .sa-mnav-list,
  .sa-mnav-sub { list-style: none; margin: 0; padding: 0; }
  .sa-mnav-list > li { border-bottom: 1px solid var(--sa-mnav-line); }

  .sa-mnav-list a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--sa-mnav-fg);
    text-decoration: none;
  }
  .sa-mnav-list a:active { background: rgba(255, 255, 255, 0.06); }

  /* A row with a link plus an expand caret. */
  .sa-mnav-row { display: flex; align-items: stretch; }
  .sa-mnav-row > a { flex: 1 1 auto; }
  .sa-mnav-caret {
    flex: 0 0 auto;
    width: 54px;
    border: 0;
    border-left: 1px solid var(--sa-mnav-line);
    background: transparent;
    color: var(--sa-mnav-fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sa-mnav-caret-icon {
    width: 9px; height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
  }
  .sa-mnav-has-children.sa-mnav-expanded > .sa-mnav-row .sa-mnav-caret-icon {
    transform: rotate(225deg) translate(-2px, 0);
  }

  /* Sub-items (the flyout contents, shown as an indented accordion). */
  .sa-mnav-sub { background: var(--sa-mnav-sub-bg); }
  .sa-mnav-sub a {
    padding-left: 1.9rem;
    color: var(--sa-mnav-fg-muted);
    font-size: 0.95rem;
  }
  .sa-mnav-sub > li { border-top: 1px solid rgba(255, 255, 255, 0.06); }

  /* Accessibility floor: visible keyboard focus. */
  .sa-mnav-burger:focus-visible,
  .sa-mnav-close:focus-visible,
  .sa-mnav-caret:focus-visible,
  .sa-mnav-list a:focus-visible {
    outline: 2px solid var(--sa-mnav-accent);
    outline-offset: -2px;
  }
}

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .sa-mnav-drawer,
  .sa-mnav-caret-icon { transition: none; }
}
