/* Keep the redesigned navigation isolated from the original site styles. */

.navbar {
    --nav-muted: var(--muted);
    /* The bar's inner padding. Its text stands on the page column -- the name
       over the hero's left edge, the effects slider over the cards' right
       edge -- and the surface that appears on scroll reaches this far past
       it, the way a card's padding sits outside the words inside it. A
       phone's gutter is too narrow to lend the bar that much room, so there
       the bar keeps half a rem from the window and its text sits a few pixels
       inside the column rather than squeezing its padding to fit. */
    --nav-pad: 1.5rem;
    position: fixed;
    inset: calc(1rem + var(--safe-area-top)) 0 auto;
    z-index: 1000;
    border: 0;
    background: transparent;
}
.navbar .nav-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    width: calc(min(var(--site-max-width), 100% - var(--page-inline-start) - var(--page-inline-end)) + var(--nav-pad) * 2);
    /* never closer than half a rem to either side of the window */
    max-width: calc(100% - 1rem);
    min-height: 3.5rem;
    margin-inline: auto;
    padding: 0 var(--nav-pad);
    border-radius: var(--radius-surface);
}
.navbar .nav-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    /* the same corner as every card it floats over */
    border-radius: var(--radius-surface);
}
/* ---- Liquid glass ---------------------------------------------------------
   The bar that appears on scroll is the same glass as the cards and buttons
   below it, layer for layer: the thin surface grey (--glass-surface), the
   frost over it (--glass-blur, --glass-brightness), the light on its face
   (--glass-sheen), the rim (--glass-edge, --glass-edge-ring,
   --glass-edge-lights) and, in High FX, the same bend at that rim. Every one
   of those is written down once, in portfolio.css, and both ends of the page
   read it from there; the bar's own is the shadow it throws, which is what
   sets a sheet floating over the page apart from the ones lying in it.
   glass.js decides how much of the effect this browser can show and writes it
   to html[data-glass]:

     refract  High FX, Chromium: the frosted backdrop bends through an SVG
              filter
     lens     High FX, Safari and Firefox: the page behind frosts, and
              nothing bends
     frost    Medium and Low FX: nothing bends, and of all the glass only
              the bar frosts -- in Low FX only while its menu is open (below)

   The links keep legible over the brightest thing that can scroll behind
   them -- the hero's name, a white photo -- through the frost and the soft
   shadow the text carries. */
.navbar { --nav-tint: var(--glass-surface); }
.navbar .nav-content::before {
    border: 1px solid var(--glass-edge-ring);
    background: var(--glass-sheen), var(--nav-tint);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .3), var(--glass-edge-lights);
    opacity: 0;
    transition: opacity .28s;
}
/* Clear glass, as the cards are (portfolio.css), with a little more shade:
   the navigation crosses photos and white type, and its links have to read
   over them, with the shadow they carry once the page has scrolled. */
html[data-effects] .navbar {
    --nav-tint: rgba(12, 14, 18, .32);
}
html[data-effects="high"] .navbar .nav-content::before {
    box-shadow: var(--glass-volume), 0 12px 32px rgba(0, 0, 0, .3);
}
/* The backdrop filter only runs while the glass is showing: at the top of the
   page there is no bar, and nothing behind it should be paying for one. */
.has-scrolled .navbar .nav-content::before,
.navbar[data-nav-open] .nav-content::before {
    opacity: 1;
}
/* Filter the glass container, as the cards do. A blended sibling of a
   filtering pseudo-element can suppress its backdrop in Chromium. Keeping
   the filter on the container also lets the rim see that filtered image. */
.has-scrolled .navbar .nav-content,
.navbar[data-nav-open] .nav-content {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4) brightness(var(--glass-brightness));
    backdrop-filter: blur(var(--glass-blur)) saturate(1.4) brightness(var(--glass-brightness));
}
/* The frost goes on first and the bend after it, as on the cards. Until
   glass.js has hung its filter on the bar, the bar frosts without bending. */
html[data-glass="refract"] .has-scrolled .navbar .nav-content {
    backdrop-filter: blur(var(--glass-blur)) var(--glass-filter,) saturate(1.4) brightness(var(--glass-brightness));
}
/* An open menu frosts in every mode, over the cards' denser sheet: it lies
   over the hero's lettering, where its links have to read at a glance, and
   it changes height on every frame as it opens, which is no time to bend. */
