/* =========================================================================
   THE NAV. ONE COMPONENT, EVERY PAGE.

   This file plus assets/nav.js are the whole nav. Both pages load both, so
   the bar looks the same, sits the same, and fills its ring on scroll the same.

   The layout is Antimetal's (antimetal.com, studied 2026-10-12, Liam: "i
   really like how they did their nav bar"): three separate glass pills
   floating over the page, the links on the left, the wordmark in the middle,
   Book a call on the right. The middle pill hugs the wordmark and fills as
   the page scrolls: a line traces its outline with a glowing dot on the end
   (two-suns-nav.js draws it). Their glass is light on a cream page; ours is the same
   build in dark, on our ground.

   The pills are the nav's own shape. The rest of the site keeps --r.

   Tokens are read with fallbacks, because the homepage export defines a
   smaller token set than assets/site.css does.
   ========================================================================= */

.nav{
  position:fixed;top:0;left:0;right:0;z-index:60;
  display:flex;justify-content:center;
  padding:20px var(--gutter,32px) 0;
  pointer-events:none;                 /* the band is not clickable */
}

.nav-in{
  position:relative;
  width:100%;max-width:var(--shell,1320px);height:48px;
  display:flex;align-items:center;justify-content:space-between;gap:16px;
}
/* only the pills take the pointer, so the gaps between them click through */
.nav-in > *{pointer-events:auto}

/* ---- the glass. One recipe for all three pills (and the phone's button and
   panel): a dark tint, a blur that lifts what passes under it, a hairline
   that is bright at the top left and fades out, and a faint sheen. ---- */
.mark,.nav-links,.nav-cta,.nav-menu{
  position:relative;isolation:isolate;
  border-radius:999px;
  background:rgba(30,28,26,.52);
  -webkit-backdrop-filter:blur(14px) saturate(160%) brightness(1.08);
  backdrop-filter:blur(14px) saturate(160%) brightness(1.08);
  box-shadow:inset 0 0 12px rgba(0,0,0,.28),0 10px 30px -14px rgba(0,0,0,.7);
}
/* over the paper band (Services, the one light section) the half-clear glass turns grey and the
   links vanish, so it takes more tint there. assets/stack.js sets html.nav-on-paper while the
   band sits under the nav. */
html.nav-on-paper :is(.mark,.nav-links,.nav-cta,.nav-menu){background:rgba(22,21,20,.86);transition:background var(--dur-1)}

/* Firefox redraws a backdrop blur, and everything under it, on every frame the page moves:
   with the three glass pills over the page it dropped frames on every scroll (Liam, October
   25, 2026: "glitchy and jittery"). In his Firefox the case studies hub's slowest frames went
   from 16.6ms to 9.3ms with the blur off, Collabstr's from 24.9ms to 9.2ms. Firefox gets the
   same pills at the paper band's deeper tint, with no blur; Chrome and Safari keep the glass. */
@supports (-moz-appearance:none){
  .mark,.nav-links,.nav-cta,.nav-menu{-webkit-backdrop-filter:none;backdrop-filter:none;background:rgba(22,21,20,.86)}
}

