/* 
 ---------------------------------
 |   LAST UPDATED: 2026-04-13    |
 ---------------------------------
 */

/* VIEWPORT HEADNOTE: Viewport-specific rules: (1) at ≤1023px drawer flush left and icon on screen (--sidebar-peek-width 72px when closed, full width when open); (2) at ≤767px drop Sign in/Join and hide desktop navbar logo and search bar, search layout/sizing, announcement-bar positioning; (3) at ≤479px announcement/search padding. All other layout is viewport-agnostic. */

/*
   ELEMENT DIGEST (commented out for reference)
   --------------------------------------------
   #header
       Fixed top-level wrapper. Contains the top bar (.navbar) and the slide-out
       drawer (.menu). One full-width strip at the top of the viewport.

   .navbar
       The top bar: horizontal strip with site logo (.navbar-logo), Sign in/Join
       (.navbar-button), and search (.search-bar-wrapper, .search-icon-wrapper).
       Desktop height 55px; mobile 50px. Has ornamental glyph border (::after/::before).

   .menu
       The slide-out drawer/panel. Contains .menu-top (strip with hamburger/close
       glyph) and .menu-content (scrollable area with nav links). On desktop when
       open also shows .sidebar (narrow vertical strip with rotated logo). When
       closed, only .menu-top is visible (same height as top bar). Slides in from
       the left; on mobile it is full-width overlay.

   .menu-top
       The top strip of the drawer; same height as .navbar (55px desktop, 50px
       mobile). Holds the menu (hamburger/close) glyph. When drawer is closed this
       strip is the only visible part of .menu.

   .menu-content
       The scrollable body of the drawer, below .menu-top. Contains .menu-links
       (which wraps .nav). (.mobile-menu-cta was a fixed bottom bar; unused, commented out.)
       Height is typically viewport minus top-bar height (so content sits below
       the .navbar/.menu-top strip).

   .nav
       The list of navigation links inside the drawer (inside .menu-content). Not
       the top bar; it is the main link list shown when the drawer is open.

   .sidebar
       Desktop-only. Narrow vertical strip (e.g. 56px) inside .menu when open,
       with rotated site logo. Hidden on mobile/tablet (drawer is full-width, no
       sidebar). Its absence there may explain why article/content left margin
       overflows on mobile/tablet (no sidebar pushing content right as on desktop).

   .mobile-logo
       Site logo shown in the top bar on mobile only (hidden on desktop, where
       .navbar-logo is used).

   .mobile-menu-cta
       Unused: fixed bottom bar (Join/Sign in) was for mobile; rules commented out below.
*/

/* ========================================================================
   VIEWPORT-AGNOSTIC (base styles)
   ======================================================================== */
#header {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    margin-left: 0;
    background-color: var(--background-color);
    --header-max-opacity: 0.94;
    --header-visibility: 1;
    z-index: 9998;
    --sidebar-peek-width: calc(4vw * var(--imgScale));
    --sidebar-panel-width: min(320px, calc(27vw * var(--imgScale)));
    --content-left-offset: calc(max(calc(72px * var(--imgScale)), var(--sidebar-peek-width)) + calc(2.5vw * var(--imgScale)));
}

.navbar {
    display: none;
    width: 100%;
    background-color: var(--background-color);
    opacity: calc(var(--header-max-opacity) * var(--header-visibility));
    justify-content: flex-end;
    align-items: stretch;
    border-bottom: 1px solid var(--text-color-lower-opac);
    height: calc(55px * var(--imgScale));
    z-index: 1;
    position: relative;
    transition: opacity var(--ease-transition);
}

.navbar-logo {
    margin-left: var(--content-left-offset);
    margin-right: auto;
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    min-width: 0;
    overflow: hidden;
}

.navbar-logo img {
    height: calc(22px * var(--logo-scale));
    width: auto;
}

