/* ==========================================================================
   Block: Menu
   ========================================================================== */

.block-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.admin-bar .block-menu {
    top: 32px;
}


/* ==========================================================================
   Marquee (Osmo CSS Marquee) — scrolling announcement bar above the menu
   ========================================================================== */

.marquee-css {
    color: var(--wp--preset--color--white);
    background-color: var(--wp--preset--color--accent-4); /* dark blue */
    width: 100%;
    display: flex;
    position: relative;
    z-index: 4;
    overflow: hidden;
    text-decoration: none;
}

.marquee-css__list {
    flex: none;
    align-items: center;
    display: flex;
    position: relative;
}

.marquee-css__item {
    grid-column-gap: 1em;
    grid-row-gap: 1em;
    flex: 0;
    align-items: center;
    padding-top: 0.6em;
    padding-bottom: 0.6em;
    padding-right: 1em;
    display: flex;
}

.block-menu .marquee-css__item-p {
    white-space: nowrap;
    margin: 0 !important;
    color: var(--wp--preset--color--white); /* full white (not the 80% paragraph colour) */
    font-size: var(--wp--preset--font-size--small);
    line-height: 1;
    text-transform: uppercase;
    font-weight: var(--uppercase-font-weight);
    letter-spacing: var(--uppercase-letter-spacing);
}

.marquee-css__item-dot {
    flex: none;
    font-size: var(--wp--preset--font-size--small);
    line-height: 1;
}

/* On scroll the whole header slides up by exactly the marquee height: the
   marquee slides out of view and the menu bar slides up with it, at the same
   speed, then stays fixed at the top. Uses `top` (not transform) so the fixed
   mobile menu inside the header keeps its viewport positioning.
   --marquee-height is measured in menu.js. */
.block-menu.has-marquee {
    transition: top 0.5s cubic-bezier(0.625, 0.05, 0, 1);
}

.block-menu.has-marquee.scrolled {
    top: calc(var(--marquee-height, 0px) * -1);
}

.admin-bar .block-menu.has-marquee.scrolled {
    top: calc(32px - var(--marquee-height, 0px));
}

/* Keep the marquee in place while the mobile menu is open */
.block-menu.has-marquee.scrolled.is-menu-open {
    top: 0;
}

.admin-bar .block-menu.has-marquee.scrolled.is-menu-open {
    top: 32px;
}

/* CSS Keyframe Animation */
@keyframes translateX {
    to {
        transform: translateX(-100%);
    }
}

[data-css-marquee-list] {
    animation: translateX 30s linear;
    animation-iteration-count: infinite;
    animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
    [data-css-marquee-list] {
        animation: none;
    }
}


/* ==========================================================================
   Top bar
   ========================================================================== */

.block-menu__bar {
    border-bottom: 1px solid var(--wp--preset--color--current-15);
    position: relative;
    z-index: 3;
    transition: .3s;
}

/* At the top of the page the bar stays transparent on hover; it only turns
   white once scrolled, or while a submenu / the mobile menu is open */

header.scrolled .block-menu__bar,
.block-menu.is-menu-open .block-menu__bar,
.block-menu.is-submenu-open .block-menu__bar {
    background-color: var(--wp--preset--color--base);
}

/* While a submenu is open (or still sliding closed) the bar and panel read as
   one white surface — no line in between */
.block-menu.is-submenu-open .block-menu__bar,
.block-menu.is-menu-open .block-menu__bar {
    border-bottom-color: transparent;
}

/* Three columns so the logo stays optically centred no matter how many links
   sit on either side. */
.block-menu__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 1.25rem var(--wp--style--root--padding-right);
    max-width: var(--wp--style--global--wide-size);
    margin-left: auto;
    margin-right: auto;
    box-sizing: content-box;
}

.block-menu__side {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    min-width: 0;
}

.block-menu__side--left {
    justify-content: flex-start;
}

.block-menu__side--right {
    justify-content: flex-end;
}


/* ==========================================================================
   Logo
   ========================================================================== */

.block-menu__logo {
    display: flex;
    align-items: center;
    justify-self: center;
}

.block-menu__logo img {
    height: 1.4rem;
    width: auto;
    display: block;
}

/* Logo swap — dark logo by default, light logo only in the is-light state */
.block-menu__logo img.block-menu__logo-img--light {
    display: none;
}

