/*
 * Site header (resources/views/layouts/site/header.blade.php), shared by every page.
 * Behaviour lives in public/site/assets/js/header.js.
 * Inner pages pad their first section by 80px, so the bar must stay at or under that height.
 */

.hd {
    --hd-h: 70px;
    --hd-ink: #0f1d2e;
    --hd-text: #3d4b5c;
    --hd-muted: #66768a;
    --hd-line: rgba(15, 29, 46, .08);
    --hd-soft: #f3f7fb;
    --hd-blue: #1577bb;
    --hd-blue-600: #0f5f97;
    --hd-green: #3fb24a;

    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--hd-line);
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    transition: box-shadow .3s, background-color .3s;
}

.hd.is-scrolled {
    background: #fff;
    box-shadow: 0 8px 28px rgba(15, 29, 46, .08);
}

.hd :where(ul) { margin: 0; padding: 0; list-style: none; }

.hd a { text-decoration: none; }

.hd :focus-visible {
    outline: 2px solid var(--hd-blue);
    outline-offset: 2px;
    border-radius: 8px;
}

.hd-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: 1320px;
    height: var(--hd-h);
    margin: 0 auto;
    padding: 0 24px;
}

.hd-logo { flex: none; display: block; }
.hd-logo picture { display: block; }

.hd-logo img {
    display: block;
    /* whole-pixel size matching the logo files, so the browser never resamples */
    width: 158px;
    height: 40px;
}

/* ---------- Burger (phones and tablets) ---------- */

.hd-burger {
    display: none;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 1px solid var(--hd-line);
    border-radius: 12px;
    background: #fff;
    color: var(--hd-ink);
    cursor: pointer;
}

.hd-burger__lines {
    position: relative;
    display: block;
    width: 20px;
    height: 14px;
}

.hd-burger__lines span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .3s, opacity .2s, top .3s;
}

.hd-burger__lines span:nth-child(1) { top: 0; }
.hd-burger__lines span:nth-child(2) { top: 6px; }
.hd-burger__lines span:nth-child(3) { top: 12px; }

.hd-burger[aria-expanded="true"] .hd-burger__lines span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.hd-burger[aria-expanded="true"] .hd-burger__lines span:nth-child(2) { opacity: 0; }
.hd-burger[aria-expanded="true"] .hd-burger__lines span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---------- Menu ---------- */

.hd-menu {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.hd-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.hd-item {
    position: relative;
    display: flex;
    align-items: center;
}

.hd-link {
    position: relative;
    display: block;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--hd-ink);
    white-space: nowrap;
    transition: color .2s;
}

.hd-item--menu .hd-link { padding-right: 4px; }

.hd-link:hover,
.hd-item.is-active .hd-link,
.hd-item.is-open .hd-link { color: var(--hd-blue); }

.hd-caret {
    display: grid;
    place-items: center;
    width: 26px;
    height: 32px;
    margin-right: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--hd-muted);
    font-size: 11px;
    cursor: pointer;
    transition: color .2s;
}

.hd-caret i { transition: transform .25s; }
.hd-item.is-open .hd-caret i { transform: rotate(180deg); }
.hd-item.is-active .hd-caret,
.hd-caret:hover { color: var(--hd-blue); }

/* ---------- Dropdown panels ---------- */

.hd-sub {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    color: var(--hd-text);
    transition: background-color .2s;
}

.hd-sub:hover { background: var(--hd-soft); }

.hd-sub__icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 15px;
    color: var(--hd-blue);
    background: linear-gradient(135deg, rgba(21, 119, 187, .12), rgba(63, 178, 74, .12));
    transition: color .2s, background .2s;
}

.hd-sub:hover .hd-sub__icon {
    color: #fff;
    background: linear-gradient(135deg, var(--hd-blue), var(--hd-green));
}

.hd-sub__text { display: block; min-width: 0; }

.hd-sub__title {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--hd-ink);
    line-height: 1.3;
}

.hd-sub__desc {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--hd-muted);
}

/* ---------- Call to action ---------- */

