/* Paints the page before the Compose/WASM bundle has loaded, so the loading shell in index.html is
   already on a Spendy surface rather than the browser's default white.

   The --spendy-* properties come from the generated spendy-palette.css, linked ahead of this file.
   The fallbacks are CSS system colours, not literals: Canvas/CanvasText resolve against the
   document's color-scheme (declared in index.html), so if the generated file were ever missing the
   shell degrades to a correctly *dark* surface under a dark OS instead of a white flash. A hex
   fallback could not do that, and a colour literal here would violate the one-place-only palette
   rule anyway. */
html, body {
    background: var(--spendy-background, Canvas);
    color: var(--spendy-on-background, CanvasText);
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* The shell's splash (#106). Fixed to the viewport so its centre is the window's, as on Android and in
   SpendySplash. The fill falls back to currentColor (the on-background above) so the mark stays visible
   if spendy-palette.css is ever missing. */
.spendy-shell-mark {
    position: fixed;
    inset: 0;
    margin: auto;
    fill: var(--spendy-primary, currentColor);
}

/* Under the mark, its 40px centred 120px below the middle (SpendySplashDefaults.IndicatorOffset), and
   only after 600ms (IndicatorDelay) so a fast load never flashes it. A zero-length animation with a
   delay is the CSS-only way to reveal something later. Hidden unless the boot script runs
   (.spendy-boot-js, #102): without JavaScript nothing is loading, so nothing may spin. */
.spendy-shell-spinner {
    display: none;
    position: fixed;
    left: 50%;
    top: calc(50% + 100px);
    transform: translateX(-50%);
    opacity: 0;
    animation: spendy-shell-reveal 0s linear 600ms forwards;
}

.spendy-boot-js .spendy-shell-spinner {
    display: block;
}

@keyframes spendy-shell-reveal {
    to { opacity: 1; }
}

/* The boot script gave up (unsupported browser or a failed load): nothing more is coming, so the spinner goes. */
.spendy-boot-stopped .spendy-shell-spinner {
    display: none;
}

/* The boot messages (#102): one column under the mark and below the spinner (whose box ends 140px below the
   middle), so "still loading" never covers it. 16px side gutter, at most 32rem wide. */
.spendy-boot-message {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(50% + 156px);
    box-sizing: border-box;
    max-width: 32rem;
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
    font-family: system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--spendy-on-background, CanvasText);
}

/* A class's display would otherwise beat the hidden attribute's. */
.spendy-boot-message[hidden] {
    display: none;
}

.spendy-boot-message p {
    margin: 0 0 12px;
}

.spendy-boot-reload {
    min-height: 48px;
    padding: 0 24px;
    border: 0;
    border-radius: 24px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--spendy-primary, ButtonFace);
    color: var(--spendy-on-primary, ButtonText);
}

.spendy-boot-reload:focus-visible {
    outline: 2px solid var(--spendy-on-background, CanvasText);
    outline-offset: 2px;
}
