/* ==========================================================================
   Base — Reset, tokens, typography, utilities
   ========================================================================== */

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

/* Spacing tokens */
:root {
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
}

/* Typography tokens */
:root {
    --text-label: 14px;
    --text-base: 16px;
    --text-heading: 22px;
    --text-display: 32px;

    --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-heading: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, monospace;
}

/* Layout tokens */
:root {
    --layout-max-width: 1200px;
    --article-max-width: 720px;
    --sidebar-width: 300px;
}

/* Base typography */
body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--color-text);
    background-color: var(--color-bg);
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
}

h1 { font-size: var(--text-display); line-height: 1.2; }
h2 { font-size: var(--text-heading); }
h3 { font-size: calc(var(--text-heading) - 2px); }
h4 { font-size: var(--text-base); font-weight: 700; }

/* Links */
a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--color-accent-hover);
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lists */
ul, ol {
    list-style: none;
}

/* Skip navigation */
.skip-nav {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 9999;
    background: var(--color-accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 700;
    text-decoration: none;
}

.skip-nav:focus {
    top: 8px;
}

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