/* Self-hosted fonts (SIL Open Font License). The theme (TipplaTheme) selects Outfit; JetBrains Mono is for numeric values. */
@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url('../fonts/outfit-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
}

/* Numeric values (KPIs, amounts, IDs). */
.tippla-mono {
    font-family: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-variant-numeric: tabular-nums;
}

/* A readable maximum width for page content on very large screens. */
.tippla-page {
    max-width: 1600px;
    margin-inline: auto;
}

/* Native checkboxes (used in static server-rendered forms) follow the theme color. */
input[type='checkbox'] {
    accent-color: var(--mud-palette-primary);
}

/* MudBlazor shows keyboard focus on buttons, chips and links only as a faint background tint, which is too subtle to
   see (WCAG 2.4.7). Text fields keep MudBlazor's own focus border. */
a:focus-visible,
button:focus-visible,
input[type='range']:focus-visible,
.tippla-switch:has(input:focus-visible) {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: var(--mud-default-borderradius);
}

/* FocusOnNavigate moves focus to the page heading after navigation so screen readers announce it; the heading is
   not interactive, so it does not need a focus ring. */
h1:focus {
    outline: none;
}

/* Lets keyboard users jump past the navigation drawer; only visible while focused. */
.tippla-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2000;
    padding: 8px 16px;
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

.tippla-skip-link:focus {
    left: 8px;
    top: 8px;
}

#main-content:focus {
    outline: none;
}

/* Connection-lost dialog. MudBlazor styles #components-reconnect-modal itself (!important), so these selectors are
   more specific. Blazor adds one components-reconnect-* state class to the element while the connection is not healthy. */
#components-reconnect-modal.tippla-reconnect {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55) !important;
}

.tippla-reconnect-card {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(440px, calc(100vw - 32px));
    padding: 16px 20px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
}

.tippla-reconnect-message {
    display: none;
    margin: 0;
}

#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected,
#components-reconnect-modal.components-reconnect-paused,
#components-reconnect-modal.components-reconnect-resume-failed {
    display: block;
}

/* Reconnecting. */
.components-reconnect-show .tippla-reconnect-show,
.components-reconnect-retrying .tippla-reconnect-show,
/* Gave up reconnecting: offer to try again. */
.components-reconnect-failed .tippla-reconnect-failed,
/* The server no longer has the session: the page has to be reloaded. */
.components-reconnect-rejected .tippla-reconnect-rejected,
.components-reconnect-paused .tippla-reconnect-rejected,
.components-reconnect-resume-failed .tippla-reconnect-rejected {
    display: block;
}

/* While a failed state is shown, the generic "reconnecting" message must not also show. */
.components-reconnect-failed .tippla-reconnect-show,
.components-reconnect-rejected .tippla-reconnect-show,
.components-reconnect-paused .tippla-reconnect-show,
.components-reconnect-resume-failed .tippla-reconnect-show {
    display: none;
}

.tippla-reconnect-card button {
    margin-left: 8px;
    padding: 4px 12px;
    border: 0;
    border-radius: var(--mud-default-borderradius);
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
