/* =========================================================
   Jackson County Historical Society header navigation
========================================================= */

:root {
    --jchs-nav-background: #0b0a08;
    --jchs-nav-text: #ffffff;
    --jchs-nav-muted: rgba(255, 255, 255, 0.74);
    --jchs-nav-gold: #bd8e28;
    --jchs-nav-gold-light: #ddb654;
    --jchs-nav-red: #6f2d25;
    --jchs-nav-border: rgba(255, 255, 255, 0.12);
    --jchs-nav-height: 86px;
    --jchs-nav-width: 1480px;
}

/* =========================================================
   General header
========================================================= */

.site-header,
.site-header * {
    box-sizing: border-box;
}

.site-header {
    position: relative;
    z-index: 5000;
    width: 100%;
    color: var(--jchs-nav-text);
    background: var(--jchs-nav-background);
    border-bottom:
        1px solid rgba(189, 142, 40, 0.38);
}

.nav-container {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: min(
        calc(100% - 48px),
        var(--jchs-nav-width)
    );
    min-height: var(--jchs-nav-height);
    margin: 0 auto;
}

/* =========================================================
   Brand
========================================================= */

.brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 13px;
    min-width: 230px;
    color: var(--jchs-nav-text);
    text-decoration: none;
}

.brand:hover,
.brand:focus-visible {
    color: var(--jchs-nav-text);
    text-decoration: none;
}

.brand:focus-visible {
    outline:
        2px solid var(--jchs-nav-gold-light);
    outline-offset: 5px;
}

.brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.brand-copy {
    display: grid;
    gap: 3px;
    line-height: 1;
}

.brand-copy strong {
    color: var(--jchs-nav-gold-light);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.brand-copy small {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.49rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* =========================================================
   Primary navigation
========================================================= */

.primary-navigation {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    min-width: 0;
}

.primary-navigation > .nav-link,
.nav-dropdown-heading > .nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--jchs-nav-height);
    padding: 0 clamp(11px, 1.15vw, 19px);
    color: var(--jchs-nav-text);
    background: transparent;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.12em;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
    transition:
        color 150ms ease,
        background-color 150ms ease;
}

