/**
 * accessibility-overrides.css
 * WCAG 2.1 AA remediation overrides — loaded last to ensure highest priority.
 * Do NOT edit bootstrap.css or components.css to fix new accessibility issues — use this file.
 */

/* Visually hidden but available to screen readers (Bootstrap 4 sr-only pattern) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================================================
   SC 1.4.1 — Use of Color / link-in-text-block
   Links within text blocks must be distinguishable by
   something other than color alone (underline + bold weight).
   ========================================================= */

/* Tooltip (?) links inside certtotal cells.
   !important required: Bootstrap resets a{text-decoration:none} and
   accessibility-overrides.css must be the definitive final word. */
td.certtotal-text a {
    color: #0066cc !important;
    text-decoration: underline !important;
    font-weight: bold;
}

td.certtotal-text a:hover,
td.certtotal-text a:focus {
    color: #004080 !important;
    text-decoration: underline !important;
}

/* "Add Another Request" link inside cart section headings.
   templates/cart.tpl:  th.cart-info.title.bord-t > a
   responsive_templates: th.bord-t > a  (no cart-info class) */
th.cart-info a,
th.bord-t a {
    text-decoration: underline !important;
    font-weight: bold;
}

/* Inline links inside paragraph/text containers on the home page */
.cnt-p a {
    text-decoration: underline;
}

/* =========================================================
   SC 1.4.3 — Contrast (Minimum)
   certtotal-text cells on .bg-color (#e5e5e5) rows.
   #8e9c98 on #e5e5e5 ≈ 2.3:1 (fails 4.5:1 for 18px bold text).
   Fix: #4d6260 → ~4.7:1 on #e5e5e5, ~5.9:1 on #ffffff.
   ========================================================= */
td.certtotal-text {
    color: #4d6260;
}

/* Home hero title text over image/gradient background.
   White text on this overlay:
     opacity 0.72 over worst-case white bg → effective #526472 → contrast 6.13:1
     (h1.title 110px bold → threshold 3:1 ✅; h2.title 11px bold → threshold 4.5:1 ✅)
   Previous value 0.62 gave 4.69:1 on h2.title — borderline. Raised to 0.72. */
h1.title,
h2.title {
    background-color: rgba(8, 34, 53, 0.72);
    border-radius: 6px;
    padding: 2px 10px;
    text-shadow: none;
}

/* Strengthen right-panel heading contrast on light backgrounds */
h1.info-right {
    color: #0e3d7a;
    text-shadow: none;
}

/* Additional needs-review hardening for text containers/fields */
h1.formtitle,
#county-scroll > h1,
label,
#additional_comments,
textarea.disc,
.cnt-p {
    color: #1f2f3a;
}

#additional_comments,
textarea.disc {
    background-color: #ffffff;
}

/* =========================================================
   SC 1.4.11 — Non-text Contrast
   Form controls and UI components must have at least 3:1
   contrast ratio against adjacent colors. Bootstrap default
   #cccccc borders = 1.6:1 (FAIL). Using #767676 = 4.5:1.
   ========================================================= */

/* Base form controls - override Bootstrap's #cccccc borders */
.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="file"],
select,
textarea {
    border: 2px solid #767676 !important; /* 4.5:1 contrast - exceeds 3:1 minimum */
    background-color: #ffffff !important;
}

/* Focus states - high visibility for keyboard navigation */
.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
input[type="month"]:focus,
input[type="week"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    border-color: #005a9c !important; /* 4.9:1 contrast */
    outline: 2px solid #005a9c !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.25) !important;
}

/* Hover states - visual feedback */
.form-control:hover,
input[type="text"]:hover,
input[type="password"]:hover,
input[type="email"]:hover,
input[type="tel"]:hover,
input[type="number"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="datetime-local"]:hover,
input[type="month"]:hover,
input[type="week"]:hover,
input[type="file"]:hover,
select:hover,
textarea:hover {
    border-color: #595959 !important; /* 7:1 contrast */
}

