/* Theme overrides for the public shells (accessibility package P1-5).

   Linked from templates/inc_landmarks_head.html, which every public shell includes after its
   theme CSS (Remark, or Bootstrap 4.3.1 for base_mobile.html).

   1. Text contrast (WCAG 1.4.3). The themes' own colors are too light for text: Remark's body
      text (#76838f, 3.9:1 on white), its placeholder and floating-label grey (#a3afb7, 2.2:1),
      its primary blue (#3e8ef7, 3.3:1 for white text on it and for links), and the danger,
      success and info buttons (2.3:1 to 3.3:1); Bootstrap 4's primary blue (#007bff, 4.0:1).
      Each is replaced by a darker step of Remark's own palette, at least 4.5:1 against what it
      sits on, at rest and on hover, focus and press:

        primary      #0b69e3 (blue-800, 5.1:1 with white)    hover, focus, press #0053bf (7.0:1)
        danger       #d60b0b (red-900, 5.4:1)                hover, focus, press #b00a0a (7.3:1)
        success      #006e3c (green-900, 6.4:1)              hover, focus, press #005a31 (8.4:1)
        info         #007d96 (cyan-800, 4.8:1)               hover, focus, press #006275 (7.0:1)
        body text    #526069 (blue-grey-600, 6.5:1 on white, 5.9:1 on the page grey #f1f4f5)
        placeholders and floating labels  #66737e (4.9:1 on white)

   City colors are not changed here (that is P1-9, after the notice to the cities). Every city
   color rule comes after this file in the page (inline style attributes, or <style> blocks
   later in the head or in the body), and each rule below has the same specificity as the theme
   rule it replaces (the same selector, plus :where() parts, which add none): wherever a city
   color applied before, it still wins. Disabled buttons keep the theme's colors (1.4.3 exempts
   inactive controls). A browser without :where() (before Chrome 88, Firefox 78, Safari 14)
   drops those rules and shows the theme's colors, as before.

   2. Text fields at 16px on small screens. iOS Safari zooms the page in when a text field
      smaller than 16px gets focus, and since P1-1 allowed zoom it does so on the 14px fields
      of the themes; the page then stays zoomed after the field loses focus.

   3. Rows against the page's padding below 480px (WCAG 1.4.10, P1-5b). Remark narrows
      .page-content's side padding to 10px there (site.min.css), but Bootstrap's .row still
      pulls out 15px on each side, so a row placed directly in .page-content stuck out 5px past
      the window (the knowledge page and the portal's alerts, requests and profile pages: a
      395px page at 390). */

/* --- Links ----------------------------------------------------------------------------------- */

a {
    color: #0b69e3;
}

a:hover {
    color: #0053bf;
}

.text-primary {
    color: #0b69e3 !important;
}

a.text-primary:focus,
a.text-primary:hover {
    color: #0053bf !important;
}

/* --- Buttons: Remark (bootstrap-extend) and Bootstrap 4 use these selectors ------------------ */

.btn-primary {
    color: #fff;
    background-color: #0b69e3;
    border-color: #0b69e3;
}

.btn-primary.focus:where(:not(:disabled):not(.disabled)),
.btn-primary.hover:where(:not(:disabled):not(.disabled)),
.btn-primary:focus:where(:not(:disabled):not(.disabled)),
.btn-primary:hover:where(:not(:disabled):not(.disabled)) {
    color: #fff;
    background-color: #0053bf;
    border-color: #0053bf;
}