.primary-navigation > .nav-link::after,
.nav-dropdown-heading > .nav-link::after {
    position: absolute;
    right: 14px;
    bottom: 16px;
    left: 14px;
    height: 2px;
    content: "";
    background: var(--jchs-nav-gold);
    opacity: 0;
    transform: scaleX(0);
    transform-origin: center;
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.primary-navigation > .nav-link:hover,
.primary-navigation > .nav-link:focus-visible,
.nav-dropdown-heading > .nav-link:hover,
.nav-dropdown-heading > .nav-link:focus-visible {
    color: var(--jchs-nav-gold-light);
    text-decoration: none;
    outline: none;
}

.primary-navigation > .nav-link.active::after,
.nav-dropdown-heading > .nav-link.active::after,
.primary-navigation > .nav-link:hover::after,
.primary-navigation > .nav-link:focus-visible::after,
.nav-dropdown-heading > .nav-link:hover::after,
.nav-dropdown-heading > .nav-link:focus-visible::after {
    opacity: 1;
    transform: scaleX(1);
}

/* =========================================================
   Membership dropdown heading
========================================================= */

.nav-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.nav-dropdown-heading {
    display: flex;
    align-items: stretch;
}

.nav-membership-link {
    padding-right: 5px !important;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    min-height: var(--jchs-nav-height);
    margin: 0;
    padding: 0 5px 0 0;
    color: var(--jchs-nav-text);
    background: transparent;
    border: 0;
    border-radius: 0;
    font: inherit;
    cursor: pointer;
    transition: color 150ms ease;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown-open .nav-dropdown-toggle {
    color: var(--jchs-nav-gold-light);
    outline: none;
}

.nav-dropdown-toggle:focus-visible {
    box-shadow:
        inset 0 -2px 0
        var(--jchs-nav-gold);
}

.nav-dropdown-arrow {
    display: block;
    width: 6px;
    height: 6px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition:
        margin-top 150ms ease,
        transform 150ms ease;
}

.nav-dropdown-open
.nav-dropdown-arrow {
    margin-top: 4px;
    transform: rotate(225deg);
}

.nav-dropdown-open
.nav-membership-link {
    color: var(--jchs-nav-gold-light);
}

/* =========================================================
   Desktop Membership dropdown
========================================================= */

.nav-dropdown-menu {
    position: absolute;
    z-index: 5100;
    top: 100%;
    left: 0;
    width: 235px;
    margin: 0;
    padding: 6px;
    color: #ffffff;
    background: #bd8e28;
    border: 1px solid #d6ae52;
    box-shadow:
        0 16px 32px rgba(0, 0, 0, 0.38);
}

/*
 * JavaScript applies the hidden attribute when the menu is closed.
 */
.nav-dropdown-menu[hidden] {
    display: none !important;
}

.nav-dropdown-menu a {
    display: block;
    width: 100%;
    padding: 13px 15px;
    color: #ffffff;
    background: transparent;
    border: 0;
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.1em;
    text-decoration: none;
    text-transform: uppercase;
    text-underline-offset: 4px;
    white-space: nowrap;
    transition: color 150ms ease;
}

.nav-dropdown-menu a + a {
    border-top: 1px solid rgba(255, 255, 255, 0.4);
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
    padding-left: 15px;
    color: #111111;
    background: transparent;
    text-decoration: underline;
    text-decoration-color: #111111;
    text-decoration-thickness: 1px;
    outline: none;
}

.nav-dropdown-menu .nav-dropdown-logout {
    color: #ffffff;
}

.nav-dropdown-menu .nav-dropdown-logout:hover,
.nav-dropdown-menu .nav-dropdown-logout:focus-visible {
    color: #111111;
}

/*
 * Keep the Membership heading highlighted while its submenu
 * is open or hovered.
 */
.nav-dropdown-open
.nav-membership-link,
.nav-dropdown:hover
.nav-membership-link {
    color: var(--jchs-nav-gold-light);
}

/* =========================================================
   Desktop hover behavior
========================================================= */

@media (min-width: 981px) {
    /*
     * Show the submenu whenever the pointer is over either the
     * Membership heading or the submenu itself.
     *
     * The !important is necessary because JavaScript adds the
     * standard HTML hidden attribute while the menu is closed.
     */
    .nav-dropdown:hover
    > .nav-dropdown-menu {
        display: block !important;
    }

    /*
     * Keep the menu open when keyboard focus is inside it.
     */
    .nav-dropdown:focus-within
    > .nav-dropdown-menu {
        display: block !important;
    }

    /*
     * Rotate the arrow while hovering or focusing within the menu.
     */
    .nav-dropdown:hover
    .nav-dropdown-arrow,
    .nav-dropdown:focus-within
    .nav-dropdown-arrow {
        margin-top: 4px;
        transform: rotate(225deg);
    }

    /*
     * The small overlap prevents a gap between the navigation
     * heading and dropdown that could cause the menu to close
     * while moving the pointer downward.
     */
    .nav-dropdown-menu {
        top: calc(100% - 1px);
    }
}

/* =========================================================
   Mobile menu button
========================================================= */

.menu-toggle {
    display: none;
    align-self: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    margin: 0;
    padding: 11px;
    color: var(--jchs-nav-text);
    background: transparent;
    border:
        1px solid rgba(255, 255, 255, 0.28);
    border-radius: 0;
    cursor: pointer;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
    border-color: var(--jchs-nav-gold);
    outline: none;
}

.menu-toggle-line {
    display: block;
    width: 100%;
    height: 2px;
    margin: 5px 0;
    background: currentColor;
    transition:
        opacity 150ms ease,
        transform 150ms ease;
}

.menu-toggle[aria-expanded="true"]
.menu-toggle-line:nth-child(1) {
    transform:
        translateY(7px)
        rotate(45deg);
}

.menu-toggle[aria-expanded="true"]
.menu-toggle-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle[aria-expanded="true"]
.menu-toggle-line:nth-child(3) {
    transform:
        translateY(-7px)
        rotate(-45deg);
}

/* =========================================================
   Medium desktop sizes
========================================================= */

@media (max-width: 1220px) {
    .nav-container {
        width: calc(100% - 30px);
    }

    .brand {
        min-width: 215px;
    }

    .primary-navigation > .nav-link,
    .nav-dropdown-heading > .nav-link {
        padding-right: 10px;
        padding-left: 10px;
        font-size: 0.62rem;
        letter-spacing: 0.09em;
    }

    .nav-membership-link {
        padding-right: 3px !important;
    }

    .nav-dropdown-toggle {
        width: 22px;
    }
}

/* =========================================================
   Mobile and tablet navigation
========================================================= */

@media (max-width: 980px) {
    :root {
        --jchs-nav-height: 76px;
    }

    .site-header {
        position: relative;
    }

    .nav-container {
        position: relative;
        align-items: center;
        width: calc(100% - 28px);
    }

    .brand {
        min-width: 0;
        min-height: var(--jchs-nav-height);
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-copy strong {
        font-size: 0.8rem;
    }

    .menu-toggle {
        display: block;
    }

    .primary-navigation {
        position: absolute;
        z-index: 5200;
        top: 100%;
        right: -14px;
        left: -14px;
        display: none;
        align-items: stretch;
        flex-direction: column;
        padding: 9px 14px 16px;
        background: var(--jchs-nav-background);
        border-top:
            1px solid rgba(189, 142, 40, 0.45);
        border-bottom:
            3px solid var(--jchs-nav-gold);
        box-shadow:
            0 18px 30px rgba(0, 0, 0, 0.38);
    }

    .primary-navigation.navigation-open {
        display: flex;
    }

    .primary-navigation > .nav-link {
        justify-content: flex-start;
        width: 100%;
        min-height: 48px;
        padding: 0 14px;
        border-bottom:
            1px solid var(--jchs-nav-border);
        font-size: 0.7rem;
    }

    .primary-navigation > .nav-link::after {
        top: 12px;
        right: auto;
        bottom: 12px;
        left: 0;
        width: 2px;
        height: auto;
        transform: scaleY(0);
    }

    .primary-navigation >
        .nav-link.active::after,
    .primary-navigation >
        .nav-link:hover::after,
    .primary-navigation >
        .nav-link:focus-visible::after {
        transform: scaleY(1);
    }

    /* Membership mobile heading */

    .nav-dropdown {
        display: block;
        width: 100%;
        border-bottom:
            1px solid var(--jchs-nav-border);
    }

    .nav-dropdown-heading {
        display: flex;
        width: 100%;
    }

    .nav-dropdown-heading >
        .nav-link {
        flex: 1;
        justify-content: flex-start;
        min-height: 48px;
        padding: 0 0 0 14px;
        font-size: 0.7rem;
    }

    .nav-dropdown-heading >
        .nav-link::after {
        top: 12px;
        right: auto;
        bottom: 12px;
        left: 0;
        width: 2px;
        height: auto;
        transform: scaleY(0);
    }

    .nav-dropdown-heading >
        .nav-link.active::after,
    .nav-dropdown-heading >
        .nav-link:hover::after,
    .nav-dropdown-heading >
        .nav-link:focus-visible::after {
        transform: scaleY(1);
    }

    .nav-dropdown-toggle {
        width: 50px;
        min-height: 48px;
        padding: 0;
        border-left:
            1px solid var(--jchs-nav-border);
    }



   /* Membership mobile submenu */

.nav-dropdown-menu {
    position: static;
    width: 100%;
    margin: 0;
    padding: 6px;
    background: #bd8e28;
    border: 1px solid #d6ae52;
    box-shadow: none;
}

.nav-dropdown-menu a {
    padding: 13px 15px;
    color: #ffffff;
    background: #bd8e28;
    border: 0;
    font-size: 0.64rem;
}

.nav-dropdown-menu a + a {
    border-top:
        1px solid rgba(255, 255, 255, 0.4);
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus-visible {
    padding-left: 19px;
    color: #ffffff;
    background: #6f2d25;
}



/* =========================================================
   Small mobile devices
========================================================= */

@media (max-width: 560px) {
    :root {
        --jchs-nav-height: 70px;
    }

    .nav-container {
        width: calc(100% - 20px);
    }

    .primary-navigation {
        right: -10px;
        left: -10px;
        padding-right: 10px;
        padding-left: 10px;
    }

    .brand {
        gap: 9px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
    }

    .brand-copy strong {
        font-size: 0.7rem;
        letter-spacing: 0.035em;
    }

    .brand-copy small {
        font-size: 0.43rem;
    }

    .menu-toggle {
        width: 43px;
        height: 43px;
        padding: 10px;
    }
}

/* =========================================================
   Reduced motion
========================================================= */

@media (prefers-reduced-motion: reduce) {
    .site-header *,
    .site-header *::before,
    .site-header *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
