/**
* ACCESSIBILITY ENHANCEMENTS
* Advanced accessibility features beyond WCAG
* 2025/2026 Accessibility Best Practices
*/

/* ============================================
  SKIP LINKS
  ============================================ */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 0 0 8px 0;
    font-weight: 600;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #764ba2;
    outline-offset: 2px;
}

/* ============================================
  FOCUS MANAGEMENT
  ============================================ */
*:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
  HIGH CONTRAST MODE
  ============================================ */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }

    .card-premium,
    .project-card-animated {
        border: 2px solid currentColor;
    }

    .btn-premium {
        border: 2px solid currentColor;
    }
}

/* ============================================
  REDUCED MOTION
  ============================================ */
@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;
    }
}

/* ============================================
  LARGE TEXT MODE
  ============================================ */
@media (prefers-reduced-data: reduce) {
    .particle,
    .morphing-shape,
    .abstract-graphic,
    video,
    .background-video {
        display: none !important;
    }
}

/* ============================================
  SCREEN READER ONLY
  ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
  ARIA LIVE REGIONS
  ============================================ */
[role="alert"],
[role="status"],
.aria-live {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

[role="alert"]:focus,
[role="status"]:focus,
.aria-live:focus {
    position: static;
    left: auto;
    width: auto;
    height: auto;
    overflow: visible;
}

/* ============================================
  KEYBOARD NAVIGATION
  ============================================ */
.keyboard-user *:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

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

/* ============================================
  FOCUS TRAP
  ============================================ */
.focus-trap {
    position: relative;
}

.focus-trap::before,
.focus-trap::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* ============================================
  LANDMARK REGIONS
  ============================================ */
main,
[role="main"] {
    outline: 2px dashed transparent;
    outline-offset: -2px;
}

main:focus,
[role="main"]:focus {
    outline-color: #667eea;
}

/* ============================================
  FORM ACCESSIBILITY
  ============================================ */
.form-group-enhanced label {
    display: block;
    margin-bottom: 8px;
}

.form-group-enhanced .required::after {
    content: ' *';
    color: #ef4444;
    font-weight: bold;
}

.form-error {
    display: block;
    margin-top: 6px;
    color: #ef4444;
    font-size: 0.85rem;
}

.form-input-enhanced[aria-invalid="true"] {
    border-color: #ef4444;
}

.form-input-enhanced[aria-invalid="true"]:focus {
    outline-color: #ef4444;
}

/* ============================================
  BUTTON ACCESSIBILITY
  ============================================ */
button:disabled,
.btn-premium:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

button[aria-busy="true"],
.btn-premium[aria-busy="true"] {
    position: relative;
    color: transparent;
}

button[aria-busy="true"]::after,
.btn-premium[aria-busy="true"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ============================================
  LINK ACCESSIBILITY
  ============================================ */
a[href^="http"]:not([href*="parthpatel66.net"])::after {
    content: ' (external link)';
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

a[href^="http"]:not([href*="parthpatel66.net"]):focus::after {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ============================================
  IMAGE ACCESSIBILITY
  ============================================ */
img:not([alt]) {
    border: 2px dashed #ef4444;
}

img[alt=""] {
    border: 2px dashed #f59e0b;
}

/* ============================================
  TABLE ACCESSIBILITY
  ============================================ */
table {
    border-collapse: collapse;
}

th {
    text-align: left;
    font-weight: 600;
}

th[scope="col"] {
    border-bottom: 2px solid currentColor;
}

th[scope="row"] {
    border-right: 2px solid currentColor;
}

/* ============================================
  COLOR CONTRAST ENHANCEMENTS
  ============================================ */
.low-contrast {
    filter: contrast(1.2);
}

/* ============================================
  TEXT SIZE ADJUSTMENT
  ============================================ */
.text-size-adjust {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* ============================================
  RESPONSIVE DESIGN
  ============================================ */
@media (max-width: 768px) {
    .skip-link {
        font-size: 1rem;
        padding: 10px 16px;
    }
}

