html {
    /* The nav header is 182px high, plus 20px for the margin-top of the
       main container. */
    scroll-padding-top: calc(182px + 20px);
}

body {
    font-family: 'Open Sans', sans-serif;
}

/* Replacement for `body { background-attachment: fixed; }`, which has
   performance issues when scrolling on large displays. See #1394. */
body::before {
    content: ' ';
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-color: var(--bs-body-bg);
    background: url(../img/grid.png) repeat-x;
    will-change: transform;
    z-index: -1;
}

body.homepage::before {
    background: url(../img/bgn.jpg) repeat;
    background-size: 100vw auto;
}

body > .container {
    margin-top: 20px;
    min-height: 400px;
}

.navbar.fixed-top {
    position: -webkit-sticky;
    position: sticky;
}

.navbar.bg-primary {
    background-color: white !important;
    background-image: url(../img/hpc_logo.jpg) !important;
    background-position: 24px 16px;
    background-repeat: no-repeat;
    background-size: auto 116px;
    align-items: flex-start;
    height: 182px;
    padding: 142px 0 0;
}

.navbar.bg-primary > .container {
    background-color: #d22d40;
    border-bottom: 1px solid var(--bs-border-color);
    border-top: 1px solid var(--bs-border-color);
    min-height: 40px;
    max-width: none;
}

.navbar.bg-primary .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
    flex-grow: 1;
    align-items: flex-start;
    flex-wrap: wrap;
}

.navbar.bg-primary .navbar-brand,
.navbar.bg-primary .nav-link {
    color: white !important;
}

.navbar.bg-primary .navbar-brand {
    margin-right: 1.25rem;
    white-space: normal;
    line-height: 1.1;
}

.navbar.bg-primary .cu-navbar-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, auto));
    grid-template-rows: repeat(2, auto);
    align-items: center;
    justify-items: center;
    column-gap: 0.4rem;
    row-gap: 0;
    margin-bottom: 0;
}

.navbar.bg-primary .cu-navbar-grid .nav-link {
    font-weight: 600;
    text-align: center;
    padding: 0.25rem 0.5rem;
    line-height: 1.15;
    border-radius: 4px;
    border: 1px solid transparent;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.navbar.bg-primary .cu-navbar-grid .nav-link:hover,
.navbar.bg-primary .cu-navbar-grid .nav-link:focus-visible {
    color: #d22d40 !important;
    background-color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
}

.navbar.bg-primary .cu-navbar-grid .nav-link:nth-child(n + 6) {
    font-size: 0.85rem;
    font-weight: 400;
    padding-top: 0;
    padding-bottom: 0.35rem;
}

@media (max-width: 991.98px) {
    .navbar.bg-primary .cu-navbar-grid {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
        grid-template-rows: none;
        row-gap: 0.15rem;
        margin-top: 0.35rem;
        width: 100%;
    }
}

.source-links {
    float: right;
}

body.homepage>div.container>div.row>div.col-md-3 {
    display: none;
}

/* Homepage: let the content span the full width so it and the footer
   share the same centre line (the sidebar column is hidden above). */
body.homepage>div.container>div.row>div.col-md-9 {
    margin-left: 0;
    flex: 0 0 100%;
    max-width: 100%;
}


.col-md-9 img {
    max-width: 100%;
    display: inline-block;
    padding: 4px;
    line-height: 1.428571429;
    background-color: var(--bs-secondary-bg-subtle);
    border: 1px solid var(--bs-secondary-border-subtle);
    border-radius: 4px;
    margin: 20px auto 30px auto;
}

h1 {
    color: inherit;
    font-weight: 400;
    font-size: 42px;
}

/* Homepage: centre the title and its divider so they line up with the
   centred intro text and service cards below. */
body.homepage h1 {
    text-align: center;
}

body.homepage h1 + hr {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

/* Homepage: intro / hero */
.homepage-intro {
    max-width: 720px;
}

.homepage-intro .lead {
    font-weight: 400;
}

/* Homepage: service cards */
.service-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.service-card:hover,
.service-card:focus-within {
    transform: translateY(-3px);
    border-color: #d22d40;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
}

.service-card .card-title {
    margin-bottom: 0.5rem;
}

/* Title acts as the card link, but should read as a heading (not a link) */
.service-link {
    color: inherit;
    text-decoration: none;
}

.service-card:hover .service-link,
.service-card:focus-within .service-link {
    color: #d22d40;
}

.rse-banner .service-link {
    color: #d22d40;
}

/* Circular icon badge above each card title */
.service-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    color: #d22d40;
    background-color: rgba(210, 45, 64, 0.1);
    border-radius: 50%;
}

.service-icon svg {
    width: 24px;
    height: 24px;
}

/* Full-width Research Software Engineering banner */
.rse-banner .service-icon {
    color: #fff;
    background-color: #d22d40;
}

.rse-banner .card-title {
    color: #d22d40;
}

h2, h3, h4, h5, h6 {
    color: inherit;
    font-weight: 300;
    text-align: center;
}

hr {
    border-top: 1px solid #aaa;
    opacity: 1;
}
