/* ============================================================
   NAV  .site-header / .nav
   Floating frosted pill fixed at the top of the viewport.
   Desktop: name + anchor links + "Book a Call".
   ≤991px: short name + menu toggle + "Book a Call"; the links
   drop down as a column of pills when the menu is open.
   ============================================================ */

.site-header {
  position: fixed;
  top: 12px;
  left: 17px;
  right: 17px;
  z-index: 50;
}

/* ---- Liquid glass ----
   How Apple's material is imitated (layers, back to front):
   1. Frost: low tint + light blur + boosted saturation, so what
      scrolls underneath stays colourful instead of turning grey.
   2. Refraction (Chrome/Edge only): js/modules/liquid-glass.js
      adds .has-refraction and an SVG displacement filter that
      bends the backdrop at the rounded edges like a lens.
      Safari/Firefox can't run SVG filters on backdrops, so they
      keep the frost + rim, which is the look on iPhone.
   3. Rim (::before): a 1.5px ring that is NOT the same all
      round, lit as if from the top-left:
      - top edge: a bright specular line
      - bottom edge: a faint, thinner line (the far side of the glass)
      - the rounded ends: where the top and bottom lines bend
        into each other, a glint sits on the upper-left cap and a
        softer one on the lower-right cap (the two "hot spots" of
        a capsule lit from above-left)
      The layers are sized in px, not %, so a 1400px-wide bar
      lights the same way as a short one (a diagonal % gradient
      on a wide bar would only fade left→right).
   4. Depth (box-shadow): light pooling under the top edge, a
      faint shade above the bottom edge (thickness), a hairline +
      soft shadow outside so the pill reads on a white page.
   5. Sheen (::after): faint highlight across the upper-left.
   Tweak the custom properties below. */
.nav {
  --glass-tint: rgb(255 255 255 / 0.38);
  --glass-blur: 10px;
  --glass-saturate: 190%;
  --glass-brightness: 1.06;
  --glass-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) brightness(var(--glass-brightness));

  position: relative;
  isolation: isolate;               /* keeps the ::before/::after layers between the glass and the content */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 1.4rem;
  border: 1px solid transparent;    /* space for the rim (::before), same size as the old border */
  border-radius: var(--radius-pill);
  background-color: var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow:
    inset 0 12px 16px -14px rgb(255 255 255 / 0.9),   /* light pooling just under the top edge */
    inset 0 -12px 16px -14px rgb(0 0 0 / 0.07),       /* faint shade above the bottom edge: glass thickness */
    0 0 0 0.5px rgb(0 0 0 / 0.07),                    /* hairline so the edge reads on white */
    0 2px 6px rgb(0 0 0 / 0.05),
    0 10px 30px rgb(0 0 0 / 0.08);                    /* soft lift off the page */
}

/* Rim: drawn only in a thin ring (mask trick: full box minus
   content box = just the border). Layers, top to bottom:
   cap glints → top/bottom edge lines → dim base so the sides
   still read on white. Tweak --rim-* below. */