html[data-glass] .navbar[data-nav-open] .nav-content::before {
    --nav-tint: var(--glass-surface-dense);
}
html[data-glass] .navbar[data-nav-open] .nav-content {
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.4) brightness(var(--glass-brightness));
    backdrop-filter: blur(var(--glass-blur)) saturate(1.4) brightness(var(--glass-brightness));
}
/* The rim: a hairline that catches the light along the top edge and fades
   round the ends -- a masked gradient border, so it can vary along its
   length the way light does on a bevel. Every card and button made of the
   same glass wears the same rim (--glass-edge, in portfolio.css). */
.navbar .nav-content::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    padding: var(--glass-edge-width, 1px);
    border-radius: var(--radius-surface);
    background: var(--glass-edge);
    mix-blend-mode: var(--glass-edge-blend, normal);
    -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;
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s;
}
.has-scrolled .navbar .nav-content::after,
.navbar[data-nav-open] .nav-content::after { opacity: 1; }
@media (hover: hover) {
    .navbar .nav-content:hover::after {
        background: var(--blue);
        mix-blend-mode: normal;
    }
}
.navbar .nav-content:focus-within::after {
    background: var(--blue);
    mix-blend-mode: normal;
}
/* On glass the links are set near white, with a shadow that keeps each word
   legible whatever scrolls behind it. */
.has-scrolled .navbar { --nav-muted: rgba(247, 244, 237, .92); }
.has-scrolled .navbar .logo,
.has-scrolled .navbar .nav-links > li > a {
    text-shadow: 0 0 .75rem rgba(0, 0, 0, .55), 0 1px 2px rgba(0, 0, 0, .35);
}
/* Anyone who has asked their system for less transparency, or for more
   contrast, gets a solid bar instead of glass. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    .navbar .nav-content::before {
        background: #101113 !important;
    }
    .navbar .nav-content {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
}
/* The bar is the one sheet that passes over the page's own lettering, so it
   keeps a light frost of its own, as Apple's clear glass does: what slides
   under it still shows through, colour and shape, but softened enough that
   a heading behind the links does not cross them. The cards stay clear and
   unfrosted below High (portfolio.css). */
.navbar { --glass-blur: 5px; }
/* Except in Low FX, and on a computer drawing without graphics acceleration
   (data-effects-renderer, portfolio.js): the frost is blurred again on every
   scrolled frame, and in Low FX at 3x it tripled what the graphics process
   spent putting each frame together (cycle 27). More shade there instead. */
html[data-effects="low"] .navbar,
html[data-effects-renderer="software"]:not([data-effects="high"]) .navbar {
    --nav-tint: rgba(12, 14, 18, .66);
}
html[data-effects="low"] .has-scrolled .navbar:not([data-nav-open]) .nav-content,
html[data-effects-renderer="software"]:not([data-effects="high"]) .has-scrolled .navbar:not([data-nav-open]) .nav-content {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}
.navbar .logo {
    position: relative;
    z-index: 1;
    color: var(--ink);
    font-family: var(--font-text);
    font-size: .9375rem;
    font-weight: 550;
    line-height: 1.65;
    letter-spacing: -.015em;
    text-transform: none;
    white-space: nowrap;
    transition: color .16s;
}
.navbar .logo:hover,
.navbar .logo:focus-visible {
    color: var(--blue);
}
/* On a touch screen the name is pressed like every other control on the
   page, so it stands the same 44px tall. It is centred on its line, as the
   text was, so nothing moves; the target only grows to meet the thumb. */
html[data-primary-input="touch"] .navbar .logo {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}
.navbar .nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-family: var(--font-text);
    line-height: 1.65;
}
/* The links and the effects slider are one row, so they stand as tall. */
.navbar .nav-links > li > a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--nav-muted);
    font-size: var(--type-meta);
    transition: color .16s;
}
.navbar .nav-links > li > a:hover,
.navbar .nav-links > li > a:focus-visible { color: var(--blue); }

