/*
 * Site-wide styles that sit outside any one component. Colors, type, and spacing come from Fluent's
 * design tokens (brand colors from brand.css); nothing here defines its own palette.
 */
:root {
    /* The shared content width that the header and every page section line up on. */
    --page-max-width: 1120px;
    /* The page follows the system's light or dark mode (as Fluent does), so the browser's own form
       colors, scrollbars, and autofill match it instead of staying light. */
    color-scheme: light dark;
}

/*
 * Fluent's text input is a padded box with the real <input> inside it, and browsers paint autofill
 * only on that <input>: a pale block inset at the sides. The side padding moves onto the <input> so
 * it fills the field, and autofill is repainted in Fluent's own shades. Browsers do not allow
 * replacing an autofilled input's background, so an inset shadow covers it.
 */
fluent-text-input::part(root) {
    padding-inline: 0;
}

fluent-text-input::part(control) {
    padding-inline: var(--spacingHorizontalMNudge);
}

fluent-text-input::part(control):autofill {
    box-shadow: inset 0 0 0 100px var(--colorNeutralBackground1Selected);
    -webkit-text-fill-color: var(--colorNeutralForeground1);
    caret-color: var(--colorNeutralForeground1);
}

/* width: 100% keeps it full width when it is itself a flex item, such as a page's root inside <main>. */
.page-width {
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 600px) {
    .page-width {
        padding: 0 1rem;
    }
}

/*
 * The signed-in shell (AppLayout). Fluent's layout elements are outside the layout's CSS scope, so
 * they are styled here. Every surface is Fluent's off-white canvas (dark gray in dark mode); Fluent
 * fills the header with the brand color, and this shell keeps blue as an accent instead.
 */
.app-layout,
.app-layout .fluent-layout-item[area=header] {
    background-color: var(--colorNeutralBackground2);
    color: var(--colorNeutralForeground1);
}

/* The header's content (AppLayout's .app-header) sets its own padding, so its items line up with the page below. */
.app-layout .fluent-layout-item[area=header] {
    padding: 0;
    border-bottom: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
}

/* Fluent colors its hamburger inline for a brand-filled header; on this neutral header it takes the text color. */
.app-layout .fluent-layout-hamburger fluent-button {
    color: var(--colorNeutralForeground1) !important;
}

/* Fluent sizes the sticky navigation to its items; the divider runs the full height below the header. */
.app-layout .fluent-layout-item[area=nav] {
    min-height: calc(var(--layout-height) - var(--layout-header-height));
    border-inline-end: var(--strokeWidthThin) solid var(--colorNeutralStroke2);
}

/*
 * A navigation group (Messages: Inbox, Sent) is shown open only while one of its pages is showing (AppLayout).
 * The layout renders statically, so Fluent's fold toggle cannot run, and the open group's header drops the
 * chevron and hover that would offer one.
 */
.app-layout .fluent-navcategoryitem {
    cursor: default;
}

.app-layout .fluent-navcategoryitem:hover {
    background-color: transparent !important;
}

.app-layout .fluent-navcategoryitem .expand-icon {
    display: none;
}

/*
 * The group unfolds when it appears: its height grows from 0, clipped while it grows, as Fluent's own
 * (interactive) nav animates it. Fluent's 150ms on its sharpest decelerate curve covers most of the height
 * in the first frame, so this uses its normal duration and gentlest decelerate curve to read as a slide.
 * Navigating between the group's own pages keeps the same elements, so it does not replay. Browsers
 * without interpolate-size show the items at once.
 */
.app-layout .fluent-navsubitemgroup {
    interpolate-size: allow-keywords;
    animation: nav-group-unfold var(--durationNormal) var(--curveDecelerateMin);
}

@keyframes nav-group-unfold {
    from {
        height: 0;
        min-height: 0;
        overflow: hidden;
    }

    to {
        height: auto;
        min-height: 0;
        overflow: hidden;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-layout .fluent-navsubitemgroup {
        animation: none;
    }
}

h1:focus {
    outline: none;
}

/* Blazor's ValidationMessage, for forms whose inputs do not show their own validation. */
.validation-message {
    color: var(--colorPaletteRedForeground1);
    font-size: var(--fontSizeBase200);
    line-height: var(--lineHeightBase200);
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIge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AxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }
