/* Header layout is independent of the background scenery. */
.ls-site-header {
    width: min(1120px, calc(100% - 2rem));
    padding-top: 12px;
}
.ls-header-nav-row {
    position: relative;
    width: 100%;
    max-width: none;
    gap: 12px;
    align-items: center;
}
.ls-header-nav-row .ls-home-logo-space {
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
}
.ls-header-nav-row .ls-nav-bar {
    flex: 1;
    min-width: 0;
    width: auto;
    max-width: none;
    padding: 8px;
    backdrop-filter: none;
    background: rgba(226, 233, 238, .88);
}
.ls-site-header p { margin: 0; }
.ls-site-header p:empty { display: none; }
.ls-nav-controls { justify-content: space-between; }
.ls-site-header .ls-primary-nav > ul { flex-wrap: nowrap; gap: 6px; }
.ls-site-header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}
.ls-site-header nav li { border: 0; min-width: 0; }
.ls-site-header nav a,
.ls-site-header summary,
.ls-site-header .ls-search-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #77766f;
    border-radius: 8px;
    background: #e0d8c3;
    color: #202a45;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,.35), 0 2px 0 #565a62;
    font-size: .9375rem;
    line-height: 1.3;
    text-transform: none;
    text-decoration: none;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: anywhere;
    animation: none;
    transform: none;
}
.ls-site-header summary { list-style: none; }
.ls-site-header summary::-webkit-details-marker { display: none; }
.ls-site-header summary::after { content: '+'; margin-left: auto; font-size: 1.1rem; }
.ls-site-header details[open] > summary::after { content: '−'; }
.ls-site-header nav a:hover,
.ls-site-header summary:hover,
.ls-site-header .ls-search-toggle:hover { background: #fff8e8; color: #202a45; transform: none; }
.ls-site-header summary.is-current-section { background: #fcf3de; border-color: #172b5d; }
.ls-site-header :focus-visible { outline: 3px solid #2b4fa0; outline-offset: 3px; }
.ls-nav-group { position: relative; }
.ls-site-header .ls-nav-group-panel {
    padding: 8px;
    border: 1px solid rgba(61,74,101,.35);
    border-radius: 10px;
    background: #e2e9ee;
    box-shadow: 0 7px 16px rgba(31,44,70,.2);
}
.ls-site-header .ls-nav-group-panel a,
.ls-site-header .ls-nav-group-panel summary { box-shadow: none; border-color: transparent; background: transparent; }
.ls-site-header .ls-nav-group-panel a:hover,
.ls-site-header .ls-nav-group-panel summary:hover { background: #fff8e8; }
.ls-site-header .ls-nav-group-panel .ls-submenu {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    min-width: 0;
    visibility: visible;
    opacity: 1;
    transform: none;
    box-shadow: none;
}
.ls-site-header .ls-nav-group-panel .ls-nav-group-panel {
    margin-left: 12px;
    border: 0;
    border-left: 2px solid #8a9caf;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 0 6px;
}
.ls-menu-close-label { display: none; }
.ls-mobile-nav[open] > summary .ls-menu-label { display: none; }
.ls-mobile-nav[open] > summary .ls-menu-close-label { display: inline; }
@media (min-width: 861px) {
    .ls-site-header .ls-primary-nav { display: block; }
    .ls-site-header .ls-mobile-nav { display: none; }
    .ls-primary-nav > ul > li > .ls-nav-group > .ls-nav-group-panel {
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        width: 280px;
        max-height: min(600px, 70dvh);
        overflow-y: auto;
        z-index: 50;
    }
    .ls-primary-nav > ul > li:nth-last-child(-n+3) > .ls-nav-group > .ls-nav-group-panel { left: auto; right: 0; }
}
@media (max-width: 860px) {
    .ls-site-header .ls-primary-nav { display: none; }
    .ls-header-nav-row .ls-nav-bar { flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; }
    .ls-site-header .ls-mobile-nav { display: block; position: static; }
    .ls-site-header .ls-mobile-nav > summary { min-width: 100px; }
    .ls-mobile-nav-links {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: min(420px, 100%);
        max-height: calc(100vh - 160px);
        max-height: calc(100dvh - 160px);
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 1px solid #8a9caf;
        border-radius: 12px;
        background: #e2e9ee;
        box-shadow: 0 8px 24px rgba(31,44,70,.25);
        padding: 12px;
    }
    .ls-site-header .ls-mobile-nav-links > ul { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
    .ls-mobile-nav-links .ls-nav-group-panel { margin-top: 6px; box-shadow: none; }
}
@media (max-width: 540px) {
    .ls-site-header { width: calc(100% - 1rem); padding-top: 8px; }
    .ls-header-nav-row { gap: 8px; }
    .ls-header-nav-row .ls-home-logo-space { width: 48px; height: 48px; flex-basis: 48px; }
    .ls-site-header .ls-mobile-nav > summary { min-width: 88px; }
}
.ls-site-search-overlay { overflow-y: auto; padding: max(12px, env(safe-area-inset-top)) 12px; }
.ls-site-search-dialog { max-height: calc(100dvh - 24px); overflow-y: auto; }

/* Centred, content-sized navigation buttons with consistent padding. */
@media (min-width: 861px) {
    .ls-site-header .ls-nav-controls { justify-content: center; gap: 8px; }
    .ls-site-header .ls-primary-nav > ul { gap: 8px; }
    .ls-site-header .ls-primary-nav > ul > li > a,
    .ls-site-header .ls-search-toggle {
        box-sizing: border-box;
        width: auto;
        min-width: 0;
        height: 46px;
        min-height: 46px;
        justify-content: center;
        padding: 10px 18px;
        border-radius: 8px;
        text-align: center;
        white-space: nowrap;
        margin: 0;
    }
}
@media (max-width: 860px) {
    .ls-site-header .ls-search-toggle,
    .ls-site-header .ls-mobile-nav > summary {
        box-sizing: border-box;
        width: auto;
        min-width: 0;
        padding: 12px 20px;
        font-size: 1.0625rem;
        height: 54px;
        min-height: 54px;
        justify-content: center;
        border-radius: 8px;
    }
}

/* Keep the entire Close target clear of the search form. */
.ls-site-search-dialog {
    padding: 16px clamp(16px, 4vw, 32px) 24px;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overscroll-behavior: contain;
}
.ls-site-search-dialog .ls-search-close {
    position: relative;
    top: auto;
    right: auto;
    z-index: 2;
    display: flex;
    width: auto;
    min-width: 72px;
    min-height: 44px;
    margin: 0 0 12px auto;
    padding: 10px 14px;
    touch-action: manipulation;
}
.ls-site-search-dialog > p:empty { display: none; }
.ls-site-search-dialog .ls-site-search { z-index: auto; min-width: 0; }
.ls-site-search-dialog .ls-site-search-control { grid-template-columns: minmax(0, 1fr) auto; }
.ls-site-search-dialog input[type="search"] { min-width: 0; width: 100%; font-size: 16px; }
.ls-site-search-dialog .ls-site-search-results { max-height: min(440px, 45dvh); overflow-y: auto; }
@media (max-width: 420px) {
    .ls-site-search-dialog .ls-site-search-control { grid-template-columns: minmax(0, 1fr); }
    .ls-site-search-dialog .ls-site-search-control button { width: 100%; min-height: 44px; }
}

/* Keep compact controls at opposite ends of the bar. */
@media (max-width: 860px) {
    .ls-site-header .ls-nav-controls { margin-left: auto; flex: 0 0 auto; }
    .ls-site-header .ls-mobile-nav { flex: 0 0 auto; }
    .ls-site-header .ls-mobile-nav-links { left: 0; right: auto; }
}

@media (min-width: 861px) and (max-width: 980px) {
    .ls-primary-nav > ul > li,
    .ls-primary-nav .ls-submenu li {
        position: relative;
        border: 0;
    }

    .ls-primary-nav .ls-submenu {
        position: absolute;
        z-index: 50;
        top: calc(100% + 0.25rem);
        left: 0;
        display: flex;
        min-width: 220px;
        flex-direction: column;
        gap: 0.35rem;
        visibility: hidden;
        margin: 0;
        border: 1px solid rgba(61, 74, 101, 0.35);
        border-radius: 8px;
        background: rgba(226, 233, 238, 0.96);
        box-shadow: 0 7px 16px rgba(31, 44, 70, 0.2);
        padding: 0.5rem;
        opacity: 0;
        transform: translateY(-5px);
        transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
    }

    .ls-primary-nav .ls-submenu .ls-submenu {
        top: -0.5rem;
        left: calc(100% + 0.3rem);
    }

    .ls-primary-nav li:hover > .ls-submenu,
    .ls-primary-nav li:focus-within > .ls-submenu {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    .ls-primary-nav .ls-submenu a {
        width: 100%;
        min-height: 38px;
        justify-content: flex-start;
        border-radius: 7px;
        color: #111;
        padding: 0.5rem 0.7rem;
        text-transform: none;
        transform: scale(1);
        transition: background-color 200ms ease, transform 200ms ease;
        white-space: nowrap;
    }

    .ls-primary-nav .ls-submenu a:hover,
    .ls-primary-nav .ls-submenu a:focus-visible {
        border-radius: 7px;
        background: #fff;
        color: #111;
        transform: scale(1.05);
    }
}
