/*
 * Bootstrap 3 -> 5.1 compatibility layer.
 * Loaded after bootstrap-5.1/bootstrap.min.css and before libs.css / main.css.
 * main.css was written against Bootstrap 3, so this restores the BS3 base metrics
 * and the BS3-only helpers/components the markup still relies on.
 */

/* ---- Base metrics (BS3: 10px root, 14px body, 30px gutters) ---- */
html { font-size: 10px; }
body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857143;
    color: #333;
}
h1, h2, h3, h4, h5, h6 { font-weight: 500; line-height: 1.1; }
/* the site's BS3 build (live libs.css) uses 20px below h1-h3, not stock BS3's 10px */
h1, h2, h3 { margin-top: 20px; margin-bottom: 20px; }
h4, h5, h6 { margin-top: 10px; margin-bottom: 10px; }
h1 { font-size: 36px; }
h2 { font-size: 30px; }
h3 { font-size: 24px; }
h4 { font-size: 18px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }
p { margin: 0 0 10px; }
ul, ol { margin-bottom: 10px; padding-left: 40px; }
a { color: #337ab7; text-decoration: none; }
a:hover, a:focus { color: #23527c; text-decoration: underline; }
label { margin-bottom: 5px; font-weight: 700; }

/* BS5.1 pads .container with the full --bs-gutter-x but .row > * with half of it; BS3 used 15px for both */
.container, .container-fluid { --bs-gutter-x: 15px; }
.row { --bs-gutter-x: 30px; }
/* BS3 sized .container with width (not max-width); main.css overrides it with width:100% / 960px etc.,
   which a BS5 max-width cap would silently defeat */
.container { width: auto; max-width: none; }
@media (min-width: 768px)  { .container { width: 750px; } }
@media (min-width: 992px)  { .container { width: 970px; } }
@media (min-width: 1200px) { .container { width: 1170px; } }
.container::before, .container::after { content: " "; display: table; }
.container::after { clear: both; }

/* BS3 .row was a block; headings use class="row" only for the gutter offset and hold bare text,
   which BS5's flex .row shrink-wraps and left-aligns despite text-align:center */
h1.row, h2.row, h3.row, h4.row, h5.row, h6.row { display: block; }
/* BS5 .row also zeroes margin-top (calc(-1 * --bs-gutter-y)) */
h1.row, h2.row, h3.row { margin-top: 20px; }
h4.row, h5.row, h6.row { margin-top: 10px; }
/* BS5 pads every .row child like a column; BS3 only padded .col-*. :where() keeps this at .row specificity
   so any padding main.css/libs.css set on the element itself still wins */
.row > :where(:not(.col):not([class^="col-"]):not([class*=" col-"])) { padding-right: 0; padding-left: 0; }

/* BS3 columns were floats, so .col-* also laid out side by side outside a .row (e.g. the modals'
   .popupSection cover/text and the button pair). Floats are ignored on flex items, so .row is unaffected. */
[class^="col-"], [class*=" col-"] { position: relative; min-height: 1px; }
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 { float: left; }
@media (min-width: 576px)  { [class^="col-sm-"], [class*=" col-sm-"] { float: left; } }
@media (min-width: 768px)  { [class^="col-md-"], [class*=" col-md-"] { float: left; } }
@media (min-width: 992px)  { [class^="col-lg-"], [class*=" col-lg-"] { float: left; } }
@media (min-width: 1200px) { [class^="col-xl-"], [class*=" col-xl-"] { float: left; } }

/* Horizontally scrolling track rows used inline-block items + white-space:nowrap on BS3's block rows */
.grid-tracks .grid-tracks-row:not(.linear-list) { flex-wrap: nowrap; }

/* ---- Utility classes removed in BS5 ---- */
.hide { display: none !important; }
.hidden { display: none !important; }
/* BS3 had .show{display:block!important}; server-rendered modals use "modal show" to be visible on load */
.modal.show { display: block; }

/* ---- Components with no BS5 equivalent ---- */
.close {
    float: right;
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .2;
}
.close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; opacity: .5; }
button.close { padding: 0; cursor: pointer; background: transparent; border: 0; -webkit-appearance: none; appearance: none; }

.btn { font-size: 14px; padding: 6px 12px; line-height: 1.42857143; border-radius: 4px; }
.btn-default { color: #333; background-color: #fff; border-color: #ccc; }
.btn-default:hover, .btn-default:focus, .btn-default.active { color: #333; background-color: #e6e6e6; border-color: #adadad; }

.radio, .checkbox { position: relative; display: block; margin-top: 10px; margin-bottom: 10px; }
.radio label, .checkbox label { min-height: 20px; margin-bottom: 0; font-weight: 400; cursor: pointer; }

/* ---- Modals: BS5 makes header/footer flex rows and sizes everything in rem ---- */
.modal-header { display: block; padding: 15px; }
.modal-header .close { margin-top: -2px; }
.modal-title { margin: 0; line-height: 1.42857143; }
.modal-body { padding: 15px; }
.modal-footer { display: block; padding: 15px; text-align: right; }
.modal-dialog { margin: 10px; }
@media (min-width: 576px) { .modal-dialog { max-width: none; margin: 10px; } }
/* BS3 fixed the width (main.css then caps some dialogs with max-width); width:auto would shrink-wrap the inline-block dialog */
@media (min-width: 768px) { .modal-dialog { width: 600px; max-width: none; margin: 30px auto; } }

.popover { font-size: 14px; }
.tooltip { font-size: 12px; }

/* ---- Navbar: the site uses a custom BS3-style navbar (no navbar-expand-*) ---- */
.navbar { display: block; position: relative; min-height: 50px; margin-bottom: 20px; padding: 0; border: 1px solid transparent; }
/* .navbar's position:relative above would otherwise beat BS5's .fixed-top (same specificity, loaded later) */
.navbar.fixed-top { position: fixed; margin-bottom: 0; border-width: 0 0 1px; }
/* BS5 turns .navbar > .container into a space-between flex row, which shrink-wraps and left-aligns .navbar-collapse */
.navbar > .container, .navbar > .container-fluid { display: block; }
.navbar-header::before, .navbar-header::after,
.navbar-collapse::before, .navbar-collapse::after,
.navbar-nav::before, .navbar-nav::after { content: " "; display: table; }
.navbar-header::after, .navbar-collapse::after, .navbar-nav::after { clear: both; }
.navbar-collapse {
    flex-basis: auto;
    flex-grow: 0;
    align-items: initial;
    padding-right: 15px;
    padding-left: 15px;
    overflow-x: visible;
    border-top: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.navbar.fixed-top .navbar-collapse { max-height: 340px; }
.container > .navbar-header, .container > .navbar-collapse { margin-right: -15px; margin-left: -15px; }
.navbar-toggle {
    position: relative;
    float: right;
    padding: 9px 10px;
    margin-right: 15px;
    margin-top: 8px;
    margin-bottom: 8px;
    background-color: transparent;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}
.navbar-toggle .icon-bar { display: block; width: 22px; height: 2px; border-radius: 1px; }
.navbar-toggle .icon-bar + .icon-bar { margin-top: 4px; }
.navbar-default .navbar-toggle .icon-bar { background-color: #888; }
.navbar-nav { display: block; margin: 7.5px -15px; padding-left: 0; list-style: none; }
.navbar-nav > li { position: relative; display: block; }
.navbar-nav > li > a { position: relative; display: block; padding: 10px 15px; line-height: 20px; }
@media (min-width: 768px) {
    .navbar { border-radius: 4px; }
    .navbar.fixed-top { border-radius: 0; }
    .navbar-header { float: left; }
    .navbar-toggle { display: none; }
    .navbar-collapse { width: auto; border-top: 0; box-shadow: none; }
    .navbar.fixed-top .navbar-collapse { padding-right: 0; padding-left: 0; }
    .container > .navbar-header, .container > .navbar-collapse { margin-right: 0; margin-left: 0; }
    .navbar-nav { float: left; margin: 0; }
    .navbar-nav > li { float: left; }
    .navbar-nav > li > a { padding-top: 15px; padding-bottom: 15px; }
}
.navbar-default { background-color: #f8f8f8; border-color: #e7e7e7; }
.navbar-default .navbar-collapse { border-color: #e7e7e7; }
.navbar-default .navbar-nav > li > a { color: #777; }
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus { color: #333; background-color: transparent; }

/* BS5 only positions .dropdown-menu via Popper; the site opens its menus with CSS/own JS */
.dropdown-menu { top: 100%; left: 0; min-width: 160px; padding: 5px 0; margin: 2px 0 0; font-size: 14px; }
.dropdown-menu > li > a { display: block; padding: 3px 20px; clear: both; font-weight: 400; line-height: 1.42857143; color: #333; white-space: nowrap; }
.dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus { color: #262626; text-decoration: none; background-color: #f5f5f5; }
