/* ===== HEROSWIPE<3 - BASE STYLES ===== */

/* ===== RESET & ENHANCED BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    line-height: 1.15;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
    width: 100%;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal scrolling but allow vertical */
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    transition: var(--transition-all);
    min-height: 100vh;
    min-width: 100vw;
    height: 100%;
    width: 100%;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Enhanced theme transition for all elements */
*, *::before, *::after {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* ===== ACCESSIBILITY UTILITIES ===== */
/* Screen reader only content */
.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;
}

/* Show on focus for keyboard users */
.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ===== TYPOGRAPHY HIERARCHY ===== */
/* Professional heading hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-display);
    font-weight: var(--font-weight-bold);
    line-height: var(--line-height-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-2);
    letter-spacing: -0.025em;
}

h1 {
    font-size: var(--font-size-5xl);
    font-weight: var(--font-weight-extrabold);
}

h2 {
    font-size: var(--font-size-4xl);
    font-weight: var(--font-weight-bold);
}

h3 {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-semibold);
}

h4 {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
}

h5 {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-medium);
}

h6 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-medium);
}

/* Form elements */
fieldset {
    border: 1px solid var(--color-border-accent);
    border-radius: var(--radius-lg);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-4);
}

legend {
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    padding: 0 var(--spacing-2);
    font-size: var(--font-size-base);
}

/* Paragraph and text elements */
p {
    font-size: var(--font-size-base);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-4);
}

/* Text utilities */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }

.leading-tight { line-height: var(--line-height-tight); }
.leading-normal { line-height: var(--line-height-normal); }
.leading-relaxed { line-height: var(--line-height-relaxed); }

/* ===== ENHANCED SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-full);
    margin: var(--spacing-1);
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-bg-tertiary);
    transition: var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-secondary);
    border-color: var(--color-bg-secondary);
}

::-webkit-scrollbar-corner {
    background: var(--color-bg-tertiary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) var(--color-bg-tertiary);
}

/* ===== ENHANCED ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    /* Allow essential UI transitions for better feedback */
    .modal,
    .modal-content,
    .preferences-modal,
    .preferences-content,
    .header-btn,
    .action-btn,
    .start-game-btn {
        transition-duration: 0.2s !important;
        transition-timing-function: var(--ease-out) !important;
    }
}

/* Enhanced focus styles for better keyboard navigation */
*:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Focus visible only when using keyboard */
*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Interactive elements focus states */
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    padding: var(--spacing-2) var(--spacing-4);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: var(--z-maximum);
    transition: var(--transition-fast);
    font-weight: var(--font-weight-medium);
}

.skip-link:focus {
    top: 6px;
}

/* ===== HIGH CONTRAST MODE SUPPORT ===== */
@media (prefers-contrast: high) {
    :root {
        --color-border-primary: currentColor;
        --color-border-secondary: currentColor;
        --color-border-tertiary: currentColor;
        --color-border-accent: currentColor;
    }
    
    /* Ensure text remains readable in high contrast */
    .gradient-text,
    .logo h1,
    .character-name,
    .preferences-header h2 {
        -webkit-text-fill-color: unset;
        background: none;
        color: var(--color-text-primary);
    }
}

/* ===== SELECTION STYLES ===== */
::selection {
    background: var(--color-primary-light);
    color: var(--color-text-primary);
}

::-moz-selection {
    background: var(--color-primary-light);
    color: var(--color-text-primary);
}

/* ===== PRINT STYLES ===== */
@media print {
    .animated-background,
    .particles,
    .gradient-orbs,
    .loading-overlay,
    .debug-panel,
    .header-btn,
    .action-btn,
    .preferences-modal,
    .modal {
        display: none !important;
    }
    
    .app {
        box-shadow: none;
        border: 1px solid #000;
        background: white;
    }
    
    .card,
    .character-modal {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    /* Ensure readable text in print */
    * {
        color: black !important;
        background: white !important;
    }
} 

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* GPU acceleration for animated elements */
.card,
.header-btn,
.action-btn,
.modal,
.preferences-modal,
.loading-spinner {
    transform: var(--gpu-acceleration);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Contain layout shifts */
.card img,
.character-image-container img {
    contain: layout;
}

/* Optimize will-change for better performance */
.card.dragging {
    will-change: var(--will-change-transform);
}

.loading-spinner {
    will-change: var(--will-change-transform);
}

.modal.show,
.preferences-modal.active {
    will-change: var(--will-change-opacity);
}

/* Reset will-change after animations */
.card:not(.dragging) {
    will-change: var(--will-change-auto);
}

.modal:not(.show),
.preferences-modal:not(.active) {
    will-change: var(--will-change-auto);
} 