/* Header and floating navigation. Palette tokens live in base.css.
   Desktop: wordmark | section links (float as a glass pill once scrolled) | appearance + CV.
   Mobile (≤820px, with JS): wordmark | menu button; header.js moves appearance + CV into the menu panel. */
.site-header{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:16px;height:82px;padding:0 var(--gutter);position:relative;z-index:30;background:var(--paper)}
.wordmark{grid-column:1;justify-self:start;display:inline-flex;align-items:center;min-width:44px;min-height:44px;font-size:22px;font-weight:750;letter-spacing:-.06em}
.wordmark span{color:var(--accent)}
.header-actions{grid-column:3;justify-self:end;display:flex;align-items:center;gap:12px}
.nav-shell{grid-column:2;grid-row:1;justify-self:center;display:flex;align-items:center;justify-content:center;max-width:calc(100vw - 32px);padding:5px 22px;background:var(--paper);border-radius:999px;color:var(--ink);transition:background-color .25s ease,box-shadow .25s ease}
.nav-panel{display:flex;align-items:center}
.nav-shell #site-nav{display:flex;align-items:center;gap:22px;font-size:16px}
.nav-shell #site-nav a{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 2px;color:var(--muted);white-space:nowrap}
.nav-shell #site-nav a:hover,.nav-shell #site-nav a[aria-current]{color:var(--ink)}
.nav-shell #site-nav a[aria-current]{text-decoration:underline;text-underline-offset:7px;text-decoration-thickness:2px;text-decoration-color:var(--accent)}
.nav-extras:empty{display:none}
.menu-toggle{display:none}
.nav-shell :is(a,button):focus-visible,.site-header :is(.wordmark,.header-cv):focus-visible{outline:2px solid var(--accent);outline-offset:3px}

/* Appearance: Auto / Light / Dark segmented slider. The thumb follows html[data-appearance], set by theme-boot.js before paint. */
.appearance-switch{--opt:34px;position:relative;display:inline-flex;flex-shrink:0;padding:3px;border-radius:999px;background:var(--surface)}
.appearance-thumb{position:absolute;top:3px;left:3px;width:var(--opt);height:var(--opt);border-radius:50%;background:var(--ink);transition:transform .25s cubic-bezier(.3,.7,.3,1)}
[data-appearance=light] .appearance-thumb{transform:translateX(100%)}
[data-appearance=dark] .appearance-thumb{transform:translateX(200%)}
.appearance-switch button{position:relative;display:grid;place-items:center;width:var(--opt);height:var(--opt);padding:0;border:0;border-radius:50%;background:none;color:var(--muted);transition:color .25s ease}
.appearance-switch button:hover{color:var(--ink)}
[data-appearance=auto] .appearance-switch button[value=auto],[data-appearance=light] .appearance-switch button[value=light],[data-appearance=dark] .appearance-switch button[value=dark]{color:var(--paper)}
.appearance-switch svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.appearance-switch svg .fill{fill:currentColor}
.appearance-switch button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
html:not([data-appearance]) .appearance-switch{display:none}

