/* nav.css — the site navigation, on every public page (2026-10-02).
 *
 * Brand sheet step 1: one nav everywhere. The markup is navHtml() in
 * src/layouts/Nav.tsx; Layout.tsx, static.tsx and hubs.tsx all render it.
 * The services panel's own look is mega.css; this file is the bar, the
 * dropdown mechanics, the Resources panel and the phone switch.
 *
 * Every selector starts at #nav, and the file loads after every page
 * stylesheet, so it wins over main.css's old indigo pill, home.css's copy
 * (now removed), and whatever a legacy page stylesheet still says. It sets
 * every property those set, ::after included, so nothing leaks through.
 *
 * No :root, reset, body{} or element selector outside #nav: safe beside a
 * legacy page stylesheet (the bar in CLAUDE.md). Colours are the brand
 * tokens in tokens.css.
 */

@property --nav-hue {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@keyframes navDiffract { to { --nav-hue: 360deg; } }

/* ── The pill ─────────────────────────────────────────────────────── */
#nav {
  position: fixed;
  top: 16px;
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  width: max-content;
  height: auto;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 6px 6px 6px 20px;
  border: 0;
  border-radius: 100px;
  isolation: isolate;
  font-family: var(--sw-text);
  /* home.css's body values, set here so every family gets the same bar
     height. Links and the button inherit them; a tighter line-height took
     8px off the bar (Alwaz: "you shortened the height"). */
  font-size: 1rem;
  line-height: 1.75;
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(52px) saturate(200%) brightness(1.2);
  -webkit-backdrop-filter: blur(52px) saturate(200%) brightness(1.2);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(255, 255, 255, 0.12);
  --nav-hue: 0deg;
  animation: navDiffract 9s linear infinite;
  transition: transform 0.4s cubic-bezier(.22, 1, .36, 1), box-shadow 0.35s ease, background 0.3s ease;
}
#nav::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(
    from var(--nav-hue),
    rgba(217, 119, 6, .85) 0%,
    rgba(245, 158, 11, .95) 14%,
    rgba(251, 191, 36, .65) 24%,
    rgba(255, 255, 255, .95) 29%,
    rgba(253, 230, 138, .55) 37%,
    rgba(217, 119, 6, .75) 50%,
    rgba(245, 158, 11, .85) 63%,
    rgba(255, 255, 255, .65) 70%,
    rgba(251, 191, 36, .75) 80%,
    rgba(217, 119, 6, .85) 92%,
    rgba(245, 158, 11, .95) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  /* The rotating ring on dark sections. --nav-hue is registered with
     inherits: false, so the animation has to run on ::before itself;
     animating #nav does nothing to the ring. */
  animation: navDiffract 9s linear infinite;
  pointer-events: none;
  z-index: -1;
}
#nav::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 35%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}
/* Slide away on scroll-down (Layout.tsx adds .nav-hidden on phones). */
#nav.nav-hidden { transform: translateX(-50%) translateY(calc(-100% - 24px)); }

/* Over a light section (navTheme.ts measures and sets .nav-light). */
#nav.nav-light {
  background: rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(48px) saturate(160%) brightness(0.97);
  -webkit-backdrop-filter: blur(48px) saturate(160%) brightness(0.97);
  border: 0;
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.1),
    0 1px 4px rgba(0, 0, 0, 0.07),
    inset 0 1px 0 rgba(0, 0, 0, 0.05),
    0 0 0 0.5px rgba(0, 0, 0, 0.1);
  animation: none;
}
#nav.nav-light::before { background: rgba(0, 0, 0, 0.14); animation: none; }
#nav.nav-light::after { background: none; }

/* The shadow under the pill once the page has scrolled (nav.js adds
   .scrolled past 20px). These are the exact values main.js used to set
   inline before 2026-10-02, and like that inline style it applies over
   light sections too: Alwaz asked for it back by name. Declared after
   .nav-light so it wins at equal specificity. */
#nav.scrolled {
  box-shadow:
    0 16px 60px rgba(0, 0, 0, 0.65),
    0 4px 16px rgba(0, 0, 0, 0.45),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.17),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 0 0 0.5px rgba(255, 255, 255, 0.08);
}


/* ── Logo ─────────────────────────────────────────────────────────── */
#nav .nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  text-decoration: none;
  color: #FFFFFF;
  font: inherit;
  white-space: nowrap;
}
#nav .logo-mark { display: block; width: 32px; height: 32px; flex: none; }
#nav .logo-rect { fill: #FFFFFF; stroke: none; transition: fill 0.3s ease; }
#nav .logo-text { fill: #0A0A0A; transition: fill 0.3s ease; }
#nav .logo-wordmark {
  display: none;
  font-family: var(--sw-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  -webkit-text-fill-color: currentColor;
}
#nav.nav-light .nav-logo,
#nav.nav-light .logo-wordmark { color: #0A0A0A; }
#nav.nav-light .logo-rect { fill: #0A0A0A; }
#nav.nav-light .logo-text { fill: #FFFFFF; }