/* ---- The effects slider ---------------------------------------------------
   The two-position switch it replaced, drawn out to three stops: the same
   pill, the same dark track and hairline border, the same blue once it is
   on. Left is Low FX, the middle Medium, the right High (portfolio.js). The
   thumb is a bead of the glass the bar is made of, and the track fills with
   blue behind it as the level rises, so where it stands reads at a glance
   without a word beside it; the stops it can land on show as dots. No word
   names the level, even while it is being used. The sparkle says what it is
   for.

   Its place comes from html[data-effects], so it is right from the first
   paint; a drag sets --fx-drag while the finger is down. The range input
   over it is unseen: it has the keyboard and the screen reader, and the
   track draws its focus ring. */
.navbar .fx-controls {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.navbar .fx-background-button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 14px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: var(--nav-muted);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color .16s;
}
.navbar .fx-background-button:hover { color: var(--blue); }
.navbar .fx-background-button:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}
.navbar .fx-slider {
    --fx-width: 48px;
    --fx-height: 18px;
    --fx-knob: 12px;
    /* From the inside of the border to the thumb. */
    --fx-pad: 2px;
    --fx-step: calc((var(--fx-width) - 2px - var(--fx-pad) * 2 - var(--fx-knob)) / 2);
    --fx-at: 2;
    --fx-fill: rgba(123, 168, 216, .3);
    --fx-edge: rgba(123, 168, 216, .55);
    --fx-ground: rgba(123, 168, 216, .09);
    --fx-bead: var(--blue-light);
    --fx-glow: 0 0 9px rgba(157, 204, 255, .55);
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    color: var(--nav-muted);
    cursor: pointer;
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: color .16s;
}
html[data-effects="medium"] .navbar .fx-slider {
    --fx-at: 1;
    --fx-fill: rgba(123, 168, 216, .17);
    --fx-edge: rgba(123, 168, 216, .38);
    --fx-ground: rgba(123, 168, 216, .05);
    --fx-bead: #e4edf8;
    --fx-glow: 0 0 6px rgba(228, 237, 248, .3);
}
html[data-effects="low"] .navbar .fx-slider {
    --fx-at: 0;
    --fx-fill: rgba(123, 168, 216, 0);
    --fx-edge: rgba(255, 255, 255, .22);
    --fx-ground: #202124;
    --fx-bead: var(--nav-muted);
    --fx-glow: 0 0 0 transparent;
}
.navbar .fx-slider:hover { color: var(--blue); }
/* On its own: a browser that cannot read :has() drops the whole rule. */
.navbar .fx-slider:has(.fx-slider-input:focus-visible) { color: var(--blue); }
.navbar .fx-slider-icon {
    flex: none;
    width: 14px;
    height: 14px;
    fill: currentColor;
    pointer-events: auto;
}
.has-scrolled .navbar .fx-slider-icon {
    filter: drop-shadow(0 0 .375rem rgba(0, 0, 0, .55));
}
.navbar .fx-slider-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.navbar .fx-slider-track {
    position: relative;
    flex: none;
    box-sizing: border-box;
    width: var(--fx-width);
    height: var(--fx-height);
    border: 1px solid var(--fx-edge);
    border-radius: 999px;
    background: var(--fx-ground);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .35);
    transition: background .28s, border-color .28s;
}
.navbar .fx-slider:hover .fx-slider-track {
    border-color: rgba(123, 168, 216, .7);
}
.navbar .fx-slider-input:focus-visible + .fx-slider-track {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}
/* The inside of the track, which cuts the fill to its rounded ends. The
   thumb sits outside it, so its glow is not cut too. */
.navbar .fx-slider-rail {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
}
/* The blue the track fills with: from its left end to just past the thumb.
   A bar two stops longer than it needs to be, slid along with the thumb and
   cut off by the rail, so it moves on the compositor as the thumb does and
   neither stalls if the page is busy the moment a level is chosen. */
