/*
 * Header — transparent utility bar + sticky gold nav bar with overlapping logo.
 * Loaded on every page (see functions.php enqueue()).
 *
 * Breakpoints mirror the original site:
 *   > 1024px  desktop — full menu, logo centred, decorative arrows
 *   ≤ 1024px  tablet  — logo left, burger right, menu in slide-in panel
 *   ≤ 767px   phone   — same, utility bar content hidden
 */

/* The gold bar stays pinned while scrolling, as on prod. `position: sticky`
   on the bar alone can't escape the header's own box, so the whole header
   sticks instead, offset upwards by everything above the bar. */
.site-header {
    --header-offset: 50px; /* utility bar + the bar's top margin */

    position: sticky;
    top: calc(var(--wp-admin-bar-h, 0px) - var(--header-offset));
    z-index: var(--z-sticky);
}

/* Logged-in users get WP's fixed admin bar over the viewport top — park the
   stuck bar below it. Visitors never see this; --wp-admin-bar-h stays unset. */
.admin-bar {
    --wp-admin-bar-h: 32px;
}

/* ── Top utility bar ───────────────────────────────────────────────────── */
/* No background of its own — the page background shows through, as on prod. */
.site-header__top {
    padding: 10px 20px;
}

.site-header__top-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.site-header__mail {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-muted);
    font-family: var(--font-body);
    font-size: 14px;
    text-decoration: none;
}

.site-header__mail:hover {
    color: var(--color-text);
}

.site-header__utils {
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-header__social {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Icons inherit this — they're drawn with currentColor so the same files
   work on the dark utility bar and on the gold mobile panel. */
.site-header__social-link {
    display: flex;
    color: var(--color-muted);
}

.site-header__social-link:hover {
    opacity: .8;
}

/* ── Language switcher ─────────────────────────────────────────────────── */
.site-header__lang {
    position: relative;
    font-family: var(--font-body);
    font-size: 14px;
}

.site-header__lang-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #cdcdcd;
    color: #444;
    font-family: inherit;
    font-size: inherit;
    line-height: 1;
    cursor: pointer;
}

.site-header__lang-flag {
    display: block;
    flex-shrink: 0;
}

.site-header__lang-caret {
    width: 0;
    height: 0;
    margin-left: 10px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
}

.site-header__lang-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 100%;
    background: #fff;
    border: 1px solid #cdcdcd;
    border-top: none;
    padding: 0;
    list-style: none;
    display: none;
    /* Above .site-header__bar (--z-sticky), which would otherwise paint over it. */
    z-index: var(--z-modal);
}

.site-header__lang--open .site-header__lang-menu {
    display: block;
}

.site-header__lang-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    color: #444;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__lang-link:hover {
    background: #f4f4f4;
}

/* ── Gold nav bar ───────────────────────────────────────────────────────── */
/* The 4px margins hold the gold rules drawn by ::before / ::after. */
.site-header__bar {
    position: relative;
    margin: 4px 0;
    padding: 0 20px;
    background: linear-gradient(90deg, #c09c4d 0%, #d9c17e 50%, #c09c4d 100%);
    z-index: var(--z-sticky);
}

/* 2px gold rules above and below the bar, separated by a 2px gap. */
.site-header__bar::before,
.site-header__bar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-accent);
}

.site-header__bar::before { top: -4px; }
.site-header__bar::after  { bottom: -4px; }

.site-header__bar-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
}

/* Left and right halves of the bar: decorative arrow + its menu, packed
   together so each half sits flush against its container edge. */
.site-header__side {
    display: flex;
    align-items: center;
    gap: 16px;
}

.site-header__deco {
    flex-shrink: 0;
    /* Pinned square on purpose: the artwork is 30×32, and prod draws it
       squashed to 30×30. Without this the icon helper would honour the
       viewBox and the gold bar's spacing would drift by 2px. */
    width:  30px;
    height: 30px;
}

.site-header__menu-list {
    display: flex;
    align-items: center;
    gap: 16px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Vertical padding only — enlarges the hit area without shifting the row. */
.site-header__menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    text-transform: uppercase;
    color: #000;
    text-decoration: none;
    white-space: nowrap;
}

.site-header__menu-link:hover {
    text-decoration: underline;
}

.site-header__logo {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* .custom-logo is WP core's own class on get_custom_logo() output — used
   whenever a Customizer logo is set, in place of our .site-header__logo-image.
   It's globally unique (one per page), so no nesting needed to scope it. */
.site-header__logo-image,
.custom-logo {
    display: block;
    width: 250px;
    height: auto;
}

/* ── Burger toggle ─────────────────────────────────────────────────────── */
.site-header__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-bg-alt);
    cursor: pointer;
}