/* Light mode: bar is transparent over a dark (has-base-color) hero, until the
   header is scrolled or hovered — then it reverts to the normal menu bar. */
.block-menu.is-light:not(.scrolled):not(.is-menu-open):not(.is-submenu-open) .block-menu__logo img.block-menu__logo-img--dark {
    display: none;
}

.block-menu.is-light:not(.scrolled):not(.is-menu-open):not(.is-submenu-open) .block-menu__logo img.block-menu__logo-img--light {
    display: block;
}

.block-menu.is-light:not(.scrolled):not(.is-menu-open):not(.is-submenu-open) .block-menu__side {
    color: var(--wp--preset--color--base);
}

/* Bar's currentColor drives the border (current-15) — make it light too */
.block-menu.is-light:not(.scrolled):not(.is-menu-open):not(.is-submenu-open) .block-menu__bar {
    color: var(--wp--preset--color--base);
}


/* ==========================================================================
   Desktop nav
   ========================================================================== */

.block-menu__nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    transition: color 0.3s;
}

.block-menu__item {
    position: relative;
}

.block-menu__link {
    color: currentColor;
    text-decoration: none;
    font-size: var(--wp--preset--font-size--small);
    text-transform: uppercase;
    font-weight: var(--uppercase-font-weight);
    letter-spacing: var(--uppercase-letter-spacing);
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}

.block-menu__chevron {
    display: block;
    margin-top: 0.1em;
}


/* ==========================================================================
   Desktop dropdown — full-width white panel that slides down from under the bar
   ========================================================================== */

/* The panel is positioned against the bar (not the item) so it spans the full
   width. The item stretches over the bar's vertical padding so the pointer
   never leaves it on the way down to the panel. */
.block-menu__item--has-submenu {
    position: static;
    padding-block: 1.25rem;
    margin-block: -1.25rem;
}

.block-menu__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--wp--preset--color--base);
    color: var(--wp--preset--color--contrast);
    /* The line sits on the panel's bottom edge, so it travels down on open
       and straight back up on close */
    border-bottom: 1px solid var(--wp--preset--color--current-15);
    display: grid;
    grid-template-rows: 0fr;
    visibility: hidden;
    pointer-events: none;
    z-index: 2;
    transition: grid-template-rows 0.6s cubic-bezier(0.625, 0.05, 0, 1), visibility 0s linear 0.6s;
}

.block-menu__item--has-submenu:is(:hover, :focus-within) .block-menu__dropdown {
    grid-template-rows: 1fr;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.block-menu__dropdown-inner {
    min-height: 0;
    overflow: hidden;
}

/* The list lines up under its own menu item (offsets set in menu.js) */
.block-menu__dropdown-list {
    list-style: none;
    margin: 0;
    padding: 1.5rem 0 2rem;
    width: max-content;
    margin-left: var(--dropdown-left, var(--wp--style--root--padding-left));
}

/* Right-hand items: same as the left — list starts under the item, left-aligned */

.block-menu__dropdown-list li {
    opacity: 0;
    transform: translateY(-0.5em);
    transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.625, 0.05, 0, 1);
}

.block-menu__item--has-submenu:is(:hover, :focus-within) .block-menu__dropdown-list li {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.15s;
}

/* Same hover underline as the main menu links (data-underline-link) — inline
   so the line is as wide as the text, not the whole list */
