/************************************************
* Theme Name:   Simmelink
*
* Block Name:   Header (Standard)
************************************************/

:root {
    --header-height: 72px;
}

@media screen and (max-width: 768px) {
    :root {
        --header-height: 56px;
    }
}

.skip-link {
    background-color: var(--blue-dark);
    clip-path: inset(50%);
    color: var(--white);
    font-size: var(--wp--preset--font-size--medium);
    height: 1px;
    left: 0;
    overflow: hidden;
    padding: 0;
    position: fixed;
    top: var(--wp-admin--admin-bar--height, 0px);
    white-space: nowrap;
    width: 1px;
    z-index: 10000;

    &:focus-visible {
        clip-path: none;
        height: auto;
        outline: var(--focus-on-dark);
        outline-offset: -4px;
        padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
        width: auto;
    }
}

/* .site-header fills its parent, so only the parent has room to stick. */
.wp-block-template-part:has(> .site-header) {
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0px);
    z-index: 9999;
}

.site-header {
    background-color: var(--white);
    border-bottom: 1px solid var(--hairline-on-light);
    color: var(--blue-dark);
    height: var(--header-height);
    width: 100%;

    --menu-accent: var(--blue-normal);

    &.site-header--navy {
        background-color: var(--blue-dark);
        border-bottom-color: transparent;
        color: var(--white);

        --menu-accent: var(--blue-light);
    }

    .site-header-inner {
        align-items: center;
        display: flex;
        gap: var(--wp--preset--spacing--40);
        height: 100%;
        margin: 0 auto;
        max-width: var(--max-width);
        padding: 0 var(--gutter);
    }

    .site-logo-link {
        display: block;
        flex: 0 0 auto;
    }

    .site-logo {
        display: block;
        height: 40px;
        width: auto;
    }

    .menu-toggle {
        display: none;
    }

    .site-nav {
        align-items: center;
        display: flex;
        flex: 1 1 auto;
        gap: var(--wp--preset--spacing--30);
        height: 100%;
        justify-content: space-between;
    }

    .header-menu-container {
        height: 100%;
    }

    .header-menu {
        display: flex;
        gap: var(--wp--preset--spacing--30);
        height: 100%;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .header-menu-item {
        align-items: center;
        display: flex;
        height: 100%;
        margin: 0;
        position: relative;
    }

    .menu-link {
        color: inherit;
        font-size: var(--wp--preset--font-size--medium);
        font-weight: 400;
        text-decoration: underline;
        text-decoration-color: transparent;
        text-decoration-thickness: 1px;
        text-underline-offset: 6px;
        transition: var(--transition);
        white-space: nowrap;

        &:hover,
        &[aria-current] {
            text-decoration-color: var(--menu-accent);
        }

        &[aria-current] {
            font-weight: 500;
        }
    }

    /* Only for keyboards and touch screens; the mouse opens the submenu on hover. */
    .submenu-toggle {
        background: none;
        border: 0;
        color: inherit;
        cursor: pointer;
        font-size: var(--wp--preset--font-size--medium);
        line-height: 1;
        margin-left: var(--wp--preset--spacing--20);
        padding: 0;

        &[aria-expanded="true"] {
            font-weight: 500;
        }
    }

    .submenu {
        background-color: var(--white);
        border: 1px solid var(--border-field);
        border-radius: var(--radius);
        color: var(--blue-dark);
        display: none;
        left: 0;
        padding: var(--wp--preset--spacing--30);
        position: absolute;
        top: 100%;
        width: max-content;
        z-index: 100;

        a {
            color: inherit;
            text-decoration: underline;
            text-decoration-color: transparent;
            text-decoration-thickness: 1px;
            text-underline-offset: 3px;
            transition: var(--transition);

            &:hover,
            &[aria-current] {
                text-decoration-color: var(--blue-normal);
            }
        }

        :focus-visible {
            outline: var(--focus-on-light);
        }
    }

    .has-submenu.is-open > .submenu {
        display: block;
    }

    .submenu-intro {
        margin-bottom: var(--wp--preset--spacing--30);
        max-width: 24rem;
    }

    .submenu-title,
    .submenu-description,
    .submenu-more {
        display: block;
    }

    .submenu-title {
        font-size: var(--wp--preset--font-size--medium);
        font-weight: 500;
    }

    .submenu-description,
    .submenu-more {
        font-size: var(--wp--preset--font-size--small);
    }

    .submenu-description {
        margin-bottom: var(--wp--preset--spacing--20);
    }

    .submenu .submenu-more {
        color: var(--blue-normal);
        text-decoration-color: currentColor;

        &::after {
            content: '\00a0\2192';
        }

        &:hover {
            color: var(--blue-dark);
        }
    }

    .submenu-groups {
        display: flex;
        gap: var(--wp--preset--spacing--40);
    }

    .submenu-group {
        width: 15rem;
    }

    .submenu-group-title {
        margin-bottom: var(--wp--preset--spacing--20);
    }

    .submenu-links {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .submenu-link {
        border-top: 1px solid var(--hairline-on-light);
        font-size: var(--wp--preset--font-size--medium);
        margin: 0;

        a {
            display: block;
            padding: var(--wp--preset--spacing--20) 0;
        }
    }

    /* The featured box under the groups: one way in to the advice meeting. The title is a paragraph, not a heading. */
    .submenu-feature-title,
    .submenu-feature-text {
        margin: 0;
    }

    .submenu-feature-title {
        font-size: var(--wp--preset--font-size--medium);
        font-weight: 500;
        margin-bottom: 0.25rem;
    }

    /* The arrow is text, after a non-breaking space. */
    .submenu .submenu-feature-link {
        text-decoration-color: currentColor;
    }

    .header-actions {
        align-items: center;
        display: flex;
        flex: 0 0 auto;
        gap: var(--wp--preset--spacing--30);
    }

    .header-search,
    .header-language {
        color: inherit;
        font-size: var(--wp--preset--font-size--small);
        text-decoration: underline;
        text-decoration-color: transparent;
        text-decoration-thickness: 1px;
        text-underline-offset: 6px;
        transition: var(--transition);

        &:hover {
            text-decoration-color: var(--menu-accent);
        }
    }

    .header-language {
        font-weight: 500;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .header-divider {
        background-color: var(--hairline-on-light);
        height: 24px;
        width: 1px;
    }

    /* Only in the mobile menu; the footer shows these details on wide screens. */
    .header-contact {
        display: none;
    }

    &.site-header--navy .header-divider {
        background-color: var(--hairline-on-dark);
    }

    .header-cta {
        align-items: center;
        display: inline-flex;
        height: var(--control-height);
        padding: 0 1.5rem;
        white-space: nowrap;

        &:hover,
        &:focus,
        &:active {
            background-color: var(--gold-light);
            color: var(--blue-dark);
            text-decoration: underline;
            text-decoration-thickness: 1px;
            text-underline-offset: 3px;
        }
    }
}

@media screen and (min-width: 1200px) {
    .site-header .has-submenu:hover > .submenu,
    .site-header .has-submenu:focus-within > .submenu {
        display: block;
    }

    /* After Escape it stays closed until the mouse or the focus has left. */
    .site-header .has-submenu.is-dismissed > .submenu {
        display: none;
    }

    /* On the home the header is navy, but the submenu panel is light: the group title takes the colour for light. */
    .site-header.site-header--navy .submenu .submenu-group-title {
        color: var(--blue-normal);
    }

    /* The panel on wide screens: room around the content and one hairline, under the intro. */
    .site-header .submenu {
        max-width: calc(min(100vw, var(--max-width)) - 2 * var(--gutter));
        padding: 40px var(--wp--preset--spacing--50);
    }

    /* A panel higher than the window scrolls inside itself, so the featured box at its end stays within reach.
       The scroll padding keeps the focus ring of a link clear of the edge of the panel. */
    .site-header .submenu {
        max-height: calc(100vh - var(--header-height) - var(--wp-admin--admin-bar--height, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        scroll-padding-block: 40px;
    }

    .site-header .submenu-intro {
        border-bottom: 1px solid var(--hairline-on-light);
        margin-bottom: var(--wp--preset--spacing--40);
        max-width: none;
        padding-bottom: var(--wp--preset--spacing--40);
    }

    /* The hairline takes the width of the panel, the text keeps a readable line. */
    .site-header .submenu-title,
    .site-header .submenu-description,
    .site-header .submenu-more {
        max-width: 30rem;
    }

    .site-header .submenu-groups {
        align-items: flex-start;
        gap: 56px;
    }

    /* A group is as wide as its longest line, so no title or link wraps. */
    .site-header .submenu-group {
        flex: 0 0 auto;
        width: auto;
    }

    /* Without the hairline of .lijntitel: the columns line up on the first link. */
    .site-header .submenu .submenu-group-title {
        margin-bottom: 14px;
        white-space: nowrap;

        &::after {
            display: none;
        }
    }

    /* One step below the main items, and no line between the links. */
    .site-header .submenu-link {
        border-top: 0;
        font-size: 1rem;
        line-height: 1.4;
    }

    /* The featured box: under the groups, over the width of the panel's content. Beside the groups a panel
       would pass the edge of the window. Width 0 with a minimum of 100% keeps the text of the box out of the
       width of the panel, which follows the groups. */
    .site-header .submenu-feature {
        background-color: var(--blue-light);
        border-radius: var(--radius);
        margin-top: var(--wp--preset--spacing--40);
        min-width: 100%;
        padding: var(--wp--preset--spacing--30);
        width: 0;
    }

    .site-header .submenu-feature-title,
    .site-header .submenu-feature-text {
        max-width: 30rem;
    }

    .site-header .submenu-feature-text {
        font-size: 1rem;
    }

    /* A text link, as high as a link in a group; the margin takes the room under it back out of the box. */
    .site-header .submenu .submenu-feature-link {
        color: var(--blue-normal);
        display: inline-block;
        font-size: 1rem;
        line-height: 1.4;
        margin-bottom: calc(-1 * var(--wp--preset--spacing--20));
        padding: var(--wp--preset--spacing--20) 0;

        &:hover {
            color: var(--blue-dark);
        }
    }
}

/* Up to 1279px a panel of three groups under the second main item would pass the edge of the window: less room there. */
@media screen and (min-width: 1200px) and (max-width: 1279px) {
    .site-header .submenu {
        padding-left: 40px;
        padding-right: 40px;
    }

    .site-header .submenu-groups {
        gap: var(--wp--preset--spacing--40);
    }
}

@media screen and (min-width: 1200px) and (hover: hover) {
    .site-header .submenu-toggle:not(:focus-visible) {
        clip-path: inset(50%);
        height: 1px;
        margin: 0;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }
}

/* On a wide touch screen the plus gets a target of 44 px without moving the menu. */
@media screen and (min-width: 1200px) and (hover: none) {
    .site-header .submenu-toggle {
        position: relative;

        &::after {
            content: "";
            inset: -13px -16px;
            position: absolute;
        }
    }
}

/* The menu needs this width to stay on one line. */
@media screen and (max-width: 1199px) {
    body.menu-open {
        overflow: hidden;
    }

    .site-header {
        .menu-toggle {
            background: none;
            border: 0;
            color: inherit;
            cursor: pointer;
            display: block;
            font-size: var(--wp--preset--font-size--small);
            font-weight: 500;
            letter-spacing: 0.06em;
            margin-left: auto;
            min-height: 44px;
            min-width: 44px;
            padding: 0;
            text-align: right;
            text-transform: uppercase;
        }

        .site-nav {
            background-color: var(--blue-dark);
            bottom: 0;
            color: var(--white);
            display: none;
            height: auto;
            left: 0;
            overflow-y: auto;
            padding: 0 var(--gutter) var(--wp--preset--spacing--40);
            position: fixed;
            right: 0;
            top: calc(var(--header-height) + var(--wp-admin--admin-bar--height, 0px));

            &.is-open {
                display: block;
            }

            :focus-visible {
                outline: var(--focus-on-dark);
            }
        }

        .header-menu-container {
            height: auto;
        }

        .header-menu {
            display: block;
            height: auto;
        }

        .header-menu-item {
            align-items: center;
            border-bottom: 1px solid var(--hairline-on-dark);
            display: flex;
            flex-wrap: wrap;
            height: auto;
            padding: var(--wp--preset--spacing--20) 0;
        }

        .menu-link {
            align-items: center;
            display: flex;
            flex: 1 1 0;
            font-size: var(--wp--preset--font-size--large);
            min-height: 44px;
            white-space: normal;

            &:hover,
            &[aria-current] {
                text-decoration-color: var(--blue-light);
            }
        }

        .submenu-toggle {
            flex: 0 0 auto;
            font-size: var(--wp--preset--font-size--large);
            font-weight: 400;
            height: 44px;
            margin: 0;
            text-align: right;
            width: 44px;

            &[aria-expanded="true"] {
                font-weight: 400;
            }
        }

        /* An accordion: the main item is the title, so its repeat goes. */
        .submenu-title {
            display: none;
        }

        .submenu {
            background: none;
            border: 0;
            color: inherit;
            flex: 0 0 100%;
            padding: 0 0 var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
            position: static;
            width: auto;

            a:hover,
            a[aria-current] {
                text-decoration-color: var(--blue-light);
            }
        }

        .submenu .submenu-more {
            color: inherit;

            &:hover {
                color: inherit;
            }
        }

        .submenu-intro {
            max-width: none;
        }

        .submenu-more {
            align-items: center;
            display: flex;
            min-height: 44px;
        }

        .submenu-groups {
            display: block;
        }

        .submenu-group {
            margin-top: var(--wp--preset--spacing--20);
            width: auto;
        }

        .submenu-group-title {
            color: var(--blue-light);

            &::after {
                border-top-color: var(--hairline-on-dark);
            }
        }

        .submenu-link {
            border-top-color: var(--hairline-on-dark);

            a {
                align-items: center;
                display: flex;
                min-height: 44px;
                padding: 0;
            }
        }

        /* The featured box in the accordion: no background, one hairline above. */
        .submenu-feature {
            border-top: 1px solid var(--hairline-on-dark);
            margin-top: var(--wp--preset--spacing--20);
            padding-top: var(--wp--preset--spacing--30);
        }

        .submenu-feature-text {
            font-size: var(--wp--preset--font-size--small);
        }

        .submenu .submenu-feature-link {
            align-items: center;
            display: flex;
            font-size: var(--wp--preset--font-size--small);
            min-height: 44px;
        }

        .header-actions {
            align-items: stretch;
            flex-flow: column;
            gap: 0;
            margin-top: var(--wp--preset--spacing--20);
        }

        .header-search,
        .header-language {
            align-items: center;
            display: flex;
            min-height: 44px;

            &:hover {
                text-decoration-color: var(--blue-light);
            }
        }

        .header-divider {
            display: none;
        }

        .header-contact {
            display: block;
            margin-top: var(--wp--preset--spacing--40);

            address {
                font-style: normal;
            }
        }

        .header-contact-title {
            color: var(--blue-light);

            &::after {
                border-top-color: var(--hairline-on-dark);
            }
        }

        .header-contact-line {
            display: block;
            font-size: var(--wp--preset--font-size--medium);
        }

        .header-contact-link {
            align-items: center;
            color: inherit;
            display: flex;
            min-height: 44px;
            text-decoration: underline;
            text-decoration-color: transparent;
            text-decoration-thickness: 1px;
            text-underline-offset: 6px;
            transition: var(--transition);

            &:hover {
                text-decoration-color: var(--blue-light);
            }
        }

        .header-contact-line + .header-contact-link {
            margin-top: var(--wp--preset--spacing--20);
        }

        .header-contact-link + .header-contact-link {
            margin-top: 0;
        }

        .header-cta {
            justify-content: center;
            margin-top: var(--wp--preset--spacing--30);
            width: 100%;
        }
    }
}

@media screen and (max-width: 768px) {
    .site-header {
        .site-logo {
            height: 32px;
        }
    }
}
