/* Site styles live in Bootstrap's "custom" cascade layer: they override
   Bootstrap's components, while Bootstrap utilities (.d-none, .mb-3, ...)
   still win, like they did with Bootstrap 4's !important utilities. */
@layer custom {
    body {
        background-color: #FCFCFC;
    }

    .footer-bg {
        background-color: #f5f5f5;
    }

    .footer-links a {
        display: inline-block;
        padding: .25rem .75rem;
    }

    .footer-social a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
    }

    /* Keep phone headings from wrapping awkwardly */
    @media (max-width: 767.98px) {
        #content h1:not(.display-2) {
            font-size: 1.75rem;
        }

        #content h2 {
            font-size: 1.4rem;
        }
    }
    /* CSS targeting screen smaller than lg (992px) */
    @media (max-width: 991.98px) {
        #cart {
          margin-right: .5rem; /* added mr-2 equivalent */
        }
      }

    /* The header navbar sizes to its content, so it can't be a size container
       (which Bootstrap 6 uses for .navbar-expand). Expand it at lg with a
       viewport media query instead. */
    .main-navbar {
        container-type: normal;
    }

    .main-navbar .navbar-nav {
        --nav-gap: 0;
        --nav-link-border-width: 0;
        --nav-link-padding-y: .5rem;
        --nav-link-padding-x: 0;
    }

    .main-navbar .navbar-toggler {
        --btn-min-height: 0;
        --btn-padding-y: .25rem;
        --btn-padding-x: .75rem;
        --btn-font-size: 1.25rem;
        --btn-line-height: 1;
        --btn-color: var(--navbar-color);
        --btn-hover-color: var(--navbar-color);
        --btn-hover-bg: transparent;
        --btn-border-color: var(--navbar-toggler-border-color);
        --btn-hover-border-color: var(--navbar-toggler-border-color);
        display: inline-block;
        vertical-align: baseline;
    }

    .main-navbar .navbar-toggler-icon {
        vertical-align: middle;
    }

    @media (max-width: 991.98px) {
        .main-navbar {
            display: block !important;
        }
    }

    @media (min-width: 992px) {
        .main-navbar .navbar-nav {
            flex-direction: row;
            --nav-link-padding-x: .5rem;
        }
    }

    /* Bootstrap 6 spaces button contents with a flex gap; match the text space
       Bootstrap 4 had between the cart icon, label and caret */
    #cart {
        --btn-gap: .25rem;
    }

    /* Bootstrap 6 dropped the automatic dropdown caret */
    .menu-caret::after {
        display: inline-block;
        margin-left: .255em;
        vertical-align: .255em;
        content: "";
        border-top: .3em solid;
        border-right: .3em solid transparent;
        border-bottom: 0;
        border-left: .3em solid transparent;
    }

    #home-search-bar {
        /* At least 16px so iPhones don't zoom in when the field is tapped */
        font-size: max(1rem, calc(0.3rem + 2vmin));
    }

    .border-2 {
        border-width: 2px !important;
    }

    .course-count[data-count]:after {
        position: absolute;
        right: 0%;
        top: -20%;
        content: attr(data-count);
        font-size: 90%;
        padding: .3em;
        border-radius: 20%;
        line-height: 1em;
        color: #fcfcfc;
        background: rgba(27, 26, 26, 0.85);
        text-align: center;
        min-width: 1em;
    }

    /* No badge on an empty cart */
    .course-count[data-count="0"]:after {
        display: none;
    }

    .navbar-brand {
        display: inline-block;
        font-family: merienda one, cursive;
    }

    header.masthead {
        padding-top: 10%;
    }

    input.homepage-search {
        height: calc(1.5em + 2rem + 2px);
    }

    /* Size the cart to its table; Floating UI positions it near the right
       edge, which would otherwise shrink it to a narrow column */
    .menu.selected-courses {
        width: max-content;
        max-width: calc(100vw - 1rem);
    }

    div.menu.selected-courses.show {
        height: auto;
        max-height: 400px;
        overflow-x: hidden;
    }

    .menu.selected-courses {
        --menu-padding-x: .5rem;
        min-width: 18rem;
    }

    .selected-courses .table {
        --table-cell-padding-y: .5rem;
        --table-cell-padding-x: .5rem;
        --table-cell-vertical-align: middle;
        margin-bottom: .5rem;
    }

    .selected-courses thead th {
        padding-top: .25rem;
        font-size: .75rem;
        font-weight: 600;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: .04em;
        border-top: 0;
        border-bottom-width: 1px;
    }

    .selected-courses tbody tr:last-child td {
        border-bottom: 0;
    }

    .selected-courses [id^="cart-crn-"] {
        color: #6c757d;
        font-variant-numeric: tabular-nums;
    }

    .selected-courses [id^="cart-code-"] {
        font-weight: 600;
        white-space: nowrap;
    }

    .selected-courses [id^="cart-title-"] {
        max-width: 16rem;
    }

    /* Empty cart: a friendly note instead of the column headings and button */
    .selected-courses:has(.empty-cart:not(.d-none)) :is(thead, #review-order) {
        display: none;
    }

    .selected-courses .empty-cart td {
        padding: 1.25rem 1rem;
        color: #6c757d;
        border-width: 0;
    }

    .selected-courses .empty-cart .fa-shopping-cart {
        display: block;
        margin-bottom: .75rem;
        color: #ced4da;
    }

    .selected-courses .empty-cart strong {
        display: block;
        margin-bottom: .25rem;
        color: #212529;
    }

    .selected-courses #review-order {
        gap: .5rem;
    }

    td[colspan]:not([colspan="1"]) {
        text-align: center;
    }

    /* Roomier result rows on wider screens, as Tablesaw had them */
    @media (min-width: 40em) {
        .search-results-table tbody td {
            line-height: 2;
        }
    }

    /* "Columns" menu checkboxes on the search results table */
    .columns-menu .menu-item {
        display: flex;
        gap: .625rem;
        align-items: center;
        width: 100%;
        cursor: pointer;
    }

    .columns-menu .menu-item:focus-visible {
        background-color: #e9ecef;
    }

    /* Checkbox drawn for the menuitemcheckbox buttons */
    .columns-check {
        display: inline-flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        width: 1.125rem;
        height: 1.125rem;
        border: 1px solid #adb5bd;
        border-radius: .25rem;
    }

    .columns-menu [aria-checked="true"] .columns-check {
        background-color: #007bff;
        border-color: #007bff;
    }

    .columns-menu [aria-checked="true"] .columns-check::after {
        width: .3125rem;
        height: .5625rem;
        margin-top: -.125rem;
        content: "";
        border: solid #fff;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
    }

    #main-header {
        background-color: #2874f0;
        color: #FFFFFF;
    }

    /* Trash-can buttons in the course cart */
    .remove-course {
        padding: .25rem .5rem;
        margin: -.25rem 0;
        line-height: 1;
        border-radius: 50rem;
    }

    .remove-course:hover,
    .remove-course:focus-visible {
        background-color: #fbe4df;
    }

    /* Home page headline sized for phones */
    @media (max-width: 575.98px) {
        .masthead .display-2 {
            font-size: 3rem;
        }
    }

    .add-to-course-cart {
        white-space: nowrap;
    }

    /* 404 and 500 pages */
    .error-page {
        max-width: 38rem;
        padding: 1.5rem 0 2rem;
        margin: 0 auto;
        text-align: center;
    }

    .error-illustration {
        display: block;
        width: 200px;
        max-width: 55%;
        height: auto;
        margin: 0 auto 1.25rem;
    }

    .error-code {
        display: inline-block;
        padding: .25rem .875rem;
        margin-bottom: 1rem;
        font-size: .8125rem;
        font-weight: 700;
        color: #1e7e34;
        text-transform: uppercase;
        letter-spacing: .08em;
        background-color: #d4edda;
        border-radius: 50rem;
    }

    .error-code-server {
        color: #8a4b08;
        background-color: #fde3c4;
    }

    .error-page h1,
    .error-page .lead {
        text-wrap: balance;
    }

    .error-page h1 {
        margin-bottom: .75rem;
    }

    .error-page .lead {
        margin-bottom: 2rem;
        color: #495057;
    }

    .error-actions {
        display: flex;
        flex-wrap: wrap;
        gap: .75rem;
        justify-content: center;
        margin-bottom: 2rem;
    }

    .error-help {
        margin-bottom: 0;
        font-size: .9375rem;
        color: #6c757d;
    }

    /* No search results: one line of tips, then a prominent way to ask us */
    .search-tips {
        margin-bottom: 2rem;
    }

    .search-help {
        padding: 1.5rem;
        background-color: #eef4fe;
        border-radius: .75rem;
    }

    .search-help p {
        margin-bottom: 1rem;
    }

    /* About page (and other reading pages): a comfortable line length */
    .page-narrow {
        max-width: 45rem;
        margin: 0 auto;
    }

    .page-narrow h2 {
        margin-top: 2.5rem;
        margin-bottom: 1rem;
    }

    .page-narrow .lead {
        margin-bottom: 2rem;
    }

    /* .lead is light (300), so plain <strong> would barely show */
    .page-narrow .lead strong {
        font-weight: 600;
    }

    .about-steps {
        display: grid;
        gap: 1rem;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    @media (min-width: 768px) {
        .about-steps {
            grid-template-columns: repeat(3, 1fr);
        }
    }

    /* Phones: icon beside the text; from md up: icon on top */
    .about-steps li {
        display: grid;
        grid-template-columns: 2.25rem 1fr;
        column-gap: .75rem;
        align-items: start;
        padding: 1rem 1.25rem;
        background-color: #fff;
        border: 1px solid #dee2e6;
        border-radius: .75rem;
    }

    .about-steps .fas,
    .about-steps .far {
        grid-row: span 2;
        padding-top: .125rem;
        font-size: 1.75rem;
        color: #2874f0;
        text-align: center;
    }

    .about-steps span {
        color: #495057;
    }

    @media (min-width: 768px) {
        .about-steps li {
            grid-template-columns: 1fr;
            row-gap: .25rem;
            padding: 1.25rem;
        }

        .about-steps .fas,
        .about-steps .far {
            grid-row: auto;
            padding-top: 0;
            margin-bottom: .5rem;
            text-align: left;
        }
    }

    .about-plans .card-header {
        text-align: center;
    }

    .about-plans .card-body {
        text-align: center;
    }

    .about-plan-icon {
        color: #2874f0;
    }

    .about-reasons {
        padding: 0;
        list-style: none;
    }

    /* Checkmark hangs in the left margin so wrapped lines stay aligned */
    .about-reasons li {
        position: relative;
        padding: .25rem 0 .25rem 1.75rem;
    }

    .about-reasons .fa-check {
        position: absolute;
        top: .55rem;
        left: 0;
        color: #28a745;
    }

    .about-faqs details {
        background-color: #fff;
        border: 1px solid #dee2e6;
        border-radius: .75rem;
    }

    .about-faqs details + details {
        margin-top: .75rem;
    }

    .about-faqs summary {
        display: flex;
        gap: 1rem;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.25rem;
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

    .about-faqs summary::-webkit-details-marker {
        display: none;
    }

    /* Chevron that flips when the answer is open */
    .about-faqs summary::after {
        flex: 0 0 auto;
        width: .5rem;
        height: .5rem;
        margin-top: -.25rem;
        content: "";
        border: solid #6c757d;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
        transition: transform .15s;
    }

    .about-faqs details[open] summary::after {
        margin-top: .25rem;
        transform: rotate(-135deg);
    }

    .about-faqs summary:focus-visible {
        border-radius: .75rem;
        outline: 2px solid #2874f0;
        outline-offset: 2px;
    }

    .about-faqs details p {
        padding: 0 1.25rem 1rem;
        margin: 0;
    }

    .about-cta {
        padding: 1.75rem 1.5rem;
        margin-top: 3rem;
        text-align: center;
        background-color: #eef4fe;
        border-radius: .75rem;
    }

    .page-narrow .about-cta h2 {
        margin-top: 0;
        margin-bottom: .5rem;
    }

    .about-cta-actions {
        display: flex;
        flex-wrap: wrap;
        gap: .75rem;
        justify-content: center;
        margin: 1.25rem 0 .75rem;
    }

    .about-disclaimer {
        margin: 1.5rem 0 0;
        font-size: .875rem;
        color: #6c757d;
        text-align: center;
    }

    /* ---- Look carried over from the multi-school branch ---- */

    /* Dev-mode header: maroon instead of bright red */
    #main-header.debug-header {
        background-color: #8a1818;
    }

    /* Brighter header links (the drawer styles them separately) */
    .main-navbar .main-nav-links .nav-link {
        font-weight: 500;
        color: rgb(255 255 255 / 88%);
    }

    .main-navbar .main-nav-links .nav-link.active,
    .main-navbar .main-nav-links .nav-link:hover,
    .main-navbar .main-nav-links .nav-link:focus-visible {
        color: #fff;
    }

    .footer-bg {
        border-top: 1px solid #e5e5e5;
    }

    /* Search results: compact uppercase headings, light zebra rows */
    .search-results-table {
        font-size: .94rem;
    }

    .search-results-table thead th {
        font-size: .75rem;
        color: #6c757d;
        text-transform: uppercase;
        background: #f8f9fa;
        border-top: 0;
    }

    .search-results-table tbody td {
        vertical-align: middle;
    }

    .search-results-table tbody tr:nth-child(even) > td {
        background: #fcfcfc;
    }

    .search-results-table tbody tr:hover > td {
        background: #f5f9ff;
    }

    .search-results-table .add-to-course-cart {
        min-width: 6.4rem;
    }

    /* Order page: the cart, the two choices and the forms as white cards */
    .page-notifications .course-cart,
    .page-notifications #choose-notifications .card,
    .page-notifications #email-form,
    .page-notifications #text-form {
        background: #fff;
        border: 1px solid #e5e5e5;
        border-radius: .75rem;
        box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .04);
    }

    .page-notifications .course-cart {
        margin-bottom: 1.5rem;
        overflow: hidden;
    }

    .page-notifications .course-cart .table {
        margin-bottom: 0;
    }

    .page-notifications .course-cart th,
    .page-notifications .course-cart td {
        padding: .75rem 1rem;
        vertical-align: middle;
    }

    .page-notifications .course-cart thead th {
        background: #f8f9fa;
        border-top: 0;
    }

    .page-notifications .course-cart tbody tr:last-child td {
        border-bottom: 0;
    }

    .page-notifications .course-cart td:last-child,
    .page-notifications .course-cart th:last-child {
        width: 3.5rem;
        text-align: right;
    }

    .page-notifications #choose-notifications .card-header {
        background: #f8f9fa;
    }

    .notification-option-icon {
        color: #2874f0;
    }

    /* The form card hugs its fields instead of spanning the page */
    .page-notifications #email-form,
    .page-notifications #text-form {
        max-width: 34rem;
        padding: 1.25rem;
        margin-top: 1rem;
    }

    .page-notifications #email-form .row > *,
    .page-notifications #text-form .row > * {
        flex: 1 0 0;
        width: 100%;
        max-width: 100%;
    }

    @media (max-width: 767.98px) {
        .page-notifications .course-cart th,
        .page-notifications .course-cart td {
            padding: .625rem .5rem;
        }

        .page-notifications .course-cart td:first-child,
        .page-notifications .course-cart th:first-child {
            padding-left: .875rem;
        }

        .page-notifications .course-cart [id^="code-"] {
            white-space: nowrap;
        }
    }
}

