/*
 * Base Styles
 * Reset, typography, layout primitives.
 * Mobile-first. System fonts. rem/em units.
 */

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-regular);
    line-height: var(--line-height-default);
    color: var(--text-primary);
    background-color: var(--surface-sunken);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--text-link); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--text-link-hover); }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== SKIP LINK (a11y) ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-200);
    padding: var(--space-100) var(--space-200);
    background: var(--brand-primary);
    color: var(--text-inverse);
    border-radius: var(--radius-md);
    z-index: var(--z-tooltip);
    font-weight: var(--font-weight-semibold);
}
.skip-link:focus {
    top: var(--space-100);
}

/* ===== TYPOGRAPHY ===== */
h1 { font-size: var(--font-size-xl); font-weight: var(--font-weight-semibold); line-height: var(--line-height-tight); }
h2 { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); line-height: var(--line-height-tight); }
h3 { font-size: var(--font-size-md); font-weight: var(--font-weight-medium); line-height: var(--line-height-default); }
h4 { font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); line-height: var(--line-height-default); }
p { margin-bottom: var(--space-200); }
p:last-child { margin-bottom: 0; }
small, .text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-secondary { color: var(--text-secondary); }
.text-subtlest { color: var(--text-subtlest); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-mono { font-family: var(--font-family-mono); }

/* ===== FOCUS STATES (a11y) ===== */
:focus-visible {
    outline: 2px solid var(--border-focused);
    outline-offset: 2px;
}

/* ===== UTILITIES ===== */
.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;
}
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; }
.flex-gap-100 { gap: var(--space-100); }
.flex-gap-200 { gap: var(--space-200); }
.flex-gap-300 { gap: var(--space-300); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.mt-100 { margin-top: var(--space-100); }
.mt-200 { margin-top: var(--space-200); }
.mt-300 { margin-top: var(--space-300); }
.mt-400 { margin-top: var(--space-400); }
.mb-200 { margin-bottom: var(--space-200); }
.mb-300 { margin-bottom: var(--space-300); }
.mb-400 { margin-bottom: var(--space-400); }
