/* Shared navigation; the chapter reader keeps its dedicated controls. */
.jd-header {
    --nav-bg: rgba(13, 14, 19, .94);
    --nav-panel: #191b23;
    --nav-border: #ffffff12;
    --nav-text: #f6f6f9;
    --nav-muted: #a1a4b2;
    position: sticky;
    top: 0;
    z-index: 1000;
    direction: ltr;
    color: var(--nav-text);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 8px 32px #0002;
    backdrop-filter: blur(20px)
}
.jd-header:after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(var(--jade-glow-rgb), 0.3333), transparent);
    pointer-events: none
}
.jd-header-inner {
    position: relative;
    width: min(1360px, calc(100% - 48px));
    height: 76px;
    margin: auto;
    display: flex;
    align-items: center;
    gap: 24px
}
.jd-header a {
    text-decoration: none
}
.jd-header button {
    cursor: pointer;
    font: inherit
}
.jd-header .jd-icon, .jd-header-menu svg {
    width: 20px;
    height: 20px;
    flex: none
}
.jd-header-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: none;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap
}
.jd-header-logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    border: 1px solid rgba(var(--jade-glow-rgb), 0.1686);
    background: linear-gradient(145deg, rgba(var(--jade-glow-rgb), 0.0824), #ffffff04);
    box-shadow: 0 4px 20px rgba(var(--jade-glow-rgb), 0.0627)
}
.jd-header-logo img {
    width: 36px;
    height: 36px;
    object-fit: contain
}
.jd-header-navigation {
    flex: none
}
.jd-header-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 5px;
    border: 1px solid var(--nav-border);
    border-radius: 15px;
    background: #ffffff03
}
.jd-header-links li {
    margin: 0;
    padding: 0;
    list-style: none
}
.jd-header-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 10px;
    color: var(--nav-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    transition: background .2s, color .2s
}
.jd-header-links a:hover {
    background: #ffffff08;
    color: var(--nav-text)
}
.jd-header-links a[aria-current="page"], .jd-header-links .current-menu-item > a {
    background: #eeeeee12;
    color: #fff;
}
.jd-header-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
    width: 320px;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--nav-border);
    border-radius: 13px;
    background: var(--nav-panel);
    color: var(--nav-muted);
    text-align: left;
    transition: border-color .2s, background .2s
}
.jd-header-search:hover {
    border-color: rgba(var(--jade-glow-rgb), 0.3765);
    background: #22242e
}
.jd-header-search > span {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px
}
.jd-header-search kbd {
    flex: none;
    padding: 3px 5px;
    border: 1px solid var(--nav-border);
    border-radius: 5px;
    color: var(--nav-muted);
    font-size: 10px;
    line-height: 1.2
}
.jd-header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: none;
    padding-left: 18px;
    border-left: 1px solid var(--nav-border)
}
.jd-header-icon, .jd-header .jd-account-trigger, .jd-header-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--nav-muted);
    transition: background .2s, color .2s, border-color .2s
}
.jd-header-icon:hover, .jd-header .jd-account-trigger:hover, .jd-header-menu:hover {
    background: var(--nav-panel);
    color: var(--nav-text);
    border-color: var(--nav-border)
}
.jd-header .jd-account-trigger {
    border-color: rgba(var(--jade-glow-rgb), 0.2118);
    background: rgba(var(--jade-glow-rgb), 0.051);
    color: var(--jade-accent)
}
.jd-header .jd-account-trigger svg {
    width: 20px;
    height: 20px
}
.jd-header .jd-account-popover {
    top: calc(100% + 20px);
    border-radius: 18px;
    box-shadow: 0 24px 60px #0006
}
.jd-header .jd-account-trigger[aria-expanded="true"] {
    background: var(--jade-primary);
    color: #fff;
    outline: none
}
.jd-header-menu, .jd-header-mobile-links {
    display: none
}
.jd-header :is(a,button):focus-visible {
    outline: 2px solid var(--jade-primary);
    outline-offset: 4px
}
.admin-bar .jd-header {
    top: 32px
}
html[data-theme="light"] .jd-header {
    --nav-bg: rgba(255, 255, 255, .94);
    --nav-panel: #f2f3f7;
    --nav-border: #17182315;
    --nav-text: #242633;
    --nav-muted: #636778;
    box-shadow: 0 8px 32px #24263308
}
html[data-theme="light"] .jd-header-search:hover {
    background: #e9ebf2
}
html[data-theme="light"] .jd-header-links {
    background: #17182303
}
html[data-theme="light"] .jd-header-links a:hover {
    background: #17182307
}
@media (max-width: 1150px) {
    .jd-header-inner {
        gap: 16px
    }

    .jd-header-search {
        width: 240px
    }

    .jd-header-search kbd {
        display: none
    }

    .jd-header-actions {
        padding-left: 12px
    }

    .jd-header-links a {
        padding: 9px 11px
    }
}
@media (max-width: 980px) {
    .jd-header-inner {
        gap: 12px
    }

    .jd-header-navigation {
        display: none;
        position: absolute;
        left: 0;
        right: 0;
        top: calc(100% + 8px);
        padding: 14px;
        background: var(--nav-bg);
        border: 1px solid var(--nav-border);
        border-radius: 18px;
        box-shadow: 0 20px 40px #0005
    }

    .jd-header-navigation.is-open {
        display: block
    }

    .jd-header-links {
        border: 0;
        background: none;
        padding: 0;
        display: grid;
        gap: 4px
    }

    .jd-header-links a {
        padding: 12px;
        font-size: 14px
    }

    .jd-header-mobile-links {
        display: grid;
        gap: 4px;
        padding-top: 10px;
        margin-top: 10px;
        border-top: 1px solid var(--nav-border)
    }

    .jd-header-mobile-links :is(a,button) {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px;
        color: var(--nav-muted);
        border: 0;
        background: none;
        border-radius: 10px;
        font-size: 14px;
        text-align: left
    }

    .jd-header-mobile-links :is(a,button):hover {
        background: var(--nav-panel);
        color: var(--nav-text)
    }

    .jd-header-menu {
        display: flex;
        border-color: var(--nav-border)
    }

    .jd-header-search {
        width: 280px
    }

    .jd-header-brand {
        font-size: 16px
    }
}
@media (max-width: 600px) {
    .jd-header-inner {
        width: calc(100% - 24px);
        height: 66px;
        gap: 7px
    }

    .jd-header-logo {
        width: 36px;
        height: 36px;
        border-radius: 11px
    }

    .jd-header-logo img {
        width: 29px;
        height: 29px
    }

    .jd-header-brand {
        gap: 7px;
        font-size: 13px;
        min-width: 0;
        flex: 1
    }

    .jd-header-brand-name {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px
    }

    .jd-header-search {
        flex: none;
        margin-left: auto;
        width: 34px;
        height: 36px;
        padding: 0;
        justify-content: center;
        background: none;
        border-color: transparent
    }

    .jd-header-search > span {
        display: none
    }

    .jd-header-actions {
        gap: 4px;
        border: 0;
        padding: 0
    }

    .jd-header-icon, .jd-header .jd-account-trigger, .jd-header-menu {
        width: 34px;
        height: 36px;
        border-radius: 10px
    }

    .jd-header-bookmarks, .jd-header-updates {
        display: none
    }

    .jd-header .jd-account-popover {
        position: fixed;
        right: 12px;
        top: 76px;
        width: calc(100vw - 24px);
        max-width: 420px
    }

    .admin-bar .jd-header .jd-account-popover {
        top: 122px
    }

    .admin-bar .jd-header {
        top: 46px
    }
}
@media (prefers-reduced-motion: reduce) {
    .jd-header * {
        transition: none !important
    }
}

/* The body must not become a separate sticky scroll container under the WP toolbar. */
body:has(.jd-header) {
    overflow-x: clip;
    overflow-y: visible
}
.admin-bar .jd-header {
    top: var(--jd-admin-offset, 32px)
}
@media (max-width: 782px) {
    .admin-bar .jd-header {
        top: var(--jd-admin-offset, 46px)
    }
}
@media (max-width: 600px) {
    .admin-bar .jd-header .jd-account-popover {
        top: calc(76px + var(--jd-admin-offset, 46px))
    }
}