.btn-primary:not([disabled]):not(.disabled).active,
.btn-primary:not([disabled]):not(.disabled):active,
.btn-primary:not([disabled]):not(.disabled).active.focus,
.btn-primary:not([disabled]):not(.disabled).active.hover,
.btn-primary:not([disabled]):not(.disabled).active:focus,
.btn-primary:not([disabled]):not(.disabled).active:hover,
.btn-primary:not([disabled]):not(.disabled):active.focus,
.btn-primary:not([disabled]):not(.disabled):active.hover,
.btn-primary:not([disabled]):not(.disabled):active:focus,
.btn-primary:not([disabled]):not(.disabled):active:hover,
.btn-primary:not(:disabled):not(.disabled).active,
.btn-primary:not(:disabled):not(.disabled):active,
.open > .btn-primary.dropdown-toggle,
.open > .btn-primary.dropdown-toggle.focus,
.open > .btn-primary.dropdown-toggle.hover,
.open > .btn-primary.dropdown-toggle:focus,
.open > .btn-primary.dropdown-toggle:hover,
.show > .btn-primary.dropdown-toggle,
.show > .btn-primary.dropdown-toggle.focus,
.show > .btn-primary.dropdown-toggle.hover,
.show > .btn-primary.dropdown-toggle:focus,
.show > .btn-primary.dropdown-toggle:hover {
    color: #fff;
    background-color: #0053bf;
    border-color: #0053bf;
}

.btn-outline-primary {
    color: #0b69e3;
    border-color: #0b69e3;
}

.btn-outline-primary.focus:where(:not(:disabled):not(.disabled)),
.btn-outline-primary.hover:where(:not(:disabled):not(.disabled)),
.btn-outline-primary:focus:where(:not(:disabled):not(.disabled)),
.btn-outline-primary:hover:where(:not(:disabled):not(.disabled)),
.btn-outline-primary:not([disabled]):not(.disabled).active,
.btn-outline-primary:not([disabled]):not(.disabled):active,
.btn-outline-primary:not(:disabled):not(.disabled).active,
.btn-outline-primary:not(:disabled):not(.disabled):active,
.show > .btn-outline-primary.dropdown-toggle {
    color: #fff;
    background-color: #0b69e3;
    border-color: #0b69e3;
}

/* Bootstrap 4's grey outline button: #6c757d is 4.4:1 on the light grey bar it sits on. */
.btn-outline-secondary {
    color: #545b62;
    border-color: #545b62;
}

.btn-outline-secondary:hover:where(:not(:disabled):not(.disabled)),
.btn-outline-secondary:not(:disabled):not(.disabled).active,
.btn-outline-secondary:not(:disabled):not(.disabled):active,
.show > .btn-outline-secondary.dropdown-toggle {
    color: #fff;
    background-color: #545b62;
    border-color: #545b62;
}

.btn-danger {
    color: #fff;
    background-color: #d60b0b;
    border-color: #d60b0b;
}

.btn-danger.focus:where(:not(:disabled):not(.disabled)),
.btn-danger.hover:where(:not(:disabled):not(.disabled)),
.btn-danger:focus:where(:not(:disabled):not(.disabled)),
.btn-danger:hover:where(:not(:disabled):not(.disabled)) {
    color: #fff;
    background-color: #b00a0a;
    border-color: #b00a0a;
}

.btn-danger:not([disabled]):not(.disabled).active,
.btn-danger:not([disabled]):not(.disabled):active,
.btn-danger:not([disabled]):not(.disabled).active.focus,
.btn-danger:not([disabled]):not(.disabled).active.hover,
.btn-danger:not([disabled]):not(.disabled).active:focus,
.btn-danger:not([disabled]):not(.disabled).active:hover,
.btn-danger:not([disabled]):not(.disabled):active.focus,
.btn-danger:not([disabled]):not(.disabled):active.hover,
.btn-danger:not([disabled]):not(.disabled):active:focus,
.btn-danger:not([disabled]):not(.disabled):active:hover,
.btn-danger:not(:disabled):not(.disabled).active,
.btn-danger:not(:disabled):not(.disabled):active,
.open > .btn-danger.dropdown-toggle,
.open > .btn-danger.dropdown-toggle.focus,
.open > .btn-danger.dropdown-toggle.hover,
.open > .btn-danger.dropdown-toggle:focus,
.open > .btn-danger.dropdown-toggle:hover,
.show > .btn-danger.dropdown-toggle,
.show > .btn-danger.dropdown-toggle.focus,
.show > .btn-danger.dropdown-toggle.hover,
.show > .btn-danger.dropdown-toggle:focus,
.show > .btn-danger.dropdown-toggle:hover {
    color: #fff;
    background-color: #b00a0a;
    border-color: #b00a0a;
}

