/* General Page Styles */

:root {
    --table-header: #e9edf2;
    --special-week: #fff4d6;
}

h2 {
    color: var(--heading-text);
}

.schedule-note,
.updated-date {
    color: var(--muted-text);
}

.updated-date {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Desktop Table */

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    background: var(--content-background);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
}

.schedule-table th,
.schedule-table td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}

.schedule-table th {
    background: var(--table-header);
    color: var(--heading-text);
}

.schedule-table tbody tr:last-child td {
    border-bottom: 0;
}

.schedule-table tbody tr:hover {
    background: #f8fafc;
}

.schedule-table .special-week {
    background: var(--special-week);
}

.schedule-table .special-week:hover {
    background: var(--special-week);
}

.schedule-table .exam-day {
    background: #e8f1ff;
    font-weight: 600;
}

.schedule-table .exam-day:hover {
    background: #e8f1ff;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    width: 8rem;
    white-space: nowrap;
}


/*
    Mobile
    On smaller screens, each table row becomes a separate card.
*/

@media screen and (max-width: 700px) {
    .container {
        width: min(100% - 1rem, 1100px);
    }

    main {
        padding-top: 1.25rem;
    }

    .course-details {
        grid-template-columns: 1fr;
    }

    .table-wrapper {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .schedule-table,
    .schedule-table tbody,
    .schedule-table tr,
    .schedule-table td {
        display: block;
        width: 100%;
    }

    .schedule-table thead {
        /*
            Hide the table headings visually while keeping the
            cell-specific labels below.
        */
        display: none;
    }

    .schedule-table tbody {
        display: grid;
        gap: 1rem;
    }

    .schedule-table tr {
        overflow: hidden;
        border: 1px solid var(--border-color);
        border-radius: 0.6rem;
        background: var(--content-background);
    }

    .schedule-table td {
        display: grid;
        grid-template-columns: minmax(7.5rem, 38%) 1fr;
        gap: 0.75rem;
        padding: 0.7rem 0.85rem;
        border-bottom: 1px solid var(--border-color);
    }

    .schedule-table td:last-child {
        border-bottom: 0;
    }

    .schedule-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--heading-text);
    }

    .schedule-table tbody tr:hover {
        background: var(--content-background);
    }

    .schedule-table .special-week,
    .schedule-table .special-week:hover {
        background: var(--special-week);
    }
}


/*
    Very narrow phones: place the label above the value.
*/

@media screen and (max-width: 400px) {
    .schedule-table td {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

/* Print Styles */

@media print {

    @page {
        margin: 0.75in;
    }

    html,
    body {
        background: white;
        color: black;
        font-size: 11pt;
    }

    .container {
        width: 100%;
        margin: 0;
    }

    section {
        margin-bottom: 0.25in;
    }

    .table-wrapper {
        overflow: visible;
        border: none;
    }

    .schedule-table {
        width: 100%;
        border-collapse: collapse;
    }

    .schedule-table th,
    .schedule-table td {
        border: none;
        border-bottom: 1px solid black;
    }

    .schedule-table th {
        border-top: 1px solid black;
        font-weight: bold;
    }

    /* Prevent rows from being split across two printed pages. */
    .schedule-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Remove hover effects. */
    .schedule-table tbody tr:hover {
        background: white;
    }

    /* Don't print the site header and exam summary sections. */
    .site-header {
        display: none;
    }

    .exam-summary {
        display: none;
    }

    /* Don't underline hyperlinks. */
    a {
        color: black;
        text-decoration: none;
    }

    /* Don't print URLs after links. */

    a[href]::after {
        content: "";
    }

}

.exam-summary {
    margin-bottom: 1.5rem;
    background-color: var(--table-header);
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.exam-summary summary {
    font-weight: 600;
    cursor: pointer;
}

.exam-summary ul {
    margin: 0.75rem 0 0;
    padding-left: 1.5rem;
}

.exam-summary li {
    margin: 0.3rem 0;
}

/* Course List */

.course-list {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
}

.course-link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;

    padding: 1.25rem;

    border: 1px solid var(--border-color);
    border-radius: 0.6rem;

    background: var(--content-background);
    color: var(--body-text);
    text-decoration: none;
}

.course-link strong {
    color: var(--heading-text);
    font-size: 1.1rem;
}

.course-link span {
    color: var(--muted-text);
}

.course-link:hover,
.course-link:focus-visible {
    background: #f8fafc;
    border-color: var(--link-color);
}

.course-link:focus-visible {
    outline: 2px solid var(--link-color);
    outline-offset: 2px;
}
