/* =========================================
   SHRINEFORSOULS
   GLOBAL SITE HEADER
========================================= */

:root {

    --site-header-background:
        #25291f;

    --site-header-text:
        #e9e8df;

    --site-header-soft:
        #b8bbb0;

    --site-header-accent:
        #929982;

    --site-header-border:
        #565d48;

}


/* =========================================
   HEADER
========================================= */

.top-bar {

    width:
        100%;

    padding:
        18px 28px;

    display:
        flex;

    align-items:
        center;

    flex-wrap:
        wrap;

    gap:
        24px;

    background-color:
        var(--site-header-background);

    border-bottom:
        1px solid
        var(--site-header-border);

}


/* =========================================
   LOGO
========================================= */

.site-logo {

    flex-shrink:
        0;

    color:
        var(--site-header-text);

    font-size:
        21px;

    font-weight:
        bold;

    text-decoration:
        none;

    white-space:
        nowrap;

}


/* =========================================
   GLOBAL SEARCH
========================================= */

.top-search-form {

    width:
        100%;

    max-width:
        560px;

    flex:
        1 1 300px;

    margin-right:
        auto;

}


.top-search-input {

    width:
        100%;

    padding:
        8px 12px;

    border:
        1px solid
        var(--site-header-border);

    border-radius:
        0;

    background-color:
        rgba(
            255,
            255,
            255,
            0.03
        );

    color:
        var(--site-header-text);

    font-family:
        inherit;

    font-size:
        14px;

    outline:
        none;

}


.top-search-input::placeholder {

    color:
        var(--site-header-soft);

}


.top-search-input:focus {

    border-color:
        var(--site-header-accent);

}


/* =========================================
   NAVIGATION
========================================= */

.top-navigation {

    margin-left:
        auto;

    display:
        flex;

    align-items:
        center;

    justify-content:
        flex-end;

    flex-wrap:
        wrap;

    gap:
        22px;

    flex-shrink:
        0;

}


.completed-navigation {

    display:
        flex;

    align-items:
        center;

    flex-wrap:
        wrap;

    gap:
        22px;

}


.completed-navigation.hidden {

    display:
        none;

}


.top-navigation a,
.logout-button {

    color:
        var(--site-header-text);

    font-family:
        inherit;

    font-size:
        14px;

    text-decoration:
        none;

    white-space:
        nowrap;

}


.top-navigation a:hover,
.logout-button:hover,
.top-navigation a.active {

    color:
        var(--site-header-accent);

}


.top-navigation a.active {

    padding-bottom:
        4px;

    border-bottom:
        1px solid
        var(--site-header-accent);

}


.logout-button {

    padding:
        0;

    border:
        none;

    background:
        none;

    cursor:
        pointer;

}


/* =========================================
   MOBILE
========================================= */

@media (
    max-width: 760px
) {

    .top-bar {

        padding:
            16px 18px;

        flex-direction:
            column;

        align-items:
            flex-start;

        gap:
            14px;

    }


    .top-search-form {

        order:
            initial;

        width:
            100%;

        max-width:
            none;

        flex:
            none;

        margin-right:
            0;

    }


    .top-navigation {

        width:
            100%;

        margin-left:
            0;

        justify-content:
            flex-start;

        gap:
            12px 16px;

    }


    .completed-navigation {

        gap:
            12px 16px;

    }

}

/* =========================================
   GLOBAL HEADER — SEARCH LINK
========================================= */

.site-search-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.site-search-link span {
    display: inline-block;
    font-size: 18px;
    line-height: 1;
    font-weight: normal;
}

/* =========================================
   STICKY HEADER — STORY READER
========================================= */

body.sfs-reader-page > .top-bar {
    position: sticky;
    top: 0;
    z-index: 500;

    background-color:
        var(--site-header-background);

    box-shadow:
        0 5px 18px rgba(0, 0, 0, 0.12);
}

/* Keep targeted Whispers visible below the header. */
body.sfs-reader-page [id^="whisper-"] {
    scroll-margin-top: 115px;
}

