/* ==========================================================================
   NAV ADDITIONS  (link this AFTER mama2.css and mojo-extras.css)
   1. Fluid sizing so every nav link is fully visible at any width
   2. Hide / show button for laptop, iPad, and landscape-phone views
   ========================================================================== */

:root {
  --nav-full-h: 140px;   /* real value is measured by js/nav-toggle.js */
}

/* ---------- 1. FIT EVERYTHING ---------------------------------------- */

.nav-inner {
  padding: clamp(8px, 1.5vw, 20px);
}

.seal {
  width: clamp(56px, 8vw, 90px);
  height: clamp(56px, 8vw, 90px);
  flex: 0 0 auto;
}

.brand {
  min-width: 0;
}

.brand-title {
  font-size: clamp(11px, 1.3vw, 14px);
}

.brand-title b {
  font-size: clamp(14px, 1.6vw, 18px);
}

/* Links never get cut off: they keep their full text and wrap to a
   second row when there isn't room */
.pill {
  white-space: nowrap;
  font-size: clamp(11px, 1.15vw, 14px);
  letter-spacing: 0.06em;
  padding: clamp(9px, 1.2vw, 13px) clamp(9px, 1.1vw, 14px);
}

@media (min-width: 761px) {
  .nav-links {
    flex: 1 1 0;
    min-width: 0;
    gap: 8px;
  }
}

/* Phone / small screens: brand + menu button on one row,
   the opened menu on its own full-width row underneath */
@media (max-width: 760px) {
  .nav-inner {
    flex-wrap: wrap;
  }

  nav.open .nav-links {
    flex: 1 1 100%;
  }

  /* Opened menu scrolls inside the nav if the screen is too short */
  nav.open .nav-inner {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Short landscape screens (phones on their side): slim the bar down */
@media (max-height: 500px) and (orientation: landscape) {
  nav {
    padding: 4px 10px;
    border-radius: 12px;
  }

  .nav-inner {
    padding: 6px 10px;
  }

  .seal {
    width: 48px;
    height: 48px;
  }

  .brand-title b {
    margin-top: 4px;
  }

  .pill {
    padding: 8px 10px;
  }
}

/* Landscape phone with the hamburger menu open: keep the logo in the flow
   and lay the links out in two columns so they all fit on screen */
@media (max-width: 760px) and (max-height: 500px) {
  nav.open .seal {
    position: relative;
    top: auto;
    left: auto;
    width: 56px;
    height: 56px;
  }

  nav.open .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  nav.open .nav-links .pill {
    padding: 9px 10px;
    font-size: 12px;
  }
}


/* ---------- 2. HIDE / SHOW BUTTON ------------------------------------ */

.nav-hide-btn,
.nav-show-btn {
  display: none;               /* only turned on in the views below */
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(231, 201, 106, .45);
  background: rgba(15, 8, 30, .85);
  color: var(--gold-glow);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 0 14px rgba(231, 201, 106, .2);
}

.nav-hide-btn:hover,
.nav-show-btn:hover {
  border-color: rgba(255, 217, 138, .8);
  box-shadow: 0 0 20px rgba(232, 200, 74, .35);
}

.nav-hide-btn:focus-visible,
.nav-show-btn:focus-visible {
  outline: 3px solid rgba(231, 201, 106, .45);
  outline-offset: 2px;
}

/* Laptop / desktop / iPad (wider than the phone menu breakpoint)
   AND phones held sideways */
@media (min-width: 761px), (orientation: landscape) and (max-height: 500px) {

  /* Small tab sitting in the bottom-centre edge of the nav bar */
  .nav-hide-btn {
    display: inline-flex;
    position: absolute;
    left: 30%;
    bottom: -8px;
    transform: translateX(-50%);
    padding: 6px 14px 12px;
    border-radius: 10px;
    z-index: 2;
  }

  /* Floating tab at the top of the screen while the nav is hidden */
  .nav-show-btn {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    padding: 8px 18px;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
  }

  body.nav-is-hidden .nav-show-btn {
    display: inline-flex;
    opacity: 1;
    pointer-events: auto;
  }

  /* Slide the nav away and pull the page up into its space */
  nav {
    transition:
      transform .35s ease,
      margin-bottom .35s ease,
      opacity .35s ease,
      visibility 0s;
  }

  nav.nav-hidden {
    transform: translateY(-110%);
    margin-bottom: calc(var(--nav-full-h) * -1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      transform .35s ease,
      margin-bottom .35s ease,
      opacity .35s ease,
      visibility 0s linear .35s;
  }

  /* The modal was padded to sit below the nav; with the nav hidden
     it only needs to clear the little "show" tab .modal-backdrop */
  body.nav-is-hidden  {
    padding-top: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  nav,
  nav.nav-hidden,
  .nav-show-btn {
    transition: none;
  }
}
