/**
 * Accessibility CSS for Sal Securities
 * WCAG 2.2 Level A/AA fixes
 *
 * RULES:
 * - Do NOT change existing visual design, sizes, padding or layout
 * - Do NOT override existing class styles with new dimensions
 * - Only add accessibility behaviour (skip link, focus, ARIA helpers)
 * - Existing style.css / responsive.css / IDs remain untouched
 */

/* ========== 2.4.1 Skip to Content Link ========== */
/* New class – does not exist in original CSS, so no conflict */
/* Legacy off-screen skip (if present) – prefer header button version */
.skip-to-content:not(.getintouch-btn) {
  position: absolute;
  top: -100px;
  left: 0;
  background: #273b79;
  color: #ffffff;
  padding: 10px 14px;
  z-index: 99999;
  font-size: 16px;
  text-decoration: none;
  border: 2px solid #ddd;
  transition: top 0.2s ease;
}
.skip-to-content:not(.getintouch-btn):focus,
.skip-to-content:not(.getintouch-btn):active {
  top: 0;
}

/* ========== Focus Visible (WCAG 2.4.7) ========== */
/*
 * Show clear focus ONLY for keyboard users (:focus-visible).
 * Mouse clicks on menu links must NOT leave a persistent blue box
 * on the previous item (that was the issue in the header).
 */

/* Keyboard focus – visible indicator */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Form controls: keep a visible focus for mouse too (needed for usability) */
input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 3px solid #005fcc;
  outline-offset: 2px;
}

/* Nav / header links: suppress mouse focus box; keyboard still uses :focus-visible above */
.navbar-default .navbar-nav > li > a:focus:not(:focus-visible),
.navbar-default .navbar-nav > li > a:focus,
.header-block a:focus:not(:focus-visible),
.getintouch-btn:focus:not(:focus-visible),
.login-btn:focus:not(:focus-visible),
.hire-btn:focus:not(:focus-visible),
.footer-nav a:focus:not(:focus-visible),
.social-icons a:focus:not(:focus-visible) {
  outline: none;
}

/* Older browsers without :focus-visible: still no thick box on nav after click */
@supports not selector(:focus-visible) {
  .navbar-default .navbar-nav > li > a:focus,
  .header-block a:focus {
    outline: none;
  }
  /* Keep a simple underline for keyboard-ish focus on forms only */
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid #005fcc;
    outline-offset: 1px;
  }
}

/* ========== 2.5.8 Target Size – NON-INVASIVE ========== */
/*
 * We do NOT set padding / min-width / min-height on existing classes
 * because that changes the visual design.
 *
 * Instead we only ensure that very small interactive elements
 * (icon-only links, social icons) have an adequate hit area
 * using a transparent pseudo-element. This does not alter
 * the visible size of the element.
 */
.social-icons a,
.footer-nav a,
.question-box a {
  position: relative;
}

.social-icons a::after,
.footer-nav a::after,
.question-box a::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  /* transparent hit area – does not affect layout or visual size */
}

/* ========== 1.4.13 Header dropdowns – HOVER only (not focus) ========== */
/*
 * Dropdown menus open/close on HOVER, not on focus.
 * Focus outline is suppressed on parent menu items so clicking
 * another item does not leave a blue box on the previous one.
 * Dropdown stays visible while pointer is over parent OR submenu.
 */

/* Show dropdown on hover of parent li (with or without .drop class) */
.navbar-default .navbar-nav > li:hover > ul.dropdown,
.navbar-default .navbar-nav > li.drop:hover > ul.dropdown {
  visibility: visible !important;
  opacity: 1 !important;
  display: block;
  z-index: 1000;
}

/* Keep dropdown open while hovering the dropdown itself */
.navbar-default .navbar-nav > li > ul.dropdown:hover {
  visibility: visible !important;
  opacity: 1 !important;
  display: block;
  z-index: 1000;
}

/* Do NOT open dropdown on focus – hover only */
.navbar-default .navbar-nav > li > a:focus + ul.dropdown,
.navbar-default .navbar-nav > li:focus-within > ul.dropdown {
  /* intentionally not forcing open on focus alone for mouse users;
     keyboard users can still Tab into dropdown links when open via hover */
}

/* Suppress focus box on top-level menu links (mouse click must not leave outline) */
.navbar-default .navbar-nav > li > a:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Keyboard-only: subtle focus when using Tab (focus-visible) */
.navbar-default .navbar-nav > li > a:focus-visible {
  outline: 2px solid #005fcc !important;
  outline-offset: 2px;
}

/* Dropdown item links – no sticky focus box after click */
.navbar-default .navbar-nav ul.dropdown a:focus {
  outline: none !important;
}
.navbar-default .navbar-nav ul.dropdown a:focus-visible {
  outline: 2px solid #005fcc !important;
  outline-offset: 1px;
}

