:root {
    --color1: #000;
    --color2: #D61F1F;
    --color3: white;
    --color4: #E9AD11;

    --colorB1: #222;
    --colorB2: #0c0c0c;

    --headerHeight: 4rem;
    --legendWidth: 14rem;

    --colorN1: #cdcdcd;

    --title-font: "Oswald", sans-serif;;
    --body-font: "Heebo", sans-serif;

    --small-font-size: 16px;
    --default-font-size: 21px;
    --large-font-size: 28px;
}

html {
    width: 100vw;
    overflow-x: hidden;
}

body {
    margin: 0;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--colorB1);
    color: var(--color3);
    font-family: var(--body-font);
    font-size: var(--default-font-size);
}
body.modal-open {
    height: 100vh;
}

h1, h2, h3, h4, h5, h6, .title-font {
    font-family: var(--title-font);
}

a {
    color: var(--color3);
    transition: .25s;
}
a:hover {
    color: var(--colorN1);
}

.btn {
    font-family: var(--body-font);
    border-radius: 0;
    background: var(--color3);
    color: var(--color1);
    border-color: transparent;
    min-width: 8rem;
    font-size: var(--default-font-size);
    font-weight: 400;
    padding: 8px 12px;
    cursor: pointer;
    transform: translateY(0);
    transition: .25s;
}
.btn:focus,
.btn:focus-visible,
.btn:active,
.btn:hover {
    color: var(--color3);
    border-color: var(--color3);
    outline: none;
    box-shadow: none;
    background: var(--colorB1);
}
.btn.btn-dark {
    background: var(--color1);
    color: var(--color3);
}
.btn.btn-dark:hover {
    background: transparent;
    border-color: var(--color1);
    color: var(--color1);
}
.btn.btn-primary {
    background: var(--color2);
    color: var(--color3);
}
.btn.btn-primary:hover {
    border-color: var(--color2);
    background: var(--color3);
    color: var(--color2);
}
.btn.disabled {
    border-color: transparent;
}

.sticky {
    position: sticky;
    top: 0;
    left: 0;
}
.sticky.bottom {
    top: unset;
    bottom: 0;
}
.sticky.right {
    left: unset;
    right: 0;
}

.modal-content {
    border-radius: 0;
}
.modal-footer,
.modal-header {
    border: none;
}


form.loading .btn[type="submit"],
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.vue-app.loading::after,
form.loading .btn[type="submit"]::after,
.btn.loading::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    height: 1rem;
    width: 1rem;
    transform: translate(-50%, -50%);

    border-top: 2px solid var(--colorB1);
    border-right: 2px solid transparent;
    border-bottom: 0px solid transparent;
    border-left: 2px solid var(--colorB1);

    border-radius: 50%;

    animation-name: loading;
    animation-duration: 1s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.vue-app.loading::after,
form.loading .btn.btn-primary[type="submit"]::after,
.btn.btn-primary.loading::after {
    border-top: 2px solid var(--color3);
    border-right: 2px solid transparent;
    border-bottom: 0px solid transparent;
    border-left: 2px solid var(--color3);
}

@keyframes loading {
    from { transform: translate(-50%, -50%) rotate(0); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

main {
    flex-grow: 1;
}

#header {
    position: relative;
    top: 0;
    left: 0;
    width: 100vw;
    height: 4rem;
    background: var(--color1);
    z-index: 10;
}

#header .logo {
    position: absolute;
    width: 8rem;
    aspect-ratio: 1/1;
}
#header nav {
    list-style: none;
}
#header nav li {
    padding-left: 1rem;
}
#header nav li a {
    text-decoration: none;
    font-family: var(--title-font);
    font-size: var(--small-font-size);
}
#header nav li a.active {
    color: var(--color4);
    pointer-events: none;
}
#header ~ main {
    padding-top: 6rem;
}

/* Hamburger (mobile only, hidden at lg via d-lg-none). While the menu is
   open the bars morph into an X: on open the bars slide to center first,
   then rotate; on close everything reverses at once — no stagger. */
#mobileToggle {
    position: relative;
    width: 36px;
    height: 36px;
    cursor: pointer;
    flex-shrink: 0;
}
#mobileToggle::before,
#mobileToggle::after {
    content: '';
    display: block;
    position: absolute;
    left: 50%;
    height: 2px;
    width: 26px;
    background: var(--color3);
    border-radius: 2px;
    transform: translate(-50%, -50%);
    transition: top .25s ease, transform .25s ease;
}
#mobileToggle::before { top: calc(50% - 5px); }
#mobileToggle::after  { top: calc(50% + 5px); }
.menu-toggled #mobileToggle::before,
.menu-toggled #mobileToggle::after {
    top: 50%;
    transition: top .25s ease, transform .25s .25s ease;
}
.menu-toggled #mobileToggle::before { transform: translate(-50%, -50%) rotate(45deg); }
.menu-toggled #mobileToggle::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* Keep the header (and the toggle in it) above the open offcanvas + backdrop
   (z-index 1040-1045) so the X stays visible and clickable to close. menu-open
   lasts from open until the close animation fully ends (unlike menu-toggled),
   and is scoped so the header doesn't sit above modals the rest of the time. */
