/* Shared typography and layout for the course site. */
:root {
  --mit-red: #750014;
  --paper: #fdfcf8;
  --ink: #1a1c1e;
  --text: var(--ink);
  --muted: #5f6467;
  --rule: #ded9d0;
  --link: #14608a;
  --label: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  border-top: 8px solid var(--mit-red);
  background: var(--paper);
  color: var(--text);
  font-family: "Source Serif 4", Charter, "Bitstream Charter", Georgia, serif;
  font-size: 17.5px;
  line-height: 1.55;
  letter-spacing: 0;
}

::selection {
  background: #f0dcd2;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
}

.course-header {
  padding-top: 16px;
}

.identity {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  column-gap: 26px;
  align-items: start;
}

.mit {
  display: block;
  width: 72px;
  height: 38px;
}

.mit img {
  display: block;
  width: 100%;
  height: 100%;
}

.course-heading {
  min-width: 0;
}

.formal-title {
  display: block;
  margin: 0;
  color: var(--ink);
  font-family: "Source Serif 4", Charter, Georgia, serif;
  font-size: 29px;
  font-weight: 600;
  line-height: 1.14;
  text-decoration: none;
}

.course-title {
  display: block;
  margin: 0 0 7px;
  color: var(--mit-red);
  font-family: var(--label);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-decoration: none;
  text-transform: uppercase;
}

.formal-title:hover,
.formal-title:focus-visible {
  text-decoration: underline;
}

.course-nav {
  margin: 30px 0 12px;
  color: var(--muted);
  font-family: var(--label);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
}

.course-nav a {
  color: #3e4144;
  margin: 0 10px;
}

.course-nav a[aria-current="page"] {
  color: var(--mit-red);
  font-weight: 700;
}

.course-nav span {
  display: none;
}

.term {
  margin: 7px 0 0;
  padding: 0;
  color: var(--muted);
  font-family: var(--label);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

main {
  padding: 20px 0 54px;
}

.page-title {
  margin: 6px 0 24px;
  color: var(--ink);
  font-family: "Source Serif 4", Charter, Georgia, serif;
  font-size: 33px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

h2 {
  margin: 30px 0 8px;
  color: var(--mit-red);
  font-family: var(--label);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-transform: uppercase;
}

h3 {
  margin: 20px 0 6px;
  color: var(--ink);
  font-family: var(--label);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.header-rule {
  height: 3px;
  margin: 0;
  border: 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

p {
  margin: 0 0 11px;
}

main > p {
  hyphens: auto;
  text-align: justify;
  text-justify: inter-word;
}

ul,
ol {
  margin: 6px 0 14px;
  padding-left: 24px;
}

li + li {
  margin-top: 4px;
}

.lead {
  font-size: 18.5px;
  line-height: 1.6;
}

.info {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  margin: 8px 0 20px;
  border-top: 1px solid var(--rule);
}

.info dt,
.info dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}

.info dt {
  color: var(--muted);
  font-family: var(--label);
  font-size: 14.5px;
  font-weight: 600;
}

table {
  width: 100%;
  margin: 9px 0 19px;
  border-collapse: collapse;
  font-size: 15.5px;
}

th,
td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

th {
  border-top: 1px solid #b9b3a8;
  color: #3e4144;
  font-family: var(--label);
  font-size: 14px;
  font-weight: 650;
}

.date {
  width: 88px;
  white-space: nowrap;
}

.lecture-number {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--label);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  line-height: 1.25;
  text-transform: uppercase;
}

.topic strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
}

.topic small {
  display: block;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.week td {
  padding-top: 18px;
  background: var(--paper);
  color: var(--mit-red);
  font-family: var(--label);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.provisional {
  position: relative;
  z-index: 2;
  margin: 0 0 0 2px;
  padding: 0 3px;
  border: 0;
  border-bottom: 1px dotted currentColor;
  background: transparent;
  color: var(--mit-red);
  cursor: help;
  font: inherit;
  font-size: 1.15em;
  font-weight: 900;
  line-height: 1;
  text-transform: none;
  vertical-align: super;
}

.provisional::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  width: max-content;
  max-width: min(320px, 80vw);
  padding: 7px 9px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  content: attr(data-note);
  font-family: var(--label);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  visibility: hidden;
  white-space: normal;
}

.provisional:hover::after,
.provisional:focus::after,
.provisional:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

.provisional:focus-visible {
  outline: 2px solid var(--mit-red);
  outline-offset: 2px;
}

.page-note {
  margin-left: 4px;
  padding: 0 2px;
  border-bottom: 0;
  color: #777777;
  font-size: 0.58em;
  font-weight: 700;
  vertical-align: super;
}

.note {
  margin: 15px 0;
  padding-left: 12px;
  border-left: 3px solid #b9b3a8;
  color: var(--muted);
}

code,
.math {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

footer {
  padding: 14px 0 32px;
  border-top: 1px solid var(--rule);
  color: #8a8580;
  font-family: var(--label);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

footer p {
  margin: 0;
}

@media (max-width: 650px) {
  body {
    font-size: 16px;
  }

  .identity {
    grid-template-columns: 58px minmax(0, 1fr);
    column-gap: 18px;
  }

  .mit {
    width: 58px;
    height: auto;
    aspect-ratio: 72 / 38;
  }

  .course-title {
    font-size: 14px;
  }

  .formal-title {
    font-size: 21px;
  }

  .course-nav {
    margin: 34px 0 16px;
    line-height: 1.9;
  }

  .page-title {
    font-size: 24px;
  }

  .info {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  th,
  td {
    padding: 7px 5px;
  }

  .provisional::after {
    position: fixed;
    right: 18px;
    bottom: 18px;
    left: 18px;
    width: auto;
    max-width: none;
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  }
}