.hd-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 22px;
    border-radius: 999px;
    background: var(--hd-blue);
    color: #fff !important;
    font-size: 14.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 8px 20px rgba(21, 119, 187, .25);
    transition: background-color .2s, transform .2s;
}

.hd-cta i { font-size: .85em; transition: transform .2s; }
.hd-cta:hover { background: var(--hd-blue-600); transform: translateY(-1px); }
.hd-cta:hover i { transform: translateX(3px); }

/* ---------- Desktop ---------- */

@media (min-width: 992px) {
    /* animated underline under the top-level links */
    .hd-link::after {
        content: "";
        position: absolute;
        left: 14px;
        right: 14px;
        bottom: 2px;
        height: 2px;
        border-radius: 2px;
        background: linear-gradient(90deg, var(--hd-green), var(--hd-blue));
        transform: scaleX(0);
        transform-origin: left;
        transition: transform .25s;
    }

    .hd-item--menu .hd-link::after { right: 4px; }

    .hd-link:hover::after,
    .hd-item.is-active .hd-link::after { transform: scaleX(1); }

    .hd-panel {
        position: absolute;
        top: 100%;
        left: 50%;
        width: 340px;
        padding-top: 14px; /* invisible bridge so the pointer can travel into the panel */
        opacity: 0;
        visibility: hidden;
        transform: translate(-50%, 8px);
        transition: opacity .2s, transform .2s, visibility 0s .2s;
    }

    .hd-panel--wide { width: 600px; }

    .hd-panel__list {
        padding: 10px !important;
        background: #fff;
        border: 1px solid var(--hd-line);
        border-radius: 18px;
        box-shadow: 0 24px 48px rgba(15, 29, 46, .14);
    }

    .hd-panel--wide .hd-panel__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px;
    }

    .hd-item--menu:hover .hd-panel,
    .hd-item.is-open .hd-panel {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, 0);
        transition: opacity .2s, transform .2s;
    }

    .hd-item--menu:hover .hd-caret i { transform: rotate(180deg); }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .hd-bar { gap: 16px; padding: 0 20px; }
    .hd-menu { gap: 12px; }
    .hd-link { padding-left: 10px; padding-right: 10px; font-size: 14.5px; }
    .hd-item--menu .hd-link { padding-right: 3px; }
    .hd-link::after { left: 10px; right: 10px; }
    .hd-caret { margin-right: 2px; }
    .hd-cta { padding: 0 18px; }
    .hd-logo img { width: 142px; height: 36px; }
}

/* ---------- Phones and tablets ---------- */

@media (max-width: 991.98px) {
    .hd { --hd-h: 64px; }

    .hd-bar { padding: 0 20px; }

    .hd-logo img { width: 142px; height: 36px; }

    .hd-burger { display: grid; }

    .hd-menu {
        position: fixed;
        top: var(--hd-h);
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        margin: 0;
        padding: 8px 20px 32px;
        background: #fff;
        overflow-y: auto;
        overscroll-behavior: contain;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .25s, transform .25s, visibility 0s .25s;
    }

    .hd.is-open .hd-menu {
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: opacity .25s, transform .25s;
    }

    .hd.is-open {
        background: #fff;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .hd-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .hd-item {
        flex-wrap: wrap;
        border-bottom: 1px solid var(--hd-line);
    }

    .hd-link,
    .hd-item--menu .hd-link {
        flex: 1;
        padding: 16px 0;
        font-size: 17px;
    }

    .hd-caret {
        width: 44px;
        height: 44px;
        margin: 0;
        font-size: 13px;
        border-radius: 10px;
    }

    .hd-panel {
        display: none;
        width: 100%;
        padding-bottom: 10px;
    }

    .hd-item.is-open .hd-panel { display: block; }

    .hd-sub { padding: 10px 8px; }

    .hd-cta {
        height: 52px;
        margin-top: 28px;
        font-size: 16px;
    }
}

/* Stops the page behind the open phone menu from scrolling */
html.hd-lock { overflow-y: hidden; }

@media (prefers-reduced-motion: reduce) {
    .hd,
    .hd *,
    .hd *::after {
        transition: none !important;
    }
}