/* ── Links ────────────────────────────────────────────────────────── */
#nav .nav-center {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
#nav .nav-item,
#nav .has-dropdown { position: relative; margin: 0; padding: 0; list-style: none; }
#nav .nav-item > a,
#nav .nav-item > button {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0.5rem 0.9rem;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--sw-text);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
#nav .nav-item > a:hover,
#nav .nav-item > button:hover,
#nav .nav-item > a.active,
#nav .nav-item > button.active { color: #FFFFFF; }
#nav.nav-light .nav-item > a,
#nav.nav-light .nav-item > button { color: rgba(0, 0, 0, 0.6); }
#nav.nav-light .nav-item > a:hover,
#nav.nav-light .nav-item > button:hover,
#nav.nav-light .nav-item > a.active,
#nav.nav-light .nav-item > button.active { color: rgba(0, 0, 0, 0.92); }
#nav .chevron-icon { width: 12px; height: 12px; opacity: 0.5; transition: transform 0.2s; }
#nav .nav-item.open > button .chevron-icon { transform: rotate(180deg); }

/* ── The booking button ───────────────────────────────────────────
   The gradient and the amber glow are the live nav's, kept on purpose.
   Step 1 shipped a flat --sw-amber pill locally; Alwaz saw it beside the
   live one on 2026-10-02 and kept the live look ("i loved how it is
   currently"). Values are home.css's from before this file existed. */
#nav .nav-right { display: flex; justify-content: flex-end; margin: 0; padding: 0; }
#nav .nav-pill {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 100px;
  background: linear-gradient(135deg, #92400E, #D97706, #F59E0B);
  box-shadow: 0 2px 12px rgba(217, 119, 6, .4);
  color: #FFFFFF;
  font-family: var(--sw-text);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
#nav .nav-pill:hover {
  background: linear-gradient(135deg, #7c3209, #b45309, #d97706);
  color: #FFFFFF;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(217, 119, 6, .5);
}
#nav .nav-pill:focus-visible,
#nav .nav-item > a:focus-visible,
#nav .nav-item > button:focus-visible,
#nav .nav-logo:focus-visible,
#nav .hamburger:focus-visible { outline: 2px solid var(--sw-amber-bright); outline-offset: 3px; }

/* ── Dropdowns ─────────────────────────────────────────────────────
   Opened by nav.js (hover with a close delay, click for touch and
   keyboard). mega.css styles the Services panel itself. */
#nav .nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 1rem);
  left: 50%;
  transform: translateX(-50%);
  max-height: calc(100vh - 7.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  background: #0F0F0F;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--sw-radius);
  padding: 1.5rem;
  z-index: 100;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: navSlideDown 0.2s ease;
  text-align: left;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
#nav .nav-item.open > .nav-dropdown { display: block; }
@keyframes navSlideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  #nav, #nav::before, #nav .nav-dropdown { animation: none; }
}
/* Centred under the PILL, not under the Services item: #nav carries a
   transform, so it is the containing block for this fixed panel. */
#nav .mega-menu { position: fixed; }

/* Resources: three rows, one column. */
#nav .nav-dropdown-small { width: 280px; padding: 0.75rem; }
#nav .nav-dropdown-small .mega-link {
  display: block;
  margin: 0;
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s;
}
#nav .nav-dropdown-small .mega-link:hover { background: rgba(255, 255, 255, 0.06); }
#nav .nav-dropdown-small .mega-link-name {
  display: block;
  font: 500 0.86rem/1.3 var(--sw-display);
  letter-spacing: -0.01em;
  color: rgba(255, 255, 255, 0.85);
}
#nav .nav-dropdown-small .mega-link:hover .mega-link-name { color: #FFFFFF; }
#nav .nav-dropdown-small .mega-link-desc {
  display: block;
  margin-top: 0.1rem;
  font: 400 0.72rem/1.45 var(--sw-text);
  color: rgba(255, 255, 255, 0.5);
}

/* ── Hamburger (opens the phone sheet, MobileMenu.ts) ─────────────── */
#nav .hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 0 0 0 4px;
  padding: 8px;
  border: 0;
  background: none;
  cursor: pointer;
}
#nav .hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: rgba(255, 255, 255, 0.85);
  transition: transform 0.3s cubic-bezier(.22, 1, .36, 1), opacity 0.3s;
  transform-origin: center;
}
#nav.nav-light .hamburger span { background: rgba(0, 0, 0, 0.7); }
#nav .hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
#nav .hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#nav .hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── Widths ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  #nav .mega-menu .mega-link-desc { display: none; }
}
/* 801 to 900: the bar spans the width and tightens, so the iPhone Duo
   open (890) keeps the full nav. Measured: everything fits from 801. */
@media (max-width: 900px) {
  #nav {
    width: calc(100vw - 32px);
    justify-content: space-between;
    gap: 12px;
    padding: 6px 6px 6px 16px;
  }
  #nav .logo-wordmark { display: inline; }
  #nav .nav-item > a,
  #nav .nav-item > button { padding-left: 0.55rem; padding-right: 0.55rem; }
}
/* The phone switch, at 800 not 768 (the Duo, above). */
@media (max-width: 800px) {
  #nav .nav-center,
  #nav .nav-right { display: none; }
  #nav .hamburger { display: flex; margin-left: auto; }
}
@media (max-width: 768px) {
  #nav {
    width: calc(100vw - 24px);
    padding: 5px 5px 5px 14px;
    justify-content: space-between;
  }
  #nav .logo-wordmark { font-size: 0.95rem; }
  #nav .hamburger { padding: 8px 6px; }
}
