/* Layout refinements, loaded after the original Sass bundle and component styles.
   Authored CSS: no separate Sass build is needed for this file. */
:root {
    --navigation-height: calc(64px + env(safe-area-inset-bottom, 0px));
}

body { gap: 0; color: #222; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid #0071c1;
    outline-offset: 3px;
}
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.skip-link {
    position: fixed;
    top: -100px;
    left: 16px;
    z-index: 2100;
    padding: 12px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.skip-link:focus { top: 12px; }
.mobile-masthead, .mobile-panel-heading, .panel-close { display: none; }

/* Keep the two independent, familiar desktop sidebars. */
#site-navigation { max-height: 100dvh; }
#site-navigation > .column {
    width: 220px;
    font-size: 13px;
    scrollbar-width: thin;
    scrollbar-color: #d1d1d1 transparent;
    overscroll-behavior: contain;
}
#site-navigation > .column.secondary { width: 300px; }
#site-navigation > .column > .sidebar-title {
    font-size: 14px;
    margin-bottom: 24px;
}
#site-navigation > .column > h2 { color: #6b6b6b; opacity: 1; }
#site-navigation > .column > a { min-height: 38px; border-radius: 6px; flex-shrink: 0; }
#site-navigation > .column > a:hover:not(.active) { background: #eee; }
#site-navigation > .column > a:active { top: 0; left: 0; }
#site-navigation > .column > a.card { padding: 8px 12px; }
#site-navigation .card > .column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 12px;
    width: 100%;
    min-width: 0;
    line-height: 1.45;
}
#site-navigation .card .title { grid-column: 1 / -1; overflow-wrap: anywhere; }
#site-navigation .card .meta { font-size: 12px; color: #737373; }
#site-navigation .card .right { position: static; font-size: 11px; color: #737373; }
#site-navigation .card.active .meta, #site-navigation .card.active .right { color: #ddd; }
#site-navigation .bottom_bar {
    position: static;
    margin: 20px -16px -16px;
    flex-shrink: 0;
}
#site-navigation .post-search {
    position: sticky;
    top: -16px;
    z-index: 1;
    background: #fafafa;
    padding: 8px 0 12px;
    flex-shrink: 0;
}
.post-search input {
    width: 100%;
    min-width: 0;
    border: 1px solid #dedede;
    border-radius: 6px;
    background: white;
    padding: 9px 10px;
    color: #222;
    font: inherit;
}
.post-search input::placeholder { color: #737373; }
.search-status { padding: 4px 12px 12px; color: #666; font-size: 12px; }

/* Reading spacing, including the block editor's read-only renderer. */
#site-body { min-width: 0; margin-bottom: 6rem; }
#site-body > article.content {
    width: 100%;
    min-width: 0;
    padding: 0 !important;
}
.page-content-normal {
    max-width: 740px;
    margin: clamp(3rem, 7vw, 7rem) auto;
    padding: 0 32px;
    line-height: 1.7;
}
.page-header .title { margin: 0 0 8px; line-height: 1.2; }
.page-header .meta { font-size: 14px; color: #737373; }
.page-content-normal > .content { padding-top: 20px; }
.page-content-normal .bed-root.bed-viewer .richish {
    padding: 0;
    font-size: inherit;
    line-height: 1.7;
}
.page-content-normal .content a { color: #0071c1; text-decoration: underline; text-underline-offset: 3px; }
.page-content-normal .content figure, .page-content-normal .content pre { margin-inline: 0; }
.page-content-normal .content iframe { max-width: 100%; }
.comment-entry > .header { flex-wrap: wrap; gap: 2px 8px; }
.comment-entry .body { padding-top: 8px; min-width: 0; }
.sxs:first-child { margin-top: 0; }

@media (min-width: 951px) and (max-width: 1400px) {
    #site-navigation > .column.primary { width: 190px; }
    #site-navigation > .column.secondary { width: 260px; }
    .page-content-normal { padding-inline: 28px; }
}

@media (max-width: 950px) {
    body { display: block; min-height: 100dvh; }
    body.navigation-open { overflow: hidden; }
    .mobile-masthead {
        display: flex;
        min-height: 60px;
        align-items: center;
        padding: calc(16px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-left, 0px)) 16px;
        border-bottom: 1px solid #eee;
    }
    .mobile-masthead a { font-size: 14px; font-weight: 700; text-decoration: none; color: #222; }
    #site-body {
        position: static;
        display: block;
        overflow: visible;
        margin: 0;
        padding-bottom: calc(var(--navigation-height) + 32px);
    }
    #site-body > article.content { max-width: 100%; }
    .page-content-normal { margin: 0 auto; padding: 30px 20px; font-size: 16px; }
    .page-header .title { font-size: 30px; overflow-wrap: anywhere; }
    .page-header .meta { font-size: 13px; }
    .page-content-normal > .content { padding-top: 14px; }
    .content pre { border-radius: 5px; }
    .content figure { margin-inline: 0; }
    .sxs { margin-block: 32px; gap: 12px; }
    .sxs > .sxs-title { opacity: 1; color: #737373; font-size: 14px; }
    .sxs > .sxs-title:empty { display: none; }
    .comment-system .comment-header { margin: 48px 0; }
    .comment-entry { padding-left: 0; padding-top: 0; margin-bottom: 32px; }
    .comment-entry > .avatar img { width: 36px; height: 36px; }
    .comment-entry > .header { min-height: 40px; padding-left: 48px; align-items: center; column-gap: 8px; }
    .comment-entry > .header > .date { width: 100%; font-size: 12px; line-height: 1.4; }
    .comment-entry .body { padding-top: 12px; }
    .comment-system > h2 { color: #666; }
    .add-comment .bed-editor { padding: 12px; }

    /* Hide inactive panels completely: they cannot cover content or receive focus. */
    #site-navigation {
        display: none;
        position: fixed;
        inset: 0 0 var(--navigation-height);
        max-height: none;
        overflow: hidden;
        touch-action: auto;
        background: #fafafa;
        z-index: 1000;
    }
    #site-navigation.primary, #site-navigation.secondary { display: block; }
    #site-navigation > .column.primary, #site-navigation > .column.secondary {
        display: none;
        position: absolute;
        inset: 0;
        width: 100%;
        border: 0;
        margin: 0;
        padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
        opacity: 1;
        transition: none;
        overflow-y: auto;
        touch-action: pan-y;
        font-size: 15px;
    }
    #site-navigation.primary > .column.primary, #site-navigation.secondary > .column.secondary {
        display: flex;
        box-shadow: none;
    }
    #site-navigation > .column > a { min-height: 48px; flex-shrink: 0; }
    #site-navigation > .column > a.card { padding-block: 13px; }
    #site-navigation .card .meta { font-size: 13px; }
    #site-navigation > .column > .sidebar-title, .mobile-panel-heading {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        flex-shrink: 0;
        margin: 0 0 16px;
        font-weight: 700;
        font-size: 15px;
    }
    .panel-close {
        display: flex;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-color: #e2e2e2;
        color: #555;
        font-size: 18px;
    }
    #site-navigation .post-search { top: -16px; }
    .post-search input { min-height: 44px; font-size: 16px; }

    #appbar {
        height: var(--navigation-height);
        padding: 6px max(12px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
        border-top: 1px solid #e5e5e5;
        box-shadow: 0 -3px 16px #00000004;
        gap: 8px;
        z-index: 1100;
    }
    #appbar .button {
        flex: 1;
        max-width: 150px;
        min-height: 50px;
        justify-content: center;
        padding: 4px 8px;
        gap: 3px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        font-family: inherit;
        color: #555;
        line-height: 1.2;
    }
    #appbar .button icon { font-size: 22px; }
    #appbar .button span { font-size: 11px; color: #666; }
    #appbar .button.active { background: #f0f0f0; color: #111; }
    #appbar .button.active span { color: #111; font-weight: 600; }
    #appbar:has(#menu-toggle.active) .button:not(#menu-toggle) { background: transparent; }
}
