/* =====================================================================
   BASE STYLES - Reset, Typography, and Global Elements
   ===================================================================== */

/* ==========================================
   CSS RESET
   ========================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Prevent horizontal scrolling */
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--text-md);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background: var(--color-bg);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page Body Class - Main wrapper */
.page-body {
    background: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
    line-height: var(--leading-normal);
    margin: 0;
    padding: 0;
    width: 100%;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    color: var(--color-text);
    text-rendering: optimizeLegibility;
}

h1, h2, h3 {
    font-weight: var(--font-bold);
    line-height: 1.05;
    letter-spacing: -0.03em;
}

h4, h5, h6 {
    font-weight: var(--font-semibold);
    line-height: 1.2;
    letter-spacing: var(--tracking-tight);
}

h1 {
    font-size: var(--text-4xl);
    letter-spacing: -0.04em;
}

h2 {
    font-size: var(--text-3xl);
}

h3 {
    font-size: var(--text-2xl);
}

h4 {
    font-size: var(--text-xl);
}

h5 {
    font-size: var(--text-lg);
}

h6 {
    font-size: var(--text-md);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

p:last-child {
    margin-bottom: 0;
}

/* Links */
a {
    color: var(--color-accent-blue);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
    color: var(--color-text);
}

/* Lists */
ul, ol {
    padding-left: var(--space-6);
    margin-bottom: var(--space-4);
}

li {
    margin-bottom: var(--space-2);
    line-height: var(--leading-relaxed);
}

li:last-child {
    margin-bottom: 0;
}

/* Strong/Bold */
strong, b {
    font-weight: var(--font-semibold);
}

/* Small Text */
small {
    font-size: var(--text-sm);
}

/* Code */
code {
    font-family: var(--font-family-mono);
    font-size: 0.875em;
    background: var(--color-bg-elevated);
    padding: 0.125em 0.375em;
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-family-mono);
    overflow-x: auto;
    background: var(--color-bg-elevated);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

/* Blockquote */
blockquote {
    border-left: 3px solid var(--color-border-hover);
    padding-left: var(--space-4);
    margin: var(--space-4) 0;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-8) 0;
}

/* ==========================================
   IMAGES & MEDIA
   ========================================== */

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* ==========================================
   FORMS - Basic Reset
   ========================================== */

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

/* ==========================================
   TABLES
   ========================================== */

table {
    border-collapse: collapse;
    width: 100%;
}

/* ==========================================
   SELECTION
   ========================================== */

::selection {
    background-color: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-text);
}

::-moz-selection {
    background-color: rgba(var(--color-primary-rgb), 0.15);
    color: var(--color-text);
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */

/* 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;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-4);
    padding: var(--space-3) var(--space-5);
    background: var(--color-text);
    color: var(--color-bg);
    font-weight: var(--font-medium);
    font-size: var(--text-sm);
    border-radius: var(--radius-lg);
    z-index: var(--z-tooltip);
    transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
    top: var(--space-4);
}

/* Focus States - Modern ring style */
:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-bg),
                0 0 0 4px var(--color-primary);
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ==========================================
   UTILITY CLASSES
   ========================================== */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font Weights */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text Colors */
.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* ==========================================
   LUCIDE ICONS BASE
   ========================================== */

[data-lucide] {
    width: 1.25em;
    height: 1.25em;
    stroke-width: 2;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
    color: var(--color-text);
}

/* ==========================================
   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;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    body {
        background: white;
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    .no-print {
        display: none !important;
    }
}
