/*
 * Accessibility styles (WCAG 2.2 AA).
 *
 * Kept separate from /css/tailwind.css, which is a prebuilt static file that
 * is not regenerated on deploy, so new Tailwind utilities would not take effect.
 */

/* Visually hidden but still read by screen readers */
.visually-hidden {
    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;
}

/* Skip link: hidden until focused, then shown top-left */
.skip-link {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    background: #212353;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: none;
    outline: 3px solid #9058df;
    outline-offset: 2px;
}

/* Clearly visible keyboard focus indicator on every interactive element.
   Dark indigo (#212353) has at least 3:1 contrast against white, the pink
   footer and the purple call-to-action panels. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #212353 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 3px #fff !important;
}

/* Underline links in footer lists and testimonials so they are not
   identified by colour alone */
.footer-links a,
.text-link {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Heading accent line rendered inside headings as a span */
.heading-line {
    display: block;
}

/* The main landmark is a focus target for the skip link; no outline needed */
main:focus {
    outline: none;
}

/* Pagination */
.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
}

/* Alpine: hide elements until Alpine has initialised */
[x-cloak] {
    display: none !important;
}

/*
 * Brand orange contrast (WCAG 1.4.3).
 * The bright brand orange #F26422 is only 3.17:1 against white, so it is kept
 * for icons, borders and decoration (non-text, 3:1 is enough). Where orange is
 * used as text, or sits behind white text (buttons, CTA panels, category
 * pills), the darker #CD490C (4.61:1 with white) is used instead.
 */
.text-purple-500:not(svg),
.hover\:text-purple-500:not(svg):hover {
    color: #cd490c;
}

.bg-purple-500,
.hover\:bg-purple-500:hover {
    background-color: #cd490c;
}

.bg-purple-500.border-purple-500 {
    border-color: #cd490c;
}

/* On the peach footer even the darker orange is too light, so footer
   links stay dark and gain an underline on hover instead */
footer .hover\:text-purple-500:hover {
    color: #2f2e41;
    text-decoration: underline;
}
