/* ============================================================
   PracticeVue — Base styles
   ============================================================
   Reset + element defaults + global typography. Token-driven.
============================================================ */

/* --- Reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: var(--text-md);
  background: var(--bg-canvas);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-canvas);
  min-height: 100vh;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  transition: background-color var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

/* --- Typography defaults --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: var(--weight-semi);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-6xl); font-weight: var(--weight-semi); letter-spacing: var(--tracking-tighter); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--text-link-hover); }

small { font-size: var(--text-sm); color: var(--text-tertiary); }

code, pre, .mono, .num {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
}

/* Tabular numerals — applied wherever numbers appear in financial context */
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* --- Selection --- */
::selection {
  background: var(--accent-subtle-bg);
  color: var(--accent-subtle-fg);
}

/* --- Scrollbar (subtle, ledger-style) --- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-200) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--gray-150);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--gray-200); background-clip: padding-box; border: 2px solid transparent; }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: var(--gray-700); background-clip: padding-box; border: 2px solid transparent; }
[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: var(--gray-600); background-clip: padding-box; border: 2px solid transparent; }

/* --- Focus ring (keyboard only) --- */
*:focus { outline: none; }
*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-md);
}

/* --- Buttons & inputs reset --- */
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
input, textarea, select {
  font: inherit;
  color: inherit;
}

/* --- SVG defaults --- */
svg { display: inline-block; flex-shrink: 0; vertical-align: middle; }

/* ============================================================
   Utilities
============================================================ */
.u-text-primary   { color: var(--text-primary); }
.u-text-secondary { color: var(--text-secondary); }
.u-text-tertiary  { color: var(--text-tertiary); }
.u-text-positive  { color: var(--positive-fg); }
.u-text-negative  { color: var(--negative-fg); }
.u-text-warning   { color: var(--warning-fg); }

.u-weight-medium { font-weight: var(--weight-medium); }
.u-weight-semi   { font-weight: var(--weight-semi); }

.u-flex          { display: flex; }
.u-flex-col      { display: flex; flex-direction: column; }
.u-items-center  { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-gap-1 { gap: var(--space-1); }
.u-gap-2 { gap: var(--space-2); }
.u-gap-3 { gap: var(--space-3); }
.u-gap-4 { gap: var(--space-4); }
.u-gap-6 { gap: var(--space-6); }

.u-mt-2 { margin-top: var(--space-2); }
.u-mt-4 { margin-top: var(--space-4); }
.u-mt-6 { margin-top: var(--space-6); }
.u-mt-8 { margin-top: var(--space-8); }

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

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