/* ACADEMY'S COLOURS — us-mtns' brand, so the desk's two apps read as one family.
   Loaded by layout.pug straight after Bootstrap 5.2, and changes nothing on any page by itself: it
   sets the palette below and points Bootstrap's own variables at it, so every page that uses
   Bootstrap's classes takes the colours without its template changing.

   THE PALETTE, and what each is for:
     navy       #16325A  us-mtns' brand navy: the navbar, headings, card titles. 12.8:1 on white.
     teal       #249087  us-mtns' brand teal, as a MARK only — the active page's underline. It is
                         3.9:1 on white, under the 4.5:1 text floor, so it never carries text (us-mtns
                         keeps it out of text for the same reason).
     teal-ink   #1D7A72  the teal darkened until it can carry text: buttons, links, ✎. 5.2:1 both
                         ways — teal text on white, white text on a teal button.
     page       #F4F6F9  the page behind the cards: cool and soft rather than pure white.
     line, header, thead the card border, the card header's tint, a table header's tint.
     ink-ok / ink-danger / ink-warn / muted
                         us-mtns' readable status inks. Bootstrap's own green (#198754) only scrapes
                         4.5:1 on white and its red sits under it on any tint; these clear it on every
                         background this site paints.

   Every text-on-background pair this file creates is recomputed in tests/theme-contrast.test.js from
   THIS file, so a lighter shade cannot creep back in. Add a pair there when you add one here. */

:root {
  --academy-navy: #16325A;
  --academy-navy-deep: #10264A;
  --academy-teal: #249087;
  --academy-teal-ink: #1D7A72;
  --academy-teal-ink-hover: #16625C;
  --academy-teal-ink-active: #124F4A;
  --academy-page: #F4F6F9;
  --academy-surface: #FFFFFF;
  --academy-line: #DDE3EA;
  --academy-header: #EEF2F7;
  --academy-thead: #E6ECF2;
  --academy-ink: #1F2937;
  --academy-muted: #4A5058;
  --academy-nav-link: #DCE4EE;
  --academy-ink-ok: #0F5132;
  --academy-ink-danger: #8B1A1A;
  --academy-ink-warn: #5C4400;
  --academy-warn-wash: #FFF3CD;

  /* Bootstrap's own, pointed at the palette. The -rgb triplet is the same colour as numbers
     (Bootstrap mixes it with an opacity); the test checks it matches its hex. Success and danger
     are NOT re-pointed here: that would darken every green and red badge too, while .btn-success
     and .alert-* kept Bootstrap's shades — one meaning in two colours. Only their TEXT inks change,
     under Status inks below. */
  --bs-body-bg: var(--academy-page);
  --bs-link-color: var(--academy-teal-ink);
  --bs-link-hover-color: var(--academy-navy);
  --bs-primary: var(--academy-teal-ink);
  --bs-primary-rgb: 29, 122, 114;
}

/* -- Navbar: navy, with the page you are on underlined in brand teal ------------------------- */

.navbar.bg-dark { background-color: var(--academy-navy) !important; }
.navbar-dark {
  --bs-navbar-color: var(--academy-nav-link);
  --bs-navbar-hover-color: #FFFFFF;
  --bs-navbar-active-color: #FFFFFF;
  --bs-navbar-brand-color: #FFFFFF;
  --bs-navbar-brand-hover-color: #FFFFFF;
}
.navbar-brand { font-weight: 700; }
/* layout.pug's script marks the link; the mark is not text, so brand teal is fine. Colour only —
   no bolder weight, which would widen the link and shift the bar when the script runs. Under the
   link in the bar; beside it when the menu is collapsed and links stack, where an underline would
   read as a divider. */
.navbar .nav-link.active { box-shadow: inset 3px 0 0 var(--academy-teal); }
@media (min-width: 576px) {
  .navbar .nav-link.active { box-shadow: inset 0 -3px 0 var(--academy-teal); }
}
.dropdown-menu-dark {
  --bs-dropdown-bg: var(--academy-navy-deep);
  --bs-dropdown-link-color: var(--academy-nav-link);
  --bs-dropdown-link-hover-bg: rgba(255, 255, 255, .08);
  --bs-dropdown-link-active-bg: var(--academy-teal-ink);
}

/* -- Headings and cards ----------------------------------------------------------------------- */

