/* =========================================================
   base.css — Reset, element defaults, text styles, utilities
   Depends on: tokens.css
   ========================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

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

* { margin: 0; padding: 0; }

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

body {
  min-height: 100vh;
  background: var(--color-bg-page);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); text-decoration: underline; }
a:active { color: var(--color-primary-active); }
table { border-collapse: collapse; border-spacing: 0; width: 100%; }
hr { border: 0; border-top: 1px solid var(--color-border); }
[hidden] { display: none !important; }

/* ---------- Keyboard focus (outline only, no shadow) ---------- */
:focus { outline: none; }
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

::selection { background: var(--color-primary-soft); color: var(--color-primary-active); }

/* Hard rule: no animation / transition anywhere */
*, *::before, *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ---------- Headings (map to type scale) ---------- */
h1, h2 {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-xl);
  font-weight: var(--font-weight-xl);
}
h3, h4 {
  font-size: var(--font-size-lg);
  line-height: var(--line-height-lg);
  font-weight: var(--font-weight-lg);
}
h5, h6 {
  font-size: var(--font-size-md);
  line-height: var(--line-height-md);
  font-weight: var(--font-weight-md);
}

/* ---------- Text style classes ---------- */
.text-xl { font-size: var(--font-size-xl); line-height: var(--line-height-xl); font-weight: var(--font-weight-xl); }
.text-lg { font-size: var(--font-size-lg); line-height: var(--line-height-lg); font-weight: var(--font-weight-lg); }
.text-md { font-size: var(--font-size-md); line-height: var(--line-height-md); font-weight: var(--font-weight-md); }
.text-sm { font-size: var(--font-size-sm); line-height: var(--line-height-sm); font-weight: var(--font-weight-sm); }
.text-xs { font-size: var(--font-size-xs); line-height: var(--line-height-xs); font-weight: var(--font-weight-xs); }

/* Body copy (regular weight at Medium size) */
.text-body { font-size: var(--font-size-md); line-height: var(--line-height-md); font-weight: 400; }

/* ---------- Text colors ---------- */
.text-primary   { color: var(--color-text); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted     { color: var(--color-text-muted); }
.text-brand     { color: var(--color-primary); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }
.text-info      { color: var(--color-info); }

/* ---------- Text pair (title + subtitle, 2px apart) ---------- */
.text-pair {
  display: flex;
  flex-direction: column;
  gap: var(--text-pair-gap);
  min-width: 0;
}

/* ---------- Text helpers ---------- */
.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap   { white-space: nowrap; }

/* ---------- Layout primitives (no breakpoint logic) ---------- */
.stack     { display: flex; flex-direction: column; }
.row       { display: flex; flex-direction: row; align-items: center; }
.row-wrap  { flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row-end   { justify-content: flex-end; }
.align-start { align-items: flex-start; }
.flex-1    { flex: 1 1 0; min-width: 0; }
.shrink-0  { flex-shrink: 0; }
.w-full    { width: 100%; }

/* Gap utilities — spacing scale only */
.gap-4  { gap: var(--space-4); }
.gap-8  { gap: var(--space-8); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }
.gap-20 { gap: var(--space-20); }
.gap-24 { gap: var(--space-24); }
.gap-28 { gap: var(--space-28); }
.gap-32 { gap: var(--space-32); }

/* Padding / margin helpers */
.p-0  { padding: 0; }
.p-8  { padding: var(--space-8); }
.p-12 { padding: var(--space-12); }
.p-16 { padding: var(--space-16); }
.p-20 { padding: var(--space-20); }
.p-24 { padding: var(--space-24); }
.mt-8  { margin-top: var(--space-8); }
.mt-16 { margin-top: var(--space-16); }
.mt-24 { margin-top: var(--space-24); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-16 { margin-bottom: var(--space-16); }
.mb-24 { margin-bottom: var(--space-24); }

/* ---------- Icons ---------- */
.icon      { width: var(--icon-20); height: var(--icon-20); flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-16   { width: var(--icon-16); height: var(--icon-16); }
.icon-20   { width: var(--icon-20); height: var(--icon-20); }
.icon-24   { width: var(--icon-24); height: var(--icon-24); }
.icon-28   { width: var(--icon-28); height: var(--icon-28); }
.icon-32   { width: var(--icon-32); height: var(--icon-32); }

/* ---------- Visibility ---------- */
.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;
}