.nav::before {
  --rim-width: 1.5px;
  --rim-top: rgb(255 255 255 / 0.95);        /* top specular line */
  --rim-bottom: rgb(255 255 255 / 0.5);      /* bottom line, weaker */
  --rim-base: rgb(0 0 0 / 0.07);             /* where the light doesn't reach */
  --glint-size: 44px 28px;                   /* size of the hot spots on the rounded ends */

  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  padding: var(--rim-width);
  border-radius: inherit;
  background:
    /* glint on the upper-left cap, where the top line curves down */
    radial-gradient(var(--glint-size) at 16px 22%, rgb(255 255 255 / 1), transparent 100%),
    /* softer glint on the lower-right cap, where the bottom line curves up */
    radial-gradient(var(--glint-size) at calc(100% - 16px) 80%, rgb(255 255 255 / 0.8), transparent 100%),
    /* top line brightest towards the left (closer to the light) */
    linear-gradient(90deg, rgb(255 255 255 / 0.5), transparent 45%) top / 100% 50% no-repeat,
    /* top line → dim middle of the ends → bottom line */
    linear-gradient(180deg, var(--rim-top) 0%, rgb(255 255 255 / 0.25) 32%, var(--rim-base) 50%, var(--rim-base) 68%, var(--rim-bottom) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* Sheen: soft light on the upper-left of the glass (px-sized so
   it stays a local highlight on a wide bar) */
.nav::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background:
    radial-gradient(320px 70px at 80px 0, rgb(255 255 255 / 0.5), transparent 70%),
    linear-gradient(180deg, rgb(255 255 255 / 0.2), transparent 55%);
  pointer-events: none;
}

/* Chrome/Edge: refraction filter first, then the frost.
   The filter itself (#nav-glass-filter) is built by liquid-glass.js. */
.nav.has-refraction {
  backdrop-filter: url(#nav-glass-filter) var(--glass-filter);
}

/* Users who asked the OS for less transparency get a solid bar */
@media (prefers-reduced-transparency: reduce) {
  .nav,
  .nav.has-refraction {
    background-color: var(--color-white);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.nav__start {
  display: flex;
  align-items: center;
}

/* ---- Brand ---- */
.nav__brand {
  margin-right: 2rem;
  color: var(--color-text);
  font-family: var(--font-brand);
  font-size: 1.2rem;
  line-height: 114%;
  letter-spacing: 0.04rem;
}

.nav__brand-short {
  display: none;
}

/* ---- Links ---- */
.nav__menu {
  display: flex;
  gap: 11px;
}

.nav__item {
  display: flex;
  flex-direction: column;
}

.nav__link {
  display: block;
  padding-right: 9px;
  border-right: 1px solid var(--color-black);
  color: var(--color-black);
  font-size: 1.1rem;
  font-weight: var(--fw-light);
  line-height: 115%;
  letter-spacing: 0.04rem;
}

.nav__item:last-child .nav__link {
  border-right: 0;
}

/* underline that grows from the left on hover */
.nav__link::after {
  content: "";
  display: block;
  width: 88%;
  height: 1px;
  background-color: var(--color-black);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration) var(--ease-out-quart);
}

.nav__link:hover::after,
.nav__link:focus-visible::after {
  transform: scaleX(1);
}

/* ---- Menu toggle (hidden on desktop) ---- */
.nav__toggle {
  display: none;
  position: relative;
  width: 50px;
  height: 40px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* three-bar icon that morphs into an X
   Tweak size here: --bar-w (length), --bar-h (thickness), --bar-gap (distance between bars) */
.nav__toggle {
  --bar-w: 26px;
  --bar-h: 2.5px;
  --bar-gap: 8px;
}

.nav__toggle-bars,
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  position: absolute;
  left: 50%;
  width: var(--bar-w);
  height: var(--bar-h);
  margin-left: calc(var(--bar-w) / -2);
  border-radius: var(--bar-h);
  background-color: var(--color-black);
  transition: transform 300ms var(--ease-in-out), background-color 150ms ease;
}

.nav__toggle-bars {
  top: 50%;
  margin-top: calc(var(--bar-h) / -2);
}

.nav__toggle-bars::before,
.nav__toggle-bars::after {
  content: "";
  left: 0;
  margin-left: 0;
}

.nav__toggle-bars::before { transform: translateY(calc(var(--bar-gap) * -1)); }
.nav__toggle-bars::after  { transform: translateY(var(--bar-gap)); }

.nav.is-open .nav__toggle-bars { background-color: transparent; }
.nav.is-open .nav__toggle-bars::before { transform: rotate(45deg); }
.nav.is-open .nav__toggle-bars::after  { transform: rotate(-45deg); }

/* ============ Tablet and below ============ */
@media (max-width: 991px) {
  .nav {
    padding-block: 5px;   /* breathing room above/below the Book a Call pill */
  }

  .nav__start {
    flex: 1;
    justify-content: space-between;
  }

  .nav__brand {
    min-width: 19vw;
    margin-right: 0;
    font-family: var(--font-sans);
    font-weight: var(--fw-medium);
  }

  .nav__brand-full { display: none; }
  .nav__brand-short { display: inline; }

  .nav__toggle {
    display: block;
    height: 36px;         /* same height as the Book a Call pill, so the bar hugs both evenly */
    margin-inline: auto;
  }

  /* links: column of pills under the bar, right-aligned.
     padding-top (not `top`) makes the gap below the bar, so the
     reveal line sits right at the bar's bottom edge */
  .nav__menu {
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    align-items: flex-end;
    gap: 24px;
    padding-top: 16px;
  }

  /* ---- Slide-down reveal (same idea as Webflow's default navbar) ----
     Closed: the menu is shifted up by its own height and clipped by
     the same amount, so it is hidden "behind" the bar. Opening slides
     it down while the clip opens at the same rate: the top clip edge
     stays fixed under the bar and the pills glide out from beneath it.
     Only applies with JS (without JS the menu is simply shown).
     Tweak: --menu-open / --menu-close durations, --menu-ease. */
  .js .nav__menu {
    --menu-open: 600ms;
    --menu-close: 400ms;
    --menu-ease: cubic-bezier(0.22, 1, 0.36, 1); /* ease-out-quint: fast start, silky stop */
    visibility: hidden;
    transform: translateY(-100%);
    clip-path: inset(100% 0 0 0);
    transition:
      transform var(--menu-close) var(--menu-ease),
      clip-path var(--menu-close) var(--menu-ease),
      visibility 0s linear var(--menu-close);  /* hide only after sliding up */
  }

  .js .nav.is-open .nav__menu {
    visibility: visible;
    transform: translateY(0);
    clip-path: inset(0);
    transition:
      transform var(--menu-open) var(--menu-ease),
      clip-path var(--menu-open) var(--menu-ease),
      visibility 0s;
  }

  .nav__link,
  .nav__item:last-child .nav__link {
    padding: 11px 58px;
    border: 1px solid var(--color-black);
    border-radius: 20rem;
    background-color: #ffffffde;
    font-weight: var(--fw-semibold);
  }

  .nav__link::after {
    display: none;
  }

  .nav__cta {
    flex: none;
  }
}

@media (max-width: 767px) {
  .nav__menu {
    gap: 16px;
  }

  .nav__cta {
    padding-inline: 0.7rem 0.5rem;
  }

  .site-header {
    left: 10px;
    right: 10px;
  }

  /* 5px above/below the Book a Call pill, 7px to its right: the pill
     sits evenly inside the rounded end of the bar */
  .nav {
    padding: 5px 7px 5px 17px;
  }

  .nav__brand {
    letter-spacing: 0.05rem;
  }

  .nav__toggle {
    width: 40px;
  }

  .nav__link,
  .nav__item:last-child .nav__link {
    padding: 12px 1.8rem;
  }

  /* optical centring: the label's lowercase letters make it read 1px low */
  .nav__cta .btn__label {
    position: relative;
    top: -1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .js .nav__menu,
  .js .nav.is-open .nav__menu,
  .nav__toggle-bars,
  .nav__toggle-bars::before,
  .nav__toggle-bars::after {
    transition: none;
  }
}
