/* Top bar (MainLayout) */
:root {
    --topbar-height: 64px;
}

.topbar.mud-appbar {
    height: var(--topbar-height);
    /* Soft light spots over a diagonal gradient from the brand blue */
    background:
        radial-gradient(circle at 12% -40%, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 45%),
        radial-gradient(circle at 88% 140%, rgba(124, 58, 237, 0.45) 0%, rgba(124, 58, 237, 0) 50%),
        linear-gradient(115deg, #142a47 0%, var(--brand-bg) 40%, #27508a 75%, #3b2f7a 100%) !important;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #7c3aed, #4f8df7, #7c3aed) 1;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

    .topbar .mud-toolbar {
        height: 100%;
        min-height: 0;
        padding-inline: 12px 16px;
    }

.topbar-offset {
    margin-top: var(--topbar-height) !important;
}

/* Side menu drawer: the full height of the window, with the brand header (as tall as the top bar)
   at its top. A long menu (e.g. with "About Us and Contact" open) scrolls inside it, so its last
   entries can always be reached. */
.my-drawer.mud-drawer {
    top: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    /* the menu's light blue down to the bottom, also below the last entry */
    background: linear-gradient(180deg, var(--v5-sky-100, #e0f2fe) 0%, #eef2ff 100%) !important;
}

/* brand header at the top of the side menu: logo and site name on a deep blue gradient */
.drawer-brand {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-height);
    padding: 0 12px;
    background:
        radial-gradient(circle at 85% -20%, rgba(165, 180, 252, 0.55) 0%, rgba(165, 180, 252, 0) 55%),
        linear-gradient(135deg, var(--v5-sky-900, #0c4a6e) 0%, var(--v5-sky-700, #0369a1) 100%);
    border-bottom: 3px solid var(--v5-accent, #a5b4fc);
    box-shadow: 0 2px 10px rgba(12, 74, 110, 0.25);
    color: #fff;
    text-decoration: none;
}

.drawer-brand-logo {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

    .drawer-brand-logo img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.drawer-brand-name {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.drawer-brand:hover .drawer-brand-name,
.drawer-brand:focus-visible .drawer-brand-name {
    color: var(--v5-accent, #a5b4fc);
}

.drawer-brand:focus-visible {
    outline: 2px solid var(--v5-accent, #a5b4fc);
    outline-offset: -4px;
}

/* menu and logo */
.topbar-start {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.topbar-menu {
    color: #fff !important;
}

    .topbar-menu:hover {
        background-color: rgba(255, 255, 255, 0.12) !important;
    }

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.topbar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    padding: 4px 10px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

    .topbar-logo img {
        height: 100%;
        width: auto;
        display: block;
    }

.topbar-name {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.topbar-brand:hover .topbar-name,
.topbar-brand:focus-visible .topbar-name {
    color: #cfd8ff;
}

/* language switch: one pill with a highlighted current language */
.topbar-langs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.08);
}

.topbar-lang {
    min-width: 64px;
    padding: 6px 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--site-font);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

    .topbar-lang:hover {
        background-color: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

    .topbar-lang:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 1px;
    }

.topbar-lang-active,
.topbar-lang-active:hover {
    background-color: #fff;
    color: var(--brand-bg);
    cursor: default;
}

/* version switch: same pill as the languages, with links instead of buttons */
.topbar-versions {
    margin-inline-end: 10px;
}

    .topbar-versions .topbar-lang {
        display: inline-flex;
        justify-content: center;
        min-width: 44px;
        text-decoration: none;
    }

@media (max-width: 600px) {
    .topbar-versions {
        margin-inline-end: 4px;
    }

    .topbar-versions .topbar-lang {
        min-width: 0;
    }

    :root {
        --topbar-height: 58px;
    }

    .topbar .mud-toolbar {
        padding-inline: 4px 8px;
    }

    .topbar-name {
        display: none;
    }

    .topbar-logo {
        height: 38px;
        padding: 3px 8px;
    }

    .topbar-lang {
        min-width: 0;
        padding: 5px 9px;
        font-size: 0.8rem;
    }
}

/* versions overview and exit buttons */
.topbar-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-inline-end: 10px;
}

.topbar-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    transition: background-color 0.2s ease;
}

    .topbar-tool:hover,
    .topbar-tool:focus-visible {
        background-color: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

@media (max-width: 600px) {
    .topbar-tools {
        margin-inline-end: 4px;
    }

    .topbar-tool {
        width: 30px;
        height: 30px;
    }
}

/* Narrow screens: the version and language switches no longer fit in one row,
   so the bar wraps onto two rows (languages on the second) */
@media (max-width: 900px) {
    :root {
        --topbar-height: 108px;
    }

    .topbar .mud-toolbar {
        flex-wrap: wrap;
        align-content: center;
        row-gap: 8px;
        padding-block: 6px;
    }

    .topbar-langs:not(.topbar-versions) {
        margin-inline: auto;
    }
}

@media (max-width: 600px) {
    :root {
        --topbar-height: 96px;
    }
}
