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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-weight: var(--font-normal);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    color: var(--text-primary);
    background-color: var(--surface-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

::selection {
    background-color: var(--primary-100);
    color: var(--primary-900);
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    font-weight: var(--font-bold);
    line-height: var(--leading-snug);
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    letter-spacing: var(--tracking-tight);
}

h1 {
    font-size: var(--text-4xl);
    font-weight: var(--font-extrabold);
    letter-spacing: -0.03em;
    margin-bottom: var(--space-8);
    line-height: var(--leading-tight);
}

h2 {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    margin-bottom: var(--space-8);
    line-height: 1.25;
}

h3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-6);
    line-height: var(--leading-snug);
}

h4 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-4);
    line-height: 1.4;
}

p {
    margin-bottom: var(--space-6);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
    font-size: var(--text-md);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-default);
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    touch-action: manipulation;
}

a:hover {
    color: var(--text-link-hover);
}

a:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
    border-radius: 2px;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

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

/* ===== Focus styles ===== */
:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

/* ===== Reduced motion ===== */
@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;
    }
}
