/* ============================================================
   Shared Nav — used on every page
   Structure: Logo · [Work · Services▾ · About▾ · Contact] · Start a Project
   ============================================================ */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px var(--pad-x);
  background: rgba(17, 17, 17, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav.on-light {
  background: rgba(250, 250, 247, .88);
  border-bottom-color: #d9d3bc;
}
.nav.on-light .nav-logo,
.nav.on-light .nav-logo .logo-anim { color: var(--ink); }
.nav.on-light .nav-wordmark { color: #6a6250; border-left-color: #d9d3bc; }
.nav.on-light .nav-links > li > a,
.nav.on-light .nav-links > li > .nav-link-row > a { color: #4a4331; }
.nav.on-light .nav-links > li > a:hover,
.nav.on-light .nav-links > li > .nav-link-row > a:hover { color: var(--ink); }
.nav.on-light .nav-chev-btn { color: #4a4331; }
.nav.on-light .btn-primary { background: var(--ink); border-color: var(--ink); }
.nav.on-light .btn-primary:hover { background: #000; }
.nav.on-light .nav-burger { color: var(--ink); border-color: #d9d3bc; }

/* Logo -------------------------------------------------- */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  transition: color .3s;
}
.nav-logo .logo-anim {
  height: 40px;
  width: auto;
  color: #fff;
  transition: color .3s;
}
.nav-logo .logo-anim path {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .5s, transform .5s;
}
.nav-logo.lit .logo-anim .lp { opacity: 1; transform: none; transition-delay: .05s; }
.nav-logo.lit .logo-anim .lx { opacity: 1; transform: none; transition-delay: .22s; }
.nav-logo.lit .logo-anim .ll { opacity: 1; transform: none; transition-delay: .38s; }
.nav-logo.lit .logo-anim .ld { opacity: 1; transform: none; transition-delay: .55s; }
.nav-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
  line-height: 1;
}
.nav-wordmark {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
/* PXL game score — hidden until the first pixel is shot.
   Minimal: a small blue pixel-mark + a two-digit count. No label. */
.nav-pxl-score {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--blue);
  margin-top: 3px;
  line-height: 1;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .35s, transform .35s;
}
.nav-pxl-score.is-visible {
  opacity: 1;
  transform: none;
}
.nav-pxl-score__mark {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 1px;
}
.nav-pxl-score__num {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.nav.on-light .nav-pxl-score { color: var(--blue); }

/* Right side ------------------------------------------- */
.nav-right {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  padding: 0; margin: 0;
}
.nav-links > li { position: relative; }
/* Dropdown triggers extend their hit area below so cursor can travel
   down to the menu without leaving the li (prevents dropdown flicker). */
.nav-links > li.has-dropdown { padding-bottom: 18px; margin-bottom: -18px; }
/* Both selectors apply: simple <a> children of <li> (e.g. Work) and
   <a> nested inside <span class="nav-link-row"> (Services, About — the
   chevron lives next to the link in that row so it can be its own
   tappable target). */
.nav-links > li > a,
.nav-links > li > .nav-link-row > a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  color: #d6d6d6;
  transition: color .2s;
  position: relative;
  padding: 4px 0;
}
.nav-links > li > a::after,
.nav-links > li > .nav-link-row > a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s;
}
.nav-links > li > a:hover,
.nav-links > li > .nav-link-row > a:hover { color: #fff; }
.nav-links > li > a:hover::after,
.nav-links > li > .nav-link-row > a:hover::after { transform: scaleX(1); }
.nav-links > li > a.is-active,
.nav-links > li > .nav-link-row > a.is-active { color: #fff; }
.nav-links > li > a.is-active::after,
.nav-links > li > .nav-link-row > a.is-active::after { transform: scaleX(1); }

.nav-chev {
  width: 8px; height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .2s;
  opacity: .7;
  display: inline-block;
}
.nav-links > li:hover .nav-chev,
.nav-links > li.is-open .nav-chev { transform: rotate(225deg) translateY(-2px); opacity: 1; }

/* Link row — wraps the link + chevron button so both stay aligned but
   the chevron is its own tappable target (not navigation). On desktop
   this just behaves like the original inline link. */
.nav-link-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-chev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 4px;
  margin: 0;
  cursor: pointer;
  color: inherit;
}
.nav-chev-btn .nav-chev { display: inline-block; }
.nav-links > li.is-open > .nav-link-row .nav-chev,
.nav-links > li:hover > .nav-link-row .nav-chev { transform: rotate(225deg) translateY(-2px); opacity: 1; }

/* Dropdowns ------------------------------------------- */
.nav-dropdown {
  position: absolute;
  top: 100%;           /* sits right below the padded li; li padding-bottom is the visual gap */
  left: 50%;
  transform: translate(-50%, -6px);
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 20px 40px rgba(0,0,0,.45);
  list-style: none;
  margin: 0;
}
.nav-links > li:hover .nav-dropdown,
.nav-links > li:focus-within .nav-dropdown,
.nav-links > li.is-open .nav-dropdown {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.nav.on-light .nav-dropdown {
  background: #fff;
  border-color: #d9d3bc;
}
.nav.on-light .nav-dropdown a { color: var(--ink); }
.nav.on-light .nav-dropdown a:hover { background: #f5f0dc; }
.nav.on-light .nav-dropdown a small { color: #7a7360; }

.nav-dropdown a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #e7e7e7;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 14px;
  transition: background .18s, color .18s;
}
.nav-dropdown a:hover { background: var(--bg); color: #fff; }
.nav-dropdown a small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 400;
}
.nav-dropdown a .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: 0 0 8px;
}
.nav-dropdown a .dot.blue { background: var(--blue); }
.nav-dropdown a .dot.red { background: var(--red); }
.nav-dropdown a .dot.cream { background: var(--cream); }
.nav-dropdown a .dot.white { background: #fff; }

/* Service icon — small monoline glyph next to dropdown items. */
.nav-dropdown a .svc-ico {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: color .2s, background .2s, border-color .2s;
}
.nav-dropdown a .svc-ico svg { width: 16px; height: 16px; }
.nav-dropdown a .svc-ico.blue  { color: var(--blue);  border-color: rgba(91,90,255,.35);  background: rgba(91,90,255,.08); }
.nav-dropdown a .svc-ico.red   { color: var(--red);   border-color: rgba(232,69,60,.35);  background: rgba(232,69,60,.08); }
.nav-dropdown a .svc-ico.cream { color: var(--cream); border-color: rgba(245,240,220,.30); background: rgba(245,240,220,.05); }
.nav-dropdown a:hover .svc-ico { background: rgba(255,255,255,.10); }
.nav.on-light .nav-dropdown a .svc-ico {
  background: rgba(0,0,0,.04);
  border-color: #d9d3bc;
}
/* Cream is invisible on a cream panel. In the on-light nav, swap the
   AI Product icon's cream tint for ink so it stays legible. The blue
   and red variants already have enough contrast against cream. */
.nav.on-light .nav-dropdown a .svc-ico.cream {
  color: var(--ink);
  background: rgba(15, 15, 15, .04);
  border-color: rgba(15, 15, 15, .2);
}

/* Mobile burger ---------------------------------------
   Three-bar icon that morphs into an × when `.is-open` is on.
   On hover the tile gains a subtle surface tint to signal
   interactivity. */
.nav-burger {
  display: none;
  width: 44px; height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: inherit;
  padding: 0;
  cursor: pointer;
}
.nav-burger:hover { background: rgba(255,255,255,.06); }
.nav.on-light .nav-burger:hover { background: rgba(0,0,0,.05); }
.nav-burger span {
  display: block;
  width: 22px; height: 1.5px;
  background: currentColor;
  transition: transform .3s ease, opacity .2s ease;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Responsive ------------------------------------------ */
@media (max-width: 980px) {
  .nav-wordmark { display: none; }
  .nav-links { gap: 18px; }
  .nav-links > li > a,
  .nav-links > li > .nav-link-row > a { font-size: 13px; }
}

@media (max-width: 820px) {
  /* Burger flush to the right edge. We hide .nav-right entirely on
     closed mobile (instead of just hiding its children) so the
     flex layout collapses to just logo + burger — `space-between`
     then pushes the burger to the right edge cleanly. The .is-open
     rule below re-enables .nav-right as the drawer. The end result
     is that the burger sits in the same horizontal position whether
     the menu is closed (☰) or open (×) — same right padding as
     the rest of the bar. */
  .nav-burger { display: inline-flex; margin-left: auto; }
  .nav-right { display: none; }
  .nav.is-open > .nav-right { display: flex; }
  /* Hide the meta block (wordmark + pxl-score) on mobile — wordmark
     is already display:none from the 980px rule, and the empty meta
     wrapper kept its left border which made the logo feel orphaned. */
  .nav-meta { display: none; }
  /* Ensure the logo SVG stays at its full height when the drawer is
     open, matching desktop. */
  .nav-logo .logo-anim { height: 40px; }
  /* Inside the drawer the desktop CTA + nav-links + icons all show.
     Re-enable each explicitly because the parent .nav-right reset
     above hides them by default. */
  .nav.is-open > .nav-right > .nav-icons { display: flex; }

  /* Drawer opens from under the nav. Full-bleed, section borders,
     big touch targets, service sub-items with svc-ico tiles, and a
     footer CTA + meta line. Same structure as the design-system
     nav preview. */
  .nav.is-open {
    background: var(--surface);
    border-bottom-color: var(--border);
  }
  .nav.on-light.is-open {
    background: #fafaf7;
    border-bottom-color: #d9d3bc;
  }
  .nav.is-open .nav-right {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px var(--pad-x) 28px;
    background: inherit;
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }
  .nav.on-light.is-open .nav-right { border-bottom-color: #d9d3bc; }

  .nav.is-open .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
  }
  /* Each top-level item sits in its own section with a hairline
     divider — bigger touch target, clearer hierarchy. */
  .nav.is-open .nav-links > li {
    border-bottom: 1px solid var(--border);
    padding: 4px 0;
    /* Reset the desktop `.has-dropdown` margin-bottom: -18px (used to
       extend the hover hit-area above the dropdown). On mobile that
       negative margin pulled the divider under Services/About 18px
       higher than under the simpler Work row, making the row spacing
       look uneven. Forcing margin-bottom: 0 here keeps every li the
       same vertical rhythm. */
    margin-bottom: 0;
  }
  .nav.on-light.is-open .nav-links > li { border-bottom-color: #d9d3bc; }
  .nav.is-open .nav-links > li > a {
    padding: 16px 4px;
    font-size: 18px;
    font-weight: 500;
    border-bottom: 0;
    justify-content: space-between;
    width: 100%;
  }
  .nav.is-open .nav-links > li > a::after { display: none; }
  .nav.is-open .nav-links > li .nav-chev {
    width: 10px; height: 10px;
    border-width: 1.5px;
    opacity: .55;
    margin-right: 4px;
  }

  /* Sub-menu (Services / About) nested inside the drawer. Default
     state is COLLAPSED so the user lands on a clean menu with the
     primary CTA visible without scrolling — they expand the section
     they actually want. The chevron button toggles expansion. */
  .nav.is-open .nav-dropdown {
    position: static;
    transform: none;
    box-shadow: none;
    background: transparent;
    border: 0;
    /* Collapsed by default on mobile */
    display: none;
    padding: 4px 0 14px;
    gap: 2px;
  }
  .nav.is-open .nav-links > li.has-dropdown.is-open .nav-dropdown {
    display: flex;
    flex-direction: column;
    opacity: 1;
    pointer-events: auto;
    /* Override the desktop is-open rule which sets
       `transform: translate(-50%, 0)` to centre the dropdown panel.
       Inside the mobile drawer the dropdown should sit flush at left:0
       — without this override the items shift 50% off-screen. */
    transform: none;
  }
  /* Make the chevron a generous tap target — 44px square — and align
     it on the right of the row. */
  .nav.is-open .nav-chev-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
  }
  .nav.is-open .nav-link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .nav.is-open .nav-link-row > a {
    flex: 1 1 auto;
    padding: 16px 4px;
    font-size: 18px;
    font-weight: 500;
  }
  .nav.is-open .nav-dropdown a {
    padding: 12px 4px;
    font-size: 14px;
    border-radius: 8px;
  }

  /* Footer CTA pill + meta line at the bottom of the drawer. Margin
     bumped to match the rhythm between top-level nav items above (the
     About row + the button now have the same breathing space as the
     space between Work, Services and About). */
  .nav.is-open > .nav-right > .btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 36px;
    padding: 18px 22px;
    font-size: 15px;
    border-radius: 999px;
  }
  /* Sign-off line beneath the CTA. Email removed — the email icon in
     the drawer footer rail already covers it; this row keeps just the
     location stamp. */
  .nav.is-open > .nav-right::after {
    content: "London · Working globally";
    display: block;
    text-align: left;
    margin-top: 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .nav.on-light.is-open > .nav-right::after { color: #6a6250; }
}

/* Nav icon rail --------------------------------------------
   Replaces the old "Contact" text link. Email + LinkedIn icons at 18px
   inherit the nav link colour by default and shift to the brand blue
   on hover. Each gets a compact tooltip via data-tooltip. */
.nav-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #d6d6d6;
  border-radius: 10px;
  transition: color .2s, background .2s;
}
.nav-icon svg { width: 18px; height: 18px; display: block; }
.nav-icon:hover { color: var(--blue); background: rgba(91, 90, 255, .08); }
.nav.on-light .nav-icon { color: #4a4331; }
.nav.on-light .nav-icon:hover { color: var(--blue); background: rgba(91, 90, 255, .10); }

/* Tooltip — small bubble sliding in below the icon on hover.
   Uses ::after on the anchor so no extra DOM and a11y stays clean
   (the visible label is already on aria-label). */
.nav-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, -4px);
  padding: 6px 10px;
  background: var(--surface);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 60;
}
.nav-icon:hover::after,
.nav-icon:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.nav.on-light .nav-icon::after {
  background: #fff;
  color: var(--ink);
  border-color: #d9d3bc;
}

@media (max-width: 900px) {
  /* Inside the mobile drawer the icons sit above the CTA in a row. */
  .nav.is-open .nav-icons {
    order: 3;
    width: 100%;
    gap: 10px;
    justify-content: flex-start;
    padding: 8px 0 4px;
  }
  .nav.is-open .nav-icon { width: 42px; height: 42px; border: 1px solid var(--border); }
  .nav.is-open .nav-icon svg { width: 20px; height: 20px; }
  /* Hide tooltip on touch — label is on aria-label already. */
  .nav-icon::after { display: none; }
}
