/* ==========================================================================
   kamal·ui — Reset + base element styles
   A light, modern reset (not a heavy normalize). Sets sane defaults so the
   component layer stays small.
   ========================================================================== */

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

* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "calt";
  min-height: 100dvh;
}

/* A faint WARM wash so the ivory canvas reads as a lit room, not flat paint.
   Driven by a warm ivory tint (not teal) so it never casts the page cool/mint;
   the teal stays an accent, not a background tint. Reads warmer in light, a
   subtle lift in dark. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--page-wash, none);
}

/* Tabular, lining numerals everywhere metrics appear */
.tnum,
.stat__value,
.cell--num,
.mono,
time { font-variant-numeric: tabular-nums lining-nums; }

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

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

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}
a:hover { color: var(--accent-hover); }

/* Headings — large, confident, friendly */
h1, h2, h3, h4 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p { line-height: var(--leading-loose); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

::selection { background: var(--accent-soft); color: var(--text); }

/* Consistent, soft teal focus ring for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Custom, quiet scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Tiny, generic utilities (kept minimal on purpose) ---------------- */
.muted   { color: var(--text-muted); }
.subtle  { color: var(--text-subtle); }
.faint   { color: var(--text-faint); }
.mono    { font-family: var(--font-mono); }
.nowrap  { white-space: nowrap; }
.truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.stack    { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--space-2); }
.row      { display: flex; align-items: center; gap: var(--space-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.wrap     { flex-wrap: wrap; }
.grow     { flex: 1 1 auto; min-width: 0; }