/* Parent item should not keep "active-looking" focus style after click
   unless it truly has class="active" for the current page */
.navbar-default .navbar-nav > li > a:focus:not(.active):not(:hover) {
  background: transparent;
  color: #333;
  border-bottom: none;
}

/* ========== Status / Live region helpers (WCAG 4.1.3) ========== */
/* New classes used by the form scripts – do not touch existing styles */
.form-error {
  color: #a94442;
  background-color: #f2dede;
  border: 1px solid #ebccd1;
  padding: 10px 15px;
  margin: 10px 0;
  border-radius: 4px;
}

.form-success {
  color: #3c763d;
  background-color: #dff0d8;
  border: 1px solid #d6e9c6;
  padding: 10px 15px;
  margin: 10px 0;
  border-radius: 4px;
}

/* ========== Form helpers – only colour for required asterisk ========== */
/* Does not change label layout or font */
label .required {
  color: #c00;
}

/* ========== Registration / Contact form – match email, date, tel to text input design ========== */
/*
 * Original style.css only styles:
 *   #contact-form input[type="text"], #contact-form select, #contact-form textarea
 * So type="email", type="date", type="tel", type="number" looked different.
 * These rules copy the SAME visual styles (no design change) for the extra types.
 */
#contact-form input[type="email"],
#contact-form input[type="date"],
#contact-form input[type="tel"],
#contact-form input[type="number"],
#contact-form input[type="text"],
.contatct-form input[type="email"],
.contatct-form input[type="date"],
.contatct-form input[type="tel"],
.contatct-form input[type="number"],
.contactForm input[type="email"],
.contactForm input[type="date"],
.contactForm input[type="tel"],
.contactForm input[type="number"] {
  color: #333;
  font-size: 13px;
  font-family: 'Open Sans', sans-serif;
  border: 1px solid #999;
  font-weight: 400;
  border-radius: 2px;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  -o-border-radius: 2px;
  outline: none;
  width: 100%;
  padding: 7px 14px;
  display: block;
  margin-bottom: 10px;
  background-color: #fff;
  height: auto;
  line-height: normal;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: all 0.4s ease-in-out;
  -moz-transition: all 0.4s ease-in-out;
  -webkit-transition: all 0.4s ease-in-out;
  -o-transition: all 0.4s ease-in-out;
}

#contact-form input[type="email"]:focus,
#contact-form input[type="date"]:focus,
#contact-form input[type="tel"]:focus,
#contact-form input[type="number"]:focus,
.contatct-form input[type="email"]:focus,
.contatct-form input[type="date"]:focus,
.contatct-form input[type="tel"]:focus,
.contatct-form input[type="number"]:focus,
.contactForm input[type="email"]:focus,
.contactForm input[type="date"]:focus,
.contactForm input[type="tel"]:focus,
.contactForm input[type="number"]:focus {
  border-color: #ddd;
  box-shadow: 0 0 3px #eee;
  -o-box-shadow: 0 0 3px #eee;
  -moz-box-shadow: 0 0 3px #eee;
  -webkit-box-shadow: 0 0 3px #eee;
}

/* Date input – keep calendar icon usable but field looks like text */
#contact-form input[type="date"],
.contatct-form input[type="date"],
.contactForm input[type="date"] {
  min-height: 34px; /* matches text input visual height with padding */
}

/* Ensure select already styled by original CSS still consistent */
#contact-form select,
.contatct-form select,
.contactForm select {
  box-sizing: border-box;
}

/* Buttons – match original input[type="submit"] design (from style.css + blue.css) */
#contact-form input[type="submit"],
#contact-form input[type="reset"],
.contatct-form input[type="submit"],
.contatct-form input[type="reset"],
.contactForm input[type="submit"],
.contactForm input[type="reset"],
#contact-form button.button,
.contatct-form button.button,
.contactForm button.button {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  font-size: 12px;
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 3px;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  -o-border-radius: 3px;
  border: none;
  outline: none;
  cursor: pointer;
  background-color: #273b79;
  transition: all 0.2s ease-in-out;
  -moz-transition: all 0.2s ease-in-out;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  width: auto;
  margin-bottom: 0;
}

#contact-form input[type="submit"]:hover,
#contact-form input[type="reset"]:hover,
.contatct-form input[type="submit"]:hover,
.contatct-form input[type="reset"]:hover,
.contactForm input[type="submit"]:hover,
.contactForm input[type="reset"]:hover,
#contact-form button.button:hover,
.contatct-form button.button:hover,
.contactForm button.button:hover {
  background: #444;
  color: #fff;
}

