/**
  When adding fonts here, make sure to add them using a base64 data uri, otherwise
  fonts loading are delayed, and text may get displayed incorrectly.
*/

/*
  Force dark color-scheme so the browser never shows a light-mode
  canvas, scrollbar chrome, or default background between the
  splash screen and the first XAML frame.
*/
html {
  color-scheme: dark;
  background-color: #2E2E2E;
}

/* https://github.com/unoplatform/uno/issues/3954 */
@font-face {
  font-family: 'Segoe UI';
  src: local('Segoe UI'), local('-apple-system'), local('BlinkMacSystemFont'), local('Inter'), local('Cantarell'), local('Ubuntu'), local('Roboto'), local('Open Sans'), local('Noto Sans'), local('Helvetica Neue'), local('sans-serif');
}

@font-face {
  font-family: 'Roboto';
  src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Light.ttf) format('truetype');
  font-weight: 300;
}

@font-face {
  font-family: 'Roboto';
  src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Regular.ttf) format('truetype');
  font-weight: 400;
}

@font-face {
  font-family: 'Roboto';
  src: url(./Uno.Fonts.Roboto/Fonts/Roboto-Medium.ttf) format('truetype');
  font-weight: 500;
}

/*
  Open Sans is the Uno default app typeface on non-Windows targets (WASM
  included), shipped by the Uno.Fonts.OpenSans package and used by the XAML
  startup overlay caption (AppRoot.xaml's StartupLoadingText, which inherits
  the default font). Declaring it here makes the pre-WASM splash caption below
  render in the same face as the XAML overlay, so the HTML->XAML hand-off shows
  no font change. Like the Roboto faces above, this references the deployed
  font asset via url() rather than a base64 data URI: the ~128 KB face would
  otherwise have to download before the splash could paint at all. Only the
  Regular (400) weight is needed — the caption is font-weight 400.
  font-display: block keeps the caption invisible (the diamond still shows)
  until Open Sans is ready, so it never flashes a fallback face that would
  then swap to Open Sans when the XAML overlay takes over. Deliberate
  trade-off: if this font asset fails to load (e.g. a package rename moves
  the .ttf and 404s), "block" suppresses the caption for the whole startup
  rather than showing a fallback face — chosen over font-display: swap
  because a fallback flash here would itself be the visible hand-off glitch
  this rule exists to prevent. Keep this src path in sync with the deployed
  Uno.Fonts.OpenSans asset on package upgrades.
*/
@font-face {
  font-family: 'Open Sans';
  src: url(./Uno.Fonts.OpenSans/Fonts/OpenSans-Regular.ttf) format('truetype');
  font-weight: 400;
  font-display: block;
}

/*
  Static WASM loading screen — matches the Figma "Preparing environment" design
  (Uno Platform Studio, node 119280:90512). Overrides the default Uno bootstrap
  .uno-loader markup so the initial paint shows the brand-gradient diamond and
  caption while the .NET runtime initializes. Selectors are prefixed with
  #uno-body so they win over Uno.Wasm.Bootstrap's own uno-bootstrap.css rules
  regardless of <link> ordering.
*/
#uno-body.uno-body,
#uno-body .uno-loader {
  background-color: #2E2E2E;
}

#uno-body .uno-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
}

@media (prefers-color-scheme: dark) {
  #uno-body.uno-body,
  #uno-body .uno-loader {
    background-color: #2E2E2E;
  }
}

/* Hide the default bootstrap logo (we draw our own diamond) but keep the
   bottom-pinned <progress> bar — it's positioned absolutely by uno-bootstrap.css. */
#uno-body .uno-loader .logo {
  display: none;
}

/*
  Diamond: identical Figma export (node 119281:90555 from
  https://www.figma.com/design/LCfAv1msumRIVO1vVpLFHy) rendered as an inline
  SVG data URI so the static loader has zero external-asset dependencies.
  The same SVG file lives at Assets/StartupDiamond.svg and is used by the
  XAML startup overlay (AppRoot.xaml). Update both together if the design
  changes. # in colors is %23-encoded for the data URI.
*/
#uno-body .uno-loader::before {
  content: '';
  display: block;
  width: 113px;
  height: 113px;
  background:
    url('data:image/svg+xml;utf8,<svg width="113" height="113" viewBox="43 3 113 113" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="99.5684" y="114.015" width="77" height="77" rx="14.5" transform="rotate(-135 99.5684 114.015)" stroke="url(%23a)" stroke-width="3"/><rect x="99.5684" y="114.015" width="77" height="77" rx="14.5" transform="rotate(-135 99.5684 114.015)" stroke="url(%23b)" stroke-width="3"/><defs><linearGradient id="a" x1="102.632" y1="119.201" x2="176.172" y2="192.74" gradientUnits="userSpaceOnUse"><stop stop-color="%2367E5AD"/><stop offset=".25" stop-color="%2367E5AD"/><stop offset=".75" stop-color="%23F85977"/><stop offset="1" stop-color="%23F85977"/></linearGradient><linearGradient id="b" x1="177.35" y1="118.494" x2="101.925" y2="193.918" gradientUnits="userSpaceOnUse"><stop stop-color="%23159BFF"/><stop offset=".4" stop-color="%23159BFF" stop-opacity="0"/><stop offset=".6" stop-color="%237A67F8" stop-opacity="0"/><stop offset="1" stop-color="%237A67F8"/></linearGradient></defs></svg>') center/contain no-repeat;
}

/*
  Caption typography MUST match the XAML startup overlay caption
  (AppRoot.xaml's StartupLoadingText) so the HTML→XAML hand-off shows no
  text reflow or size jump. That TextBlock uses Live_TitleMediumTextBlockStyle
  => Live_TitleMediumFontSize = 18 (logical px) with FontWeight Normal (400)
  and LineHeight="28". On WASM a XAML logical pixel maps 1:1 to a CSS pixel,
  so font-size/line-height here are kept identical to those values. Update
  both together if the overlay typography changes.
*/
#uno-body .uno-loader::after {
  content: 'Preparing environment...';
  display: block;
  font-family: 'Open Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: #FFFFFF;
  text-align: center;
  white-space: nowrap;
}
