/**
 * Base Styles
 * Reset, typography, and foundational styles
 */

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

/* Remove default margin/padding */
* {
    margin: 0;
    padding: 0;
}

/* Prevent font size inflation */
html {
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* Core body styles */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-background);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    letter-spacing: var(--letter-spacing-tight);
    color: var(--color-text);
}

/* Tabular numbers for data */
.tabular-nums {
    font-feature-settings: "tnum" 1;
}

h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-6);
}

h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
}

h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-4);
}

h4 {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
}

h5, h6 {
    font-size: var(--text-base);
    margin-bottom: var(--space-2);
}

p {
    margin-bottom: var(--space-md);
}

/* Links */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Lists */
ul, ol {
    padding-left: var(--space-lg);
    margin-bottom: var(--space-md);
}

li {
    margin-bottom: var(--space-xs);
}

/* Strong and emphasis */
strong, b {
    font-weight: var(--font-weight-bold);
}

em, i {
    font-style: italic;
}

/* Small text */
small {
    font-size: var(--font-size-sm);
}

/* Code */
code {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.9em;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.1em 0.3em;
    border-radius: var(--border-radius-sm);
}

pre {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: var(--space-md);
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: var(--space-md);
}

pre code {
    background: none;
    padding: 0;
}

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

/* Buttons - reset */
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Form elements */
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* Focus styles for accessibility */
:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

/* Screen reader only */
.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;
}

/* Text utilities */
.text-muted {
    color: var(--color-text-muted);
}

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

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

.text-sm {
    font-size: var(--font-size-sm);
}

.text-lg {
    font-size: var(--font-size-lg);
}

.font-medium {
    font-weight: var(--font-weight-medium);
}

.font-bold {
    font-weight: var(--font-weight-bold);
}

/* ============================================
   ACCESSIBILITY: 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;
    }
}
