/* ==========================================================================
   Idrico WP Theme - accessibility.css
   Stili per: toolbar accessibilità, alto contrasto, scala di grigi,
   evidenziazione link, reduced motion, focus styles avanzati.
   ========================================================================== */

/* ==========================================================================
   1. Accessibility Toolbar
   ========================================================================== */
.a11y-toolbar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--color-primary);
    border-radius: 0 0 0 var(--radius-md);
    box-shadow: var(--shadow-md);
}

.a11y-toolbar .a11y-btn {
    background: transparent;
    border: 2px solid transparent;
    color: var(--color-text-inverse);
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease, border-color 0.15s ease;
    min-height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.a11y-toolbar .a11y-btn:hover,
.a11y-toolbar .a11y-btn:focus-visible {
    background: var(--color-accent);
    border-color: var(--color-text-inverse);
    color: var(--color-text-inverse);
    outline: none;
}

.a11y-toolbar .a11y-btn[aria-pressed="true"] {
    background: var(--color-focus);
    color: var(--color-text);
    border-color: var(--color-text);
}

.a11y-toolbar .icon {
    width: 20px;
    height: 20px;
}

/* Hide toolbar on small screens (avoid covering content) */
@media (max-width: 575px) {
    .a11y-toolbar {
        bottom: 0;
        top: auto;
        right: 0;
        left: 0;
        justify-content: center;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        overflow-x: auto;
    }
}

/* ==========================================================================
   2. High Contrast Mode
   ========================================================================== */
body.a11y-high-contrast {
    --color-bg: #000000;
    --color-bg-alt: #111111;
    --color-text: #ffffff;
    --color-text-muted: #ffffff;
    --color-primary: #ffff00;
    --color-accent: #ffff00;
    --color-link: #ffff00;
    --color-link-hover: #ffffff;
    --color-border: #ffffff;
    background: #000 !important;
    color: #fff !important;
}

body.a11y-high-contrast .site-header,
body.a11y-high-contrast .utility-bar,
body.a11y-high-contrast .site-footer,
body.a11y-high-contrast .footer-bottom,
body.a11y-high-contrast .page-header,
body.a11y-high-contrast .hero {
    background: #000 !important;
    color: #fff !important;
}

body.a11y-high-contrast .site-title a,
body.a11y-high-contrast .site-title,
body.a11y-high-contrast .utility-bar a,
body.a11y-high-contrast .footer-col a,
body.a11y-high-contrast .footer-col h3,
body.a11y-high-contrast .footer-col h4,
body.a11y-high-contrast .footer-bottom a,
body.a11y-high-contrast .hero h1,
body.a11y-high-contrast .hero h2,
body.a11y-high-contrast .page-header h1,
body.a11y-high-contrast .page-header .page-subtitle {
    color: #ffff00 !important;
}

body.a11y-high-contrast h1,
body.a11y-high-contrast h2,
body.a11y-high-contrast h3,
body.a11y-high-contrast h4,
body.a11y-high-contrast h5,
body.a11y-high-contrast h6 {
    color: #ffff00 !important;
}

body.a11y-high-contrast a {
    color: #ffff00 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
}

body.a11y-high-contrast a:hover,
body.a11y-high-contrast a:focus-visible {
    background: #ffff00 !important;
    color: #000 !important;
    text-decoration: none !important;
}

body.a11y-high-contrast .card,
body.a11y-high-contrast .news-card,
body.a11y-high-contrast .sidebar {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

body.a11y-high-contrast .btn,
body.a11y-high-contrast .button,
body.a11y-high-contrast button {
    background: #ffff00 !important;
    color: #000 !important;
    border: 2px solid #ffff00 !important;
    font-weight: 700 !important;
}

body.a11y-high-contrast .btn--secondary,
body.a11y-high-contrast .btn--outline {
    background: transparent !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
}

body.a11y-high-contrast input,
body.a11y-high-contrast textarea,
body.a11y-high-contrast select {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #ffff00 !important;
}

body.a11y-high-contrast .quick-service-card,
body.a11y-high-contrast .quick-service-card h3 {
    background: #000 !important;
    color: #ffff00 !important;
    border: 2px solid #fff !important;
}

body.a11y-high-contrast .card-icon,
body.a11y-high-contrast .quick-service-card .icon-wrap {
    background: #ffff00 !important;
    color: #000 !important;
}

body.a11y-high-contrast .alert {
    background: #000 !important;
    border-left-width: 6px !important;
}

body.a11y-high-contrast .breadcrumbs {
    background: #111 !important;
    color: #fff !important;
}

body.a11y-high-contrast table th,
body.a11y-high-contrast table td {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #fff !important;
}

body.a11y-high-contrast table th {
    background: #ffff00 !important;
    color: #000 !important;
}

/* ==========================================================================
   3. Grayscale Mode (solo testo)
   ========================================================================== */
body.a11y-grayscale {
    filter: grayscale(100%);
}

body.a11y-grayscale img,
body.a11y-grayscale .hero {
    filter: grayscale(100%) contrast(1.1);
}

/* ==========================================================================
   4. Highlight Links Mode
   ========================================================================== */
body.a11y-highlight-links a {
    background: rgba(255, 191, 71, 0.4) !important;
    color: var(--color-text) !important;
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    padding: 2px 4px !important;
    border-radius: 2px;
}

body.a11y-highlight-links a:hover,
body.a11y-highlight-links a:focus-visible {
    background: var(--color-focus) !important;
    color: var(--color-text) !important;
    outline: 3px solid var(--color-text) !important;
}

/* ==========================================================================
   5. Reduced Motion
   ========================================================================== */
body.a11y-reduced-motion *,
body.a11y-reduced-motion *::before,
body.a11y-reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

@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;
    }
}

