/* Course layout, schedule, and contents navigation. */
:root {
  --side: 13.5rem;
  --gap: 4rem;
  --wrap: calc(var(--side) + var(--gap) + var(--measure));
}
.toc-toggle { display: none; }

.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, var(--measure));
  column-gap: var(--gap);
  max-width: var(--wrap);
  margin: auto;
  padding: 0 1.5rem 7rem;
}
.course-header {
  grid-column: 1 / -1;
  grid-row: 1;
  margin: 0 -1.5rem;
  padding: 0 1.5rem 3.5rem;
  border-bottom: 1px solid var(--rule);
}
.course-body {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding-top: 3.5rem;
}
.toc {
  grid-column: 1;
  grid-row: 2;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100dvh;
  overflow-y: auto;
  padding: 3.5rem 0 2rem;
  font: .9375rem/1.35 var(--ui);
}
#toc-title { font-weight: 600; margin-bottom: .9rem; }
.toc ul { margin: 0; padding: 0; list-style: none; }
.toc li + li { margin-top: 0; }
.toc a {
  display: block;
  padding: .32rem 0 .32rem .85rem;
  border-left: 2px solid var(--rule);
  color: var(--secondary);
  text-decoration: none;
}
.toc a:hover { color: var(--accent); }
.toc a[aria-current="location"] {
  color: var(--accent);
  border-left-color: var(--accent);
}
.toc ul ul a { padding-left: 1.6rem; font-size: .875rem; }

.course-header > dl {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  max-width: 36rem;
  margin-top: 2.25rem;
  border-top: 1px solid var(--rule);
}
.course-header dt, .course-header dd {
  padding: .6rem 0;
  border-bottom: 1px solid var(--rule);
}
.course-header dt {
  padding-right: 1rem;
  color: var(--muted);
  font: 500 .875rem/1.6 var(--ui);
}
.course-header dd { font-size: 1.0625rem; line-height: 1.5; }
.course-body h2 { margin-top: 4rem; }
.course-body > h2:first-child { margin-top: 0; }
.course-body p { hyphens: auto; }
h2#schedule + p, h2#syllabus + p {
  margin-bottom: 1.25rem;
  color: var(--secondary);
}
.course-body h3 {
  margin-bottom: 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.course-body h3 + p {
  margin-top: .35rem;
  color: var(--muted);
  font: .9375rem/1.5 var(--ui);
}

.schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.4;
}
.schedule th {
  padding: 0 .75rem .55rem 0;
  border-bottom: 1.5px solid var(--ink);
  color: var(--muted);
  text-align: left;
  font: 600 .8125rem var(--ui);
}
.schedule td {
  padding: .75rem .75rem .75rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.schedule td:last-child, .schedule th:last-child { padding-right: 0; }
.schedule .mobile-when { display: none; }
.schedule .wk, .schedule .mobile-when {
  white-space: nowrap;
  color: var(--secondary);
  font: .875rem/1.4 var(--ui);
}
.schedule .time { color: var(--muted); }
.schedule .time.unusual { color: var(--ink); }
.schedule .ttl a { color: var(--ink); text-decoration: none; }
.schedule .ttl a:hover { color: var(--accent); text-decoration: underline; }
.schedule .who { display: block; margin-top: .15rem; color: var(--muted); }
.schedule .links { width: 11.5rem; white-space: nowrap; font: .875rem/1.6 var(--ui); }
.schedule .none, .schedule .pending { color: var(--muted); }

@media (max-width: 1000px) {
  :root { --side: 11.5rem; --gap: 2.5rem; }
}

@media (max-width: 820px) {
  html { scroll-padding-top: 5rem; }
  .contents-menu .site-header { position: sticky; top: 0; }
  .toc-toggle {
    display: block;
    padding: .35rem .75rem;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: var(--tint);
    color: var(--accent);
    font: inherit;
    cursor: pointer;
  }
  .toc-toggle[aria-expanded="true"] {
    background: var(--accent);
    color: var(--paper);
  }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 1.25rem 4rem;
  }
  .course-header {
    margin: 0 -1.25rem;
    padding: 2.25rem 1.25rem 2.5rem;
  }
  .course-body { grid-column: 1; grid-row: 3; padding-top: 2.5rem; }
  .toc { position: static; max-height: none; padding: 2.5rem 0 0; }
  .contents-menu .toc {
    display: none;
    position: fixed;
    top: 3.5rem;
    left: 0;
    right: 0;
    z-index: 19;
    max-height: calc(100dvh - 3.5rem);
    padding: 1.25rem;
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    box-shadow: 0 12px 24px -12px #1c223040;
  }
  .contents-menu .toc.open { display: block; }
  .course-header > dl { grid-template-columns: 6.25rem minmax(0, 1fr); }
  .course-body h2 { margin-top: 3.25rem; }
  .schedule thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .schedule, .schedule tbody, .schedule tr, .schedule td {
    display: block;
    width: 100%;
  }
  .schedule tr { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
  .schedule tbody tr:first-child { border-top: 1.5px solid var(--ink); }
  .schedule td { border: 0; padding: 0; }
  .schedule .mobile-when { display: block; }
  .schedule .wk, .schedule .mobile-when { padding-bottom: .15rem; }
  .schedule .none::before { content: "Links: "; }
  .schedule .links { width: 100%; padding-top: .45rem; white-space: normal; }
}

@media print {
  .toc { display: none !important; }
  .layout { display: block; padding: 0; }
  .course-header { margin: 0; padding: 0 0 2rem; }
}