.navbar-logo .logo-text {
    font-family: var(--edb);
    font-size: calc(36px * var(--imgScale));
    font-optical-sizing: auto;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/*
 * Ornamental bottom edge: shared by .navbar (desktop strip) and .menu-top (peek + tablet/mobile bar).
 * Desktop-only vertical sidebar rail under the bar (.sidebar border-right + .sidebar::after) stays off
 * tablet/mobile where .sidebar is not shown — intentional per ISSUES-LIST navbar parity.
 */
.navbar::after,
.menu-top::after {
    display: none;
}

.navbar::before,
.menu-top::before {
    display: none;
}

.navbar-button {
    width: 11.2ch;
    min-width: 11.2ch;
    max-width: 11.2ch;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 2.1ch;
    line-height: 1;
    align-self: stretch;
    box-sizing: border-box;
    overflow: hidden;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    vertical-align: middle;
}

/* Sign in label is longer than Join; fixed 11.2ch + overflow:hidden clipped or wrapped (ISSUES-LIST # current). */
.navbar .navbar-signin-link.navbar-button {
    width: auto;
    min-width: 11.2ch;
    max-width: none;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: visible;
}

.navbar .button {
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1;
}

.navbar .button:hover,
.mobile-menu-cta .button:hover {
    background-color: var(--port);
    color: var(--background-color);
}

.signin-button {
    border: none;
    border-left: 1px solid var(--text-color);
}

.search-bar-wrapper {
    border-left: 1px solid var(--text-color);
    width: calc(28vw * var(--imgScale));
    display: flex;
    align-items: center;
}

.search-input {
    border: none;
    background-color: transparent;
}

.search-icon-wrapper {
    width: calc(29px * var(--imgScale));
    height: calc(29px * var(--imgScale));
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: calc(20px * var(--imgScale));
}

.search-icon-open {
    position: relative;
    width: 100%;
    height: 100%;
}

.search-icon-close {
    position: relative;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.search-icon-close-line {
    height: 2px;
    width: 100%;
    background-color: var(--text-color);
    position: absolute;
    transform: rotateZ(45deg);
    pointer-events: none;
}

.search-icon-close-line-second {
    transform: rotateZ(-45deg);
}

.menu {
    position: fixed;
    z-index: 3;
    top: 0;
    left: 0;
    width: var(--sidebar-panel-width);
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transform: translateX(calc(-1 * (var(--sidebar-panel-width) - var(--sidebar-peek-width))));
    transition: transform var(--ease-transition);
    overflow: hidden;
    overscroll-behavior: contain;
}

.menu-top {
    height: calc(55px * var(--imgScale));
    min-height: calc(55px * var(--imgScale));
    border-bottom: 1px solid var(--text-color-lower-opac);
    display: flex;
    justify-content: flex-end;
    background-color: var(--background-color);
    position: relative;
    z-index: 1;
}

.menu-button {
    width: calc(60px * var(--imgScale));
    padding: 0 calc(3px * var(--imgScale)) 0 calc(7px * var(--imgScale));
    background-color: transparent;
    border: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    box-sizing: border-box;
}

.menu-glyph {
    flex-shrink: 0;
    width: calc(55px * var(--imgScale));
    height: calc(55px * var(--imgScale));
    max-width: 100%;
    max-height: 100%;
    line-height: 0;
    background-color: var(--revolver);
    transition: background-color var(--ease-transition);
    display: block;
    border: none !important;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.menu-glyph--closed {
    -webkit-mask-image: url('../img/rosart-glyphs/orn837-menu-closed-57944.svg');
    mask-image: url('../img/rosart-glyphs/orn837-menu-closed-57944.svg');
}

.menu-glyph--open {
    -webkit-mask-image: url('../img/rosart-glyphs/orn836-menu-open-57943.svg');
    mask-image: url('../img/rosart-glyphs/orn836-menu-open-57943.svg');
}

.menu-content {
    display: flex;
    opacity: 1;
    transition: opacity var(--ease-transition);
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    height: calc(100vh - (55px * var(--imgScale)));
    height: calc(100dvh - (55px * var(--imgScale)));
    min-height: calc(100dvh - (55px * var(--imgScale)));
    overflow: hidden;
    overscroll-behavior: contain;
}

/* Radial transparency effect for expanded sidebar */
.menu-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--background-color);
    mask: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.99) 20%,
        rgba(0, 0, 0, 0.965) 40%,
        rgba(0, 0, 0, 0.925) 60%,
        rgba(0, 0, 0, 0.84) 80%,
        rgba(0, 0, 0, 0.75) 100%
    );
    -webkit-mask: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 1) 0%,
        rgba(0, 0, 0, 0.99) 20%,
        rgba(0, 0, 0, 0.965) 40%,
        rgba(0, 0, 0, 0.925) 60%,
        rgba(0, 0, 0, 0.84) 80%,
        rgba(0, 0, 0, 0.75) 100%
    );
    pointer-events: none;
    z-index: -1;
}

/* Ensure menu content has relative positioning for the pseudo-element */
.menu-content {
    position: relative;
}

.menu-links {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    height: 100%;
    min-height: 100%;
    padding-right: 0;
    opacity: 0;
    transition: opacity var(--ease-transition);
}