/* Phone menu: a Bootstrap 6 drawer in the header blue */
.main-nav-drawer {
    --drawer-bg: #2874f0;
    --drawer-color: #fff;
    --drawer-width: 300px;
    color: #fff;
}

.main-nav-drawer:focus {
    outline: 0;
}

/* A plain white X; Bootstrap 6's filled-square icon reads as a pale box on blue.
   The X is drawn on ::before so the button's own focus outline isn't clipped by
   the icon mask, and the button keeps a ~40px tap target. */
.main-nav-drawer .btn-close {
    --btn-close-size: 1rem;
    --btn-close-opacity: .85;
    --btn-close-hover-opacity: 1;
    --btn-close-focus-opacity: 1;
    --btn-close-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/%3e%3c/svg%3e");
    position: relative;
    box-sizing: content-box;
    padding: .75rem;
    margin: -.75rem -.75rem -.75rem auto;
    color: #fff;
    background-color: transparent;
    mask: none;
}

.main-nav-drawer .btn-close::before {
    position: absolute;
    inset: .75rem;
    content: "";
    background-color: currentcolor;
    mask: var(--btn-close-icon) center / contain no-repeat;
}

.main-nav-drawer .btn-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

/* Drawer-only extras, hidden when the links sit inline on desktop */
.main-nav-links .nav-icon,
.main-nav-links .nav-cart-count,
.main-nav-footer {
    display: none;
}

