/* On this page: a pinned row of jump links for long pages (worked examples and long
   blog posts). CSS only. Markup, placed inside the page's <main> after its header:

   <nav class="page-jumps" aria-label="On this page">
       <a href="#first">First</a>
       <span class="sep" aria-hidden="true">&middot;</span>
       <a href="#second">Second</a>
   </nav>

   The row sticks just under the fixed site header, on a solid background with a hairline
   rule. On wider screens it is one line with dots between the links. On phones and
   tablets (48rem and below) the dots go and the links wrap onto a second line when they
   need to, so every link stays in view and reachable by keyboard. */
:root { --page-jumps-height: 2.75rem; }

/* main.css styles every bare <nav> as the fixed site header; undo that here. */
nav.page-jumps {
    position: sticky;
    top: var(--nav-height);
    left: auto;
    right: auto;
    width: auto;
    height: var(--page-jumps-height);
    z-index: 900;
    display: flex;
    align-items: center;
    margin: 0 0 1.5rem;
    padding: 0 0.25rem;
    background: var(--bg-main);
    border: 0;
    border-bottom: 1px solid var(--hairline);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    font-size: var(--site-small);
    line-height: 1.2;
    color: var(--site-gray);
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
nav.page-jumps::-webkit-scrollbar { display: none; }
nav.page-jumps a,
nav.page-jumps .sep { flex: none; }
nav.page-jumps a { color: var(--link); text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 0.2em; }
nav.page-jumps a:hover { color: var(--site-ink); text-decoration-color: currentColor; }
nav.page-jumps a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
nav.page-jumps .sep { margin: 0 0.5rem; }

/* A jump lands below both the site header and this row. */
main:has(nav.page-jumps) [id] { scroll-margin-top: calc(var(--nav-height) + var(--page-jumps-height) + 1rem); }

/* Phones and tablets: wrap instead of clipping; no dots; jumps clear a two-line row. */
@media (max-width: 48rem) {
    nav.page-jumps {
        height: auto;
        min-height: var(--page-jumps-height);
        flex-wrap: wrap;
        white-space: normal;
        overflow: visible;
        column-gap: 0.625rem;
        row-gap: 0.35rem;
        padding: 0.5rem 0.25rem;
    }
    nav.page-jumps .sep { display: none; }
    main:has(nav.page-jumps) [id] { scroll-margin-top: calc(var(--nav-height) + 5rem); }
}
