/* =============================================================================
   BUAMS AI new-ui — RESET
   Spec: /frontend_design.md §E.2

   Minimal modern reset. Bootstrap 5's own Reboot already handles most of this,
   so this file only covers what Reboot leaves alone or what the design system
   needs to override — plus the global reduced-motion guard.
   ============================================================================= */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--bui-font);
  font-size: var(--bui-text-body);
  line-height: var(--bui-lh-normal);
  color: var(--bui-ink-900);
  background: var(--bui-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Media defaults — never let an image force horizontal page scroll (spec §H.2) */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Form controls should inherit typography, not fall back to the UA default */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Long clinical strings (patient names, diagnosis text) must wrap, not overflow */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
dd,
dt,
label {
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
}

p {
  margin: 0;
}

ul, ol {
  margin: 0;
  padding: 0;
}

a {
  color: var(--bui-primary-700);
  text-decoration: none;
  transition: color var(--bui-transition);
}

a:hover {
  color: var(--bui-primary-800);
  text-decoration: underline;
}

/* Focus: never remove an outline without replacing it (spec §I.2).
   :focus-visible keeps the ring off mouse clicks but present for keyboards. */
:focus-visible {
  outline: 2px solid var(--bui-primary-700);
  outline-offset: 2px;
}

/* Hidden attribute must win over any display rule a component sets.
   Toggle visibility with el.hidden, not inline style. */
[hidden] {
  display: none !important;
}

/* ── Reduced motion (spec §I.7) ────────────────────────────────────────────
   One global guard rather than per-component media queries. Collapses every
   transition/animation, including the token durations. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
