/*
 * What the MudBlazor theme (Layout/PhomoTheme.cs) can't express: radii, motion, the status tones, the card surface,
 * the larger type step on wide screens, dark mode's flat cards and the splash shown while the app loads.
 * See docs/layers/Presentation/Theme.md.
 */

:root {
    /* Corner radii */
    --radius-medium: 12px;
    --radius-card: 20px;
    --radius-pill: 999px;

    /* Motion: quick for a press, standard for something appearing or going, slow for a crossfade */
    --motion-quick: 120ms;
    --motion-standard: 200ms;
    --motion-slow: 400ms;
    --motion-easing: cubic-bezier(0.2, 0, 0, 1);

    color-scheme: dark light;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --motion-quick: 0ms;
        --motion-standard: 0ms;
        --motion-slow: 0ms;
    }

    /* MudBlazor's own animations and transitions too, such as the skeleton's shimmer */
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* One step up for the text read from a distance, once there's room: display 28, title 20, body 18 */
@media (min-width: 600px) {
    .phomo-app {
        --mud-typography-h5-size: 1.75rem;
        --mud-typography-h6-size: 1.25rem;
        --mud-typography-body1-size: 1.125rem;
        --mud-typography-subtitle1-size: 1.125rem;
    }
}

/* The theme's background once MudBlazor has loaded; before then, the splash's */
html, body {
    margin: 0;
    background-color: var(--mud-palette-background, #0F1115);
    -webkit-text-size-adjust: 100%;
}

body {
    /* An app, not a page: no pull-to-refresh or rubber-banding, no double-tap zoom, no text selection on a long press */
    overscroll-behavior: none;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Status tones: each sets --tone for the component to colour itself with. See Components/StatusTone.cs. */
.tone-positive { --tone: var(--mud-palette-success); }
.tone-attention { --tone: var(--mud-palette-warning); }
.tone-problem { --tone: var(--mud-palette-error); }
.tone-quiet { --tone: var(--mud-palette-gray-default); }

/*
 * Text in its tone's colour, pulled towards the text colour far enough to read at 4.5:1 or more on the surface and on
 * the tone's own wash: further in light mode, where the tones are mid-bright on a light wash.
 */
.phomo-app { --tone-text-strength: 65%; }
.phomo-app[data-theme-mode="light"] { --tone-text-strength: 55%; }

.tone-text {
    color: color-mix(in srgb, var(--tone) var(--tone-text-strength), var(--mud-palette-text-primary));
}

/* The one card surface: run rows, now playing and their placeholders */
/* Positioned, so what's inside it for screen readers only stays inside it */
.phomo-card {
    position: relative;
    border-radius: var(--radius-card);
    background-color: var(--mud-palette-surface);
    box-shadow: var(--mud-elevation-1);
}

/* Dark mode shows depth with lighter surfaces, not shadows; floating things keep theirs */
.phomo-app[data-theme-mode="dark"] {
    --mud-elevation-1: none;
    --mud-elevation-2: none;
    --mud-elevation-3: none;
    --mud-elevation-4: none;
}

/* For screen readers only */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Progress moves smoothly rather than jumping */
.mud-progress-linear .mud-progress-linear-bar {
    transition: transform var(--motion-slow) var(--motion-easing);
}

/* Shown inside #app until Blazor replaces it, in the phone's own light or dark */
.app-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
}

@media (prefers-color-scheme: light) {
    html, body {
        background-color: var(--mud-palette-background, #F3F4F8);
    }
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 12px 16px;
    box-sizing: border-box;
    background: #D2443A;
    color: #ffffff;
    font-family: system-ui, sans-serif;
}

#blazor-error-ui .reload {
    color: inherit;
    margin-left: 8px;
}
