/* ---------- header ---------- */
/* On phones the page can run under the status bar: the header sticks below the safe-area
   inset, and a fixed band in the page colour covers the strip above it. */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 51; background: var(--bg); }
.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.masthead.is-scrolled { border-bottom-color: var(--line); }
.masthead-inner { display: flex; align-items: center; gap: 20px; height: var(--head-h); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center;
  background: var(--btn-bg); color: var(--btn-ink);
  font-family: var(--font-display); font-weight: 800; font-variation-settings: "wdth" 120; font-size: .95rem; letter-spacing: -.01em;
  position: relative;
}
.brand-mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.brand-sub { font-family: var(--font-mono); font-size: .6875rem; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  position: relative; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-size: .9375rem; font-weight: 500; color: var(--ink-2);
  transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 2px; border-radius: 2px; background: var(--accent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.menu-btn { display: none; }
@media (max-width: 860px) {
  .nav { display: none; }
  .menu-btn { display: grid; }
  .brand-sub { display: none; }
}
.menu-sheet {
  position: fixed; inset: var(--head-h) 0 auto 0; z-index: 49;
  background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 8px var(--gutter-r) 20px var(--gutter-l);
  box-shadow: var(--shadow-2);
  transform-origin: top; animation: sheet .22s var(--ease-out);
  /* a phone on its side is shorter than the menu: the sheet scrolls on its own, not the page */
  max-height: calc(100vh - var(--head-h)); max-height: calc(100dvh - var(--head-h));
  overflow-y: auto; overscroll-behavior: contain;
}
.menu-btn .i-close { display: none; }
.menu-btn[aria-expanded="true"] .i-menu { display: none; }
.menu-btn[aria-expanded="true"] .i-close { display: block; }
@keyframes sheet { from { opacity: 0; transform: translateY(-8px); } }
/* The page under an open menu is dimmed by a real layer, so a tap on it only closes the menu. */
/* (outside the header, whose backdrop-filter would make it the box a fixed child is placed in) */
.menu-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(8, 12, 20, .38); animation: fadein .22s var(--ease-out); }
.menu-backdrop[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.menu-sheet a { display: flex; justify-content: space-between; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line-2); text-decoration: none; font-size: 1.125rem; font-weight: 600; }
.menu-sheet a span { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); font-weight: 500; }
.menu-sheet a[aria-current="page"] { color: var(--accent-ink); }

/* ---------- pages & transitions ---------- */
body { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
main { display: block; flex: 1 0 auto; }
.js .page { display: none; }
.js[data-route="home"] #home,
.js[data-route="projects"] #projects,
.js[data-route="career"] #career,
.js[data-route="fpslabs"] #fpslabs,
.js[data-route="briarwatch"] #briarwatch,
.js[data-route="micandmore"] #micandmore,
.js[data-route="renostack"] #renostack,
.js[data-route="pingowl"] #pingowl,
.js[data-route="skills"] #skills,
.js[data-route="about"] #about,
.js[data-route="contact"] #contact { display: block; }
.page { padding-bottom: clamp(56px, 8vw, 112px); }
.page:focus { outline: none; }
.page-focus:focus, [data-focus]:focus { outline: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .32s; animation-timing-function: var(--ease-out); }
::view-transition-old(root) { animation-name: vt-out; }
::view-transition-new(root) { animation-name: vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
.masthead { view-transition-name: masthead; }
::view-transition-old(masthead), ::view-transition-new(masthead) { animation: none; }
/* On the public site each page is its own file: browsers that can carry the same fade across
   a real page load do so, with the header holding still. */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
.page-enter { animation: page-in .45s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } }

