/**
 * Card Games - CSS Reset & Base Styles
 * Modern CSS reset following best practices
 */

/* ==========================================================================
   CSS Reset
   ========================================================================== */

/* Use a more intuitive box-sizing model */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

/* Improve text rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Remove list styles on ul, ol elements */
ul,
ol {
    list-style: none;
}

/* Set core root defaults */
html {
    scroll-behavior: smooth;
}

/* Set core body defaults */
body {
    min-height: 100vh;
    line-height: 1.5;
}

/* Improve media defaults */
img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
    font: inherit;
}

/* Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: break-word;
}

/* Remove button styles */
button {
    background: none;
    border: none;
    cursor: pointer;
}

/* Remove link underline by default, but keep for accessibility */
a {
    text-decoration: none;
    color: inherit;
}

/* Improve table styles */
table {
    border-collapse: collapse;
    border-spacing: 0;
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

body {
    font-family: var(--font-family);
    background: linear-gradient(
        135deg, 
        var(--bg-primary) 0%, 
        var(--bg-secondary) 50%, 
        var(--bg-tertiary) 100%
    );
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

/* Focus visible styles for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent-gold);
    color: var(--text-inverse);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius);
    z-index: var(--z-modal);
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--space-md);
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid currentColor;
    }
    
    .card.valid-move {
        outline: 3px solid var(--valid-color);
        outline-offset: 2px;
    }
}

/* ==========================================================================
   Screen Reader Only (Visually Hidden)
   ========================================================================== */

.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;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .game-nav,
    .controls,
    .win-overlay,
    .rules-overlay {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid black !important;
        box-shadow: none !important;
    }
}