/* Compact reader navigation on mobile. */
@media (max-width: 760px) {

    body.sfs-reader-page > .top-bar {
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
        gap: 9px 12px;
    }

    body.sfs-reader-page > .top-bar .site-logo {
        font-size: 18px;
    }

    body.sfs-reader-page > .top-bar
    .top-navigation:not([hidden]) {
        width: 100%;
        flex: 1 1 100%;
        margin: 0;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 14px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }

    body.sfs-reader-page > .top-bar
    .top-navigation a,
    body.sfs-reader-page > .top-bar
    .logout-button {
        font-size: 12px;
        flex-shrink: 0;
    }

    body.sfs-reader-page [id^="whisper-"] {
        scroll-margin-top: 135px;
    }
}


/* =========================================
   POINT 33M.5
   GLOBAL MOBILE HORIZONTAL NAVIGATION
========================================= */

@media (max-width: 760px) {

    .top-bar,
    body.sfs-reader-page > .top-bar {

        position: sticky;
        top: 0;
        z-index: 900;

        display: flex;

        flex-direction: column;
        align-items: stretch;

        flex-wrap: nowrap;

        width: 100%;

        gap: 8px;

        padding: 10px 12px;

        background:
            var(--site-header-background);

    }


    .top-bar > .site-logo {

        align-self: flex-start;

        font-size: 19px;

        line-height: 1.3;
    }


    /* =====================================
       HORIZONTAL SCROLLING NAVIGATION
    ====================================== */

    .top-bar > .top-navigation:not([hidden]),
    body.sfs-reader-page
    > .top-bar
    > .top-navigation:not([hidden]) {

        display: flex !important;

        flex-direction: row;
        flex-wrap: nowrap !important;

        justify-content: flex-start;
        align-items: center;

        flex: 0 0 auto !important;

        width: 100% !important;
        max-width: 100%;

        min-width: 0;

        margin: 0 !important;

        padding: 5px 0 7px;

        gap: 18px;

        overflow-x: auto !important;
        overflow-y: hidden;

        overscroll-behavior-x: contain;

        -webkit-overflow-scrolling: touch;

        scrollbar-width: none;

        scroll-snap-type: x proximity;
    }


    .top-bar
    > .top-navigation::-webkit-scrollbar {

        display: none;
    }


    /* Preserve hidden public/private
       navigation states. */

    .top-bar
    > .top-navigation[hidden] {

        display: none !important;
    }


    /* =====================================
       NAVIGATION ITEMS
    ====================================== */

    .top-bar
    > .top-navigation
    > a,

    .top-bar
    > .top-navigation
    > .account-menu {

        flex: 0 0 auto;

        min-width: max-content;

        scroll-snap-align: start;
    }


    .top-bar
    > .top-navigation
    > a,

    .top-bar
    .account-menu-toggle {

        font-size: 13px;

        line-height: 1.5;

        white-space: nowrap;
    }


    .top-bar
    .completed-navigation {

        display: flex;

        flex-wrap: nowrap;

        flex: 0 0 auto;

        gap: 18px;
    }


    /* =====================================
       DROPDOWN MENUS

       Use viewport positioning so that
       horizontal scrolling does not
       cut off My Content / Account.
    ====================================== */

    .top-bar
    .account-menu-dropdown {

        position: fixed !important;

        top: var(
            --sfs-mobile-dropdown-y,
            95px
        ) !important;

        left: var(
            --sfs-mobile-dropdown-x,
            12px
        ) !important;

        right: auto !important;

        z-index: 5000 !important;

        width: min(
            240px,
            calc(100vw - 24px)
        );

        max-height: min(
            65dvh,
            450px
        );

        overflow-y: auto;

        overscroll-behavior: contain;
    }


    /* Keep reader-specific anchors
       below the compact header. */

    body.sfs-reader-page
    [id^="whisper-"] {

        scroll-margin-top: 120px;
    }

}