/**
 * Accessibility & SEO Enhancements
 *
 * @package NEWTIV
 * @since 1.0.0
 */

/* ============================================
   Accessibility Improvements
   ============================================ */

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2563eb;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100000;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* Focus visible styles */
*:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    * {
        border-color: currentColor !important;
    }
    
    a {
        text-decoration: underline;
    }
}

/* 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;
    }
}

/* ============================================
   Screen Reader Only Content
   ============================================ */
.screen-reader-text,
.sr-only {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    word-wrap: normal !important;
}

.screen-reader-text:focus,
.sr-only:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    color: #21759b;
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ============================================
   ARIA Labels & Semantic HTML
   ============================================ */
button:not([aria-label]):not([aria-labelledby]) {
    /* Ensure buttons have accessible names */
}

img:not([alt]) {
    border: 2px dashed #ef4444;
}

/* ============================================
   Form Accessibility
   ============================================ */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

input[required] + label::after,
label[for*="required"]::after {
    content: ' *';
    color: #ef4444;
}

input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #ef4444;
}

input:invalid:not(:focus):not(:placeholder-shown) + .error-message {
    display: block;
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.error-message {
    display: none;
}

/* ============================================
   SEO Optimizations
   ============================================ */

/* Structured data visual helpers (hidden) */
.schema-item {
    display: none;
}

/* Better heading hierarchy */
h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

/* Better link structure */
a[rel="nofollow"] {
    opacity: 0.8;
}

/* Image optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   Print Optimizations
   ============================================ */
@media print {
    .no-print,
    .site-header,
    .site-footer,
    .sidebar,
    .widget,
    .button,
    .menu-toggle,
    .mobile-menu {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    a[href^="#"]:after,
    a[href^="javascript:"]:after {
        content: "";
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
    
    .entry,
    .article {
        page-break-inside: avoid;
    }
}

/* ============================================
   Language Support
   ============================================ */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .entry-meta,
[dir="rtl"] .post-meta {
    flex-direction: row-reverse;
}

/* ============================================
   Color Contrast Improvements
   ============================================ */
a {
    color: #2563eb;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: #1d4ed8;
    text-decoration-thickness: 2px;
}

.button,
button {
    min-height: 44px;
    min-width: 44px;
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================
   Keyboard Navigation
   ============================================ */
.menu-item a:focus,
.widget a:focus,
.footer a:focus {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
    background: rgba(37, 99, 235, 0.1);
}

/* ============================================
   Loading States
   ============================================ */
[aria-busy="true"] {
    cursor: wait;
    opacity: 0.6;
}

[aria-hidden="true"] {
    display: none;
}