.block-menu__dropdown-link {
    display: inline-block;
    margin: 0.4rem 0;
    color: currentColor;
    text-decoration: none;
    font-size: var(--wp--preset--font-size--small);
    text-transform: uppercase;
    font-weight: var(--uppercase-font-weight);
    letter-spacing: var(--uppercase-letter-spacing);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.block-menu__chevron {
    transition: transform 0.4s cubic-bezier(0.625, 0.05, 0, 1);
}

.block-menu__item--has-submenu:is(:hover, :focus-within) .block-menu__chevron {
    transform: rotate(180deg);
}



/* ==========================================================================
   Language switcher
   ========================================================================== */

ul.menu-languages {
    display: flex;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

ul.menu-languages li {
    list-style: none;
    font-weight: 400;
    opacity: 0.5;
    transition: opacity 0.3s;
}

ul.menu-languages li.current-lang,
ul.menu-languages li:hover {
    opacity: 1;
}

ul.menu-languages li a {
    text-decoration: none;
}


/* ==========================================================================
   Hamburger toggle
   ========================================================================== */

.block-menu__toggle {
    display: none;
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 1.5rem;
    height: 2rem; /* keeps a comfortable tap height */
    position: relative;
    z-index: 3;
    padding: 0;
    color: currentColor;
}

.block-menu__toggle-bar {
    display: block;
    width: 100%;
    height: 1.5px;
    background-color: currentColor;
    position: absolute;
    left: 0;
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.block-menu__toggle-bar:first-child {
    top: calc(50% - 4px);
}

.block-menu__toggle-bar:last-child {
    top: calc(50% + 4px);
}

.block-menu__toggle[aria-expanded="true"] .block-menu__toggle-bar:first-child {
    transform: translateY(4px) rotate(45deg);
}

.block-menu__toggle[aria-expanded="true"] .block-menu__toggle-bar:last-child {
    transform: translateY(-4px) rotate(-45deg);
}


/* ==========================================================================
   Mobile overlay
   ========================================================================== */

/* Grows down from under the bar to full screen — height is animated in
   menu.js. The line on the bottom edge travels with it, and slides straight
   back up on close. */
.block-menu__mobile {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 1;
    background-color: var(--wp--preset--color--base);
    color: var(--wp--preset--color--contrast);
    border-bottom: 1px solid var(--wp--preset--color--current-15);
    display: flex;
    align-items: flex-start;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
}

.block-menu__mobile.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.block-menu__mobile-inner {
    padding: 6rem var(--wp--style--root--padding-right) 2rem;
    width: 100%;
}

/* With the marquee above the bar, the mobile menu content starts lower */
.block-menu.has-marquee .block-menu__mobile-inner {
    padding-top: 8rem;
}

.block-menu__mobile-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.block-menu__mobile-item {
    list-style: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Lines only between items, not under the last one */
.block-menu__mobile-item:last-child {
    border-bottom: 0;
}

.block-menu__mobile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.block-menu__mobile-link {
    color: currentColor;
    text-decoration: none;
    font-family: 'ABC Arizona Flare', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    letter-spacing: var(--arizona-tracking-l);
    line-height: 1.3;
    padding: 0.5em 0;
    display: block;
    flex: 0 1 auto;
}

/* The toggle fills the rest of the row so tapping anywhere past the word toggles the submenu */
.block-menu__mobile-submenu-toggle {
    appearance: none;
    background: none;
    border: none;
    color: currentColor;
    cursor: pointer;
    /* Right padding centres the 12px chevron under the 1.5rem-wide close (X) icon */
    padding: 0.75rem calc(0.75rem - 6px) 0.75rem 0.75rem;
    flex: 1;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.block-menu__mobile-submenu-toggle svg {
    transition: transform 0.3s;
}

.block-menu__mobile-submenu-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Height is animated with GSAP (see menu.js) */
.block-menu__mobile-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    height: 0;
    overflow: hidden;
}

.block-menu__mobile-submenu li {
    list-style: none;
}

/* Breathing room below an opened submenu (on the last item, so a closed
   submenu still collapses to 0) */
.block-menu__mobile-submenu li:last-child {
    padding-bottom: 1.25rem;
}

.block-menu__mobile-submenu-link {
    color: currentColor;
    text-decoration: none;
    font-size: var(--wp--preset--font-size--normal);
    font-weight: 400;
    display: block;
    padding: 0.3em 0;
}

ul.menu-languages--mobile {
    margin-top: 2rem;
}


/* ==========================================================================
   Mobile breakpoint
   ========================================================================== */

@media (max-width: 1100px) { /* switch to the mobile (hamburger) menu */
    /* Tighter bar — the hamburger needs less height than the desktop nav */
    .block-menu__inner {
        padding: .75rem var(--wp--style--root--padding-right);
    }

    /* Both sides collapse into the single overlay list */
    .block-menu__nav {
        display: none;
    }

    /* The overlay carries its own switcher (.menu-languages--mobile) */
    .block-menu__side .menu-languages {
        display: none;
    }

    .block-menu__toggle {
        display: block;
    }

    /* Slightly smaller logo on mobile */
    .block-menu__logo img {
        height: 1.15rem;
    }

    .block-menu__dropdown {
        display: none;
    }
}


/* Current page in the mobile menu: underlined, like the desktop "active" state */
.block-menu__mobile-link.is-current,
.block-menu__mobile-submenu-link.is-current {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}
