/* Text spacing accommodations for WCAG 2.1 AA */
body {
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
}

* {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Ensure content remains accessible with increased text spacing */
@media (prefers-contrast: high) {
    body {
        letter-spacing: 0.07em;
        word-spacing: 0.15em;
    }
}

/* Text spacing override for specific elements that need tighter spacing */
.code-block, .address-text, .qr-address {
    letter-spacing: normal;
    word-spacing: normal;
}

/* Ensure no content loss with 200% text spacing */
body {
    letter-spacing: 0;
    word-spacing: normal;
    line-height: 1.5;
}

/* Flexible layouts that adapt to text spacing changes */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Accessibility improvements */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.3);
}

/* High contrast focus for dark themes */
.theme-dark :focus-visible,
.theme-landing :focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.5);
}

.skip-link {
    position: absolute;
    top: -9999px;
    left: -9999px;
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    z-index: 100;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

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

.skip-link + .skip-link {
    left: auto;
    right: 0;
    border-radius: 0 0 0 4px;
}

/* Improved focus styles for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex="0"]:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Ensure form controls have proper focus states */
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

/* Screen reader only - visually hidden but accessible to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

.bg-white { background-color: white; }
.bg-light { background-color: #f9f9f9; }
.bg-dark { background-color: #333; color: white; }

.rounded { border-radius: 4px; }
.rounded-lg { border-radius: 8px; }

.shadow-sm { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); }
.shadow { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); }