/* The sticky must live on the template-part wrapper: .site-header alone would
   only stick within this wrapper, which is exactly its own height. */
.wp-site-blocks > header.wp-block-template-part {
    position: sticky;
    top: 0;
    z-index: 999;
    /* JS pins this to the expanded header height so the page content never
       jumps while the pill shrinks/grows during scroll */
    height: var(--remp-header-height, auto);
    pointer-events: none;
}

.wp-site-blocks > header.wp-block-template-part > * {
    pointer-events: auto;
}

/* Disables animations while JS measures the expanded header height */
.remp-no-anim,
.remp-no-anim * {
    transition: none !important;
    animation: none !important;
}

.site-header {
    /* 100vw resolves to px so the max-width transition interpolates cleanly
       (a percentage would snap instead of animating) */
    max-width: 100vw;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
    background-color: var(--wp--preset--color--base);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header > .wp-block-group {
    transition: gap 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header .wp-block-site-logo img {
    width: 100px;
    height: auto;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.navbar-scrolled {
    max-width: 1000px;
    margin-top: 12px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* the block sets its padding as an inline style, hence !important */
    padding: 8px 28px !important;
}

/* Compact pill layout: logo slides left, menu right (overrides the theme's
   generated flex-direction:column on the inner group) */
.site-header.navbar-scrolled > .wp-block-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.site-header.navbar-scrolled .wp-block-site-logo img {
    width: 44px;
}

/* backdrop-filter makes the pill the containing block for position:fixed
   descendants, which clips the nav's fullscreen mobile overlay down to the
   pill box. Drop the blur while the menu modal is open. */
body.has-modal-open .site-header.navbar-scrolled,
.site-header.navbar-scrolled:has(.wp-block-navigation__responsive-container.is-menu-open) {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* --- Search bar --- */
.site-header .header-search {
    margin: 0;
}

.site-header .header-search .wp-block-search__inside-wrapper {
    width: 220px;
    border: 1px solid #ddd;
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header .header-search .wp-block-search__input {
    padding: 6px 14px;
    font-size: 14px;
    border: none;
    outline-offset: -2px;
}

.site-header .header-search .wp-block-search__button {
    margin: 0;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: inherit;
}

/* Desktop pill: logo left, menu middle, search right (space-between) */
@media (min-width: 600px) {
    .site-header .header-search .wp-block-search__inside-wrapper:focus-within {
        width: 280px;
    }
}

/* Mobile: WP nav switches to hamburger below 600px */
@media (max-width: 599px) {
    /* Scrolled pill: logo left, search centered, hamburger right */
    .site-header.navbar-scrolled .wp-block-site-logo {
        order: 1;
    }

    .site-header.navbar-scrolled .header-search {
        order: 2;
        flex: 1;
        min-width: 0;
    }

    .site-header.navbar-scrolled .header-search .wp-block-search__inside-wrapper {
        width: 100%;
    }

    .site-header.navbar-scrolled .wp-block-navigation {
        order: 3;
    }
}
