/**
 * ============================================================================
 * MODERN CSS RESET
 * ============================================================================
 * 
 * A comprehensive reset that removes browser inconsistencies
 * and sets up a solid foundation for consistent styling.
 */

/* === BOX SIZING RESET === */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* === REMOVE DEFAULT MARGINS AND PADDING === */
* {
    margin: 0;
    padding: 0;
}

/* === ROOT ELEMENT === */
html {
    /* Prevent font size inflation */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    
    /* Smooth scrolling for anchor links */
    scroll-behavior: smooth;
    
    /* Better font rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Set base font size for rem calculations */
    font-size: 16px;
    
    /* Prevent horizontal scroll */
    overflow-x: hidden;
}

/* === BODY RESET === */
body {
    min-height: 100vh;
    line-height: var(--line-height-normal);
    font-family: var(--font-family-sans);
    font-weight: var(--font-weight-normal);
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    
    /* Prevent font size inflation on mobile */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    
    /* Enable kinetic scrolling on iOS */
    -webkit-overflow-scrolling: touch;
    
    /* Remove default margins */
    margin: 0;
    padding: 0;
}

/* === TYPOGRAPHY RESET === */
h1, h2, h3, h4, h5, h6 {
    font-size: inherit;
    font-weight: inherit;
    line-height: var(--line-height-tight);
    margin: 0;
}

p, blockquote, pre, address, hr, table, fieldset, figure {
    margin: 0;
}

/* === LIST RESET === */
ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* === FORM ELEMENT RESET === */
input, button, textarea, select {
    font: inherit;
    color: inherit;
    background: transparent;
    border: none;
    outline: none;
    padding: 0;
    margin: 0;
}

button {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    text-decoration: none;
    outline: none;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

input, textarea, select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
}

input:focus, textarea:focus, select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-color: var(--primary-color);
}

/* === MEDIA ELEMENT RESET === */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

img {
    border-style: none;
}

/* === TABLE RESET === */
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
}

/* === LINK RESET === */
a {
    color: var(--primary-color);
    text-decoration: none;
    background-color: transparent;
}

a:hover {
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* === ACCESSIBILITY IMPROVEMENTS === */

/* Skip links for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: var(--text-white);
    padding: 8px;
    border-radius: var(--radius-md);
    text-decoration: none;
    z-index: var(--z-tooltip);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 6px;
}

/* Screen reader only content */
.sr-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;
}

/* Focus visible for better keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* === SCROLLBAR STYLING === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: var(--radius-md);
    opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
    opacity: 1;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-tertiary);
}

/* === SELECTION STYLES === */
::selection {
    background-color: var(--primary-color);
    color: var(--text-white);
}

::-moz-selection {
    background-color: var(--primary-color);
    color: var(--text-white);
}

/* === FORM VALIDATION STYLES === */
input:invalid {
    border-color: var(--danger-color);
    box-shadow: none;
}

input:valid {
    border-color: var(--success-color);
}

/* === DISABLED ELEMENT STYLES === */
[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* === ARIA HIDDEN ELEMENTS === */
[aria-hidden="true"] {
    display: none !important;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* === HIGH CONTRAST MODE === */
@media (prefers-contrast: high) {
    :focus-visible {
        outline: 3px solid;
        outline-offset: 3px;
    }
}

/* === DARK MODE SUPPORT === */
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        color-scheme: dark;
    }
}

/* === 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;
    }
} 