body.menu-open #header {
    z-index: 1060;
}

/* Mobile offcanvas nav */
#mobileMenu {
    padding-top: var(--headerHeight);
    background: var(--colorB2);
    color: var(--color3);
}
#mobileMenu .offcanvas-body {
    padding: 4rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
}
#mobileMenu nav {
    list-style: none;
}
#mobileMenu nav li {
    width: 100%;
    text-align: center;
}
#mobileMenu nav li a {
    display: block;
    text-decoration: none;
    font-family: var(--title-font);
    font-size: var(--large-font-size);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
#mobileMenu nav li a.active {
    color: var(--color4);
    pointer-events: none;
}

.brand {
    width: var(--panelWidth);
    padding: 2rem;
    display: flex;
    align-items: center;
}
.brand .sub-title {
    margin-top: .5rem;
    font-size: var(--small-font-size);
}
.brand .title {
    display: flex;
    flex-direction: column;
    margin: 0;
    height: fit-content;
}

#footer {
    min-height: 18rem;
    width: 100vw;
    background: var(--color1);
    padding: 2rem 0;
}
#footer .brand {
    width: 100%;
    padding: 0;
}
#footer .brand .title {
    margin-left: 1rem;
}
#footer .logo {
    width: 8rem;
}

figure img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 768px) {
    #header .logo {
        width: 5.5rem;
    }
    #footer .d-flex {
        flex-direction: column;
        gap: 2.5rem;
        align-items: center;
        text-align: center;
    }
    #footer .brand {
        justify-content: center;
    }
    /* Centered lists: the arrow markers hang off the left edge, which looks
       detached once the text is centered — drop them and their padding */
    #footer ul {
        padding: 0;
    }
    #footer ul li::before {
        display: none;
    }
}

ul {
    list-style: none;
}
ul a {
    text-decoration: none;
}
ul li {
    position: relative;
}
ul:not(.list-unstyled) li::before {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: -2rem;
    height: 1rem;
    width: 1rem;
    transform: translateY(-50%) rotate(45deg);
    border-top: 3px solid var(--color2);
    border-right: 3px solid var(--color2);
    border-bottom: 2px solid transparent;
    border-left: 2px solid transparent;
}

.flex-grow {
    flex-grow: 1;
}

.form-input {
    position: relative;
    margin-bottom: 1rem;
}
.form-input input {
    width: 100%;
    font-size: var(--small-font-size);
    padding: .5rem .75rem;
    transition: .25s;
    outline: 2px solid transparent;
    border: 2px solid transparent;
}
.form-input input:focus,
.form-input select:focus {
    outline-color: var(--color2);
    border-color: var(--colorB1);
}
.form-input select {
    width: 100%;
    font-size: var(--small-font-size);
    padding: .5rem 2.25rem .5rem .75rem;
    transition: .25s;
    outline: 2px solid transparent;
    border: 2px solid transparent;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpolyline points='2,5 8,11 14,5' stroke='%23000' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 1rem;
    color: var(--color1);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}
.form-input label {
    font-weight: 200;
    font-size: var(--small-font-size);
}
.form-input textarea {
    width: 100%;
    font-size: var(--small-font-size);
    padding: .5rem .75rem;
    transition: .25s;
    outline: 2px solid transparent;
    border: 2px solid transparent;
    resize: vertical;
}
.form-input textarea:focus {
    outline-color: var(--color2);
    border-color: var(--colorB1);
}
.form-input input[type="file"] {
    background-color: white;
    cursor: pointer;
}
.form-input input[type="file"]::file-selector-button {
    border: none;
    background: var(--color1);
    color: var(--color3);
    font-size: var(--small-font-size);
    padding: .25rem .75rem;
    margin-right: .75rem;
    cursor: pointer;
    transition: .25s;
}
.form-input input[type="file"]::file-selector-button:hover {
    background: var(--color2);
}
/* Forms on light backgrounds (modals): the default white fields with
   transparent borders disappear against white, so give them a visible field */
