/* The loading screen a visit sees while the engine and app download (index.html #splash). It sits on the app's own
   surface colour (lib/ui/theme.dart `surface`, light and dark) so the hand-over to the first frame does not flash,
   shows the approved mark (icons/Icon-192.png) and a thin indeterminate bar in ink teal, and leaves on the
   `flutter-first-frame` event (flutter_bootstrap.js). External, not inline: the CSP allows style-src 'self'. */
:root {
  color-scheme: light dark;
  --splash-surface: #f5f8f7;
  --splash-track: #d6e2df;
  --splash-accent: #0f6e6a;
  --splash-ink: #16201e;
  --splash-muted: #556763;
}

@media (prefers-color-scheme: dark) {
  :root {
    --splash-surface: #0e1514;
    --splash-track: #26322f;
    --splash-accent: #5bc4be;
    --splash-ink: #e4ecea;
    --splash-muted: #9db2ad;
  }
}

html,
body {
  margin: 0;
  background: var(--splash-surface);
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: var(--splash-surface);
  transition: opacity 180ms ease-out;
}

#splash.splash-done {
  opacity: 0;
  pointer-events: none;
}

#splash img {
  width: 96px;
  height: 96px;
  border-radius: 21px;
}

.splash-bar {
  position: relative;
  width: 160px;
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--splash-track);
}

.splash-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 2px;
  background: var(--splash-accent);
  animation: splash-slide 1.1s ease-in-out infinite;
}

@keyframes splash-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

/* The quotation under the bar (splash.js). Ink and muted ink are theme.dart onSurface / onSurfaceVariant, which clear
   4.5:1 on the surface in both schemes. Its box keeps a fixed minimum height so the mark and bar do not move when a
   shorter quote follows a longer one; sizes are in rem so browser zoom and text size scale them. */
.splash-quote {
  box-sizing: border-box;
  width: 100%;
  max-width: 34rem;
  min-height: 9.5rem;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  transition: opacity 400ms ease-in-out;
}

.splash-quote-out {
  opacity: 0;
}

.splash-quote blockquote {
  margin: 0;
  color: var(--splash-ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  white-space: pre-line;
  text-wrap: balance;
}

/* Italic is a Latin and Cyrillic convention; CJK and Arabic keep their upright serif (Mincho, Song, Naskh). */
.splash-quote:lang(ja) blockquote,
.splash-quote:lang(zh) blockquote,
.splash-quote:lang(ar) blockquote {
  font-family: serif;
  font-style: normal;
}

.splash-quote figcaption {
  margin-top: 0.75rem;
  color: var(--splash-muted);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.splash-quote figcaption::before {
  content: '— ';
}

/* With JavaScript off the app cannot start: the loading screen goes and index.html's <noscript> text stays (S17 plan
   §14.4). Ink on the surface, links in the accent colour (5.7:1 light, 8.9:1 dark; splash.test.mjs). */
.noscript {
  box-sizing: border-box;
  max-width: 36rem;
  margin: 15vh auto 0;
  padding: 0 16px;
  color: var(--splash-ink);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

.noscript a {
  color: var(--splash-accent);
}

@media (scripting: none) {
  #splash {
    display: none;
  }
}

/* A short landscape window keeps the mark and the bar; the quote is the first thing to go. */
@media (max-height: 420px) {
  .splash-quote {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash-quote {
    transition: none;
  }

  .splash-bar span {
    width: 100%;
    animation: none;
    opacity: 0.6;
  }

  #splash {
    transition: none;
  }
}
