/*!
 * Site header.
 * Brand bar over an artwork menu strip. Loaded only when header_style=dynasty.
 * Bar colour, strip height and logo sizes arrive as inline custom properties.
 */
/* Shares the id with the classic header to keep its bottom margin. */
#homepage-header.site-header__jx2global {
    padding: 0;
}

.site-header__jx2global {
    --header-menu-height: 72px;
    --header-gold: #e8cd8a;
    --header-gold-deep: #b8933f;
    --header-label: #f4f6fa;
    --header-caption: rgba(226, 232, 240, 0.62);

    position: relative;
    z-index: 20;
}

/* ---------- Brand strip ---------- */

.site-header__bar {
    background-color: #000;
    width: 100%;
}

.site-header__bar-shell {
    align-items: center;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin: 0 auto;
    max-width: var(--site-shell, 1300px);
    min-height: 62px;
    padding: 6px 16px;
    width: 100%;
}

.site-header__brand {
    align-items: center;
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
}

/* Size comes from the admin as an inline style; no cap here. */
.site-header__brand img {
    display: block;
    object-fit: contain;
}

.site-header__actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 12px;
}

.site-header__logout {
    display: flex;
    margin: 0;
}

/* Account buttons: gradient plate with clipped corners. */
.site-header__action {
    background: linear-gradient(180deg, #f0dda6 0%, #d8bd76 46%, #c2a457 100%);
    border: 0;
    clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
    color: #2a2214;
    cursor: pointer;
    display: inline-block;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.14em;
    line-height: 1;
    padding: 10px 26px;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
    transition: filter 140ms ease, transform 140ms ease;
    white-space: nowrap;
}

.site-header__action:hover,
.site-header__action:focus-visible {
    color: #2a2214;
    filter: brightness(1.08);
    text-decoration: none;
    transform: translateY(-1px);
}

.site-header__action:focus-visible {
    outline: 2px solid var(--header-gold);
    outline-offset: 3px;
}

/* ---------- Menu strip ---------- */

/* Transparent by default so the page background shows through. */
.site-header__strip {
    background-color: transparent;
    background-position: center 22%;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
    width: 100%;
}

/* Legibility veil, fading out before the bottom edge. */
.site-header__strip::after {
    background: linear-gradient(
        180deg,
        rgba(4, 6, 11, 0.72) 0%,
        rgba(4, 6, 11, 0.34) 52%,
        rgba(4, 6, 11, 0.06) 100%
    );
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.site-header__strip-shell {
    margin: 0 auto;
    max-width: var(--site-shell, 1300px);
    padding: 0 16px;
    position: relative;
    width: 100%;
    z-index: 1;
}

.site-header__menu {
    align-items: stretch;
    display: flex;
    justify-content: center;
    list-style: none;
    margin: 0;
    min-height: var(--header-menu-height);
    padding: 0;
}

.site-header__item {
    display: flex;
}

.site-header__link {
    align-items: center;
    color: var(--header-label);
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: center;
    padding: 10px 30px;
    text-align: center;
    text-decoration: none;
    transition: color 150ms ease, text-shadow 150ms ease;
}

/* Type scales with the strip height (admin setting), clamped both ends. */
.site-header__label {
    font-size: clamp(15px, calc(var(--header-menu-height) * 0.27), 34px);
    font-weight: 500;
    letter-spacing: 0.16em;
    line-height: 1.15;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
}

/* Caption line under each label. */
.site-header__sub {
    color: var(--header-caption);
    font-size: clamp(8px, calc(var(--header-menu-height) * 0.115), 14px);
    font-weight: 600;
    letter-spacing: 0.42em;
    line-height: 1;
    text-indent: 0.42em;   /* the last letter's tracking, given back to centre it */
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    text-transform: uppercase;
    white-space: nowrap;
}

.site-header__link:hover,
.site-header__link:focus-visible {
    color: #fff;
    text-decoration: none;
    text-shadow: 0 0 12px rgba(232, 205, 138, 0.75), 0 2px 6px rgba(0, 0, 0, 0.9);
}

.site-header__link:hover .site-header__sub,
.site-header__link:focus-visible .site-header__sub {
    color: var(--header-gold);
}

.site-header__link:focus-visible {
    outline: 2px solid var(--header-gold);
    outline-offset: -4px;
}

/* Khmer clusters break under letter-spacing, so drop it. */
.site-header__link.km-text .site-header__label {
    font-family: 'Koulen', 'Bayon', 'Noto Sans Khmer', serif;
    font-weight: 400;
    letter-spacing: normal;
}

html[lang="km"] .site-header__action {
    letter-spacing: normal;
}

/* ---------- Site logo over the artwork ---------- */

/* Hung in the gap the header's bottom margin already reserves. */
/* Same shell as the bar above, so left/right align with it. */
.site-hero-logo {
    display: flex;
    left: 0;
    margin: 0 auto;
    max-width: var(--site-shell, 1300px);
    padding: 34px 16px 0;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1;
}

.site-hero-logo--left    { justify-content: flex-start; }
.site-hero-logo--center  { justify-content: center; }
.site-hero-logo--right   { justify-content: flex-end; }

.site-hero-logo__inner {
    position: relative;
}

.site-hero-logo__img {
    display: block;
    filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.62));
    object-fit: contain;
}