.modal-content .form-input input,
.modal-content .form-input select,
.modal-content .form-input textarea {
    background-color: #f2f2f2;
    border-color: #e2e2e2;
}
.modal-content .form-input input:focus,
.modal-content .form-input select:focus,
.modal-content .form-input textarea:focus {
    background-color: white;
    border-color: var(--colorN1);
}
.form-check {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    cursor: pointer;
}
.form-check input[type="checkbox"] {
    display: none;
}
.form-check label {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: var(--small-font-size);
    font-weight: 200;
    cursor: pointer;
    user-select: none;
}
.form-check label::before {
    content: "";
    display: block;
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--colorN1);
    border-radius: 3px;
    background-color: white;
    background-repeat: no-repeat;
    background-position: center;
    background-size: .8rem;
    transition: border-color .15s, background-color .15s;
}
.form-check input[type="checkbox"]:checked + label::before {
    background-color: var(--color2);
    border-color: var(--color2);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline points='2,8 6,12 14,4' stroke='white' stroke-width='2.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.btn.btn-form-inline {
    font-size: var(--small-font-size);
    padding: .5rem .75rem;
}


/* Fade image background */
.fade-images img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
    display: none;
}
.fade-images img.active {
    display: block;
    animation-name: showImage;
    animation-timing-function: linear;
}
.fade-images img.active.no-fade {
    animation: none;
}
@keyframes showImage {
    0% { opacity: 0;}
    50% { opacity: 1;}
    100% { opacity: 1;}
}
.fade-images img.hide {
    display: block;
}

.form-message {
    width: 100%;
    margin: 1rem 0;
}
.form-message.error {
    color: var(--color2);
}
.form-message.success {
    color: var(--color5);
}

.vue-app.loading .content,
#exam.loading > .container,
#exam.loading > .container-fluid {
    display: none !important;
}
.vue-app.loading {
    position: relative;
    height: 6rem;
}
#preVueData {
    display: none;
}

.pointer-link {
    position: relative;
    color: var(--color2);
    padding-right: 2rem;
    cursor: pointer;
}

.pointer-link::after {
    content: "";
    display: block;
    position: absolute;
    top: calc(50% + 1px);
    right: .25rem;
    height: .65rem;
    width: .65rem;
    transform: translateY(-50%) rotate(45deg);
    border-top: 2px solid var(--color2);
    border-right: 2px solid var(--color2);
    border-bottom: 2px solid transparent;
    border-left: 2px solid transparent;
    transition: .25s;
}
.pointer-link::before {
    content: "";
    display: block;
    position: absolute;
    top: calc(50% + 1px);
    transform: translateY(-50%);
    right: .25rem;
    height: 2px;
    width: 1rem;
    background: var(--color2);
    transition: .25s;
}

.pointer-link:hover::after,
.pointer-link:hover::before {
    right: 0;
    border-top-color: var(--color3);
    border-right-color: var(--color3);
}
.pointer-link:hover::before {
    width: 1.5rem;
    background: var(--color3);
}

.pointer-link.no-arrow {
    padding-right: 0;
}
.pointer-link.no-arrow::before,
.pointer-link.no-arrow::after {
    display: none;
}

.course-page-image {
    position: absolute;
    height: 100%;
    overflow: hidden;
    left: 0;
}
@media (max-width: 768px) {
    .course-page-image {
        position: relative;
        height: 18rem;
    }
}


.course-card {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
}

.course-card .score-badge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.25rem 1rem 3rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(0,0,0,.85) 0%, rgba(0,0,0,0) 100%);
    z-index: 1;
}
.score-display {
    font-size: 3.5rem;
    font-family: var(--title-font);
    line-height: 1;
    display: block;
}
.score-display.passed {
    color: #4caf50;
}
.score-display.failed {
    color: var(--color2);
}

.course-card figure {
    width: 100%;
    height: 100%;
}

.course-card .course-description {
    overflow: hidden;              /* Hides the overflowing text */
    display: -webkit-box;          /* Required for -webkit-line-clamp to work */
    -webkit-box-orient: vertical;  /* Stacks content vertically */
    -webkit-line-clamp: 4;         /* Limits the text to 3 lines */
    line-height: 1.4;
    font-size: 16px;
}

.course-card .content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 6rem 2rem 2rem 2rem;
    background: linear-gradient(0deg,rgba(0, 0, 0, 1) 30%, rgba(0, 0, 0, 0) 100%);
    text-shadow: 0 0 4px black;
}
.course-card .course-title {
    font-family: var(--title-font);
    font-size: 24px;
    font-weight: 400;
}

.text-red {
    color: var(--color2);
}

section:not(.no-gap) {
    margin-bottom: 4rem;
}

/* Dashboard */
.dashboard-wrap {
    display: flex;
    min-height: calc(100vh - var(--headerHeight));
    align-items: stretch;
}