.menu[isopen="true"] .sidebar {
    display: none;
}

.menu[isopen="true"] .menu-links {
    width: 100%;
    opacity: 1;
}

.menu[isopen="false"] .menu-content {
    opacity: 0.92;
}

.menu[isopen="true"] .menu-content {
    opacity: 1;
}

/* Viewport-agnostic: closed = bar height only, open = full viewport (ISSUES-LIST) */
.menu[isopen="false"] {
    height: auto;
    min-height: calc(50px * var(--imgScale));
}
.menu[isopen="true"] {
    height: 100dvh;
    min-height: 100dvh;
}

.nav {
    display: flex;
    flex-direction: column;
    row-gap: calc(2.1vw * var(--imgScale));
    padding: calc(4.8vw * var(--imgScale)) calc(1.45vw * var(--imgScale));
    list-style: none;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - (55px * var(--imgScale)));
    min-height: calc(100dvh - (55px * var(--imgScale)));
    width: 100%;
    overflow: hidden;
}

.secondary-links {
    display: grid;
    grid-template-columns: 1fr auto;
    list-style: none;
    gap: calc(1.7vw * var(--imgScale));
    padding-left: 0;
}

.secondary-links li a {
    font-size: calc(18px * var(--imgScale)) !important;
    font-family: var(--font3);
}

.secondary-links li a:hover {
    text-decoration: underline;
}

.nav-link:hover {
    text-decoration: underline;
    text-decoration-thickness: calc(3px * var(--imgScale));
    text-decoration-color: var(--swiss-coffee) !important;
}

.nav li a, .nav li .links-label {
    line-height: 110%;
    font-size: calc(42px * var(--imgScale));
    color: var(--text-color);
    text-decoration: none;
    word-break: normal;
    overflow-wrap: anywhere;
}

.nav li .links-label {
    border-bottom: 1px solid var(--text-color-lower-opac);
    padding-bottom: calc(0.7vw * var(--imgScale));
    margin-bottom: calc(1.25vw * var(--imgScale));
    margin-top: calc(2.8vw * var(--imgScale));
}

.sidebar {
    width: var(--sidebar-peek-width);
    min-width: var(--sidebar-peek-width);
    max-width: calc(56px * var(--imgScale));
    border-right: 1px solid var(--text-color-lower-opac);
    border-top: none;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: calc(100vh - (55px * var(--imgScale)));
    height: calc(100dvh - (55px * var(--imgScale)));
    min-height: calc(100dvh - (55px * var(--imgScale)));
}

/* Sidebar bottom repeat tile (SVG asset; was Rosart U+E20D) */
.sidebar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(18px * var(--imgScale));
    pointer-events: none;
    border: none !important;
    background-color: var(--text-color);
    -webkit-mask-image: url('../img/rosart-glyphs/orn834-sidebar-bottom-tile-57869.svg');
    mask-image: url('../img/rosart-glyphs/orn834-sidebar-bottom-tile-57869.svg');
    -webkit-mask-repeat: repeat-x;
    mask-repeat: repeat-x;
    -webkit-mask-position: left bottom;
    mask-position: left bottom;
    -webkit-mask-size: calc(18px * var(--imgScale)) calc(18px * var(--imgScale));
    mask-size: calc(18px * var(--imgScale)) calc(18px * var(--imgScale));
}

.logo {
    color: var(--text-color);
    text-decoration: none;
    transform: rotate(-90deg);
    white-space: nowrap;
}

.logo img{
    height: calc(22px * var(--logo-scale));
    width: auto; 
}

.logo-text {
    font-family: var(--edb);
    font-size: calc(36px * var(--imgScale));
    font-optical-sizing: auto;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}



.blur {
    z-index: 2;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    background-color: color-mix(in srgb, var(--background-color) 14%, transparent);
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: 0;
    display: none;
}

body:has(#header .menu[isopen="true"]) .blur {
    display: block;
}

.blur-lower-index {
    z-index: 0;
}

.navbar-mobile, .search-icon-wrapper-mobile, .mobile-logo {
    display: none;
}

/* Unused: bottom CTA bar (Join/Sign in) not used; kept display: none so it never shows. */
.mobile-menu-cta {
    display: none;
}

#header ul li {
    line-height: 130%;
    margin-bottom: 0;

}

.custom-search {
    position: absolute;
    bottom: 0px;
    right: 0;
    transform: translateY(100%);
    width: calc(100% - var(--sidebar-peek-width));
    background-color: var(--background-color);
}

.custom-search .section-header {
    border-top: none;
}