.btn-success {
    color: #fff;
    background-color: #006e3c;
    border-color: #006e3c;
}

.btn-success.focus:where(:not(:disabled):not(.disabled)),
.btn-success.hover:where(:not(:disabled):not(.disabled)),
.btn-success:focus:where(:not(:disabled):not(.disabled)),
.btn-success:hover:where(:not(:disabled):not(.disabled)) {
    color: #fff;
    background-color: #005a31;
    border-color: #005a31;
}

.btn-success:not([disabled]):not(.disabled).active,
.btn-success:not([disabled]):not(.disabled):active,
.btn-success:not([disabled]):not(.disabled).active.focus,
.btn-success:not([disabled]):not(.disabled).active.hover,
.btn-success:not([disabled]):not(.disabled).active:focus,
.btn-success:not([disabled]):not(.disabled).active:hover,
.btn-success:not([disabled]):not(.disabled):active.focus,
.btn-success:not([disabled]):not(.disabled):active.hover,
.btn-success:not([disabled]):not(.disabled):active:focus,
.btn-success:not([disabled]):not(.disabled):active:hover,
.btn-success:not(:disabled):not(.disabled).active,
.btn-success:not(:disabled):not(.disabled):active,
.open > .btn-success.dropdown-toggle,
.open > .btn-success.dropdown-toggle.focus,
.open > .btn-success.dropdown-toggle.hover,
.open > .btn-success.dropdown-toggle:focus,
.open > .btn-success.dropdown-toggle:hover,
.show > .btn-success.dropdown-toggle,
.show > .btn-success.dropdown-toggle.focus,
.show > .btn-success.dropdown-toggle.hover,
.show > .btn-success.dropdown-toggle:focus,
.show > .btn-success.dropdown-toggle:hover {
    color: #fff;
    background-color: #005a31;
    border-color: #005a31;
}

.btn-info {
    color: #fff;
    background-color: #007d96;
    border-color: #007d96;
}

.btn-info.focus:where(:not(:disabled):not(.disabled)),
.btn-info.hover:where(:not(:disabled):not(.disabled)),
.btn-info:focus:where(:not(:disabled):not(.disabled)),
.btn-info:hover:where(:not(:disabled):not(.disabled)) {
    color: #fff;
    background-color: #006275;
    border-color: #006275;
}

.btn-info:not([disabled]):not(.disabled).active,
.btn-info:not([disabled]):not(.disabled):active,
.btn-info:not([disabled]):not(.disabled).active.focus,
.btn-info:not([disabled]):not(.disabled).active.hover,
.btn-info:not([disabled]):not(.disabled).active:focus,
.btn-info:not([disabled]):not(.disabled).active:hover,
.btn-info:not([disabled]):not(.disabled):active.focus,
.btn-info:not([disabled]):not(.disabled):active.hover,
.btn-info:not([disabled]):not(.disabled):active:focus,
.btn-info:not([disabled]):not(.disabled):active:hover,
.btn-info:not(:disabled):not(.disabled).active,
.btn-info:not(:disabled):not(.disabled):active,
.open > .btn-info.dropdown-toggle,
.open > .btn-info.dropdown-toggle.focus,
.open > .btn-info.dropdown-toggle.hover,
.open > .btn-info.dropdown-toggle:focus,
.open > .btn-info.dropdown-toggle:hover,
.show > .btn-info.dropdown-toggle,
.show > .btn-info.dropdown-toggle.focus,
.show > .btn-info.dropdown-toggle.hover,
.show > .btn-info.dropdown-toggle:focus,
.show > .btn-info.dropdown-toggle:hover {
    color: #fff;
    background-color: #006275;
    border-color: #006275;
}

/* --- Remark only: body.animsition is on every Remark public shell and on no Bootstrap 4 one,
       whose own text colors already pass and must not be lightened. :where() adds no
       specificity, so each rule below weighs the same as the Remark rule it replaces, and our
       templates' own colors (black text, fields and tables) still win over it. ---------------- */