/* ==========================================================================
   6. Focus enhancement (visible focus indicator)
   ========================================================================== */
*:focus-visible {
    outline: 3px solid var(--color-focus) !important;
    outline-offset: 3px !important;
    border-radius: 2px;
}

/* Skip link visible only on focus */
.skip-link:focus {
    clip: auto !important;
    clip-path: none !important;
    width: auto !important;
    height: auto !important;
    padding: var(--space-3) var(--space-4);
    background: var(--color-focus);
    color: var(--color-text);
    font-weight: 700;
    top: 0;
    left: 0;
    z-index: 100000;
    border: 3px solid var(--color-text);
    border-radius: 0 0 var(--radius-sm) 0;
}

/* ==========================================================================
   7. Screen reader only - improved
   ========================================================================== */
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
    word-wrap: normal !important;
}

.screen-reader-text:focus,
.screen-reader-shortcut:focus {
    clip: auto !important;
    clip-path: none !important;
    width: auto;
    height: auto;
    padding: var(--space-3);
    background: var(--color-focus);
    color: var(--color-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: normal;
    text-decoration: none;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 100000;
    border: 3px solid var(--color-text);
    display: block;
}

/* ==========================================================================
   8. Form accessibility
   ========================================================================== */
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
    border-color: var(--color-error) !important;
    background-color: var(--color-error-bg) !important;
    box-shadow: 0 0 0 3px rgba(179, 35, 35, 0.2);
}

.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: var(--space-1);
    display: block;
    font-weight: 600;
}

/* ==========================================================================
   9. Print styles
   ========================================================================== */
@media print {
    .a11y-toolbar,
    .cookie-banner,
    .utility-bar,
    .menu-toggle,
    .skip-link,
    .breadcrumbs,
    .site-header,
    .site-footer,
    .sidebar,
    .post-navigation,
    .pagination,
    .hero-actions,
    .btn,
    .button {
        display: none !important;
    }

    body {
        font-size: 12pt;
        color: #000;
        background: #fff;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }

    a {
        text-decoration: underline;
        color: #000;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #555;
    }

    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }

    h1, h2, h3 {
        page-break-after: avoid;
        color: #000;
    }

    img, table, figure {
        page-break-inside: avoid;
    }
}
