:root {
    /* The platform palette, shared with Trelity Internal, People and Production: navy primary, the
       blue accent, and the pale ground the page sheet floats on. */
    --ts-primary: #00183c;
    --ts-primary-dark: #234692;
    --ts-text: #1c1c28;
    --ts-text-muted: #4a4f5c;
    --ts-border: #dfe1e6;
    --ts-sidebar-bg: #f6f9ec;
    /* Roboto is what Trelity Internal renders in - it leaves MudBlazor's default family alone - so
       the apps read as one product. Set explicitly rather than relying on that default. */
    --mud-typography-default-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

/* The MudLayout shell owns the scrolling (the page sheet scrolls inside it), so the document itself
   must not scroll. */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
    color: var(--ts-text);
}

/* Background lives on body only, never on html: the boot splash columns sit at z-index -1 and are
   only visible when body's background is the one propagated to the canvas. */
body {
    background: #f6f9ec;
}

#app {
    height: 100%;
}

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

a {
    color: var(--ts-primary);
    text-decoration: none;
}

a:hover {
    color: var(--ts-primary-dark);
}

h1:focus {
    outline: none;
}

/* ---------- Layout ---------- */

/* Padding around the page sheet, tightening on narrow screens (shared with the other Trelity apps) */
.pr-p-4 {
    padding: 16px !important;
}

@media (max-width: 1300px) {
    .pr-p-4 {
        padding: 10px !important;
    }
}

/* ---------- Drawer navigation ---------- */

.nav-brand-stack {
    padding-bottom: min(4vw, 12px);
    padding-top: min(4vw, 12px);
    width: 100%;
}

/* Product switcher: the current wordmark is the trigger, the menu lists the sibling sites. */
.nav-domain-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: min(220px, calc(100vw - 32px));
    max-width: 100%;
    padding: 8px 6px;
    border: 0;
    border-radius: 12px;
    color: var(--ts-primary);
    background: transparent;
    cursor: pointer;
    font: inherit;
    transition: background-color .15s ease-in-out;
}

    .nav-domain-menu-trigger:hover,
    .nav-domain-menu-trigger:focus-visible,
    .nav-domain-menu-trigger[aria-expanded="true"] {
        background: rgba(255, 255, 255, .72);
    }

    .nav-domain-menu-trigger:focus-visible {
        outline: 2px solid var(--ts-primary-dark);
        outline-offset: 2px;
    }

.nav-domain-current-logo {
    display: block;
    width: min(180px, calc(100vw - 70px));
    max-width: 100%;
    height: auto;
}

.nav-domain-menu-chevron {
    flex: 0 0 auto;
    color: var(--ts-primary);
    transition: transform .15s ease-in-out;
}

.nav-domain-menu-trigger[aria-expanded="true"] .nav-domain-menu-chevron {
    transform: rotate(180deg);
}

.nav-domain-menu-popover {
    width: min(220px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
}

.nav-domain-menu-list {
    width: 100%;
    padding: 6px !important;
}

.nav-domain-menu-item {
    min-height: 54px;
    padding: 10px 12px !important;
    border-radius: 10px;
}

.nav-domain-menu-logo {
    display: block;
    width: 100%;
    max-width: 174px;
    height: auto;
}

@media (max-width: 420px) {
    .nav-domain-menu-trigger {
        width: min(200px, calc(100vw - 24px));
        padding-inline: 4px;
    }

    .nav-domain-current-logo {
        width: min(160px, calc(100vw - 64px));
    }

    .nav-domain-menu-popover {
        width: min(200px, calc(100vw - 16px));
        max-width: calc(100vw - 16px);
    }
}

/* Text buttons with a leading icon, as in Trelity Internal's NavMenu. The active state is an
   addition: that sidebar has no current-page indicator, and losing it here would be a regression. */
.ts-nav-link {
    text-transform: none;
    letter-spacing: normal;
}

.ts-nav-link.active {
    background: rgba(0, 24, 60, .10);
    font-weight: 600;
}

.ts-user-card {
    background: #fff;
    width: calc(100% - 10px);
    max-width: calc(100% - 10px);
    cursor: default;
}

.ts-user-card-name {
    font-weight: 800;
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-user-card-sub {
    font-size: 11px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ts-user-card-logout {
    color: #000;
}

/* ---------- Error UI (template default) ---------- */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
