/* ============================================================
   BASE — Reset, Typography, Global Utilities
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar        { width: 7px; }
::-webkit-scrollbar-track  { background: var(--surface); }
::-webkit-scrollbar-thumb  { background: var(--border-2); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Typography Elements ────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl);  }

p {
  color: var(--text-2);
  line-height: 1.7;
}

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

img, svg { display: block; max-width: 100%; }
ul, ol   { list-style: none; }
button   { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Selection ───────────────────────────────────────────── */
::selection {
  background: var(--accent-light);
  color: var(--accent-hover);
}

/* ── Focus visible (accessibility) ──────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ── Utility: Screen-reader only ─────────────────────────── */
.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;
}

/* ── Utility: Text helpers ───────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-2); }
.text-subtle   { color: var(--text-3); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-center   { text-align: center; }
.font-display  { font-family: var(--font-display); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* ── Utility: Layout helpers ────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2   { gap: var(--sp-2); }
.gap-4   { gap: var(--sp-4); }
.gap-6   { gap: var(--sp-6); }
.gap-8   { gap: var(--sp-8); }
.w-full  { width: 100%; }
.nowrap  { white-space: nowrap; }
.hidden  { display: none !important; }

/* ── Page loading spinner ────────────────────────────────── */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - var(--navbar-h));
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-6) 0;
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-20) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}
.empty-state__icon  { font-size: 72px; line-height: 1; }
.empty-state__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  color: var(--text);
}
.empty-state__text  { color: var(--text-2); max-width: 320px; }
