/* base.css — modern CSS reset + base element styles + a few utilities.
 * Loaded AFTER tokens.css. Source of truth: PHASE_1_4_SPEC.md §5. */

/* ---- Reset (Andy Bell flavour, lightly adapted) ---- */

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

html, body { height: 100%; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

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

button { background: none; border: none; cursor: pointer; }

a {
  color: var(--color-text-link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul, ol { list-style: none; }

/* ---- Headings: weight-medium, sizes from tokens ---- */

h1 { font-size: var(--font-size-title-1); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); letter-spacing: -0.02em; }
h2 { font-size: var(--font-size-title-2); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); letter-spacing: -0.01em; }
h3 { font-size: var(--font-size-title-3); font-weight: var(--font-weight-medium); line-height: var(--line-height-tight); }
h4 { font-size: var(--font-size-headline); font-weight: var(--font-weight-semibold); line-height: var(--line-height-normal); }
h5 { font-size: var(--font-size-callout); font-weight: var(--font-weight-medium); line-height: var(--line-height-normal); }
h6 { font-size: var(--font-size-subhead); font-weight: var(--font-weight-medium); line-height: var(--line-height-normal); }

/* ---- Focus ring (visible, accessible) ---- */

:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* ---- Utilities ---- */

/* Tabular numerals for amounts, IDs, times. Use sparingly: never globally. */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-danger    { color: var(--color-danger); }
.text-success   { color: var(--color-success); }
.text-center    { text-align: center; }

.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;
}

/* ---- Alpine.js: hide DOM until x-data initialises (no FOUC) ---- */

[x-cloak] { display: none !important; }
