/* ── Header: pill tabs, plus a round button on the right on some pages ──
   On phones the tabs leave the header for a glass bar at the bottom of the
   window (end of this file).
   flex-start keeps that button level with the first row of tabs when they wrap.
   The tabs sit in the same spot on every Ronde page only because each page puts
   .rh-head in the same column: max-width 1120px with 32px side padding, 16px at
   760px and below. Keep new pages on that column. */
/* Always reserve the scrollbar's space. Otherwise pages too short to scroll
   (contact, resume) are 15px wider where scrollbars take room, and the
   centred column, tabs included, sits 7.5px further right than elsewhere. */
html { scrollbar-gutter: stable; }

.rh-head__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-top: 20px;
}

/* .rh-switch: the right-hand header button (Experience's "Appearance"
   toggle). The name dates from the old design switch. */
.rh-switch {
    display: inline-flex;
    flex-shrink: 0;
    min-width: 142px;
    height: 40px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: 1px solid var(--rh-line-strong);
    border-radius: 999px;
    font-size: 14px;
    transition: background .2s, transform .15s;
}

.rh-switch:hover { background: var(--rh-fill-hover); }
.rh-switch:active { transform: scale(.96); }

.rh-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rh-tabs a {
    display: inline-flex;
    height: 40px;
    align-items: center;
    padding: 0 22px;
    border: 1px solid var(--rh-ink);
    border-radius: 999px;
    font-size: 14px;
    transition: background .2s, transform .15s;
}

.rh-tabs a:hover:not([aria-current]) { background: var(--rh-fill-hover); }
.rh-tabs a:active { transform: scale(.96); }
/* The current page's tab is solid ink (black, or white in dark mode). */
.rh-tabs a[aria-current] { background: var(--rh-ink); color: var(--rh-bg); }

/* The button drops its label before the tabs would wrap onto a
   second row beside it (tablets in portrait). */
@media (max-width: 860px) {
    .rh-switch__text { display: none; }
    .rh-switch { width: 40px; min-width: 0; padding: 0; }
}

/* ── Phones: the tabs sit on one frosted glass bar floating over the page ──
   Same buttons, three of them, sharing the bar evenly. Experience and Resume
   are reached from the home page's shortcuts instead. The bar is in the same
   place on every page; pages keep --rh-bar-clear free at the bottom for it.
   No ancestor of .rh-tabs may have a transform, filter or containment (the
   bar would stop being fixed to the window), and to fade it, fade .rh-tabs
   itself: opacity on an ancestor switches off the frost. */
@media (max-width: 760px) {
    :root {
        --rh-bar-bottom: max(24px, env(safe-area-inset-bottom));
        --rh-bar-clear: calc(var(--rh-bar-bottom) + 58px);  /* 58px: the bar's height */
    }

    html { scroll-padding-bottom: calc(var(--rh-bar-clear) + 12px); }
    body.rh { padding-bottom: var(--rh-bar-clear); }

    /* The button keeps the right-hand end of the row to itself. */
    .rh-switch { margin-left: auto; }

    .rh-tabs {
        /* light-dark() below follows this. Pages that don't take the system
           appearance (home, Experience) set their own. */
        color-scheme: light dark;
        position: fixed;
        z-index: 10;
        right: 16px;
        bottom: var(--rh-bar-bottom);
        left: 16px;
        max-width: 440px;
        margin: 0 auto;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 9px;
        border-radius: 999px;
        /* The bar is clearer than its buttons: --rh-bar-pill tops each
           outlined button back up to 60% white (73% graphite in dark) over
           the same frost, so labels keep their contrast. */
        --rh-bar-pill: light-dark(rgba(255, 255, 255, .355), rgba(32, 33, 37, .44));
        background: var(--rh-bg);  /* browsers without light-dark() */
        background:
            linear-gradient(174deg, light-dark(rgba(255, 255, 255, .6), rgba(255, 255, 255, .13)) 0%, light-dark(rgba(255, 255, 255, .12), rgba(255, 255, 255, .03)) 46%, transparent 62%),
            light-dark(rgba(255, 255, 255, .38), rgba(32, 33, 37, .52));
        -webkit-backdrop-filter: blur(18px) saturate(1.7);
        backdrop-filter: blur(18px) saturate(1.7);
        box-shadow:
            inset 0 0 12px light-dark(rgba(255, 255, 255, .45), rgba(255, 255, 255, .03)),
            0 0 0 1px light-dark(rgba(17, 18, 20, .05), rgba(0, 0, 0, .35)),
            0 2px 6px light-dark(rgba(17, 18, 20, .06), rgba(0, 0, 0, .25)),
            0 20px 40px -14px light-dark(rgba(17, 18, 20, .32), rgba(0, 0, 0, .7));
    }

    /* Lit rim: bright along the top and left, fading round the sides, catching
       the light again at the bottom right (as on the projects page's glass). */
    .rh-tabs::before {
        content: "";
        position: absolute;
        inset: 0;
        padding: 1px;
        border-radius: inherit;
        background: linear-gradient(165deg,
            light-dark(#fff, rgba(255, 255, 255, .42)) 0%,
            light-dark(rgba(255, 255, 255, .9), rgba(255, 255, 255, .22)) 24%,
            light-dark(rgba(255, 255, 255, .3), rgba(255, 255, 255, .07)) 52%,
            light-dark(rgba(255, 255, 255, .85), rgba(255, 255, 255, .24)) 100%);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask-composite: exclude;
        pointer-events: none;
    }

    .rh-tabs a { flex: 1 1 0; justify-content: center; padding: 0; }
    .rh-tabs a:not([aria-current]) { background: var(--rh-bar-pill); }
    .rh-tabs a:hover:not([aria-current]) {
        background: linear-gradient(var(--rh-fill-hover) 0 0), var(--rh-bar-pill);
    }

    .rh-tabs a[href="experience.html"],
    .rh-tabs a[href="resume.html"] { display: none; }
}

/* Paper is narrow enough to count as a phone, and a fixed bar would repeat on
   every sheet. */
@media print {
    .rh-tabs { display: none; }
}