.custom-search .grid {
    display: none;
    padding-top: calc(2.5vw * var(--imgScale));
    padding-bottom: calc(2.5vw * var(--imgScale));
    max-height: 60vh;
    overflow-y: auto;
    border-bottom: 1px solid var(--text-color);
}

.custom-search {
    display: none;
}

.search-icon {
    position: absolute;
}

.site-content {
    padding-top: calc(55px * var(--imgScale));
}

/* Lead site-cover hero: do not reserve space for fixed header; bar fades in over image */
.site-content:has(main > section.hero.has-cover:first-child),
.site-content:has(main > section:first-child section.hero.has-cover) {
    padding-top: 0;
}

body:has(#header .menu[isopen="true"]) {
    overflow: hidden;
}

/* Blur only main content when drawer is open; do NOT blur .site-content (navbar is inside it). */
body:has(#header .menu[isopen="true"]) .site-main,
body:has(#header .menu[isopen="true"]) main,
body:has(#header .menu[isopen="true"]) footer,
body:has(#header .menu[isopen="true"]) .site-footer,
body:has(#header .menu[isopen="true"]) #announcement-bar-root {
    filter: blur(5px);
    transition: filter var(--ease-transition);
}

#announcement-bar-root {
    transform: translateY(calc(55px * var(--imgScale)));
}

#announcement-bar-root .gh-announcement-bar {
    font-weight: 400;
    font-size: calc(16px * var(--imgScale));
    line-height: 150%;
    padding: 12px 6vw 12px calc(6vw + var(--sidebar-peek-width));
}

li ul li .nav-link {
    word-break: unset;
}

/* ========================================================================
   VIEWPORT-SPECIFIC (minimal: Sign in/Join drop on mobile, search, announcement only)
   ======================================================================== */

/* Tablet + mobile: drawer flush left, icon on screen; header bar-height only when closed (ISSUES-LIST navbar). */
@media (min-width: 1024px) {
    .navbar {
        display: flex;
    }
}

@media (max-width: 1023px) {
    #header {
        /* Keep only a slim closed rail; full controls appear when menu opens. */
        --sidebar-peek-width: calc(72px * var(--imgScale));
        --sidebar-panel-width: min(100vw, calc(460px * var(--imgScale)));
    }
    /* When drawer closed, header must not stretch to full viewport so post content is not overlayed. */
    #header:has(.menu[isopen="false"]) {
        height: auto;
        max-height: calc(55px * var(--imgScale));
        min-height: 0;
    }
    /* Drop Sign in / Join and hide desktop navbar logo and search bar on mobile. */
    .navbar-button,
    .search-bar-wrapper,
    .navbar-logo {
        display: none;
    }
    .navbar-mobile, .search-icon-wrapper-mobile, .mobile-logo {
        display: flex;
    }
    .menu {
        left: 0;
    }

    .menu[isopen="false"] .menu-content {
        display: none;
    }

    .menu[isopen="true"] .menu-content {
        display: flex;
    }

    .menu[isopen="false"] {
        width: 100%;
        min-width: 100%;
        max-width: 100vw;
        transform: translateX(0);
        /* Full-width fixed layer must not eat clicks on the page below the bar (ISSUES-LIST drawer overlap). */
        pointer-events: none;
    }

    .menu[isopen="false"] .menu-top,
    .menu[isopen="false"] .menu-top .mobile-logo,
    .menu[isopen="false"] .menu-top .menu-and-search-wrapper,
    .menu[isopen="false"] .menu-top .menu-button,
    .menu[isopen="false"] .menu-top .search-icon-wrapper-mobile {
        pointer-events: auto;
    }

    .menu[isopen="true"] {
        width: 100%;
        max-width: 100vw;
        transform: translateX(0);
        pointer-events: auto;
    }

    /* Tablet + mobile: drawer glyph first (left), logo fills center, search pinned right. */
    .menu-top {
        justify-content: flex-start;
        align-items: stretch;
        box-sizing: border-box;
        padding-left: 0;
        flex-direction: row;
        flex-wrap: nowrap;
    }

    .menu-and-search-wrapper {
        margin-left: auto;
        margin-right: 0;
        box-sizing: border-box;
        display: flex;
        align-items: stretch;
        flex-shrink: 0;
        width: auto;
        min-width: 0;
        justify-content: flex-end;
    }

    .mobile-logo {
        flex: 1 1 auto;
        min-width: 0;
        align-items: center;
        padding-left: calc(10px * var(--imgScale));
        text-decoration: none;
        color: var(--text-color);
    }

    .mobile-logo img {
        object-fit: scale-down;
        width: auto;
        max-width: min(100%, calc(100vw - 200px));
        height: calc(22px * var(--logo-scale));
    }

    /* Keep search then menu in natural order so flow matches desktop right-side controls. */
    .search-icon-wrapper-mobile {
        display: flex;
        justify-content: center;
        align-items: center;
        padding-left: 0;
        padding-right: 0;
        border: none;
        background-color: transparent;
        position: relative;
        left: 0;
        min-width: calc(68px * var(--imgScale));
        width: calc(68px * var(--imgScale));
        border-left: 1px solid var(--text-color);
        border-right: none;
        order: 0;
        box-sizing: border-box;
    }

    .search-icon-wrapper-mobile svg {
        width: calc(24px * var(--imgScale));
        height: calc(24px * var(--imgScale));
    }

    .menu-button {
        position: relative;
        left: 0;
        width: calc(68px * var(--imgScale));
        min-width: calc(68px * var(--imgScale));
        padding: 0;
        margin: 0;
        border: none !important;
        border-left: 0 !important;
        border-right: 1px solid var(--text-color) !important;
        background-color: transparent;
        box-sizing: border-box;
    }

    .menu-glyph {
        position: relative;
        left: 0;
        transform: none;
        width: calc(50px * var(--imgScale));
        height: calc(50px * var(--imgScale));
        overflow: visible;
    }

    .nav {
        padding: calc(32px * var(--imgScale)) calc(20px * var(--imgScale));
        row-gap: clamp(calc(14px * var(--imgScale)), 2.2vw, calc(24px * var(--imgScale)));
        justify-content: flex-start;
        align-items: flex-start;
    }

    .nav li a,
    .nav li .links-label {
        font-size: clamp(calc(28px * var(--imgScale)), 4.8vw, calc(40px * var(--imgScale)));
        line-height: 1.08;
    }
}

