/* base.css — reset, typography, focus, motion and generic layout primitives
   (stack, row, grid, spacing utilities). No component styling here. */

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

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

body {
  margin: 0;
  min-height: 100%;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
figure,
pre {
  margin: 0;
}

h1 {
  font-size: var(--fs-26);
  font-weight: 650;
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--fs-20);
  font-weight: 600;
}

h3 {
  font-size: var(--fs-16);
  font-weight: 600;
}

h4 {
  font-size: var(--fs-14);
  font-weight: 600;
}

small,
.text-sm {
  font-size: var(--fs-12);
}

.text-muted {
  color: var(--muted);
}

.text-faint {
  color: var(--faint);
}

.text-mono,
code,
kbd,
pre {
  font-family: var(--font-mono);
  font-size: var(--fs-12);
}

.text-num,
.num {
  font-variant-numeric: tabular-nums;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-wrap {
  overflow-wrap: anywhere;
}

a {
  color: var(--info);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  padding-left: var(--sp-5);
}

ul.plain,
ol.plain {
  list-style: none;
  padding: 0;
}

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

svg.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

svg.icon.sm {
  width: 14px;
  height: 14px;
}

svg.icon.lg {
  width: 28px;
  height: 28px;
}

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

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

button:disabled {
  cursor: not-allowed;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-control);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

hr,
.divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--sp-4) 0;
}

/* layout primitives */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.stack.tight {
  gap: var(--sp-2);
}

.stack.loose {
  gap: var(--sp-5);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.row.end {
  justify-content: flex-end;
}

.row.start {
  align-items: flex-start;
}

.row.nowrap {
  flex-wrap: nowrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
}

.grid.auto {
  grid-template-columns: repeat(auto-fill, minmax(var(--min, 240px), 1fr));
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.scroll-x {
  overflow-x: auto;
  max-width: 100%;
}

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }

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