/* The site header and menu (templates/includes/header.html, nav_links.html; behaviour in static/js/nav.js).
   Wide screens (1200px and up): one 48px bar. Each group's list drops down on hover, on keyboard focus, or from
   its arrow button. Narrower: name, search button and menu button; search and the menu each open as a panel
   under the bar (through :target without JavaScript, through a class with it).
   Other pages stick things under the bar at top: 48px, so the bar stays 48px tall wherever it is sticky. */

.global-nav {
  --nav-ink: #0b1220;
  --nav-gold: #c9a96a;
  --nav-gold-soft: #e6d3a8;
  --nav-line: rgba(255, 255, 255, 0.12);
  --nav-mute: #a4acbb;
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0 18px;
  min-height: 48px;
  padding: 0 22px;
  background: rgba(11, 18, 32, 0.94);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(201, 169, 106, 0.28);
  color: #fff;
}
.global-nav a { text-decoration: none; }
.global-nav a:focus-visible, .global-nav button:focus-visible, .global-nav input:focus-visible {
  outline: 2px solid var(--nav-gold-soft);
  outline-offset: 2px;
}

.wordmark {
  flex: 0 0 auto;
  color: #fff;
  font-family: var(--lux-serif, Georgia, serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}
.wordmark:hover { color: var(--nav-gold-soft); text-decoration: none; }

/* The bar's two buttons: only below 1200px. */
.nav-buttons { display: none; }
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.nav-button svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.nav-button:hover { color: var(--nav-gold-soft); text-decoration: none; }
.nav-button__cross { display: none; }
.nav-button[aria-expanded="true"] .nav-button__bars { display: none; }
.nav-button[aria-expanded="true"] .nav-button__cross { display: inline; }
.nav-button[aria-expanded="true"] { color: var(--nav-gold-soft); }
.nav-panel__close { display: none; }

/* The menu */
.nav-list, .nav-sub ul { margin: 0; padding: 0; list-style: none; }
.nav-top {
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}
.nav-top:hover { text-decoration: none; }
.nav-caret {
  width: 18px;
  min-height: 0;
  height: 24px;
  margin-left: 1px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--nav-mute);
  cursor: pointer;
}
.nav-caret::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: -3px auto 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.nav-caret:hover { background: none; color: var(--nav-gold-soft); }
.nav-sub a { display: block; color: #fff; }
.nav-sub a small { display: block; color: var(--nav-mute); font-size: 12px; font-weight: 400; letter-spacing: 0; line-height: 1.4; }
.nav-sub a:hover { text-decoration: none; }

/* Search box */
.global-nav .site-search input {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 13px;
}
.global-nav .site-search input::placeholder { color: rgba(255, 255, 255, 0.7); }
.global-nav .site-search input:focus { border-color: rgba(201, 169, 106, 0.7); }

/* Account side */
.nav-tools { display: flex; align-items: center; gap: 14px; }
.nav-tools .text-button {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.nav-tools .text-button:hover, .nav-tools .text-button[aria-current] { color: var(--nav-gold-soft); text-decoration: none; }
.nav-tools .nav-cta {
  padding: 5px 13px;
  border: 1px solid var(--nav-gold);
  background: var(--nav-gold);
  color: var(--nav-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-tools .nav-cta:hover { background: var(--nav-gold-soft); border-color: var(--nav-gold-soft); color: var(--nav-ink); text-decoration: none; }

/* ---------- Wide screens: one bar with drop-downs ---------- */
@media (min-width: 1200px) {
  .nav-panel { display: contents; }
  .global-links { flex: 1 1 auto; min-width: 0; order: 1; align-self: stretch; }
  .global-nav .site-search { order: 2; flex: 0 0 auto; }
  .nav-tools { order: 3; flex: 0 0 auto; }
  .global-nav .site-search input { width: 118px; }
  .global-nav .site-search input:focus { width: 190px; }

  .nav-list { display: flex; justify-content: safe center; gap: 0 clamp(8px, 1.15vw, 20px); height: 100%; }
  .nav-group { position: relative; display: flex; align-items: center; }
  .nav-top { position: relative; padding: 6px 0; opacity: 0.9; }
  .nav-top::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: var(--nav-gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
  }
  .nav-group:hover .nav-top, .nav-group:focus-within .nav-top, .nav-top[aria-current] { opacity: 1; }
  .nav-group:hover .nav-top::after, .nav-group:focus-within .nav-top::after, .nav-top[aria-current]::after { transform: scaleX(1); }

  .nav-sub {
    position: absolute;
    top: 100%;
    left: -22px;
    z-index: 31;
    width: 320px;
    padding: 10px;
    background: var(--nav-ink);
    border: 1px solid var(--nav-line);
    border-top: 2px solid var(--nav-gold);
    box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.6);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
  }
  .nav-sub--wide { width: 560px; }
  .nav-sub--wide ul { display: grid; grid-template-columns: 1fr 1fr; }
  .nav-group--end .nav-sub { left: auto; right: -22px; }
  .nav-group:hover .nav-sub,
  .nav-group:focus-within .nav-sub,
  .nav-group.is-open .nav-sub {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }
  /* Escape (nav.js) closes a list that hover or focus would otherwise hold open. */
  .global-nav.nav-shut .nav-sub { visibility: hidden; opacity: 0; }
  .nav-group.is-open .nav-caret::before, .nav-group:hover .nav-caret::before { margin-top: 1px; transform: rotate(-135deg); }
  .nav-sub a { padding: 9px 12px; font-size: 14px; font-weight: 600; line-height: 1.3; }
  .nav-sub a small { margin-top: 2px; }
  .nav-sub a:hover, .nav-sub a:focus-visible { background: rgba(255, 255, 255, 0.07); color: var(--nav-gold-soft); }
}
/* Up to 1440px there is no room for Contact and Enquire in the bar; both are in the footer. */
@media (min-width: 1200px) and (max-width: 1439px) {
  .global-nav { padding: 0 16px; gap: 0 14px; }
  .wordmark { font-size: 21px; }
  .nav-list { gap: 0 clamp(6px, 0.9vw, 14px); }
  .nav-tools { gap: 10px; }
  .nav-tools .nav-cta { padding: 5px 10px; letter-spacing: 0.08em; }
  .global-nav .site-search input { width: 92px; }
  .nav-tools [data-open-dialog], .nav-tools .text-button[href$="/contact/"] { display: none; }
}
@media (min-width: 1200px) and (max-width: 1299px) {
  .nav-top { font-size: 12px; }
  .global-nav .site-search input { width: 78px; }
}

/* ---------- Below 1200px: a bar with two buttons, and panels under it ---------- */
@media (max-width: 1199px) {
  .global-nav { flex-wrap: wrap; padding: 0 8px 0 16px; }
  .wordmark { margin-right: auto; }
  .nav-buttons { display: flex; align-items: center; gap: 2px; }

  .nav-panel, .global-nav .site-search { display: none; flex: 1 1 100%; }
  .nav-panel:target, .global-nav.menu-open .nav-panel,
  .global-nav .site-search:target, .global-nav.search-open .site-search { display: block; }

  .global-nav .site-search { padding: 4px 8px 14px 0; }
  .global-nav .site-search input, .global-nav .site-search input:focus { width: 100%; height: 44px; font-size: 16px; }
  .global-nav .site-search__list { left: 0; right: 8px; width: auto; }

  .nav-panel {
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin: 0 -8px 0 -16px;
    padding: 0 16px 28px;
    border-top: 1px solid var(--nav-line);
  }
  .nav-group { display: grid; grid-template-columns: minmax(0, 1fr); padding: 16px 0 14px; border-bottom: 1px solid var(--nav-line); }
  .nav-top {
    justify-self: start;
    padding: 4px 0;
    font-family: var(--lux-serif, Georgia, serif);
    font-size: 25px;
    font-weight: 500;
    line-height: 1.15;
  }
  .nav-top::after { content: "\2192"; margin-left: 10px; color: var(--nav-gold); font-family: inherit; font-size: 18px; }
  .nav-top[aria-current] { color: var(--nav-gold-soft); }
  .nav-caret { display: none; }
  .nav-sub ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; margin-top: 4px; }
  .nav-sub a { padding: 10px 0; font-size: 15px; line-height: 1.3; color: #dfe3ea; }
  .nav-sub a small { display: none; }
  .nav-sub a:hover { color: var(--nav-gold-soft); }

  .nav-tools { flex-wrap: wrap; gap: 14px 20px; padding-top: 22px; }
  .nav-tools .text-button, .nav-tools .nav-account { font-size: 14px; }
  .nav-tools .nav-cta { flex: 1 1 100%; padding: 14px 16px; font-size: 12px; text-align: center; }
  .nav-panel__close { display: inline-block; margin-top: 22px; color: var(--nav-mute); font-size: 13px; text-decoration: underline; }
}
@media (min-width: 735px) and (max-width: 1199px) {
  .nav-sub ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .nav-list { display: grid; grid-template-columns: minmax(0, 1fr); }
}
/* Phones: a 60px bar that scrolls away with the page, as the header did before. */
@media (max-width: 734px) {
  .global-nav { position: relative; min-height: 60px; }
  .wordmark { font-size: 24px; }
  .nav-panel { max-height: none; overflow: visible; }
  .nav-button__word { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-sub, .nav-top::after { transition: none; }
}
@media print {
  .nav-buttons, .nav-panel, .global-nav .site-search { display: none !important; }
}
