/*
 * Site header bar with drop-down menus. Shared by every page except the opening logo page (/index.html).
 * The menu items themselves live in /assets/site-header.js. Everything here is prefixed "trh-" so the
 * rules cannot collide with a page's own theme.
 */

.trh {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(5, 11, 45, 0.96);
    border-bottom: 1px solid rgba(37, 201, 255, 0.18);
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.2;
    text-align: left;
}

.trh *,
.trh *::before,
.trh *::after {
    box-sizing: border-box;
}

.trh-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.6rem 1rem;
    position: relative;
}

.trh-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
    border: 0;
}

.trh-brand img {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 8px;
}

.trh-brand:hover,
.trh-brand:focus-visible {
    color: #20a9ff;
}

/* The menu list */
.trh-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.trh-item {
    position: relative;
    margin: 0;
    padding: 0;
    list-style: none;
}

.trh-top {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    padding: 0.65rem 0.9rem;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #dce4ff;
    font: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    box-shadow: none;
    text-transform: none;
    height: auto;
    line-height: 1.2;
}

.trh-top::after {
    content: "";
    width: 0.42rem;
    height: 0.42rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.15s ease;
}

.trh-top:hover,
.trh-top:focus-visible,
.trh-item.open > .trh-top,
.trh-item.current > .trh-top {
    background: rgba(37, 201, 255, 0.10);
    color: #20a9ff;
    outline: none;
}

.trh-top:focus-visible,
.trh-sub a:focus-visible,
.trh-brand:focus-visible,
.trh-burger:focus-visible {
    outline: 2px solid #20a9ff;
    outline-offset: 2px;
}

.trh-item.open > .trh-top::after {
    transform: translateY(1px) rotate(225deg);
}

/* The drop-down panel */
.trh-sub {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 230px;
    margin: 0;
    padding: 0.4rem;
    list-style: none;
    background: #0a1240;
    border: 1px solid rgba(37, 201, 255, 0.22);
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.trh-item.open > .trh-sub {
    display: block;
}

@media (hover: hover) and (min-width: 821px) {
    .trh-item:hover > .trh-sub {
        display: block;
    }

    .trh-item:hover > .trh-top {
        background: rgba(37, 201, 255, 0.10);
        color: #20a9ff;
    }

    .trh-item:hover > .trh-top::after {
        transform: translateY(1px) rotate(225deg);
    }

    /* Bridges the 6px gap so the panel does not close on the way down. */
    .trh-item:hover > .trh-sub::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: -8px;
        height: 8px;
    }
}

.trh-sub li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.trh-sub a {
    display: block;
    padding: 0.65rem 0.8rem;
    border: 0;
    border-radius: 7px;
    color: #dce4ff;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
}

.trh-sub a small {
    display: block;
    margin-top: 0.2rem;
    color: #8fa0cf;
    font-size: 0.8rem;
    font-weight: 400;
}

.trh-sub a:hover,
.trh-sub a:focus-visible {
    background: rgba(37, 201, 255, 0.12);
    color: #ffffff;
}

.trh-sub a[aria-current="page"] {
    color: #20a9ff;
    background: rgba(37, 201, 255, 0.08);
}

/* Phone / narrow window: the menu collapses behind a button */
.trh-burger {
    display: none;
    margin: 0;
    padding: 0.55rem 0.7rem;
    background: transparent;
    border: 1px solid rgba(37, 201, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    box-shadow: none;
    height: auto;
}

.trh-burger span,
.trh-burger span::before,
.trh-burger span::after {
    display: block;
    width: 20px;
    height: 2px;
    background: #dce4ff;
    border-radius: 2px;
    content: "";
    position: relative;
}

.trh-burger span::before {
    position: absolute;
    top: -6px;
}

.trh-burger span::after {
    position: absolute;
    top: 6px;
}

@media (max-width: 820px) {
    .trh-burger {
        display: block;
    }

    .trh-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.5rem 1rem 1rem;
        background: #050b2d;
        border-bottom: 1px solid rgba(37, 201, 255, 0.18);
        box-shadow: 0 14px 24px rgba(0, 0, 0, 0.45);
    }

    .trh.open .trh-menu {
        display: flex;
    }

    .trh-top {
        width: 100%;
        justify-content: space-between;
    }

    .trh-sub {
        position: static;
        min-width: 0;
        margin: 0 0 0.4rem;
        box-shadow: none;
        background: #0a1240;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trh-top::after {
        transition: none;
    }
}

/* Shown only when JavaScript is off: a plain row of links. */
.trh-plain {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.8rem 1rem;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.trh-plain a {
    margin-right: 1.2rem;
    color: #20a9ff;
    font-weight: 600;
    text-decoration: none;
}
