/**
 * Bratianu Accessibility Plugin Styles
 *
 * Provides screen reader only and accessibility helper styles
 */

/* ========================================
   Screen Reader Only (sr-only) Class
   ======================================== */

.bratianu-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;
}

/* Ensure sr-only is still focusable for keyboard users */
.bratianu-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

/* ========================================
   Skip Links (for keyboard navigation)
   ======================================== */

.bratianu-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
}

.bratianu-skip-link:focus {
    top: 0;
}

/* ========================================
   Focus Outline Enhancements
   ======================================== */

/* Ensure focus outlines are visible for keyboard users */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* ========================================
   Landmark Styles
   ======================================== */

main {
    display: block;
}

header {
    display: block;
}

nav {
    display: block;
}

footer {
    display: block;
}

aside {
    display: block;
}

/* ========================================
   Heading Styles (for icon-only headings)
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    display: block;
}

/* Ensure heading icons are properly sized */
h1 i,
h2 i,
h3 i,
h4 i,
h5 i,
h6 i {
    display: inline-block;
}

/* ========================================
   Link Accessibility Enhancements
   ======================================== */

/* Ensure links are distinguishable */
a {
    text-decoration: underline;
}

a:visited {
    color: #551a8b;
}

/* Ensure sufficient contrast for focus states */
a:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* External link indicators (optional - can be enabled per site) */
/* Uncomment to show (i) icon for external links */
/*
a[target="_blank"]::after {
    content: " (opens in new window)";
    font-size: 0.9em;
    color: #999;
}
*/

/* ========================================
   Button Accessibility Enhancements
   ======================================== */

button,
[role="button"],
input[type="button"],
input[type="submit"],
input[type="reset"] {
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 8px 16px;
    font-size: 1em;
}

button:focus,
[role="button"]:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
}

/* ========================================
   Form Accessibility Enhancements
   ======================================== */

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

input,
select,
textarea {
    font-size: 1em;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid #4A90E2;
    outline-offset: 2px;
    border-color: #4A90E2;
}

/* Required field indicator */
input[required]::after,
textarea[required]::after,
select[required]::after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* ========================================
   Image Accessibility
   ======================================== */

img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Images should have alt text - no styling needed,
   but alt text is validated in plugin code */

/* ========================================
   Color Contrast Helper Classes
   ======================================== */

/* Ensure sufficient contrast for text */
body {
    color: #333;
    background-color: #fff;
}

/* High contrast background option */
.bratianu-high-contrast {
    background-color: #000;
    color: #fff;
}

.bratianu-high-contrast a {
    color: #ffff00;
}

.bratianu-high-contrast a:visited {
    color: #00ffff;
}

/* ========================================
   Text Sizing & Zooming
   ======================================== */

/* Ensure text can be resized */
html {
    font-size: 16px;
    /* Allow zoom - viewport meta tag handled in PHP */
}

body {
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Improve readability with line height */
p, li, dd {
    line-height: 1.6;
}

/* ========================================
   List Accessibility
   ======================================== */

ul, ol, dl {
    margin: 1em 0;
    padding-left: 2em;
}

li {
    margin: 0.5em 0;
}

/* ========================================
   Table Accessibility
   ======================================== */

table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

th {
    background-color: #f5f5f5;
    font-weight: bold;
}

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

@media print {
    /* Ensure sr-only content is visible in print */
    .bratianu-sr-only {
        position: static;
        width: auto;
        height: auto;
        overflow: visible;
        clip: auto;
    }

    /* Hide interactive elements that don't print well */
    .bratianu-skip-link {
        display: none;
    }
}

/* ========================================
   Mobile/Responsive Accessibility
   ======================================== */

@media (max-width: 768px) {
    /* Ensure buttons are touch-friendly (min 44x44px) */
    button,
    [role="button"],
    input[type="button"],
    input[type="submit"],
    input[type="reset"],
    a.button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    /* Ensure form inputs are touch-friendly */
    input,
    select,
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Improve label visibility on mobile */
    label {
        font-size: 1.1em;
    }
}

/* ========================================
   Debug/Developer Helpers (when WP_DEBUG enabled)
   ======================================== */

/* These are only shown when WP_DEBUG is true in PHP */
.bratianu-debug-landmark {
    border: 2px dotted blue;
    opacity: 0.3;
}

.bratianu-debug-heading {
    border: 2px dotted green;
    opacity: 0.3;
}

.bratianu-debug-link {
    border: 2px dotted orange;
    opacity: 0.3;
}
