/*
 * Kolokat's accessibility corrections to Roundcube's Elastic skin (review 32b, finding 07),
 * included by the kolokat_accessibility plugin after the skin's styles.css. The driver's README,
 * §Accessibility, says what each rule corrects and what is left to upstream.
 */

/*
 * 1. Names for screen readers. Elastic hides these texts with `display: none`, which hides them
 * from screen readers as well: the control they name is left with none (axe: link-name, label).
 * `.voice` is Roundcube's own class for text meant for screen readers alone (the Larry skin kept
 * it readable); the others are the labels of Elastic's icon-only buttons. Each selector is
 * Elastic's own, so it takes the place of that rule and of no other: where Elastic shows the text
 * (a toolbar's labelled buttons), its more specific rule still wins.
 */
.voice,
a.button.icon:not(.toolbar-button) > span.inner,
.floating-action-buttons a.button .inner,
.menu .dropbutton a.dropdown span.inner {
    display: block !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media screen and (max-width: 768px) {
    #layout > div > .header a.button:not(.toolbar-button) .inner {
        display: block !important;
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }
}

/*
 * 2. Contrast, the light theme only (the dark theme has its own palette, which passes). Elastic's
 * main blue #37beff under white text is 2.1:1 and its links #00acff on white 2.5:1, its grey
 * buttons 2.8:1, the logout's red on the dark menu 3.7:1, the list's grey count 4.2:1 (WCAG AA asks 4.5:1; upstream issue
 * #7126). The blue and the grey are those Elastic's dark theme already uses for the same buttons
 * (#006a9d, 5.9:1; #4d6066, 6.6:1), a shade darker when hovered or pressed. `:where()` adds no
 * specificity: each selector weighs what Elastic's own does and wins only by coming later, so a
 * more specific colour of Elastic's (a toolbar's links, a dialog's buttons) still applies.
 */
:where(html:not(.dark-mode)) a,
:where(html:not(.dark-mode)) .btn-link,
:where(html:not(.dark-mode)) .ui.alert a:not(.btn) {
    color: #006a9d;
}

/* the list's message count on its grey bar: #737677 is 4.2:1 there */
:where(html:not(.dark-mode)) .menu.pagenav .pagenav-text {
    color: #646768;
}

:where(html:not(.dark-mode)) a:hover,
:where(html:not(.dark-mode)) .btn-link:hover {
    color: #005a86;
}

:where(html:not(.dark-mode)) .btn-primary,
:where(html:not(.dark-mode)) .btn-primary.disabled,
:where(html:not(.dark-mode)) .btn-primary:disabled,
:where(html:not(.dark-mode)) div.tox .tox-dialog__footer .tox-button:not(.tox-button--secondary),
:where(html:not(.dark-mode)) .floating-action-buttons a.button,
:where(html:not(.dark-mode)) .folderlist li.mailbox .unreadcount,
:where(html:not(.dark-mode)) .folderlist li.mailbox.recent > a > .unreadcount,
:where(html:not(.dark-mode)) #messagestack .alert-info.information {
    color: #fff;
    background: #006a9d;
    border-color: #006a9d;
}

:where(html:not(.dark-mode)) .btn-primary:hover,
:where(html:not(.dark-mode)) .btn-primary:focus,
:where(html:not(.dark-mode)) .popover .menu li a:not(.disabled):hover,
:where(html:not(.dark-mode)) .popover .menu .dropbutton a.dropdown:hover,
:where(html:not(.dark-mode)) .popupmenu .listing li > a:not(.disabled):hover,
:where(html:not(.dark-mode)) .popupmenu .listing li.selected,
:where(html:not(.dark-mode)) .googie_list li.googie_list_onhover {
    color: #fff;
    background-color: #005a86;
    border-color: #005a86;
}

:where(html:not(.dark-mode)) .btn-primary:not(:disabled):not(.disabled):active,
:where(html:not(.dark-mode)) .btn-primary:not(:disabled):not(.disabled).active {
    background: #004c71;
    border-color: #004c71;
}

:where(html:not(.dark-mode)) .ui-menu .ui-state-active,
:where(html:not(.dark-mode)) .ui-datepicker a.ui-state-active {
    color: #fff !important;
    background-color: #006a9d !important;
}

:where(html:not(.dark-mode)) .btn-secondary,
:where(html:not(.dark-mode)) .btn-secondary.disabled,
:where(html:not(.dark-mode)) .btn-secondary:disabled,
:where(html:not(.dark-mode)) div.tox .tox-dialog__footer .tox-button.tox-button--secondary {
    color: #fff;
    background: #4d6066;
    border-color: #4d6066;
}

:where(html:not(.dark-mode)) .btn-secondary:hover,
:where(html:not(.dark-mode)) .btn-secondary:focus {
    background: #3f5056;
    border-color: #3f5056;
}

:where(html:not(.dark-mode)) .btn-secondary:not(:disabled):not(.disabled):active,
:where(html:not(.dark-mode)) .btn-secondary:not(:disabled):not(.disabled).active {
    background: #34434a;
    border-color: #34434a;
}

/* the logout's red on the menu's dark ground: lighter, 5.7:1 */
:where(html:not(.dark-mode)) #taskmenu a.logout,
:where(html:not(.dark-mode)) #taskmenu a.logout:hover {
    color: #ff9997 !important;
}