/* Disabled/readonly fields */
.form-control[disabled],
.form-control:disabled,
.form-control[readonly],
input[disabled],
input:disabled,
input[readonly],
select[disabled],
select:disabled,
select[readonly],
textarea[disabled],
textarea:disabled,
textarea[readonly],
fieldset[disabled] .form-control {
    border: 2px solid #767676 !important;
    background-color: #eeeeee !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Checkboxes and radio buttons - ensure visibility */
input[type="checkbox"],
input[type="radio"] {
    width: 18px !important;
    height: 18px !important;
    border: 2px solid #767676 !important;
    background-color: #ffffff !important;
    cursor: pointer;
    margin: 4px 8px 4px 4px;
    vertical-align: middle;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
    outline: 2px solid #005a9c !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.25) !important;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
    border-color: #595959 !important;
}

input[type="checkbox"]:checked {
    background-color: #005a9c !important;
    border-color: #005a9c !important;
}

input[type="radio"]:checked {
    background-color: #ffffff !important;
    border-color: #005a9c !important;
    border-width: 5px !important;
}

/* Buttons - ensure sufficient contrast for borders and states */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.btn {
    border: 2px solid #003d5c !important; /* High contrast border */
    min-height: 44px; /* Touch target size (WCAG 2.5.5) */
}

button:hover,
input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
.btn:hover {
    border-color: #005a9c !important;
}

button:focus,
input[type="button"]:focus,
input[type="submit"]:focus,
input[type="reset"]:focus,
.btn:focus {
    outline: 2px solid #005a9c !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 90, 156, 0.25) !important;
}

button:active,
input[type="button"]:active,
input[type="submit"]:active,
input[type="reset"]:active,
.btn:active {
    border-color: #003d5c !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* Validation state borders - maintain 3:1+ contrast */
.has-error .form-control,
.has-error input,
.has-error select,
.has-error textarea {
    border-color: #a94442 !important; /* 4.5:1 on white */
    border-width: 2px !important;
}

.has-warning .form-control,
.has-warning input,
.has-warning select,
.has-warning textarea {
    border-color: #8a6d3b !important; /* 4.5:1 on white */
    border-width: 2px !important;
}

.has-success .form-control,
.has-success input,
.has-success select,
.has-success textarea {
    border-color: #3c763d !important; /* 4.5:1 on white */
    border-width: 2px !important;
}

/* Select dropdowns - custom arrow for high contrast */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"%3E%3Cpath fill="%23333333" d="M6 8L0 0h12z"/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 32px !important;
}

/* Placeholder text - sufficient contrast */
.form-control::-webkit-input-placeholder,
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
    color: #767676 !important; /* 4.5:1 contrast */
    opacity: 1;
}

.form-control::-moz-placeholder,
input::-moz-placeholder,
textarea::-moz-placeholder {
    color: #767676 !important;
    opacity: 1;
}

.form-control:-ms-input-placeholder,
input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
    color: #767676 !important;
    opacity: 1;
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: #767676 !important;
    opacity: 1;
}

/* Input groups - ensure addon borders also meet contrast */
.input-group-addon {
    border: 2px solid #767676 !important;
}

/* =========================================================
   SC 1.4.13 — Content on Hover or Focus
   Tooltips must be hoverable - users should be able to 
   move pointer over tooltip content without it disappearing
   ========================================================= */
.tooltip {
    pointer-events: none !important;
}

.tooltip-inner {
    max-width: 300px;
    padding: 8px 12px;
    text-align: left;
    word-wrap: break-word;
}

/* Enable pointer-events only after cursor intentionally leaves a trigger.
   tooltip-interactive is set via JS on trigger mouseleave — NOT via CSS :hover —
   so the tooltip cannot be accidentally activated by approaching from other
   directions (e.g. an input field positioned below a bottom-placed tooltip). */
.tooltip.tooltip-interactive {
    pointer-events: auto !important;
}

/* Keep tooltip visible while cursor is actively over it */
.tooltip.tooltip-hover {
    visibility: visible !important;
    opacity: 0.9 !important;
}

/* =========================================================
   Button text-decoration consistency
   Bootstrap 3 only suppresses underline on .btn for :hover
   and :focus, not the default state. This means <a class="btn">
   elements (e.g. Decline, Home/Start Over) show an underline
   while <button> and <input type="submit"> elements do not.
   Buttons are visually distinct via border/background so
   underline is not required for WCAG 1.4.1 differentiation.
   ========================================================= */
a.btn,
a.btn:link,
a.btn:visited {
    text-decoration: none !important;
}
