/* ================= courses at JHU: four years laid out as a calendar ================= */

.courses {
    --cs: #1772d0;
    --am: #8a4fff;
    --ec: #e8930c;
    --rq: #1fa37a;
    --ot: #a8a8a8;
    --star: #f09228;
    --wash: .085;
    max-width: calc(1180px + 2 * var(--pad));
    padding-top: clamp(52px, 9vh, 104px);
    padding-bottom: 72px;
}
body.dark .courses {
    --cs: #00f0ff;
    --am: #ff2a6d;
    --ec: #fcee09;
    --rq: #a48bff;
    --ot: #5c676d;
    --star: #00ff9f;
    --wash: .11;
}

.cs-home {
    font: 700 16px/1 'Candara', 'Hind Madurai', 'Lato', Verdana, Helvetica, sans-serif;
    color: var(--ink-2);
    transition: color .2s;
}
.cs-home:hover { color: var(--hover); }
body.dark .cs-home { font-family: 'BlenderPro', 'Hind Madurai', sans-serif; font-size: 17px; }

.cs-title {
    margin: 16px 0 0;
    font: 700 46px/1 'Candara', 'Hind Madurai', 'Lato', Verdana, Helvetica, sans-serif;
    letter-spacing: -.02em;
    color: var(--ink);
}
.cs-title img { height: .82em; width: auto; margin-left: .12em; vertical-align: -.1em; }
body.dark .cs-title {
    font-family: 'BlenderPro', 'Hind Madurai', sans-serif;
    font-size: 50px;
    letter-spacing: .01em;
    color: var(--acc);
}

/* the two small marks: a star for a course I recommend, an arrow for a course with a website */
.star, .c > a::after {
    display: inline-block;
    background: currentColor;
    -webkit-mask: var(--m) center / contain no-repeat;
    mask: var(--m) center / contain no-repeat;
}
.star {
    --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.2l3 6.5 7.1.8-5.3 4.8 1.5 7L12 17.8l-6.3 3.5 1.5-7L1.9 9.5 9 8.7z'/%3E%3C/svg%3E");
    width: .8em;
    height: .8em;
    color: var(--star);
}

.cs-rec {
    margin: 20px 0 0;
    font-size: 15.5px;
    line-height: 1.62;
    text-wrap: pretty;
}
.cs-rec .star { margin-right: .3em; vertical-align: -.04em; }
.cs-rec a { color: var(--link); transition: color .2s; }
.cs-rec a:hover { color: var(--hover); }

/* the three majors, then the other requirements and everything else: pick one and its courses stay lit
   across the four years */
.cs-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 26px;
    margin: 30px 0 12px;
}
.cs-keys button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 5px 0;
    border: 0;
    background: none;
    color: var(--ink);
    font: 700 14.5px/1.2 'Hind Madurai', 'Lato', Verdana, sans-serif;
    cursor: pointer;
    transition: color .2s;
}
.cs-keys button::before {
    content: '';
    flex: none;
    width: 11px;
    height: 11px;
    background: var(--c);
    box-shadow: inset 0 0 0 1.5px var(--c);
    transition: background-color .2s;
}
.cs-keys abbr { display: none; text-decoration: none; }
.cs-sep { align-self: center; width: 1px; height: 15px; background: var(--rule-2); }
.cs-keys button:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
.courses.solo .cs-keys button:not(.on) { color: var(--ink-3); }
.courses.solo .cs-keys button:not(.on)::before { background: transparent; }
body.dark .cs-keys button { font: 400 14.5px/1.2 'Play', 'Hind Madurai', sans-serif; }

.cs { --c: var(--cs); }
.am { --c: var(--am); }
.ec { --c: var(--ec); }
.rq { --c: var(--rq); }
.ot { --c: var(--ot); }

/* ---------- the calendar: a column for each year, a row for each term ---------- */

.cal {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--rule-2);
    border-left: 1px solid var(--rule-2);
}
.yr, .term {
    min-width: 0;
    border-right: 1px solid var(--rule-2);
    border-bottom: 1px solid var(--rule-2);
}
.y1 { grid-column: 1; }
.y2 { grid-column: 2; }
.y3 { grid-column: 3; }
.y4 { grid-column: 4; }
.yr { grid-row: 1; }
.t1 { grid-row: 2; }
.t2 { grid-row: 3; }
.t3 { grid-row: 4; }

.yr {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 10px 12px 9px;
    font: 700 15.5px/1.2 'Candara', 'Hind Madurai', 'Lato', Verdana, Helvetica, sans-serif;
    color: var(--ink);
}
.yr span {
    font: 400 13px/1.2 'Hind Madurai', 'Lato', sans-serif;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}
body.dark .yr { font: 700 17px/1.2 'BlenderPro', 'Hind Madurai', sans-serif; color: #fff; }
body.dark .yr span { font-family: 'Play', sans-serif; font-size: 12.5px; }

.term { padding: 10px 10px 16px; }
.tl {
    margin: 0 2px;
    font: 700 10.5px/1 'Lato', 'Hind Madurai', Verdana, sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ink-2);
}
.tl span { font-weight: 400; color: var(--ink-3); }
body.dark .tl { font-family: 'Play', sans-serif; }

