/* Phone and tablet menu. Not in the client's template: added because the
   template hides the header links below 760px and wraps them onto 2-3 lines
   between 760px and ~960px. Each page's <header> sets --mnav-accent (its
   button colour) and --mnav-line (its border colour). */

html { scroll-padding-top: 90px; } /* in-page links land below the sticky header */

/* Current page in the desktop menu. The template styles this (.nav .on) on
   five pages; Beeji and the home page are built differently and lack it. */
header .nav a[aria-current="page"] {
  color: var(--mnav-accent, #333333);
  border-bottom: 2px solid var(--mnav-accent, #333333);
}

.mnav-btn { display: none; }
.mnav-cta { display: none !important; }

@media (max-width: 1023px) {
  .mnav-logo { margin-right: auto; }

  .js header .nav { display: none !important; }

  .js .mnav-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: none;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--mnav-line, #dddddd);
    border-radius: 2px;
    background: #fff;
    color: var(--mnav-accent, #333333);
    font: 500 13px/1 'Jost', system-ui, sans-serif;
    letter-spacing: .14em;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mnav-bars,
  .mnav-bars::before,
  .mnav-bars::after {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    transition: transform .2s ease, background-color .2s ease;
  }
  .mnav-bars { position: relative; }
  .mnav-bars::before,
  .mnav-bars::after { content: ""; position: absolute; left: 0; }
  .mnav-bars::before { top: -6px; }
  .mnav-bars::after { top: 6px; }
  .mnav-btn[aria-expanded="true"] .mnav-bars { background-color: transparent; }
  .mnav-btn[aria-expanded="true"] .mnav-bars::before { transform: translateY(6px) rotate(45deg); }
  .mnav-btn[aria-expanded="true"] .mnav-bars::after { transform: translateY(-6px) rotate(-45deg); }

  .js header.mnav-open .nav {
    display: flex !important;
    flex-direction: column;
    gap: 0 !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-bottom: 1px solid var(--mnav-line, #dddddd);
    box-shadow: 0 16px 32px rgba(0, 0, 0, .10);
    font-size: 18px !important;
    font-weight: 500;
  }
  .js header.mnav-open .nav a:not(.mnav-cta) {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 24px;
    border-top: 1px solid var(--mnav-line, #dddddd);
    border-bottom: 0;
  }
  .js header.mnav-open .nav a[aria-current="page"] {
    color: var(--mnav-accent, #333333);
    font-weight: 600;
    box-shadow: inset 4px 0 0 var(--mnav-accent, #333333);
  }

  .mnav-btn:focus-visible,
  .js header.mnav-open .nav a:focus-visible {
    outline: 2px solid var(--mnav-accent, #333333);
    outline-offset: -2px;
  }

  /* Without JavaScript the button can't work, so show the links as a
     wrapped row under the logo instead. */
  html:not(.js) header { position: relative !important; } /* too tall to stick */
  html:not(.js) header > .wrap { flex-wrap: wrap !important; }
  html:not(.js) header .nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px 20px !important;
    order: 5;
    width: 100%;
    padding-bottom: 12px;
  }
}

@media (max-width: 767px) {
  /* The header's booking button moves into the open menu. */
  .js .mnav-cta-desk { display: none !important; }
  .js header.mnav-open .nav .mnav-cta {
    display: flex !important;
    margin: 16px 24px 20px;
  }
  /* The ring is the button's own colour, so draw it outside the button. */
  .js header.mnav-open .nav .mnav-cta:focus-visible { outline-offset: 3px; }
}

@media (max-width: 600px) {
  .mnav-logo { font-size: clamp(22px, 6.4vw, 28px) !important; white-space: nowrap; }
}

@media (max-width: 360px) {
  /* Icon-only button; the word stays for screen readers. */
  .js .mnav-btn { width: 44px; padding: 0; justify-content: center; }
  .mnav-txt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Windows High Contrast drops background colours, which would erase the
   CSS-drawn bars (and leave the icon-only button blank at <=360px). */
@media (forced-colors: active) {
  .mnav-bars,
  .mnav-bars::before,
  .mnav-bars::after { forced-color-adjust: none; background-color: ButtonText; }
  .mnav-btn[aria-expanded="true"] .mnav-bars { background-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .mnav-bars,
  .mnav-bars::before,
  .mnav-bars::after { transition: none; }
}
