/* ==================================================
   CIVIC HORIZON INDEX V2
   HEADER
================================================== */


/* ==================================================
   HEADER SHELL
================================================== */

.site-header {
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid #d9e2ec;
    background: #ffffff;
}

.site-header__container {
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(1180px, calc(100% - 48px));
    min-height: 72px;
    margin: 0 auto;
}


/* ==================================================
   BRAND
================================================== */

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    color: inherit;
    text-decoration: none;
}

.site-brand__logo {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    padding: 2px;
    border: 1px solid #d9e2ec;
    border-radius: 50%;
    background: #ffffff;
    object-fit: contain;
}

.site-brand__text {
    display: grid;
    gap: 1px;
}

.site-brand__text strong {
    color: #0b253d;
    font-family: "Merriweather", Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.25;
}

.site-brand__text small {
    color: #627d98;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.35;
}


/* ==================================================
   ACCOUNT CONTROLS
================================================== */

.site-header__account {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    margin-left: auto;
}

.site-header__profile,
.site-header__logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 7px;
    font-family: "Inter", sans-serif;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.site-header__profile {
    border: 1px solid #d9e2ec;
    background: #ffffff;
    color: #486581;
    text-decoration: none;
}

.site-header__profile:hover,
.site-header__profile:focus-visible {
    border-color: #9fb3c8;
    background: #f5f9fc;
    color: #1f5f99;
    outline: none;
}

.site-header__logout {
    border: 1px solid #d9e2ec;
    background: #f8fafc;
    color: #486581;
}

.site-header__logout:hover,
.site-header__logout:focus-visible {
    border-color: #bcccdc;
    background: #edf2f7;
    color: #243b53;
    outline: none;
}

.site-header__logout:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}


/* ==================================================
   NAVIGATION WRAPPER
================================================== */

.primary-navigation {
    display: flex;
    align-items: center;
}


/* ==================================================
   DESKTOP NAVIGATION
================================================== */

.desktop-navigation {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.primary-navigation__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #486581;
    font-family: "Inter", sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.primary-navigation__link:hover,
.primary-navigation__link:focus-visible {
    background: #f5f9fc;
    color: #1f5f99;
    outline: none;
}

.primary-navigation__link.active {
    background: #eaf3fb;
    color: #1f5f99;
}


/* ==================================================
   DESKTOP NAV GROUPS
================================================== */

.navigation-group {
    position: relative;
}

.navigation-group__button {
    cursor: pointer;
}

.navigation-group__chevron {
    font-size: 0.7rem;
    transition: transform 180ms ease;
}

.navigation-group__button[aria-expanded="true"]
.navigation-group__chevron {
    transform: rotate(180deg);
}


/* ==================================================
   DESKTOP DROPDOWNS
================================================== */

.navigation-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    width: 320px;
    padding: 9px;
    visibility: hidden;
    opacity: 0;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 22px 55px rgba(7, 29, 47, 0.17);
    transform:
        translateX(-50%)
        translateY(-6px);
    transition:
        opacity 180ms ease,
        visibility 180ms ease,
        transform 180ms ease;
}

.navigation-dropdown::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
}

.navigation-group:hover .navigation-dropdown,
.navigation-group:focus-within .navigation-dropdown,
.navigation-group.open .navigation-dropdown {
    visibility: visible;
    opacity: 1;
    transform:
        translateX(-50%)
        translateY(0);
}

.navigation-dropdown a {
    display: grid;
    gap: 4px;
    padding: 13px 14px;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.navigation-dropdown a:hover,
.navigation-dropdown a:focus-visible {
    background: #f5f9fc;
    outline: none;
}

.navigation-dropdown strong {
    color: #102a43;
    font-size: 0.88rem;
    line-height: 1.3;
}

.navigation-dropdown span {
    color: #627d98;
    font-size: 0.76rem;
    line-height: 1.5;
}


/* ==================================================
   DESKTOP VOTE NOW
================================================== */

.site-header__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    margin-left: 6px;
    padding: 9px 15px;
    border: 1px solid #d4aa37;
    border-radius: 8px;
    background: #efc75d;
    color: #102a43;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 7px 17px rgba(212, 170, 55, 0.22);
}

.site-header__action:hover,
.site-header__action:focus-visible {
    border-color: #c89d2f;
    background: #e4b947;
    color: #102a43;
    outline: none;
}


/* ==================================================
   MOBILE MENU BUTTON
================================================== */

.mobile-menu-button {
    display: none;
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    padding: 9px;
    border: 1px solid #d9e2ec;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.mobile-menu-button span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 5px 0;
    border-radius: 999px;
    background: #0b253d;
    transition:
        transform 180ms ease,
        opacity 180ms ease;
}

.mobile-menu-button[aria-expanded="true"]
span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-button[aria-expanded="true"]
span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-button[aria-expanded="true"]
span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* ==================================================
   MOBILE NAVIGATION
================================================== */

.mobile-navigation {
    display: none;
}


/* ==================================================
   MEDIUM DESKTOP
================================================== */

@media (max-width: 1180px) {

    .site-header__container {
        gap: 14px;
    }

    .site-brand__text small {
        display: none;
    }

    .desktop-navigation {
        gap: 1px;
    }

    .primary-navigation__link {
        padding-inline: 8px;
        font-size: 0.8rem;
    }

    .site-header__action {
        padding-inline: 13px;
    }

    .site-header__profile,
    .site-header__logout {
        padding-inline: 8px;
        font-size: 0.66rem;
    }
}


