/* ==========================================================================
 * XUI Base Reset & Accessibility Primitives
 * ========================================================================== */

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

html,
body {
  margin: var(--s-0);
  padding: var(--s-0);
  height: 100%;
  width: 100%;
  background: var(--bg-base);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  font-weight: var(--t-body-w);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Smooth theme cross-fade applied briefly by XUI.theme when switching dark/light */
html.xui-theme-transition,
html.xui-theme-transition *,
html.xui-theme-transition *::before,
html.xui-theme-transition *::after {
  transition-property: background-color, border-color, color, fill, stroke, box-shadow !important;
  transition-duration: var(--d-switch) !important;
  transition-timing-function: var(--ease) !important;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

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

::selection {
  background: var(--surface-selection);
  color: var(--text-1);
}

/* Focus accessibility: visible accent ring everywhere, never outline: none */
:focus-visible {
  outline: var(--focus-ring-w) solid var(--accent);
  outline-offset: var(--focus-ring-offset);
}

/* Desktop app scrollbars */
::-webkit-scrollbar {
  width: var(--scrollbar-w);
  height: var(--scrollbar-w);
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--r-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Utility Primitives */
.tabular-nums,
.xui-nums {
  font-variant-numeric: tabular-nums;
}

.xui-mono {
  font-family: var(--font-mono);
}

.xui-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xui-noselect {
  user-select: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: var(--s-0);
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: var(--s-0);
}

/* Typography Helpers */
.xui-t-display {
  font-size: var(--t-display-size);
  line-height: var(--t-display-lh);
  font-weight: var(--t-display-w);
  letter-spacing: -0.02em;
}

.xui-t-h1 {
  font-size: var(--t-h1-size);
  line-height: var(--t-h1-lh);
  font-weight: var(--t-h1-w);
  letter-spacing: -0.015em;
}

.xui-t-h2 {
  font-size: var(--t-h2-size);
  line-height: var(--t-h2-lh);
  font-weight: var(--t-h2-w);
  letter-spacing: -0.01em;
}

.xui-t-small {
  font-size: var(--t-small-size);
  line-height: var(--t-small-lh);
}

.xui-t-caption {
  font-size: var(--t-caption-size);
  line-height: var(--t-caption-lh);
  color: var(--text-2);
}

.xui-t-micro {
  font-size: var(--t-micro-size);
  line-height: var(--t-micro-lh);
  color: var(--text-3);
}