main h1, main .h1, main h2, main .h2 { color: var(--academy-navy); }
.card {
  --bs-card-border-color: var(--academy-line);
  --bs-card-cap-bg: var(--academy-header);
  box-shadow: 0 1px 3px rgba(22, 50, 90, .08);
}
.card-header { color: var(--academy-navy); }

/* -- Tables: a tinted header and a gentle hover ---------------------------------------------- */

.table {
  --bs-table-hover-bg: rgba(22, 50, 90, .045);
  --bs-table-striped-bg: rgba(22, 50, 90, .03);
}
.table > thead { background-color: var(--academy-thead); }

/* -- Buttons, links and form focus: teal-ink -------------------------------------------------- */

.btn-primary {
  --bs-btn-bg: var(--academy-teal-ink);
  --bs-btn-border-color: var(--academy-teal-ink);
  --bs-btn-hover-bg: var(--academy-teal-ink-hover);
  --bs-btn-hover-border-color: var(--academy-teal-ink-hover);
  --bs-btn-active-bg: var(--academy-teal-ink-active);
  --bs-btn-active-border-color: var(--academy-teal-ink-active);
  --bs-btn-disabled-bg: var(--academy-teal-ink);
  --bs-btn-disabled-border-color: var(--academy-teal-ink);
  --bs-btn-focus-shadow-rgb: 29, 122, 114;
}
.btn-outline-primary {
  --bs-btn-color: var(--academy-teal-ink);
  --bs-btn-border-color: var(--academy-teal-ink);
  --bs-btn-hover-color: #FFFFFF;
  --bs-btn-hover-bg: var(--academy-teal-ink);
  --bs-btn-hover-border-color: var(--academy-teal-ink);
  --bs-btn-active-color: #FFFFFF;
  --bs-btn-active-bg: var(--academy-teal-ink-hover);
  --bs-btn-active-border-color: var(--academy-teal-ink-hover);
  --bs-btn-disabled-color: var(--academy-teal-ink);
  --bs-btn-disabled-border-color: var(--academy-teal-ink);
  --bs-btn-focus-shadow-rgb: 29, 122, 114;
}
.btn-link { --bs-btn-color: var(--academy-teal-ink); --bs-btn-hover-color: var(--academy-navy); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  border-color: #7FB8B2;
  box-shadow: 0 0 0 .25rem rgba(29, 122, 114, .25);
}
.form-check-input:checked { background-color: var(--academy-teal-ink); border-color: var(--academy-teal-ink); }
/* A switch's knob, while focused and off, is drawn in Bootstrap's blue in an SVG; the same knob in teal. */
.form-switch .form-check-input:focus:not(:checked) {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%237FB8B2'/%3e%3c/svg%3e");
}

/* The rest of Bootstrap's primary blue, so there is one primary on the page, not two. */
.progress { --bs-progress-bar-bg: var(--academy-teal-ink); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--academy-teal-ink); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--academy-teal-ink); }
.list-group {
  --bs-list-group-active-bg: var(--academy-teal-ink);
  --bs-list-group-active-border-color: var(--academy-teal-ink);
}
.pagination {
  --bs-pagination-color: var(--academy-teal-ink);
  --bs-pagination-hover-color: var(--academy-navy);
  --bs-pagination-focus-color: var(--academy-navy);
  --bs-pagination-focus-box-shadow: 0 0 0 .25rem rgba(29, 122, 114, .25);
  --bs-pagination-active-bg: var(--academy-teal-ink);
  --bs-pagination-active-border-color: var(--academy-teal-ink);
}

/* -- Status inks ------------------------------------------------------------------------------ */

/* Muted text now sits on a tinted page as well as white cards; Bootstrap's #6c757d drops under
   4.5:1 there. */
.text-muted { color: var(--academy-muted) !important; }
/* Gains and losses, and errors, in us-mtns' readable inks. Text only: badges and buttons keep
   Bootstrap's brighter fills, which carry white text. */
.text-success { color: var(--academy-ink-ok) !important; }
.text-danger { color: var(--academy-ink-danger) !important; }
/* Bootstrap 5.3's -emphasis inks, which pages here already use but 5.2 does not define. */
.text-warning-emphasis { color: var(--academy-ink-warn) !important; }
.text-success-emphasis { color: var(--academy-ink-ok) !important; }
.text-danger-emphasis { color: var(--academy-ink-danger) !important; }

footer.border-top { border-color: var(--academy-line) !important; }