.mark::before,.nav-links::before,.nav-cta::before,.nav-menu::before{
  content:"";position:absolute;inset:0;border-radius:inherit;padding:1px;pointer-events:none;
  background:linear-gradient(122deg,rgba(237,233,225,.5) 0%,rgba(237,233,225,.14) 40%,rgba(237,233,225,.03) 78%);
  -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,linear-gradient(#000 0 0);
  mask-composite:exclude;
}
.mark::after,.nav-links::after,.nav-cta::after,.nav-menu::after{
  content:"";position:absolute;inset:0;border-radius:inherit;pointer-events:none;z-index:-1;
  background:linear-gradient(122deg,rgba(237,233,225,.07) 0%,rgba(237,233,225,0) 44%);
}

/* ---- the wordmark, the middle pill ---- */
.mark{
  position:absolute;left:50%;top:0;transform:translateX(-50%);
  display:flex;align-items:center;justify-content:center;
  height:48px;padding:0 22px;width:var(--mark-fit,auto);
  transition:width var(--dur-2) cubic-bezier(.65,0,.35,1);
  font-family:var(--font-mono,'Geist Mono',monospace);
  font-size:var(--t-6,clamp(16px,1.55vw,21px));font-weight:500;
  letter-spacing:-.02em;color:var(--ink,#EDE9E1);white-space:nowrap;
}
.mark i{font-style:italic}

/* the reading-progress ring on the pill's outline. two-suns-nav.js sets the path, the
   dash offset and the dot's place from the scroll position */
.nav-ring{
  position:absolute;left:0;top:0;height:100%;overflow:visible;pointer-events:none;
  opacity:0;transition:opacity var(--dur-2) cubic-bezier(.65,0,.35,1);
}
.nav-ring.is-on{opacity:1}
/* the bottom of the page: the pill opens out to its full width around the
   wordmark and the ring goes, as Antimetal's does; two-suns-nav.js measures both widths */
.mark.is-full{width:var(--mark-full,auto)}
.mark.is-full .nav-ring{opacity:0;transition-duration: var(--dur-2)}
.mark.is-returning .nav-ring{transition-delay:.55s}
.nav-ring-line{fill:none;stroke:var(--ink,#EDE9E1);stroke-width:1.5;stroke-linecap:round;stroke-dasharray:1}
.nav-ring-dot{fill:var(--ink,#EDE9E1)}

/* ---- the links, the left pill ---- */
.nav-links{display:flex;align-items:center;gap:2px;padding:5px}
.nav-links a{
  position:relative;z-index:1;
  display:inline-flex;align-items:center;height:38px;padding:0 15px;border-radius:999px;
  font-family:var(--font-mono,'Geist Mono',monospace);
  font-size:var(--t-label,11px);font-weight:500;
  letter-spacing:.18em;text-transform:uppercase;color:var(--quiet,#8C8579);
  transition:color var(--dur-1);
}
.nav-links a:hover{color:var(--ink,#EDE9E1)}
.nav-links a[aria-current]{color:var(--ink,#EDE9E1);background:rgba(237,233,225,0.07)}

/* the hover chip. two-suns-nav.js puts one in and slides it under whichever link the
   pointer is on, instead of each link lighting its own ground */
.nav-hl{
  position:absolute;left:0;top:5px;height:38px;width:0;border-radius:999px;
  background:rgba(237,233,225,0.08);opacity:0;pointer-events:none;
  transition:transform var(--dur-2) cubic-bezier(.22,1,.36,1),width var(--dur-2) cubic-bezier(.22,1,.36,1),opacity var(--dur-1) ease;
}

/* the rolling label. two stacked copies, the second rides up on hover. */
.vx-roll-in{position:relative;display:inline-flex;overflow:hidden}
.vx-roll-in .vx-a,.vx-roll-in .vx-b{display:inline-flex;transition:transform var(--dur-2) cubic-bezier(.19,1,.22,1)}
.vx-roll-in .vx-b{position:absolute;inset:0;transform:translateY(110%);color:var(--ink,#EDE9E1)}
.vx-roll:hover .vx-a{transform:translateY(-110%)}
.vx-roll:hover .vx-b{transform:translateY(0)}

/* ---- Book a call, the right pill ---- */
.nav-cta{display:flex;align-items:center;padding:5px}

/* ---- The site's buttons: Brackets (Liam, October 24, 2026: "Go with D, Brackets. Put it on
   every button on the homepage", picked from _scratch/button-options.html). They live here
   because this is the stylesheet every page loads, and .book was already the filled button on
   every page. One type style, Geist Mono 500 capitals; 52px in a section, 40px with .sm:
     .book   filled, wearing the [66th] wordmark's brackets, which step apart on hover
     .frame  no fill and no rim, only the wordmark's four corners, which run along the
             edges on hover and close into a frame
   On a pointer coming in, two-suns-nav.js runs the label through other characters for about a third
   of a second before it settles. A phone gets the press, which is all a thumb can feel. ---- */
@property --frame-t{syntax:'<length-percentage>';inherits:false;initial-value:9px}
.book,.frame{
  position:relative;box-sizing:border-box;flex:none;
  display:inline-flex;align-items:center;justify-content:center;
  height:52px;padding:0 22px;white-space:nowrap;cursor:pointer;
  font-family:var(--font-mono,'Geist Mono',monospace);
  font-size:var(--t-label,11px);font-weight:500;line-height:1;
  letter-spacing:.16em;text-transform:uppercase;
  -webkit-tap-highlight-color:transparent;
}
.book.sm,.frame.sm{height:40px;padding:0 16px}
.book:active,.frame:active{scale:.965}

.book{
  border:0;border-radius:var(--r-sm,4px);
  background:var(--ink,#EDE9E1);color:var(--bg-a,#121110);
  transition:background var(--dur-2) var(--ease,cubic-bezier(.22,1,.36,1)),scale var(--dur-1) var(--ease,cubic-bezier(.22,1,.36,1));
}
/* the colour is restated on hover because a page's own a:hover rule outranks .book (two-suns-home.css has one) */
.book:hover{background:var(--ink-hi,#FFFFFF);color:var(--bg-a,#121110)}
/* every page's markup still carries an arrow after the label; the brackets are the move now */
.book > span{display:none}
.book::before,.book::after{font-size:14px;letter-spacing:0;transition:transform var(--dur-2) var(--ease,cubic-bezier(.22,1,.36,1))}
.book::before{content:"[";margin-right:8px}
.book::after{content:"]";margin-left:6px}   /* 6, not 8: the last letter's tracking adds the other 2 */
.book:hover::before{transform:translateX(-9px)}
.book:hover::after{transform:translateX(9px)}
.book.sm:hover::before,.nav .book:hover::before{transform:translateX(-6px)}
.book.sm:hover::after,.nav .book:hover::after{transform:translateX(6px)}
/* in the bar it takes the pill's shape */
.nav-cta .book{height:38px;padding:0 16px;border-radius:999px}

.frame{
  --c:rgba(237,233,225,.55);
  color:var(--ink,#EDE9E1);border:0;border-radius:0;
  background-color:rgba(18,17,16,.35);
  background-image:linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),
                   linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c)),linear-gradient(var(--c),var(--c));
  background-repeat:no-repeat;
  background-position:left top,left top,right top,right top,left bottom,left bottom,right bottom,right bottom;
  background-size:var(--frame-t) 1px,1px var(--frame-t),var(--frame-t) 1px,1px var(--frame-t),
                  var(--frame-t) 1px,1px var(--frame-t),var(--frame-t) 1px,1px var(--frame-t);
  transition:--frame-t var(--dur-2) var(--ease,cubic-bezier(.22,1,.36,1)),background-color var(--dur-2) var(--ease,cubic-bezier(.22,1,.36,1)),scale var(--dur-1) var(--ease,cubic-bezier(.22,1,.36,1));
}
.frame:hover{--frame-t:51%;background-color:rgba(237,233,225,.05);color:var(--ink,#EDE9E1)}
/* on a phone a long label ("Read the Maple Terroir case study") wraps inside its button
   instead of running past the card; a short one keeps its line and its height */
@media(max-width:480px){
  .book,.frame{max-width:100%;height:auto;min-height:52px;padding-top:14px;padding-bottom:14px;white-space:normal;line-height:1.4;text-align:center}
  .book.sm,.frame.sm{min-height:40px;padding-top:9px;padding-bottom:9px}
}

/* The phone's way into the links. Hidden above the breakpoint, because the
   links are in the bar there. two-suns-nav.js puts this button in, so it lands on every
   page from one file and no page carries its own copy. */
.nav-menu{
  display:none;flex:none;margin-left:auto;
  align-items:center;justify-content:center;width:52px;height:48px;padding:0;
  border:0;color:var(--ink,#EDE9E1);cursor:pointer;
}
.nav-menu svg{display:block}

/* Below this width the links do not fit beside the wordmark (two-suns-nav.js MENU_AT
   carries the same number). It was 1024px, Antimetal's switch point, until Case
   studies made four links on October 24, 2026: they need 453px, and under 1120px
   the last one ran under the centred wordmark. They become
   a panel the menu button drops, built from the SAME markup, so
   partials/sync.py stays the one source of the links and nothing can drift. */
@media(max-width:1120px){
  .nav-in{height:48px}
  /* on a phone the wordmark leads on the left and the button sits right */
  .nav-in .mark{position:relative;left:auto;transform:none}
  .nav-links{
    position:absolute;right:0;top:calc(100% + 10px);width:min(100%,380px);
    flex-direction:column;align-items:stretch;gap:0;padding:8px;
    border-radius:24px;
    background:rgba(24,22,21,.86);
    opacity:0;visibility:hidden;transform:translateY(-8px);
    transition:opacity var(--dur-2) ease,transform var(--dur-2) cubic-bezier(.22,1,.36,1),visibility 0s .35s;
  }
  .nav-in[data-menu-open] .nav-links{
    opacity:1;visibility:visible;transform:none;transition-delay:0s,0s,0s;
  }
  /* 52px so a thumb lands on the link and not between two of them */
  .nav-links a{height:52px;padding:0 18px;color:var(--ink,#EDE9E1)}
  .nav-hl{display:none}
  .nav-menu{display:inline-flex}
  /* two-suns-nav.js moves Book a call in here, so it is the panel's last row and the bar
     carries the wordmark and the menu button and nothing else */
  .nav-cta{display:none}
  .nav-links .book{
    height:52px;margin:6px 0 0;padding:0 20px;justify-content:space-between;
    border-radius:999px;color:var(--bg-a,#121110);
  }
  .nav-links .book:hover{background:var(--ink,#EDE9E1)}
}

/* a phone's band sits tighter to the glass */
@media(max-width:720px){.nav{padding:14px 16px 0}}

/* only where a pointer can actually leave: on a phone the hover state sticks
   after a tap and leaves the icon dimmed */
@media(hover:hover){.nav-menu:hover{color:var(--ink-hi,#FFFFFF)}}

@media(prefers-reduced-motion:reduce){
  .mark,.nav-ring,.nav-hl,.vx-roll-in .vx-a,.vx-roll-in .vx-b,.nav-links{transition:none}
  .book::before,.book::after{transform:none !important}
  .frame{transition:background-color var(--dur-1)}
}