#legend {
    position: sticky;
    top: 0;
    bottom: 0;
    height: calc(100vh - var(--headerHeight));
    width: var(--legendWidth);
    overflow-x: hidden;
    box-shadow: 0 0 4px #000000;
    z-index: 1;
    flex-shrink: 0;
    transition: .25s;
    background: var(--colorB2);
}
#legend.full-height {
    height: 100vh;
}
#legend:not(.hide) {
    width: var(--legendWidth);
    transition: .25s;
}
#legend.hide {
    width: 0;
    transition: .25s;
}

#toggleLegend {
    position: sticky;
    top: 50%;
    left: calc(var(--legendWidth) - 8px);
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 50%;
    transform: translate(50%, -50%);
    cursor: pointer;
    z-index: 1;
    transition: .25s;
}
#toggleLegend::after {
    content: "Menu";
    display: block;
    position: absolute;
    font-size: 12px;
    white-space: nowrap;
    left: 60%;
    transform: rotate(-270deg) translate(-50%, -100%);
    transform-origin: 0;
    opacity: 0;
    transition-delay: 0s;
}
#toggleLegend.hide {
    transform: translate(50%, -100%) rotate(180deg);
    width: 3rem;
    left: 0;
    padding-left: 12px;
}
#toggleLegend.hide::after {
    transition: .25s;
    transition-delay: .25s;
    opacity: .8;
}
/* The toggle is the first flex item in .dashboard-wrap — cancel out its
   width so #legend sits flush against the window edge. Scoped to the
   dashboard because course.css compensates differently on course pages. */
.dashboard-wrap #toggleLegend {
    margin-right: -1.5rem;
}
.dashboard-wrap #toggleLegend.hide {
    margin-right: 0;
}

#toggleLegend svg {
    fill: var(--color3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-55%, -50%);
    height: 1.5rem;
    width: 1.5rem;
    pointer-events: none;
}

#legend .content {
    overflow-y: auto;
    width: var(--legendWidth);
    height: 100%;
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    transition: .25s;
}
#legend.hide .content {
    overflow-x: hidden;
    width: 0;
}

#legend nav {
    flex-grow: 1;
    padding: 1.5rem 0;
}
#legend nav ul {
    padding: 0;
    margin: 0;
}
#legend nav ul li {
    margin: 0;
}
#legend nav ul li::before {
    display: none;
}
#legend nav ul li a {
    display: block;
    padding: .65rem 1.5rem;
    text-decoration: none;
    font-family: var(--title-font);
    font-size: var(--small-font-size);
    letter-spacing: .03em;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
#legend nav ul li a:hover {
    color: var(--color3);
    background: rgba(255,255,255,.06);
}
#legend nav ul li a.active {
    color: var(--color3);
    background: var(--color2);
}

.dash-nav-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}

.dash-content {
    flex-grow: 1;
    padding: 6rem 3rem 2.5rem 3rem;
    min-width: 0;
}
.dash-content h2 {
    font-size: 2rem;
    margin-bottom: 0;
}

.profile-field {
    display: flex;
    flex-direction: column;
    padding: .75rem 0;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.profile-field-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .5;
    margin-bottom: .2rem;
}
.profile-field-value {
    font-size: var(--small-font-size);
}

.dash-stat {
    background: var(--colorB2);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
}
.dash-stat-number {
    font-family: var(--title-font);
    font-size: 2.5rem;
    line-height: 1;
}
.dash-stat-label {
    font-size: var(--small-font-size);
    opacity: .7;
    margin-top: .25rem;
}

.table-responsive th,
.table-responsive td {
    background: none;
}

@media (max-width: 768px) {
    :root {
        --legendWidth: calc(100vw - 48px);
    }
    #legend {
        padding-top: calc(var(--headerHeight) + 24px);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        z-index: 10;
    }
    /* clear the logo, which hangs below the header */
    .dash-content {
        padding: 3.5rem 1rem 1.5rem;
    }
    .dash-content h2 {
        font-size: 1.5rem;
    }
    .dash-stat-number {
        font-size: 2rem;
    }
}
/* Smaller course cards on the dashboard */
.dash-content .course-card .content {
    padding: 4rem 1.25rem 1.25rem;
}
.dash-content .course-card .course-title {
    font-size: 19px;
}
.dash-content .course-card .score-badge {
    padding: .75rem 1rem 2rem;
}
.dash-content .score-display {
    font-size: 2.5rem;
}

/* Button that renders like an inline text link (e.g. Unenroll on course cards) */
.link-button {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--colorN1);
    text-decoration: underline;
    cursor: pointer;
    font-size: var(--small-font-size);
}
.link-button:hover {
    color: var(--color2);
}