.navbar .fx-slider-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--fx-step) * -2);
    width: calc(var(--fx-pad) * 2 + var(--fx-knob) + var(--fx-step) * 2);
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(123, 168, 216, 0), var(--fx-fill) 70%);
    transform: translateX(calc(var(--fx-at) * var(--fx-step)));
    transition: transform .34s cubic-bezier(.3, 1.35, .6, 1), background .28s;
}
.navbar .fx-slider-stop {
    position: absolute;
    top: 50%;
    left: calc(var(--fx-pad) + var(--fx-knob) / 2 - 1.5px);
    width: 3px;
    height: 3px;
    margin-top: -1.5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .3);
}
.navbar .fx-slider-stop:nth-of-type(3) { transform: translateX(var(--fx-step)); }
.navbar .fx-slider-stop:nth-of-type(4) { transform: translateX(calc(var(--fx-step) * 2)); }
.navbar .fx-slider-thumb {
    position: absolute;
    top: var(--fx-pad);
    left: var(--fx-pad);
    width: var(--fx-knob);
    height: var(--fx-knob);
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 28%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 58%),
        var(--fx-bead);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .5), inset 0 0 0 .5px rgba(255, 255, 255, .4), var(--fx-glow);
    transform: translateX(calc(var(--fx-at) * var(--fx-step)));
    transition: transform .34s cubic-bezier(.3, 1.35, .6, 1), background-color .28s, box-shadow .28s;
}
/* Under the finger: the thumb follows it, a touch larger, and settles on the
   nearest stop when it lets go. */
.navbar .fx-slider.is-dragging .fx-slider-thumb {
    transform: translateX(var(--fx-drag, 0px)) scale(1.15);
    transition: background-color .28s, box-shadow .28s;
}
.navbar .fx-slider.is-dragging .fx-slider-fill {
    transform: translateX(var(--fx-drag, 0px));
    transition: background .28s;
}
@media (min-width: 901px) {
    .navbar .nav-links {
        position: absolute;
        top: 50%;
        left: 0;
        right: 0;
        justify-content: center;
        transform: translateY(-50%);
        pointer-events: none;
    }
    .navbar .nav-links > li { pointer-events: auto; }
    .navbar .performance-control { position: absolute; right: var(--nav-pad); }
}
@media (min-width: 901px) and (max-width: 1100px) {
    .navbar { --nav-pad: 1rem; }
    .navbar .nav-links { gap: 1.5rem; }
}
/* On a touch screen the section links stand 44px tall, as every control
   there does, but a short name is narrower than that: "Skills" is 34px wide
   on an iPad in landscape. Five pixels more on each side, lent back by the
   margin, so the target meets the thumb and no letter moves. */
@media (min-width: 901px) {
    html[data-primary-input="touch"] .navbar .nav-links > li > a {
        padding-inline: 5px;
        margin-inline: -5px;
    }
}
@media (max-width: 900px) {
    /* As much padding as the page's gutter can lend while the bar keeps half
       a rem from the window, so the text still lands on the column down to
       640px. Below that the phone rule further down takes over. */
    .navbar { --nav-pad: min(1rem, calc(var(--page-inline-start) - .5rem)); }
    .navbar .nav-content { gap: 0; }
    /* No radius of its own: the site's rule makes every icon button a circle. */
    .navbar .nav-toggle {
        display: grid;
        place-items: center;
    }
    /* Collapsed with max-height rather than `grid-template-rows: 0fr`, which
       only sizes the first row: the rest land in implicit rows and keep their
       height, which left a closed bar 212px tall with the hero showing through
       it. The ceiling only has to clear five items. */
    .navbar .nav-links {
        display: block;
        flex-basis: 100%;
        max-height: 0;
        overflow: hidden;
        transition: max-height .3s var(--ease);
    }
    .navbar[data-nav-open] .nav-links { max-height: 20rem; }
    /* An open menu is read and tapped rather than skimmed, so its rows take
       the size of card copy instead of the bar's smaller text. */
    .navbar .nav-links > li > a {
        display: flex;
        justify-content: flex-start;
        width: 100%;
        padding-block: .75rem;
        font-size: var(--type-small);
    }
    /* The slider is the last row, as tall as the others. */
    .navbar .nav-links .fx-slider { min-height: 48px; }
    .navbar .nav-links .fx-background-button { width: 15px; min-height: 48px; }
    .navbar .nav-links .fx-slider-icon { width: 15px; height: 15px; }
}
@media (max-width: 639px) {
    .navbar {
        top: calc(.5rem + var(--safe-area-top));
        --nav-pad: .75rem;
    }
    .navbar .logo { font-size: .875rem; }
}
@media (max-width: 359px) {
    .navbar .logo { font-size: .8125rem; }
}
