/* =========================================================
   FEX — HEADER COMPONENT
   FancyTextEmoji
   Shared site header
   ========================================================= */


/* =========================================================
   HEADER
   ========================================================= */

.site-header {
    position: relative;
    z-index: 1000;
    width: 100%;
    background: var(--fex-color-surface, #ffffff);
    border-bottom: 1px solid var(--fex-color-border, #e5e7eb);
}


/* =========================================================
   HEADER INNER
   ========================================================= */

.site-header__inner {
    width: 100%;
    max-width: var(--fex-container-max-width, 1200px);
    min-height: 64px;
    margin: 0 auto;
    padding:
        0
        var(--fex-space-page, 20px);

    display: flex;
    align-items: center;
    gap: var(--fex-space-md, 16px);
}


/* =========================================================
   BRAND
   ========================================================= */

.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--fex-space-sm, 10px);

    min-width: 0;

    color: var(--fex-color-text, #111827);
    text-decoration: none;

    flex: 0 0 auto;
}


/* =========================================================
   LOGO
   PNG / IMAGE
   ========================================================= */

.site-header__logo {
    display: block;

    width: 40px;
    height: 40px;

    flex: 0 0 40px;

    object-fit: contain;
    object-position: center;

    border: 0;
}


/* =========================================================
   BRAND TEXT
   ========================================================= */

.site-header__brand-text {
    display: block;

    color: var(--fex-color-text, #111827);

    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;

    white-space: nowrap;
}


/* =========================================================
   MOBILE NAVIGATION BUTTON
   ========================================================= */

.site-nav-toggle {
    display: none;

    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    margin-left: auto;
    padding: 0;

    border: 1px solid var(--fex-color-border, #e5e7eb);
    border-radius: var(--fex-radius-md, 8px);

    background: var(--fex-color-surface, #ffffff);
    color: var(--fex-color-text, #111827);

    font: inherit;
    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        opacity 0.15s ease;
}


.site-nav-toggle:hover {
    background: var(--fex-color-surface-muted, #f8f9fb);
}


.site-nav-toggle:focus-visible {
    outline:
        2px solid
        var(--fex-color-primary, #2563eb);

    outline-offset: 2px;
}


/* =========================================================
   PRIMARY NAVIGATION
   ========================================================= */

.site-nav {
    display: flex;
    align-items: center;

    gap: var(--fex-space-xs, 6px);

    margin-left: auto;
}


/* =========================================================
   NAVIGATION LINK
   ========================================================= */

.site-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;

    padding:
        0
        var(--fex-space-sm, 10px);

    border-radius: var(--fex-radius-sm, 6px);

    color: var(--fex-color-text-muted, #4b5563);

    text-decoration: none;

    font-size: 14px;
    line-height: 1.2;
    font-weight: 600;

    white-space: nowrap;

    transition:
        color 0.15s ease,
        background-color 0.15s ease;
}


.site-nav__link:hover {
    color: var(--fex-color-text, #111827);

    background:
        var(
            --fex-color-surface-muted,
            #f8f9fb
        );
}


.site-nav__link:focus-visible {
    outline:
        2px solid
        var(--fex-color-primary, #2563eb);

    outline-offset: 2px;
}


/* =========================================================
   THEME TOGGLE
   ========================================================= */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: var(--fex-space-xs, 6px);

    min-height: 40px;

    padding:
        0
        var(--fex-space-sm, 10px);

    margin-left: var(--fex-space-sm, 10px);

    border:
        1px solid
        var(--fex-color-border, #e5e7eb);

    border-radius: var(--fex-radius-sm, 6px);

    background:
        var(--fex-color-surface, #ffffff);

    color:
        var(--fex-color-text, #111827);

    font: inherit;
    font-size: 14px;
    font-weight: 600;

    cursor: pointer;

    white-space: nowrap;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}


.theme-toggle:hover {
    background:
        var(
            --fex-color-surface-muted,
            #f8f9fb
        );
}


.theme-toggle:focus-visible {
    outline:
        2px solid
        var(--fex-color-primary, #2563eb);

    outline-offset: 2px;
}


/* =========================================================
   THEME ICON
   ========================================================= */

.theme-toggle__icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 20px;
    height: 20px;

    line-height: 1;
}


/* =========================================================
   THEME TEXT
   ========================================================= */

.theme-toggle__text {
    display: inline-block;
}


/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {

    .site-header__inner {
        min-height: 60px;
    }


    .site-nav {
        gap: 2px;
    }


    .site-nav__link {
        padding:
            0
            8px;

        font-size: 13px;
    }


    .theme-toggle {
        margin-left: 6px;
        padding:
            0
            8px;
    }

}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 760px) {

    .site-header__inner {
        position: relative;

        min-height: 60px;

        flex-wrap: wrap;
    }


    /* ---------------------------------------------
       Mobile menu button
       --------------------------------------------- */

    .site-nav-toggle {
        display: inline-flex;
    }


    /* ---------------------------------------------
       Navigation
       --------------------------------------------- */

    .site-nav {
        display: none;

        width: 100%;

        flex-direction: column;
        align-items: stretch;

        order: 10;

        margin-left: 0;

        padding:
            8px 0
            12px;

        border-top:
            1px solid
            var(--fex-color-border, #e5e7eb);
    }


    /* ---------------------------------------------
       Open navigation
       --------------------------------------------- */

    .site-nav.is-open {
        display: flex;
    }


    /* ---------------------------------------------
       Mobile links
       --------------------------------------------- */

    .site-nav__link {
        width: 100%;

        min-height: 44px;

        justify-content: flex-start;

        padding:
            0
            12px;

        border-radius:
            var(--fex-radius-sm, 6px);

        font-size: 15px;
    }


    /* ---------------------------------------------
       Theme button
       --------------------------------------------- */

    .theme-toggle {
        margin-left: 0;

        width: 42px;
        height: 42px;
        min-height: 42px;

        padding: 0;
    }


    .theme-toggle__text {
        position: absolute;

        width: 1px;
        height: 1px;

        padding: 0;
        margin: -1px;

        overflow: hidden;

        clip: rect(0, 0, 0, 0);

        white-space: nowrap;

        border: 0;
    }

}


/* =========================================================
   SMALL MOBILE
   ========================================================= */

@media (max-width: 420px) {

    .site-header__inner {
        padding:
            0
            var(--fex-space-sm, 10px);
    }


    .site-header__logo {
        width: 36px;
        height: 36px;

        flex-basis: 36px;
    }


    .site-header__brand-text {
        font-size: 16px;
    }


    .site-nav-toggle {
        width: 40px;
        height: 40px;
    }


    .theme-toggle {
        width: 40px;
        height: 40px;
    }

}


/* =========================================================
   DARK THEME
   Uses framework theme variables.
   No page-specific CSS required.
   ========================================================= */

[data-theme="dark"] .site-header,
.dark .site-header {
    background:
        var(
            --fex-color-surface,
            #111827
        );

    border-bottom-color:
        var(
            --fex-color-border,
            #374151
        );
}


[data-theme="dark"] .site-header__brand-text,
.dark .site-header__brand-text {
    color:
        var(
            --fex-color-text,
            #f9fafb
        );
}


[data-theme="dark"] .site-nav__link,
.dark .site-nav__link {
    color:
        var(
            --fex-color-text-muted,
            #d1d5db
        );
}


[data-theme="dark"] .site-nav__link:hover,
.dark .site-nav__link:hover {
    color:
        var(
            --fex-color-text,
            #ffffff
        );

    background:
        var(
            --fex-color-surface-muted,
            #1f2937
        );
}


[data-theme="dark"] .site-nav-toggle,
.dark .site-nav-toggle,
[data-theme="dark"] .theme-toggle,
.dark .theme-toggle {
    background:
        var(
            --fex-color-surface,
            #111827
        );

    border-color:
        var(
            --fex-color-border,
            #374151
        );

    color:
        var(
            --fex-color-text,
            #f9fafb
        );
}


[data-theme="dark"] .site-nav,
.dark .site-nav {
    border-top-color:
        var(
            --fex-color-border,
            #374151
        );
}