/* ==================================================
   MOBILE / TABLET
================================================== */

@media (max-width: 980px) {

    .site-header__container {
        min-height: 68px;
    }

    .desktop-navigation {
        display: none;
    }

    .site-header__account {
        display: none;
    }

    .mobile-menu-button {
        display: block;
        margin-left: auto;
    }

    .primary-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        display: none;
        width: 100%;
        max-height: calc(100vh - 68px);
        overflow-y: auto;
        border-top: 1px solid #d9e2ec;
        background: #ffffff;
        box-shadow: 0 14px 36px rgba(16, 42, 67, 0.09);
    }

    .primary-navigation.open {
        display: block;
    }

    .mobile-navigation {
        display: block;
        width: 100%;
        padding: 10px 18px 22px;
    }


    /* ==================================================
       MOBILE SECTION
    ================================================== */

    .mobile-navigation__section {
        width: 100%;
        margin: 10px 0 0;
        padding: 0;
        border-top: 1px solid #e5ecf2;
    }

    .mobile-navigation__section-label {
        width: 100%;
        margin: 0;
        padding: 14px 10px 7px;
        color: #1f5f99;
        font-size: 0.65rem;
        font-weight: 800;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }


    /* ==================================================
       MOBILE LINKS
       ALL FLUSH LEFT
    ================================================== */

    .mobile-navigation__link {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 46px;
        margin: 0;
        padding: 11px 10px;
        border-radius: 8px;
        color: #334e68;
        font-family: "Inter", sans-serif;
        font-size: 0.9rem;
        font-weight: 700;
        line-height: 1.3;
        text-decoration: none;
        text-align: left;
    }

    .mobile-navigation__link:hover,
    .mobile-navigation__link:focus-visible {
        background: #f5f9fc;
        color: #1f5f99;
        outline: none;
    }

    .mobile-navigation__profile {
        color: #174f7f;
        font-weight: 800;
    }


    /* ==================================================
       MOBILE VOTE NOW
    ================================================== */

    .mobile-navigation__vote {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 48px;
        margin-top: 14px;
        padding: 12px 14px;
        border: 1px solid #d4aa37;
        border-radius: 9px;
        background: #efc75d;
        color: #102a43;
        font-family: "Inter", sans-serif;
        font-size: 0.9rem;
        font-weight: 800;
        line-height: 1;
        text-decoration: none;
    }

    .mobile-navigation__vote:hover,
    .mobile-navigation__vote:focus-visible {
        border-color: #c89d2f;
        background: #e4b947;
        outline: none;
    }
}


/* ==================================================
   PHONE PORTRAIT
================================================== */

@media (max-width: 600px) {

    .site-header__container {
        width: calc(100% - 24px);
        gap: 8px;
    }

    .site-brand__logo {
        width: 34px;
        height: 34px;
    }

    .site-brand__text {
        display: none;
    }

    .mobile-menu-button {
        width: 38px;
        height: 38px;
        padding: 8px;
    }

    .mobile-navigation {
        padding:
            8px
            12px
            20px;
    }

    .mobile-navigation__section-label {
        padding-left: 8px;
        padding-right: 8px;
    }

    .mobile-navigation__link {
        padding-left: 8px;
        padding-right: 8px;
    }
}


/* ==================================================
   VERY SMALL PHONES
================================================== */

@media (max-width: 380px) {

    .site-header__container {
        width: calc(100% - 18px);
    }

    .site-brand__logo {
        width: 32px;
        height: 32px;
    }

    .mobile-menu-button {
        width: 36px;
        height: 36px;
        padding: 7px;
    }

    .mobile-navigation {
        padding-inline: 10px;
    }
}


/* ==================================================
   AUTH ACCESS GATE
================================================== */

html.auth-access-pending body {
    visibility: hidden;
}

html.auth-access-granted body {
    visibility: visible;
}
/* ==================================================
   MOBILE LOGOUT
================================================== */

.mobile-navigation__logout {
    display: none;
}


@media (max-width: 980px) {

    /* Desktop account buttons disappear in mobile menu mode */

    .site-header__account {
        display: none !important;
    }


    /* Hamburger stays on the right */

    .mobile-menu-button {
        margin-left: auto;
    }


    /* Logout appears at bottom of hamburger menu */

    .mobile-navigation__logout {
        display: flex;
        align-items: center;
        justify-content: center;

        width: 100%;
        min-height: 48px;

        margin-top: 14px;
        padding: 12px 16px;

        border: 1px solid #d98b8b;
        border-radius: 8px;

        background: #fff5f5;
        color: #a12b2b;

        font-family: "Inter", sans-serif;
        font-size: 0.9rem;
        font-weight: 800;

        cursor: pointer;
    }


    .mobile-navigation__logout:hover,
    .mobile-navigation__logout:focus-visible {
        border-color: #c96b6b;
        background: #fde8e8;
        color: #861f1f;
        outline: none;
    }


    .mobile-navigation__logout:disabled {
        cursor: not-allowed;
        opacity: 0.6;
    }

}