@media (max-width: 767px) {

    /* ≤1023 rules already size menu/search + order; mobile-only tweaks below. */
    .mobile-logo {
        padding-left: 20px;
        min-height: calc(50px * var(--imgScale));
    }

    .mobile-logo img {
        height: calc(24px * var(--logo-scale));
        max-width: calc(100vw - 130px);
    }

    .nav {
        padding: calc(22px * var(--imgScale)) calc(16px * var(--imgScale));
        row-gap: calc(14px * var(--imgScale));
    }

    .nav li a,
    .nav li .links-label {
        font-size: clamp(calc(24px * var(--imgScale)), 7.2vw, calc(34px * var(--imgScale)));
        line-height: 1.05;
    }

    .secondary-links {
        grid-template-columns: 1fr;
        gap: calc(10px * var(--imgScale));
    }

    .secondary-links li a {
        font-size: clamp(calc(16px * var(--imgScale)), 4.3vw, calc(20px * var(--imgScale))) !important;
    }

    /* Search: full-width dropdown and bar when open. */
    .custom-search {
        width: 100%;
    }

    .search-bar-wrapper {
        width: 100%;
        height: calc(50px * var(--imgScale));
        border-left: none;
        border-bottom: 1px solid var(--text-color);
    }

    .search-input {
        padding: 14px 30px;
    }

    .custom-search .grid {
        padding-top: calc(30px * var(--imgScale));
        padding-bottom: calc(30px * var(--imgScale));
        max-height: 70dvh;
    }

    /* Content starts below top bar; prevents navbar overlaying post (ISSUES-LIST navbar). */
    .site-content {
        padding-top: calc(50px * var(--imgScale));
    }

    /* Announcement: position below top bar on mobile. */
    #announcement-bar-root {
        transform: translateY(calc(50px * var(--imgScale)));
    }

    #announcement-bar-root .gh-announcement-bar {
        padding: 12px 30px;
    }

    #announcement-bar-root .gh-announcement-bar-content {
        padding: 0px 30px;
    }
}

@media (max-width: 479px) {
    /* Search: tighter padding on small mobile. */
    .search-input {
        padding: calc(14px * var(--imgScale)) calc(18px * var(--imgScale));
    }

    .custom-search .grid {
        padding-top: calc(18px * var(--imgScale));
        padding-bottom: calc(18px * var(--imgScale));
    }

    /* Announcement: tighter padding on small mobile. */
    #announcement-bar-root .gh-announcement-bar {
        padding: calc(12px * var(--imgScale)) calc(18px * var(--imgScale));
    }

    #announcement-bar-root .gh-announcement-bar-content {
        padding: 0px calc(18px * var(--imgScale));
    }
}
