/* ============================================================================
   TabDSP Documentation - Theme System
   ============================================================================ */

/* 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;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-width: 2px;
        --border-color: rgba(255, 255, 255, 0.3);
    }

    [data-theme="light"] {
        --border-color: rgba(0, 0, 0, 0.3);
    }

    .btn-primary,
    .btn-secondary {
        border: 2px solid currentColor;
    }
}

/* Dark Theme (Default) */
body {
    color-scheme: dark;
}

[data-theme="dark"] {
    color-scheme: dark;
}

/* Light Theme */
[data-theme="light"] {
    color-scheme: light;
}

[data-theme="light"] .sun-icon {
    display: none;
}

[data-theme="light"] .moon-icon {
    display: block !important;
}

/* ============================================================================
   Focus Indicators (Accessibility)
   ============================================================================ */

*:focus {
    outline: 2px solid var(--color-accent-cyan);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--color-accent-cyan);
    outline-offset: 2px;
}

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

@media print {
    .main-nav,
    .nav-actions,
    .hero-actions,
    .main-footer,
    .search-modal,
    .btn {
        display: none !important;
    }

    body {
        color: #000;
        background: #fff;
    }

    h1, h2, h3, h4, h5, h6 {
        color: #000;
        page-break-after: avoid;
    }

    p, li {
        color: #333;
    }

    a {
        color: #0066cc;
        text-decoration: underline;
    }

    .section {
        page-break-inside: avoid;
    }

    .gearhead-details[open] .gearhead-content {
        display: block;
    }

    .gearhead-details summary {
        display: none;
    }
}

/* ============================================================================
   Custom Scrollbars (Webkit)
   ============================================================================ */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-bg-elevated);
    border-radius: 6px;
}

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-elevated) var(--color-bg-secondary);
}

/* ============================================================================
   Selection Styling
   ============================================================================ */

::selection {
    background: rgba(6, 182, 212, 0.3);
    color: var(--color-text-primary);
}

::-moz-selection {
    background: rgba(6, 182, 212, 0.3);
    color: var(--color-text-primary);
}

/* ============================================================================
   Loading States
   ============================================================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-bg-elevated);
    border-top-color: var(--color-accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