/* ── Slide-in mobile panel ─────────────────────────────────────────────── */
/* Opening decelerates (ease-out) so the drawer settles; closing accelerates
   away (ease-in) and runs shorter, which reads as more responsive. */
.site-header__panel {
    --panel-in:  .5s cubic-bezier(.32, .72, 0, 1);
    --panel-out: .35s cubic-bezier(.4, 0, 1, 1);
    --panel-out-time: .35s;

    display: none;
    position: fixed;
    inset: 0;
    visibility: hidden;
    /* Stay in the layer until the drawer has finished sliding out. */
    transition: visibility 0s linear var(--panel-out-time);
    z-index: var(--z-modal);
}

/* The dim backdrop fades on its own — the drawer must not fade with it,
   otherwise its text goes pale while the panel is still on screen. */
.site-header__panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .3);
    opacity: 0;
    transition: opacity var(--panel-out);
}

.site-header__panel-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    /* A drawer on wider screens — full screen on phones, as on prod. */
    max-width: 360px;
    height: 100%;
    /* Right padding keeps the links clear of the close button. */
    padding: 20px 64px 20px 20px;
    background: var(--color-primary);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform var(--panel-out);
}

/* The panel covers the burger, so it needs its own way out. */
.site-header__panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: none;
    color: var(--color-bg-alt);
    cursor: pointer;
}

.site-header__panel-close:hover {
    opacity: .7;
}

.site-header__panel--open {
    visibility: visible;
    transition-delay: 0s;
}

.site-header__panel--open::before {
    opacity: 1;
    transition: opacity var(--panel-in);
}

.site-header__panel--open .site-header__panel-inner {
    transform: translateX(0);
    transition: transform var(--panel-in);
}

@media (prefers-reduced-motion: reduce) {
    .site-header__panel {
        --panel-in:  .01ms linear;
        --panel-out: .01ms linear;
        --panel-out-time: .01ms;
    }
}

.site-header__panel-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.site-header__panel-link {
    display: block;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    text-transform: uppercase;
    color: var(--color-bg-alt);
    text-decoration: none;
}

.site-header__panel-link:hover {
    text-decoration: underline;
}

/* ── Contacts inside the panel ─────────────────────────────────────────── */
/* On phones the utility bar is hidden, so mail and socials live here. */
.site-header__panel-contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(15, 17, 20, .2);
}

/* Dark on gold, instead of the muted white used on the dark bar. */
.site-header__mail--panel,
.site-header__social--panel .site-header__social-link {
    color: var(--color-bg-alt);
}

.site-header__mail--panel:hover {
    color: var(--color-bg-alt);
    text-decoration: underline;
}

/* The switcher inside the panel is the same block, just left-aligned and
   opening from its own left edge. */
.site-header__lang--panel {
    display: inline-block;
}

.site-header__lang--panel .site-header__lang-menu {
    right: auto;
    left: 0;
}

/* ── Narrow desktop: menu no longer fits on one line ───────────────────── */
/* The two menus plus the logo need ~1345px. Below that the bar keeps its
   desktop look (50px, centred logo) but the menus move into the panel —
   prod wraps them onto a second row instead, which reads as broken. */
@media (max-width: 1359px) {

    .site-header__side {
        display: none;
    }

    .site-header__bar-inner {
        justify-content: flex-end;
    }

    .site-header__toggle {
        display: flex;
    }

    .site-header__panel {
        display: block;
    }
}

/* ── Tablet and below ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {

    /* Extra breathing room between the utility bar and the rule, as on prod. */
    .site-header {
        --header-offset: 66px;
    }

    .site-header__bar {
        margin-top: 20px;
    }

    /* Static inner box so the logo anchors to the bar itself, ignoring its
       side padding — it sits 8px from the viewport edge, as on prod. */
    .site-header__bar-inner {
        position: static;
        height: 40px;
    }

    .site-header__logo {
        left: 8px;
        transform: translateY(-50%);
    }

    .site-header__logo-image,
    .custom-logo {
        width: 165px;
    }
}

/* WP's admin bar grows here, and below 600px it stops being fixed and just
   scrolls away — so no offset is needed at all. */
@media (max-width: 782px) {
    .admin-bar {
        --wp-admin-bar-h: 46px;
    }
}

@media (max-width: 600px) {
    .admin-bar {
        --wp-admin-bar-h: 0px;
    }
}

/* ── Phone ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {

    /* Utility bar content drops out — its copies live in the panel. Hide the
       row, not the blocks themselves, and the bar's own padding stays (20px,
       as on prod). */
    .site-header__top-inner {
        display: none;
    }

    .site-header__panel-inner {
        max-width: none;
    }

    /* The bar butts straight up against the collapsed utility bar — no top rule. */
    .site-header {
        --header-offset: 20px;
    }

    .site-header__bar {
        margin-top: 0;
    }

    .site-header__bar::before {
        display: none;
    }
}
