/* Base styles. Colors, spacing and type come from the --pt-* variables, which the app writes from
   DesignSystem/Tokens/PtTokens.cs (PtThemeStyles; the display scopes its own). Only the loading screen below repeats
   emerald's colors, because it shows before the app (and its variables) exist; a test keeps them equal to the tokens. */

/* ── Before the app starts ─────────────────────────────────────────────────── */

html[data-theme="light"] body { background: #F4F3EE; }
html[data-theme="dark"] body { background: #141413; }

/* The first load (wwwroot/index.html): the app's mark (the display's mosque avatar) and name, then the download's
   progress, centered. Emerald, the original colour, in light and dark. */
.pt-boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    /* No fade-in: while WebAssembly compiles, the page's main thread is busy and an animation might never start. */
    font-family: Roboto, "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
}

.pt-boot-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.pt-boot-mark svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}

.pt-boot-title {
    font-size: 22px;
    line-height: 28px;
}

html[data-theme="light"] .pt-boot-mark { background: #0F6E56; color: #FFFFFF; }
html[data-theme="dark"] .pt-boot-mark { background: #5DCAA5; color: #04342C; }
html[data-theme="light"] .pt-boot-title { color: #1F1F1D; }
html[data-theme="dark"] .pt-boot-title { color: #F1EFE8; }

.loading-progress {
    display: block;
    width: 3rem;
    height: 3rem;
    margin-top: 8px;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(128, 128, 128, 0.25);
    stroke-width: 0.3rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #0F6E56;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

html[data-theme="dark"] .loading-progress circle:last-child {
    stroke: #5DCAA5;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */

html, body {
    margin: 0;
    font-family: var(--pt-font, system-ui, sans-serif);
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--pt-background);
    color: var(--pt-text);
}

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

/* Visible focus everywhere: a 2px ring in the accent with a 2px offset; never removed without a replacement. */
:focus-visible {
    outline: 2px solid var(--pt-accent);
    outline-offset: 2px;
}

/* Except headings focused after navigation (FocusOnNavigate, tabindex="-1"): nothing to operate there, so no ring. */
[tabindex="-1"]:focus-visible {
    outline: none;
}

/* Clock and countdown digits must not jitter as they change (Flutter's tabularFigures). */
.pt-num {
    font-variant-numeric: tabular-nums;
}

/* Keeps an email or a link left-to-right inside right-to-left text. */
.pt-ltr {
    direction: ltr;
    unicode-bidi: isolate;
}

[dir="rtl"] .pt-mirror-rtl {
    transform: scaleX(-1);
}

/* ── Reduced motion (PRODUCT.md: slide transitions become cuts) ─────────────── */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Unhandled error bar (Blazor) ──────────────────────────────────────────── */

#blazor-error-ui {
    background: var(--pt-error-surface, #FFDAD6);
    color: var(--pt-text, #1F1F1D);
    border-top: 1px solid var(--pt-error, #BA1A1A);
    bottom: 0;
    box-sizing: border-box;
    display: none;
    inset-inline: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    z-index: 1000;
}

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