/* Text that can be read.
 *
 * Issue #56. Three colours on this site fail WCAG AA's 4.5:1 minimum for normal
 * text, and because the same three repeat on every page and every form, an
 * automated scan counts each appearance separately. Three colours produce about
 * 1,000 of that issue's 1,021 findings.
 *
 * measured, computed from the sRGB relative luminance formula:
 *
 *   #007bff on white        3.98:1   needs 4.5:1
 *   #28a745 on white        3.13:1   needs 4.5:1
 *   white on #007bff        3.98:1   needs 4.5:1
 *
 * These are Bootstrap's stock defaults. Nobody chose them; they came with the
 * framework. They are fine on a good monitor with young eyes, and hard work on
 * a phone in a car park or for anyone over about forty-five - which is most of
 * the people filling these forms.
 *
 * WHY THIS FILE RATHER THAN AN EDIT TO BOOTSTRAP
 *
 * The values live in css/bootstrap.css, a vendor file. Editing it works until
 * somebody updates Bootstrap, at which point the fix disappears silently. This
 * file loads last and overrides, so an upgrade cannot undo it.
 *
 * HOW THE REPLACEMENTS WERE CHOSEN
 *
 * The minimum darkening that crosses 4.5:1, same hue and saturation. Not a
 * redesign, and deliberately not a new palette:
 *
 *   #007bff -> #0072ed      4.54:1
 *   #28a745 -> #218838      4.52:1   (Bootstrap's own darker green)
 *
 * The difference is barely perceptible side by side. That is the point - the
 * site looks the same and the text becomes readable.
 *
 * Tests/ColourContrastTests.cs recomputes these ratios from this file, so a
 * later change that lightens one of them fails rather than quietly reopening
 * the issue.
 *
 * WHAT THIS DOES NOT FIX
 *
 * The other ~21 findings on #56 are 37 input boxes and 14 dropdowns with no
 * programmatic label. A sighted person sees the text beside the box; a screen
 * reader and the browser's autofill see an unnamed box. Each needs its own
 * edit, and no stylesheet can do it.
 */

:root {
    --blue: #0072ed;
    --primary: #0072ed;
    --green: #218838;
    --success: #218838;
}

/* Links and anything carrying the primary colour as TEXT. */
a,
.text-primary,
.btn-link {
    color: #0072ed;
}

a:hover,
a:focus,
.btn-link:hover,
.btn-link:focus {
    color: #005bbd;
}

.text-success,
.valid-feedback {
    color: #218838 !important;
}

/* White text on a coloured background: the background has to carry the ratio. */
.btn-primary,
.badge-primary,
.bg-primary {
    background-color: #0072ed;
    border-color: #0072ed;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:not(:disabled):not(.disabled):active {
    background-color: #005bbd;
    border-color: #005bbd;
}

.btn-success,
.badge-success,
.bg-success {
    background-color: #218838;
    border-color: #218838;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:not(:disabled):not(.disabled):active {
    background-color: #1b6e2d;
    border-color: #1b6e2d;
}

/* The focus ring has to be visible too: somebody tabbing through a 300-input
   form needs to see where they are. */
.btn-primary:focus,
.btn-primary.focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 114, 237, 0.5);
}
