/*
 * Accessibility overrides for the UCR Library theme.
 * Loaded after style.css to address SiteImprove findings without
 * touching the minified style.css build.
 */

/* Visually-hidden utility: available to assistive tech, hidden on screen. */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip-to-main-content link: off-screen until focused. */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 10px 16px;
    background: #fff;
    color: #2d6cc0;
    font-weight: bold;
    border: 2px solid #2d6cc0;
    border-radius: 0 0 4px 0;
}
.skip-link:focus {
    left: 0;
}

/* Remove the outline suppression so the skip target doesn't show a focus ring
   when programmatically focused, but keep keyboard focus visible elsewhere. */
#content[tabindex="-1"]:focus {
    outline: none;
}

/*
 * "Links are not clearly identifiable": body-content links were distinguished
 * from surrounding text by colour alone. Underline links inside text content
 * so they are identifiable without relying on colour. Buttons, navigation,
 * thumbnails and resource lists keep their existing styling.
 */
#content p a,
#content li a,
#content td a,
#content dd a,
#content .property .value a,
#content .description a,
.page-content a {
    text-decoration: underline;
}
/* Don't underline links that are really image/thumbnail links or buttons. */
#content a.button,
#content .resource-link img + a,
#content .media.resource,
#content a:has(> img) {
    text-decoration: none;
}

/*
 * "Color contrast does not meet minimum requirement": the search-field
 * placeholder (#777 on #fff = 4.48:1) fell just under the 4.5:1 AA threshold.
 * Darken placeholder text site-wide.
 */
input::placeholder,
textarea::placeholder {
    color: #595959;
    opacity: 1;
}
input::-ms-input-placeholder {
    color: #595959;
}

/* The "Advanced search" link (#306ec1 on #f8f8f8 = ~4.0:1) failed AA. */
.advanced-search {
    color: #225aa6;
}

/* Ensure keyboard focus is always visible for interactive elements. */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus-visible {
    outline: 2px solid #2d6cc0;
    outline-offset: 1px;
}