/* Floating: the shared glass material (base.css), so content scrolling underneath reads as depth rather than clutter. */
.nav-shell.is-floating{position:fixed;top:max(16px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:max-content;background:var(--glass);box-shadow:inset 0 1px 0 var(--glass-edge),inset 0 0 0 1px var(--glass-rim),var(--glass-lift);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);z-index:40}
.nav-enhanced{scroll-padding-top:var(--nav-anchor-offset,90px)}
.nav-enhanced main>section[id]{scroll-margin-top:0}
#nav-boundary{position:absolute;top:0;left:0;width:1px;height:6px;pointer-events:none;visibility:hidden}
@media(max-width:1040px) and (min-width:821px){.nav-shell #site-nav{gap:16px;font-size:15px}.nav-shell{padding-inline:16px}.header-actions{gap:8px}}

@media(max-width:820px){
  .site-header{height:72px;gap:8px}
  /* Three-line menu button; the lines fold into a cross while the panel is open. */
  .nav-enhanced .site-header{grid-template-columns:minmax(0,1fr) auto}
  .nav-enhanced .nav-shell{grid-column:2;justify-self:end;padding:0;background:none}
  .nav-enhanced .header-actions{display:none}
  .nav-enhanced .menu-toggle{position:relative;display:grid;place-items:center;width:48px;height:48px;padding:0;border:0;border-radius:50%;background:var(--ink);color:var(--paper);transition:background-color .2s ease,color .2s ease}
  .nav-enhanced .menu-toggle:hover,.nav-enhanced .nav-open .menu-toggle{background:var(--accent);color:var(--on-accent)}
  .menu-icon{position:relative;display:block;width:20px;height:14px}
  .menu-icon i{position:absolute;left:0;width:100%;height:2px;border-radius:2px;background:currentColor;transition:transform .25s ease,opacity .2s ease,top .25s ease}
  .menu-icon i:nth-child(1){top:0}.menu-icon i:nth-child(2){top:6px}.menu-icon i:nth-child(3){top:12px}
  .nav-open .menu-icon i:nth-child(1){top:6px;transform:rotate(45deg)}
  .nav-open .menu-icon i:nth-child(2){opacity:0}
  .nav-open .menu-icon i:nth-child(3){top:6px;transform:rotate(-45deg)}
  .nav-enhanced .nav-shell.is-floating{left:auto;right:max(16px,env(safe-area-inset-right));top:max(12px,env(safe-area-inset-top));transform:none;padding:0;background:none;box-shadow:none;-webkit-backdrop-filter:none;backdrop-filter:none}
  .nav-enhanced .nav-shell.is-floating .menu-toggle{background:var(--glass);color:var(--ink);box-shadow:inset 0 1px 0 var(--glass-edge),inset 0 0 0 1px var(--glass-rim),var(--glass-lift);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur)}
  .nav-enhanced .nav-shell.is-floating .menu-toggle:hover,.nav-enhanced .nav-shell.is-floating.nav-open .menu-toggle{background:var(--accent);color:var(--on-accent)}
  .nav-enhanced .nav-panel{display:none;position:absolute;top:calc(100% + 10px);right:0;width:min(300px,calc(100vw - 32px));max-height:calc(100dvh - 100px);overflow-y:auto;flex-direction:column;align-items:stretch;padding:8px;border-radius:22px;background:var(--glass);box-shadow:inset 0 1px 0 var(--glass-edge),inset 0 0 0 1px var(--glass-rim),var(--glass-lift);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur)}
  .nav-enhanced .nav-open .nav-panel{display:flex}
  .nav-enhanced .nav-shell #site-nav{flex-direction:column;align-items:stretch;gap:0}
  .nav-enhanced .nav-shell #site-nav a{justify-content:flex-start;padding:10px 16px;min-height:48px;font-size:17px;border-radius:14px;color:var(--ink)}
  .nav-enhanced .nav-shell #site-nav a:hover{background:var(--surface);color:var(--ink)}
  .nav-enhanced .nav-shell #site-nav a[aria-current]{background:color-mix(in srgb,var(--accent) 12%,transparent);text-decoration:none}
  .nav-extras{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:6px;padding:12px 8px 6px;border-top:1px solid var(--line)}
  html:not(.nav-enhanced) .site-header{display:flex;flex-wrap:wrap;height:auto;gap:0;min-height:72px;padding-block:10px}
  html:not(.nav-enhanced) .header-actions{margin-left:auto}
  html:not(.nav-enhanced) .nav-shell{order:3;width:100%;max-width:100%;padding:0}
  html:not(.nav-enhanced) .nav-shell #site-nav{flex-wrap:wrap;gap:12px}
}
@media(max-width:380px){.site-header{padding-inline:16px}}
@media(prefers-reduced-motion:reduce){.nav-shell,.nav-shell *{transition:none;animation:none}}
