/**
 * Reset & Base Styles
 * Foundational styles and CSS reset
 */

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

/* === HTML & BODY === */
html {
    scroll-behavior: smooth;
    font-size: 16px; /* Base font size for rem calculations */
    line-height: var(--line-height-normal);
}

body {
    font-family: var(--font-primary);
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background-color: var(--color-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === TYPOGRAPHY BASE === */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    margin-bottom: var(--spacing-base);
    color: var(--color-text-primary);
}

h1 { 
    font-size: var(--font-size-5xl); 
    font-weight: var(--font-weight-bold);
}
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-base);
    color: var(--color-text-secondary);
    line-height: var(--line-height-normal);
}

/* === LISTS === */
ul, ol {
    margin-bottom: var(--spacing-base);
}

li {
    line-height: var(--line-height-normal);
}

/* === LINKS === */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-base);
}

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

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

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

/* === FORM ELEMENTS === */
input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* === UTILITY CLASSES === */
.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;
}

.accent {
    color: var(--color-primary);
}

/* === FOCUS VISIBLE SUPPORT === */
/* Enhanced focus styles for better accessibility */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-sm);
}

/* Remove default focus styles when focus-visible is supported */
:focus:not(:focus-visible) {
    outline: none;
}

/* === SELECTION STYLES === */
::selection {
    background-color: var(--color-primary-light);
    color: var(--color-text-primary);
}

::-moz-selection {
    background-color: var(--color-primary-light);
    color: var(--color-text-primary);
}

/* === SCROLLBAR STYLES === */
/* Webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-background);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--border-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* === REDUCED MOTION === */
/* Respect user's preference for 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 {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    a,
    a:visited {
        text-decoration: underline;
    }
    
    img {
        page-break-inside: avoid;
    }
    
    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }
    
    h2,
    h3 {
        page-break-after: avoid;
    }
}