/* Reset button slightly softer so it is distinguishable but same shape */
#contact-form input[type="reset"],
.contatct-form input[type="reset"],
.contactForm input[type="reset"] {
  background-color: #666;
}

#contact-form input[type="reset"]:hover,
.contatct-form input[type="reset"]:hover,
.contactForm input[type="reset"]:hover {
  background: #444;
}

/* ========== Header menu – one line, aligned (all pages) ========== */
/*
 * Goal: keep all nav items on ONE line, properly aligned on every page.
 * Does not change logo, colors, or overall header design.
 */

/* Prevent menu wrapping to a second line (desktop) */
.navbar.navbar-default.navbar-top .navbar-collapse {
  padding-left: 0;
  padding-right: 0;
}

.navbar-default .navbar-nav {
  float: right;
  margin-right: 0 !important;
  white-space: nowrap;
}

.navbar-default .navbar-nav > li {
  display: inline-block;
  float: none;
  margin-left: 2px;
  vertical-align: middle;
}

.navbar-default .navbar-nav > li:first-child {
  margin-left: 0;
}

.navbar-default .navbar-nav > li > a {
  display: inline-block;
  padding: 12px 7px;
  font-size: 13px;
  white-space: nowrap;
  line-height: 1.35;
}

/* Medium screens – slightly tighter so 9 items still fit */
@media (min-width: 768px) and (max-width: 1199px) {
  .navbar-default .navbar-nav > li > a {
    padding: 12px 4px;
    font-size: 12px;
  }
  .logo-quote {
    font-size: 16px;
  }
}

/* Large screens – comfortable spacing, still one line */
@media (min-width: 1200px) {
  .navbar-default .navbar-nav > li {
    margin-left: 4px;
  }
  .navbar-default .navbar-nav > li > a {
    padding: 14px 9px;
    font-size: 14px;
  }
}

/* Mobile: stacked menu (original behaviour) */
@media (max-width: 767px) {
  .navbar-default .navbar-nav {
    white-space: normal;
    float: none;
  }
  .navbar-default .navbar-nav > li {
    display: block;
    float: none;
    margin-left: 0;
    margin-bottom: 5px;
    width: 100%;
  }
  .navbar-default .navbar-nav > li > a {
    display: block;
    padding: 8px 15px;
    font-size: 14px;
    white-space: normal;
  }
}

/* ========== Registration form field validation UI ========== */
.field-error {
  display: block;
  color: #a94442;
  font-size: 12px;
  margin-top: -6px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.field-error[hidden] {
  display: none !important;
}

#contact-form input.input-invalid,
#contact-form select.input-invalid,
.contatct-form input.input-invalid,
.contatct-form select.input-invalid,
.contactForm input.input-invalid,
.contactForm select.input-invalid {
  border-color: #a94442 !important;
  box-shadow: 0 0 3px rgba(169, 68, 66, 0.35);
}

/* ========== Header: Skip button + Search (match existing design) ========== */
/* Skip uses same classes as Registration (.getintouch-btn) – only minor tweaks */
a.skip-to-content-header.getintouch-btn {
  /* inherits padding, border, background from .getintouch-btn */
  text-decoration: none;
  color: #333;
}

a.skip-to-content-header.getintouch-btn:hover {
  background: #f5f5f5;
  color: #273b79;
}

/* Screen-reader only label */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header search – compact, matches site borders/colors, does not change layout width much */
.header-top-actions .header-search-wrap {
  float: right;
  margin: 10px 8px 10px 0;
  display: inline-block;
  vertical-align: middle;
}

.header-search-form {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.header-search-input {
  /*height: 38px;
  line-height: 38px;*/
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-right: none;
  border-radius: 2px 0 0 2px;
  -webkit-border-radius: 2px 0 0 2px;
  font-size: 16px;
  font-family: 'Open Sans', sans-serif;
  color: #333;
  width: 140px;
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.header-search-input:focus {
  border-color: #273b79;
}

.header-search-btn {
  display: inline-block;
  width: 38px;
  height: 45px;
  border: 2px solid #ddd;
  border-left: none;
  border-radius: 0 2px 2px 0;
  -webkit-border-radius: 0 2px 2px 0;
  background-color: #273b79;
  color: #fff;
  font-size: 14px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.header-search-btn:hover {
  background-color: #444;
  color: #fff;
}

/* Mobile: keep usable without breaking header */
@media (max-width: 767px) {
  .header-top-actions .header-search-wrap {
    float: none;
    display: block;
    margin: 8px 0;
    text-align: right;
  }
  .header-search-input {
    width: calc(100% - 42px);
    max-width: 200px;
  }
  a.skip-to-content-header.getintouch-btn {
    float: none;
    display: inline-block;
  }
}