.term ul { list-style: none; margin: 4px 0 0; padding: 0; }

/* a course, drawn like an entry in a calendar: its major's colour down the edge and washed behind it */
.c {
    margin-top: 6px;
    transition: opacity .25s ease;
}
.c > a, .c > div {
    display: block;
    position: relative;
    isolation: isolate;
    padding: 6px 24px 7px 10px;
    border-left: 3px solid var(--c);
}
.c > a::before, .c > div::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--c);
    opacity: var(--wash);
    transition: opacity .2s ease;
}
.c > a:hover::before, .c > a:focus-visible::before { opacity: calc(var(--wash) * 2.4); }
.c > a:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.c > a::after {
    --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 9 9 3M4.2 3H9v4.8' fill='none' stroke='black' stroke-width='1.3'/%3E%3C/svg%3E");
    content: '';
    position: absolute;
    top: 7px;
    right: 7px;
    width: 11px;
    height: 11px;
    color: var(--ink-2);
    transition: color .2s ease, transform .2s ease;
}
.c > a:hover::after, .c > a:focus-visible::after { color: var(--ink); transform: translate(1px, -1px); }

.c .t {
    display: block;
    font: 400 13.5px/1.32 'Lato', 'Hind Madurai', Verdana, Helvetica, sans-serif;
    color: var(--ink);
}
.c.rec .t { font-weight: 700; }
/* the star stays on the line of the title's last word */
.c .t .star { margin-left: .35em; vertical-align: -.02em; }
.c .n {
    display: block;
    margin-top: 2px;
    font: 400 11.5px/1.2 'Hind Madurai', 'Lato', sans-serif;
    font-variant-numeric: tabular-nums;
    letter-spacing: .01em;
    color: var(--ink-2);
}
/* a course I assisted, not one I took */
.c .role {
    margin-left: 7px;
    padding: 1px 4px 0;
    border: 1px solid var(--c);
    font: 700 9.5px/1.3 'Lato', 'Hind Madurai', Verdana, sans-serif;
    letter-spacing: .07em;
    color: var(--ink);
}
body.dark .c .role { font-family: 'Play', sans-serif; color: #dce5e9; }
body.dark .c .t { font-family: 'Play', 'Hind Madurai', sans-serif; font-size: 13px; color: #dce5e9; }
body.dark .c .n { font-family: 'Play', sans-serif; font-size: 11px; }
body.dark .c > a:hover::after, body.dark .c > a:focus-visible::after { color: var(--c); }

.courses.solo .c:not(.on) { opacity: .13; }

.cs-note {
    margin: 12px 2px 0;
    font: italic 400 16px/1.4 'EB Garamond', 'Hind Madurai', serif;
    color: var(--ink-2);
}
body.dark .cs-note { font: 400 14px/1.4 'Play', sans-serif; }

@media (prefers-reduced-motion: reduce) {
    .c, .c > a::before, .c > a::after { transition: none; }
}

/* ---------- two years across ---------- */

@media (max-width: 1020px) {
    .cal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .y3 { grid-column: 1; }
    .y4 { grid-column: 2; }
    .yr.y3, .yr.y4 { grid-row: 5; }
    .t1.y3, .t1.y4 { grid-row: 6; }
    .t2.y3, .t2.y4 { grid-row: 7; }
    .t3.y3, .t3.y4 { grid-row: 8; }
    .cs-title { font-size: 40px; }
    body.dark .cs-title { font-size: 44px; }
}

/* ---------- a phone: one term after another ---------- */

@media (max-width: 720px) {
    .courses { padding-top: 44px; padding-bottom: 48px; }
    .cs-title { margin-top: 14px; font-size: 34px; }
    body.dark .cs-title { font-size: 37px; }
    .cs-rec { margin-top: 16px; font-size: 14.5px; }

    /* the majors stay in reach while the list scrolls */
    .cs-keys {
        position: sticky;
        top: 0;
        z-index: 5;
        gap: 0 18px;
        margin: 20px calc(-1 * var(--pad)) 0;
        padding: 7px var(--pad) 6px;
        background: var(--bg);
        box-shadow: 0 1px 0 var(--rule);
        transition: background-color .3s ease;
    }
    .cs-keys button { font-size: 13.5px; }
    .cs-keys button span { display: none; }
    .cs-keys abbr { display: inline; }
    /* the majors on one line, the rest on the next */
    .cs-sep { flex-basis: 100%; height: 0; }

    .cal { display: block; border: 0; }
    .yr, .term { border: 0; }
    .yr { padding: 30px 0 0; font-size: 19px; }
    body.dark .yr { font-size: 20px; }
    .yr span { font-size: 13.5px; }
    .term { padding: 16px 0 0; }
    .term.none { display: none; }
    .tl { margin: 0; }
    .c > a, .c > div { padding: 8px 26px 9px 11px; }
    .c .t { font-size: 14.5px; }
    body.dark .c .t { font-size: 14px; }
    .c .n { font-size: 12px; }
    .c > a::after { top: 9px; right: 8px; }
    .cs-note { margin-left: 0; }
}