@media (width < 992px) {
    .main-nav-drawer .drawer-header {
        padding-bottom: .75rem;
        border-bottom: 1px solid rgb(255 255 255 / 20%);
    }

    .main-nav-drawer .drawer-body {
        display: flex;
        flex-direction: column;
        padding-top: .75rem;
    }

    .main-nav-links {
        --nav-gap: .25rem;
        --nav-link-padding-y: .75rem;
        --nav-link-padding-x: 1rem;
        font-size: 1.125rem;
    }

    .main-nav-links .nav-link {
        justify-content: flex-start;
        gap: .875rem;
        color: #fff;
        border-radius: .75rem;
    }

    .main-nav-links .nav-link:hover,
    .main-nav-links .nav-link:focus-visible {
        color: #fff;
        background-color: rgb(255 255 255 / 12%);
    }

    .main-nav-links .nav-link.active {
        font-weight: 600;
        color: #fff;
        background-color: rgb(255 255 255 / 22%);
    }

    .main-nav-links .nav-icon {
        display: inline-block;
        opacity: .85;
    }

    .main-nav-links .nav-cart-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 1.5rem;
        height: 1.5rem;
        padding: 0 .5rem;
        margin-left: auto;
        font-size: .875rem;
        font-weight: 700;
        line-height: 1;
        color: #2874f0;
        text-align: center;
        background-color: #fff;
        border-radius: 50rem;
    }

    .main-nav-links .nav-cart-count.d-none {
        display: none;
    }

    .main-nav-footer {
        display: flex;
        flex-direction: column;
        gap: .25rem;
        /* Full-width divider, matching the one under the drawer header */
        padding: 1rem var(--drawer-padding-x) 0;
        margin: auto calc(-1 * var(--drawer-padding-x)) 0;
        border-top: 1px solid rgb(255 255 255 / 20%);
    }

    .main-nav-footer a {
        padding: .5rem 1rem;
        color: rgb(255 255 255 / 85%);
        text-decoration: none;
    }

    .main-nav-footer a[aria-current="page"] {
        font-weight: 600;
        color: #fff;
    }

    .main-nav-footer a:hover {
        color: #fff;
        text-decoration: underline;
    }
}

/* On desktop, show the drawer's links inline in the navbar. Bootstrap's
   .lg:navbar-expand does this with a container query, which this
   content-sized navbar can't use. */
@media (width >= 992px) {
    .main-navbar #MainNav {
        position: static !important;
        display: flex !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        padding: 0;
        margin: 0;
        overflow: visible !important;
        visibility: visible !important;
        background: transparent !important;
        border: 0 !important;
        transform: none !important;
        box-shadow: none;
    }

    .main-navbar #MainNav .drawer-header {
        display: none !important;
    }

    .main-navbar #MainNav .drawer-body {
        display: flex;
        padding: 0;
    }
}
