/*
 * BrickDb reset
 * ----------------------------------------------------------------------------
 * A small, first-party reset — not a third-party reset library. Normalises box
 * sizing, margins, form controls and media so tokens.css / app.css apply
 * predictably across the web target and the MAUI BlazorWebView targets
 * (Android/iOS/macOS/Windows, each with a slightly different WebView engine).
 * ----------------------------------------------------------------------------
 */

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

/* Sensible margin reset — every element opts into spacing via the space scale
   in tokens.css rather than inheriting engine-default margins. */
* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* html/body fill the BlazorWebView viewport; app.css owns background/colour. */
html,
body {
  height: 100%;
}

/* Headings get a comfortable wrap instead of ragged/orphaned single words. */
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/* Long-form paragraphs avoid orphans where the engine supports it; falls back
   silently on engines that don't (all current WebView targets tolerate this). */
p {
  text-wrap: pretty;
}

/* Lists used as layout (nav, chip rows, etc.) start bare; content lists opt
   back into markers in app.css / components.css where semantically a list. */
ul,
ol {
  list-style: none;
}

/* Form controls inherit typography instead of engine UI-chrome fonts — this is
   the single most common cross-platform WebView inconsistency to normalise. */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  text-align: inherit;
}

/* Buttons/inputs never overflow their container on narrow viewports. */
button,
input,
select,
textarea {
  max-width: 100%;
}

/* Media never exceeds its container — critical for the "no horizontal scroll
   at any width" rule in the design-system doc. */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img,
video {
  object-fit: cover;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Tables opt into layout explicitly rather than inheriting engine defaults. */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove default fieldset chrome; ConfirmSheet/forms style their own groups. */
fieldset {
  border: none;
  padding: 0;
}

/* Reset default `<dialog>`/`<summary>` marker chrome in case native elements
   are used inside a Razor component. */
::marker {
  content: none;
}

/* Respect the OS "reduce motion" preference everywhere, unconditionally — this
   is the reset-level safety net; individual components may still define their
   own explicit reduced-motion branch in components.css for state changes that
   need an instant/opacity-only substitute rather than simply "no animation". */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