/* Shine sweep, masked to the logo's own alpha. Sweeps, then rests. */
.site-hero-logo__shine {
    -webkit-mask: var(--hero-logo-src) center / contain no-repeat;
    animation: site-hero-logo-shine 4.2s ease-in-out infinite;
    background: linear-gradient(
        102deg,
        rgba(255, 255, 255, 0) 42%,
        rgba(255, 255, 255, 0.9) 50%,
        rgba(255, 255, 255, 0) 58%
    );
    background-repeat: no-repeat;
    background-size: 260% 100%;
    inset: 0;
    mask: var(--hero-logo-src) center / contain no-repeat;
    mix-blend-mode: screen;
    pointer-events: none;
    position: absolute;
}

@keyframes site-hero-logo-shine {
    0%   { background-position: 160% 0; }
    38%  { background-position: -60% 0; }
    100% { background-position: -60% 0; }
}

@media (max-width: 991px) {
    /* No room over the artwork at this width. */
    .site-hero-logo {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-hero-logo__shine {
        animation: none;
        opacity: 0;
    }
}

/* ---------- Small screens ---------- */

.site-header__toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(232, 205, 138, 0.5);
    border-radius: 4px;
    cursor: pointer;
    display: none;
    padding: 9px 10px;
}

.site-header__toggle-line {
    background: var(--header-gold);
    display: block;
    height: 2px;
    margin: 4px 0;
    width: 22px;
}

@media (max-width: 991px) {
    .site-header__bar-shell {
        gap: 12px;
    }

    /* Overrules the admin size: a tall logo eats a phone screen. */
    .site-header__brand img {
        height: auto !important;
        max-height: 40px;
    }

    .site-header__action {
        font-size: 11px;
        letter-spacing: 0.1em;
        padding: 8px 14px;
    }

    .site-header__toggle {
        display: block;
    }

    /* Becomes a drop-down panel; needs its own ground to stay legible. */
    .site-header__strip {
        background-image: none !important;
    }

    .site-header__strip::after {
        display: none;
    }

    .site-header__strip-shell {
        display: none;
    }

    .site-header__strip-shell.show {
        background: rgba(6, 9, 15, 0.96);
        display: block;
    }

    .site-header__menu {
        flex-direction: column;
        min-height: 0;
        padding: 6px 0 12px;
    }

    .site-header__item + .site-header__item {
        border-top: 1px solid rgba(232, 205, 138, 0.16);
    }

    .site-header__link {
        align-items: flex-start;
        gap: 3px;
        padding: 12px 6px;
        text-align: left;
        width: 100%;
    }

    .site-header__label {
        font-size: 18px;
        letter-spacing: 0.1em;
    }

    .site-header__sub {
        font-size: 9px;
        letter-spacing: 0.3em;
    }
}

@media (max-width: 575px) {
    /* Buttons take their own row below this width. */
    .site-header__bar-shell {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .site-header__actions {
        order: 3;
        width: 100%;
    }

    .site-header__action,
    .site-header__logout {
        flex: 1 1 0;
    }

    .site-header__logout .site-header__action {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header__action,
    .site-header__link {
        transition: none;
    }

    .site-header__action:hover,
    .site-header__action:focus-visible {
        transform: none;
    }
}
