/* Accessibility Improvements */

/* Focus indicators */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Skip to main content link - already in HTML but enhance visibility */
.skip-link:focus {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 9999;
    padding: 1rem 1.5rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Screen reader only text - already defined but ensure it works */
.sr-only:not(:focus):not(:active) {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* High contrast mode improvements */
@media (prefers-contrast: high) {
    * {
        border-width: 2px !important;
    }
    
    .btn-primary {
        background: var(--accent);
        color: white;
        border: 2px solid white !important;
    }
    
    .btn-secondary {
        border: 2px solid var(--accent) !important;
    }
    
    .tag {
        border: 1px solid currentColor !important;
    }
    
    .section {
        border: 2px solid var(--border-strong) !important;
    }
}

/* Reduced motion preferences */
@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;
    }
    
    .profile-image::after,
    body::before {
        display: none !important;
    }
}

/* Better color contrast for text */
.text-secondary,
.timeline-date,
.cert-date,
.hero-meta-label {
    color: var(--text-secondary);
    font-weight: 500; /* Slightly bolder for better readability */
}

/* Ensure interactive elements have proper roles and states */
.filter-btn[aria-pressed="true"] {
    background-color: var(--accent);
    color: white;
}

/* Improve form labels (if any forms are added) */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Error states for better visibility */
.error {
    color: #dc2626;
    font-weight: 600;
    padding: 0.5rem;
    background: #fee2e2;
    border: 2px solid #dc2626;
    border-radius: var(--radius-sm);
}

/* Success states */
.success {
    color: #059669;
    font-weight: 600;
    padding: 0.5rem;
    background: #d1fae5;
    border: 2px solid #059669;
    border-radius: var(--radius-sm);
}

/* Loading states */
[aria-busy="true"] {
    opacity: 0.7;
    cursor: wait;
}

/* Improve link underlines for better visibility */
main a:not(.btn):not(.filter-btn):not(.social-links a) {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

main a:not(.btn):not(.filter-btn):not(.social-links a):hover {
    text-decoration-thickness: 2px;
}

/* Better keyboard navigation indicators */
.keyboard-user *:focus {
    outline: 3px solid var(--accent) !important;
    outline-offset: 3px !important;
}

/* Improve button states */
button:disabled,
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* Ensure social link text remains visible on desktop */
.social-links a span {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: nowrap;
    border: 0;
}

/* Ensure proper heading hierarchy visualization */
h1 { font-size: 2.5rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

/* Improve table accessibility (if tables are added) */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    font-weight: 700;
    text-align: left;
    background: var(--surface-alt);
}

th, td {
    padding: 0.75rem;
    border: 1px solid var(--border);
}

/* Improve list readability */
ul, ol {
    padding-left: 2rem;
    line-height: 1.8;
}

li {
    margin-bottom: 0.5rem;
}

/* Status indicators */
[role="status"],
[role="alert"] {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

[role="alert"] {
    background: #fee2e2;
    border: 2px solid #dc2626;
    color: #dc2626;
}

/* Print styles for better accessibility */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .theme-toggle,
    .scroll-indicator,
    .social-links,
    nav {
        display: none !important;
    }
    
    a {
        text-decoration: underline;
        color: black;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    .section {
        page-break-inside: avoid;
    }
}