body:where(.animsition),
:where(.animsition) .table,
:where(.animsition) .form-control,
:where(.animsition) .breadcrumb-item.active,
:where(.animsition) .list-group-item-action:where(:not(.active):not(.disabled)),
:where(.animsition) .list-group-item-action:where(:not(.active):not(.disabled)):focus,
:where(.animsition) .list-group-item-action:where(:not(.active):not(.disabled)):hover,
:where(.animsition) .list-group-item-action:where(:not(.active):not(.disabled)):active,
:where(.animsition) a.list-group-item,
:where(.animsition) a.list-group-item:focus,
:where(.animsition) a.list-group-item:hover,
:where(.animsition) .nav-tabs .nav-link {
    color: #526069;
}

:where(.animsition) .form-control::placeholder {
    color: #66737e;
}

:where(.animsition) .form-control::-webkit-input-placeholder,
:where(.animsition) .form-material .form-control::-webkit-input-placeholder {
    color: #66737e;
}

:where(.animsition) .form-material .form-control::-moz-placeholder {
    color: #66737e;
}

/* Material fields' labels (the portal's account pages): grey at rest, blue while the field has
   focus, red when its value is invalid. A field with a has-warning/danger/success/info state
   keeps Remark's state color, as before. register-v3.css comes after this file on the
   activate and reset pages, so its label rule needs the extra class to be outweighed. */
:where(.animsition) .form-material .floating-label,
.animsition.page-register-v3 form .form-material label {
    color: #66737e;
}

:where(.animsition) .form-material .form-control.focus ~ .floating-label,
:where(.animsition) .form-material .form-control:focus ~ .floating-label {
    color: #0b69e3;
}

:where(.animsition) .form-material:where(:not([class*="has-"])) .form-control.focus:invalid ~ .floating-label,
:where(.animsition) .form-material:where(:not([class*="has-"])) .form-control:not(.empty):invalid ~ .floating-label {
    color: #d60b0b;
}

/* The knowledge base's selected topic: white on the theme's blue. */
a.list-group-item.active,
a.list-group-item.active:focus,
a.list-group-item.active:hover {
    background-color: #0b69e3;
}

/* The portal's side menu: the hover grey was 3.1:1, and the selected item's blue 90% opaque
   (4.1:1). The selected rule comes second, as in Remark, so the selected item stays blue on
   hover. */
.site-menubar-light .site-menu-item > a:hover {
    color: #526069;
}

.site-menubar-light .site-menu-item.active > a {
    color: #0b69e3;
}

/* Dropify's file field (request forms): its second line was #777 (4.5:1 on white, 4.47
   measured). */
.dropify-wrapper .dropify-message p {
    color: #526069;
}

/* --- Text fields at 16px below 768px (iOS focus zoom) -----------------------------------------
   A field the accessibility toolbar has resized carries an inline font-size, and is left to it:
   the toolbar scales from the 16px set here. */

@media (max-width: 767.98px) {
    input:not([type]):not([style*="font-size"]),
    input[type="text"]:not([style*="font-size"]),
    input[type="email"]:not([style*="font-size"]),
    input[type="tel"]:not([style*="font-size"]),
    input[type="password"]:not([style*="font-size"]),
    input[type="search"]:not([style*="font-size"]),
    input[type="number"]:not([style*="font-size"]),
    input[type="url"]:not([style*="font-size"]),
    input[type="date"]:not([style*="font-size"]),
    input[type="datetime-local"]:not([style*="font-size"]),
    input[type="time"]:not([style*="font-size"]),
    select:not([style*="font-size"]),
    textarea:not([style*="font-size"]) {
        font-size: 16px !important;
    }
}

/* --- Rows directly in .page-content below 480px ---------------------------------------------- */

@media (max-width: 479.98px) {
    .page-content > .row {
        margin-right: -10px;
        margin-left: -10px;
    }
}
