@keyframes site-header-button-icon-switched {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.15);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}
@keyframes site-header-primary-section-opened {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes site-header-secondary-section-opened {
    0% {
        opacity: 0;
        transform: translateY(-200%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes site-header-slide-in {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(0);
    }
}

#site_header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    color: var(--site-light-color);
    /* border-bottom: 3px solid var(--primary-site-color); */
    z-index: 100;

    &::before, &::after {
        position: absolute;
        left: 0;
        bottom: 0;
        right: 0;
        content: "";
        transition: opacity 0.2s ease-out;
    }
    &::before {
        top: 0;
        background-color: var(--primary-site-color);
    }
    &::after {
        border-bottom: 3px solid var(--primary-site-color);
    }
    &[data-state="fixed"] {
        animation: site-header-slide-in 0.2s ease-out;
    }
    &[data-state="floating"] {
        position: absolute;
    }
}
#site_header[aria-expanded="true"] {
    bottom: 0;
}
#site_header > .content-wrapper, #site_header > .content-wrapper > .content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;   
    flex-wrap: wrap;
    height: 100%;
    width: 100%;
}
#site_header > .content-wrapper {
    background-color: rgba(0, 0, 0, 0.15);
    flex-direction: column;
    justify-content: flex-start;
    flex-wrap: nowrap;
}
#site_header[aria-expanded="true"] > .content-wrapper > .content-wrapper {
    height: auto;
    flex: 0 0 auto;
}
#site_header[aria-expanded="true"] .section.secondary {
    height: 100%;
    flex: 1 1 auto;
    border-top: 1.5px solid transparent;
}
#site_header .persistent {
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
}
#site_header .home-link {
    font-style: italic;
    font-size: 1.25em;
    padding: var(--base-padding);
    margin-right: auto;
}
#site_header .home-link:has(> .icon) {
    font-weight: bold;
}
#site_header .home-link .embedded-icon {
    font-size: 0.5em;
    padding: 0 2px;
    transform: translateY(15%) rotate(15deg);
}
#site_header .home-link .embedded-icon:nth-of-type(2n) {
    transform: translateY(15%) rotate(-15deg);
}
#site_header .persistent .icon {
    padding-right: 12px;
}
#site_header button.menu-toggle {
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5em;
    padding: 8px 16px;
}
#site_header button.menu-toggle .icon {
    animation: site-header-button-icon-switched 0.4s ease-in-out;
}
#site_header button.menu-toggle .icon[hidden] {
    display: none;
}
#site_header .section {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-grow: 1;
    color: var(--site-light-color);
    transition: transform 0.25s ease-in;
}
#site_header ul.section {
    list-style: none;
    padding: 0;
    margin: 0;
}
#site_header .section.primary {
    /* flex-basis: 0; */
    /* padding-right: 16px; */
    /* animation: site-header-primary-section-opened 0.25s ease-in; */
}
#site_header .section.secondary {
    background-color: rgba(0, 0, 0, 0.5);
    /* font-size: 0.9em; */
    /* animation: site-header-secondary-section-opened 0.25s ease-in; */
}
#site_header .section.secondary .loading-error {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: rgb(from var(--site-light-color) r g b / 0.65);
    padding: 12px 24px;
}
#site_header .section.secondary .loading-error button.retry-load {
    /* color: var(--dark-highlight-site-color); */
    color: var(--site-light-color);
}

#site_header .section > .content-wrapper {
    display: flex;
    justify-content: flex-start;
    flex-wrap: nowrap;
    width: 100%;
}
#site_header .section.primary > .content-wrapper {
    justify-content: flex-end;
}

#site_header .section.primary :is(a, button.link-button) {
    padding: 16px;
}
/* #site_header .section li :is(a, button.link-button) {
    display: block;
} */
#site_header :is(a, button.link-button) {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.25s ease-in-out;
}
#site_header a:visited {
    color: inherit;
}
#site_header a:hover:not(:active):not(:focus):not([disabled]) {
    opacity: 0.75;
}
#site_header a:is(:active, :focus):not([disabled]) {
    opacity: 0.6;
}
#site_header .section.secondary .title {
    background-color: rgb(from var(--site-dark-color) r g b / 0.5);
    font-style: italic;
    text-decoration: none;
    padding: 12px 32px;
    /* padding: 12px 24px; */
}
#site_header .section.secondary a.title:not(:hover):not(:active) {
    opacity: 0.85;
}
#site_header .section.secondary :is(li, .loading-error) {
    flex-shrink: 0;
}
#site_header .section.secondary li {
    &:not(:last-child) > * {
        border-right: 1.5px solid transparent;
    }
    > * {
        padding: 12px 24px;
    }
}