/* ============================================================
   GradSpark — Base layer (Stage 1)
   Reset, root typography, type-scale utilities, layout primitives.
   Depends on tokens.css.
   ============================================================ */

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

/* ---------- Modern reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
body { padding-top: 0px; }
@media (max-width: 767px) { body { padding-top: 56px; } }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-canvas);
  -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: 0; cursor: pointer; padding: 0; }
a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ---------- Type scale (utility classes) ---------- */
.t-display-2xl { font-size: 60px; line-height: 72px; font-weight: var(--fw-bold); letter-spacing: -1.5px; }
.t-display-xl  { font-size: 48px; line-height: 56px; font-weight: var(--fw-bold); letter-spacing: -1px; }
.t-h1 { font-size: 36px; line-height: 44px; font-weight: var(--fw-bold); letter-spacing: -0.5px; }
.t-h2 { font-size: 30px; line-height: 38px; font-weight: var(--fw-bold); letter-spacing: -0.25px; }
.t-h3 { font-size: 24px; line-height: 32px; font-weight: var(--fw-semibold); letter-spacing: -0.15px; }
.t-h4 { font-size: 20px; line-height: 28px; font-weight: var(--fw-semibold); }
.t-h5 { font-size: 18px; line-height: 26px; font-weight: var(--fw-semibold); }
.t-h6 { font-size: 16px; line-height: 24px; font-weight: var(--fw-semibold); }
.t-body-lg { font-size: 18px; line-height: 28px; font-weight: var(--fw-regular); }
.t-body-md { font-size: 16px; line-height: 24px; font-weight: var(--fw-regular); }
.t-body-sm { font-size: 14px; line-height: 20px; font-weight: var(--fw-regular); }
.t-caption { font-size: 12px; line-height: 16px; font-weight: var(--fw-medium); letter-spacing: 0.25px; }
.t-code    { font-family: var(--font-mono); font-size: 14px; line-height: 20px; font-weight: var(--fw-medium); }

.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
.text-inverse   { color: var(--text-inverse); }
.text-link      { color: var(--text-link); }
.text-disabled  { color: var(--text-disabled); }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-20);
}
@media (max-width: 1023px) { .container { padding-inline: var(--space-8); } }
@media (max-width: 767px)  { .container { padding-inline: var(--space-4); } }

.stack    { display: flex; flex-direction: column; }
.row      { display: flex; flex-direction: row; align-items: center; }
.row-wrap { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; }
.between  { justify-content: space-between; }
.center   { justify-content: center; }
.end      { justify-content: flex-end; }
.start    { justify-content: flex-start; }
.items-start { align-items: flex-start; }
.items-end   { align-items: flex-end; }
.fill        { flex: 1; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }
.gap-10 { gap: var(--space-10); }
.gap-12 { gap: var(--space-12); }
.gap-16 { gap: var(--space-16); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.p-10 { padding: var(--space-10); }

.section {
  padding-block: var(--space-16);
}
@media (max-width: 767px) { .section { padding-block: var(--space-12); } }

.surface {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-default);
}

.muted-surface {
  background: var(--bg-muted);
  border-radius: var(--radius-lg);
}

/* ---------- Grid (12 / 8 / 4) ---------- */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-6);
}
@media (max-width: 1023px) {
  .grid-12 { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: var(--space-4); }
}
@media (max-width: 767px) {
  .grid-12 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
}

/* ---------- Visually hidden (accessibility) ---------- */
.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;
}

/* ---------- Focus base ---------- */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Specimen helpers (used on Foundations + Atoms pages) ---------- */
.spec-page {
  padding-block: var(--space-12);
}
.spec-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-bottom: var(--space-16);
}
.spec-section h2 { font: inherit; }
.spec-eyebrow {
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}
.spec-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.spec-grid {
  display: grid;
  gap: var(--space-4);
}
