/* Camada final transversal de acessibilidade visual. */
:root {
    --a11y-focus: #0b62d6;
    --a11y-focus-gap: #fff;
}

:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid var(--a11y-focus) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 2px var(--a11y-focus-gap) !important;
}

:where(a[href], button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
    outline: none;
}

.skip-link:focus-visible {
    position: fixed !important;
    top: .75rem !important;
    left: .75rem !important;
    z-index: 100000 !important;
    width: auto !important;
    height: auto !important;
    padding: .75rem 1rem !important;
    overflow: visible !important;
    clip: auto !important;
    border: 3px solid #fff !important;
    border-radius: .5rem;
    background: #153f2b !important;
    color: #fff !important;
    font-weight: 800;
    text-decoration: underline;
}

main:focus {
    outline: none;
}

:where(main, section, article)[aria-labelledby] > :where(h1, h2, h3)[id] {
    scroll-margin-top: 7rem;
}

:where(.btn, .sig-iconbtn, .actions a, .gov-table-toolbar button, .nav-btn a, .nav-btn button) {
    touch-action: manipulation;
}

:where(.actions a, .sig-iconbtn, button.gov-column-resize) {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

:where(.subtitle, .text-muted, .c-text-light, small) {
    text-wrap: pretty;
}

:where(.alert[role="alert"], [role="status"], .empty-state, .system-state) {
    border-width: 1px;
    border-style: solid;
}

.alert[role="alert"] > :where(i, svg),
.system-state .auth-status-icon,
.empty-state > i:first-child {
    flex-shrink: 0;
}

:where(.alert-danger, .auth-status-icon--danger, .tag-status-danger) {
    border-left-width: 5px !important;
    border-left-style: solid !important;
}

:where(.alert-warning, .auth-status-icon--warning, .tag-status-warning) {
    border-bottom-width: 3px !important;
    border-bottom-style: solid !important;
}

:where(.alert-success, .tag-status-success, .status-online) {
    border-radius: .55rem;
}

:where(a:not(.btn):not(.sig-sidebar__brand):not(.portal-brand):not(.public-brand)):hover {
    text-decoration: underline;
    text-underline-offset: .16em;
}

:where(input, select, textarea)[aria-invalid="true"] {
    border-width: 2px !important;
    border-style: solid !important;
    background-image: linear-gradient(135deg, transparent 50%, #a51d1d 50%);
    background-position: right top;
    background-repeat: no-repeat;
    background-size: .7rem .7rem;
}

:where(input, select, textarea):disabled,
:where(input, select, textarea)[readonly] {
    cursor: not-allowed;
    opacity: 1;
    background-color: #edf1ef !important;
    color: #45554d !important;
}

:where(.responsive-card-table, .table-responsive) {
    scrollbar-color: #63776d #edf2ef;
    scrollbar-width: thin;
}

:where(.responsive-card-table caption, table caption) {
    color: #40554a;
}

@media (prefers-contrast: more) {
    :root {
        --a11y-focus: #0049b0;
    }

    :where(.card, .page-panel, .filter, .alert, .system-state, .empty-state) {
        border-color: currentColor !important;
    }

    :where(.subtitle, .text-muted, .c-text-light, small) {
        color: #263b31 !important;
    }

    :where(a) {
        text-decoration-thickness: 2px;
    }
}

@media (forced-colors: active) {
    :root {
        --a11y-focus: Highlight;
        --a11y-focus-gap: Canvas;
    }

    :where(.btn, .card, .page-panel, .filter, .alert, .badge, .tag-status, .system-state, .empty-state) {
        border: 1px solid CanvasText !important;
        forced-color-adjust: auto;
    }

    :where(.alert-danger, .alert-warning, .alert-success, .tag-status, .auth-status-icon) {
        border-left: 5px double CanvasText !important;
    }

    :where(svg, i) {
        forced-color-adjust: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto !important;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
