/* --- STACKED HEADER — on top of header.css and header-extended.css ---
   Every rule is scoped to .header-stacked (the wrapper) or .site-header--stacked (only
   header-stacked.html.twig renders them), so other headers are not affected.
   Desktop is from 992px; the burger arrangement (site-header--burger-tablet) covers phones and
   tablets up to 991px. */

/* the wrapper adds no box: the nav row stays sticky against the page, not the wrapper */
.header-stacked {
    display: contents;
}

/* the marker the script watches: right above the nav row, no size */
.header-stacked__sentinel {
    display: block;
    height: 0;
}

/* --- Utility bar --- */
/* --header-stacked-top-space: room left above the header (e.g. for a page's own line at the very top) */
.header-stacked__utility {
    margin-top: var(--header-stacked-top-space, 0);
    background: var(--header-stacked-utility-bg, var(--color-secondary, #0899DE));
    color: var(--header-stacked-utility-color, var(--color-text-light, #FFFFFF));
}
.header-stacked__utility-inner {
    display: flex;
    align-items: center;
    justify-content: var(--header-stacked-utility-justify, flex-end);
    gap: var(--header-stacked-utility-gap, 20px);
    height: var(--header-stacked-utility-height, 40px);
    max-width: var(--header-stacked-utility-max-width, none);
    margin: 0 auto;
    padding: var(--header-stacked-utility-padding, 0 25px);
}
.header-stacked__utility-links,
.header-stacked__utility-socials {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}
.header-stacked__utility-links {
    gap: var(--header-stacked-utility-link-gap, 0);
}
.header-stacked__utility-socials {
    gap: var(--header-stacked-utility-social-gap, 24px);
}
.header-stacked__utility-link {
    display: block;
    padding: var(--header-stacked-utility-link-padding, 0 20px);
    color: inherit;
    font-size: var(--header-stacked-utility-link-size, 16px);
    font-weight: var(--header-stacked-utility-link-weight, 700);
    line-height: var(--header-stacked-utility-height, 40px);
    text-transform: var(--header-stacked-utility-link-transform, uppercase);
    text-decoration: none;
}
.header-stacked__utility-link:hover {
    text-decoration: var(--header-stacked-utility-link-hover-decoration, underline);
    color: var(--header-stacked-utility-link-hover-color, inherit);
    font-weight: var(--header-stacked-utility-link-hover-weight, var(--header-stacked-utility-link-weight, 700));
}
.header-stacked__utility-social,
.header-stacked__utility-brand {
    display: flex;
    align-items: center;
    color: inherit;
}
.header-stacked__utility-social-icon {
    display: block;
    width: var(--header-stacked-utility-social-size, 24px);
    height: var(--header-stacked-utility-social-size, 24px);
    object-fit: contain;
}
.header-stacked__utility-brand-img {
    display: block;
    width: auto;
    height: var(--header-stacked-utility-brand-height, 40px);
}

/* --- Logo row --- */
/* the row may be lower than the logo (--header-stacked-brand-height): the logo then runs under
   the nav row */
.header-stacked__brand {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    height: var(--header-stacked-brand-height, auto);
    background: var(--color-header-bg, var(--color-bg, #FFFFFF));
    /* above the nav row: a logo taller than its row stays whole over the nav row's background */
    position: relative;
    z-index: 1001;
    padding: var(--header-stacked-brand-padding, 13px 25px 18px);
}
.header-stacked__brand-link {
    display: block;
}
.header-stacked__brand-logo {
    display: block;
    width: auto;
    height: var(--header-stacked-brand-logo-height, 100px);
    /* a negative offset lets the logo rise over the utility bar */
    margin-top: var(--header-stacked-brand-logo-offset, 0);
}

/* --- Nav item on hover: its weight, and a turn of its icon (e.g. rotate(-100deg)); unset → as at
   rest --- */
.site-header--stacked .nav-item:hover {
    font-weight: var(--header-stacked-nav-item-hover-weight, var(--nav-item-font-weight, 600));
}
.site-header--stacked .nav-item:hover .nav-item-icon {
    transform: var(--header-stacked-icon-hover-transform, none);
}

/* --- Nav item icon --- */
.site-header--stacked .nav-item-icon {
    display: inline-block;
    flex: none;
    width: var(--header-stacked-icon-size, 20px);
    height: var(--header-stacked-icon-size, 20px);
    margin-right: var(--header-stacked-icon-gap, 5px);
    object-fit: contain;
    /* e.g. -5px: the icon sits higher than its label; unset → centred on it */
    position: relative;
    top: var(--header-stacked-icon-top, 0);
    vertical-align: middle;
}

/* --- Desktop (from 992px) --- */
@media (min-width: 992px) {
    .site-header.site-header--stacked {
        padding: var(--header-stacked-nav-padding, 0 25px);
        min-height: var(--header-stacked-nav-height, 50px);
        transition: none;
    }
    .site-header--stacked .site-header__container {
        position: relative;
        justify-content: center;
        max-width: var(--header-stacked-container-max-width, none);
        min-height: inherit;
    }
    .site-header--stacked .nav-item {
        display: inline-flex;
        align-items: center;
        min-height: var(--header-stacked-nav-height, 50px);
    }

    /* the small logo: hidden until the nav row is stuck, then on its left */
    .site-header--stacked .logo-wrapper {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        visibility: hidden;
    }
    .site-header--stacked .logo-wrapper img {
        height: var(--header-stacked-stuck-logo-height, 61px);
    }
    /* taller once stuck, over the page: the negative margin keeps the page below where it was */
    .site-header.site-header--stacked.is-stuck {
        min-height: var(--header-stacked-stuck-height, 83px);
        /* --header-stacked-stuck-margin-adjust: what --header-stacked-stuck-padding takes off the nav
           row's padding, so the page below stays where it was */
        padding: var(--header-stacked-stuck-padding, var(--header-stacked-nav-padding, 0 25px));
        margin-bottom: calc(var(--header-stacked-nav-height, 50px) - var(--header-stacked-stuck-height, 83px) + var(--header-stacked-stuck-margin-adjust, 0px));
        box-shadow: var(--header-stacked-stuck-shadow, var(--header-box-shadow, none));
    }
    .site-header--stacked.is-stuck .logo-wrapper {
        visibility: visible;
    }
}

/* --- Burger arrangement (up to 991px) --- */
@media (max-width: 991px) {
    .header-stacked__utility,
    .header-stacked__brand {
        display: none;
    }
    .site-header.site-header--stacked {
        background: var(--header-stacked-bg-mobile, var(--color-header-bg, var(--color-bg)));
    }
    .header-stacked--logo-center-mobile .site-header--stacked .site-header__container {
        position: relative;
        justify-content: flex-end;
    }
    .header-stacked--logo-center-mobile .site-header--stacked .logo-wrapper {
        position: absolute;
        left: 50%;
        top: var(--header-stacked-logo-top-mobile, 50%);
        transform: translate(-50%, var(--header-stacked-logo-shift-mobile, -50%));
    }
    .site-header--stacked .nav-item-icon {
        width: var(--header-stacked-icon-size-mobile, var(--header-stacked-icon-size, 20px));
        height: var(--header-stacked-icon-size-mobile, var(--header-stacked-icon-size, 20px));
    }
    /* header.css gives the last row extra room at the bottom (18px); a token here */
    .site-header--stacked .nav-menu li:last-child .nav-item {
        padding-bottom: var(--header-stacked-menu-last-padding-mobile, 18px);
    }
    /* the icon sits right before its label, not spread out by the row's space-between */
    .site-header--stacked .nav-item {
        justify-content: flex-start;
        gap: 0;
        min-height: var(--header-stacked-menu-item-height-mobile, auto);
        text-transform: var(--header-stacked-menu-transform-mobile, var(--nav-item-text-transform, none));
    }
    /* the open menu: full screen by default, or a panel under the bar (top / bottom tokens) */
    .site-header--stacked nav#site-nav {
        top: var(--header-stacked-menu-top-mobile, 0);
        bottom: var(--header-stacked-menu-bottom-mobile, 0);
    }
    /* the bar can stay at the top (--header-stacked-position-mobile: sticky), lower and with a smaller
       logo once the page has scrolled (.is-stuck) */
    .site-header.site-header--stacked {
        position: var(--header-stacked-position-mobile, relative);
        top: 0;
    }
    /* the margin makes up the height it loses, so the page below does not move (no margin when the
       heights are not set: the calc is then invalid) */
    .site-header.site-header--stacked.is-stuck {
        min-height: var(--header-stacked-stuck-height-mobile, var(--header-min-height-mobile, auto));
        margin-bottom: calc(var(--header-min-height-mobile) - var(--header-stacked-stuck-height-mobile));
        --logo-height: var(--header-stacked-stuck-logo-height-mobile, var(--logo-height-mobile, 110px));
    }
    .header-stacked--logo-center-mobile .site-header--stacked.is-stuck .logo-wrapper {
        top: var(--header-stacked-stuck-logo-top-mobile, var(--header-stacked-logo-top-mobile, 50%));
    }
    .site-header--stacked.is-stuck nav#site-nav {
        top: var(--header-stacked-stuck-menu-top-mobile, var(--header-stacked-menu-top-mobile, 0));
    }
}
