:root {
  --bg: #ffffff;
  --surface: #f6f6f7;
  --text: #1b1c1f;
  --muted: #5f6168;
  --rule: #e2e3e7;
  --accent: #750014; /* MIT red */
  --maxw: 880px;
  --topbar-h: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 "Source Serif 4", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  border-top: 4px solid var(--accent);
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--topbar-h);
}

.brand {
  flex: none;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  padding: 14px 0;
}
.topbar nav a:hover { color: var(--accent); }

/* Masthead */

.masthead { padding: 64px 0 8px; }

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.course-number {
  display: block;
  margin-bottom: 0.15em;
  color: var(--accent);
}

.registration {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 24px 0 0;
}

.registration-availability {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
}

.registration-note {
  margin: 12px 0 0;
  font-size: 1rem;
}

.registration-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 24px;
  border: 2px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
}

.registration-button:hover {
  background: #56000f;
  border-color: #56000f;
}

.registration-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px 28px;
  margin: 40px 0 0;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.facts dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.facts dd {
  margin: 4px 0 0;
  font-size: 0.98rem;
  line-height: 1.45;
}

/* Sections */

section[id] {
  padding-top: 48px;
  scroll-margin-top: var(--topbar-h);
}

h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

p { margin: 0 0 14px; }

section[id] > p,
ul.plain li {
  text-align: justify;
  text-justify: inter-word;
  text-align-last: left;
  hyphens: none;
  word-break: normal;
  overflow-wrap: normal;
}

ul.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}
ul.plain li { margin-bottom: 8px; }

.tba { color: var(--muted); }

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Research cycle */

.research-cycle {
  margin: 28px 0 32px;
  padding: 24px 20px 20px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: #fff;
  color: #1b1c1f;
}

.cycle-flow { position: relative; }

.cycle-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cycle-step { min-width: 0; text-align: center; }
.cycle-illustration { position: relative; }

.cycle-illustration img {
  display: block;
  width: 100%;
  height: auto;
}

.cycle-next,
.cycle-return {
  fill: none;
  stroke: #750014;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cycle-next {
  position: absolute;
  top: 50%;
  right: -30px;
  width: 28px;
  height: 16px;
  transform: translateY(-50%);
}

.cycle-copy h3 {
  margin: 14px 0 6px;
  font-size: 1rem;
  font-weight: 650;
}

.cycle-return {
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 12px;
}

.cycle-return-mobile { display: none; }

@media (max-width: 600px) {
  .research-cycle { padding: 20px 14px; }

  .cycle-steps {
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    gap: 24px;
    padding-left: 26px;
  }

  .cycle-step {
    display: grid;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    text-align: left;
  }

  .cycle-next {
    top: auto;
    right: auto;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
  }

  .cycle-copy h3 { margin-top: 0; }
  .cycle-return { display: none; }

  .cycle-return-mobile {
    display: block;
    position: absolute;
    top: calc((100% - 48px) / 6);
    bottom: calc((100% - 48px) / 6);
    left: 0;
    width: 19px;
    border: 2px solid #750014;
    border-right: 0;
    border-radius: 12px 0 0 12px;
  }

  .cycle-return-mobile::after {
    content: "";
    position: absolute;
    top: -5px;
    right: 0;
    width: 6px;
    height: 6px;
    border-top: 2px solid #750014;
    border-right: 2px solid #750014;
    transform: rotate(45deg);
  }
}

/* Schedule */

.table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

table.schedule {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.97rem;
}

.schedule th {
  padding: 0 12px 10px;
  border-bottom: 2px solid var(--text);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.schedule td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.schedule .col-num {
  width: 3rem;
  padding-left: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.schedule .col-date {
  width: 8.5rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.schedule tbody tr:hover { background: var(--surface); }

.schedule tr.no-class,
.schedule tr.no-class:hover {
  background: var(--surface);
  color: var(--muted);
}

/* Staff */

ul.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.people li {
  display: flex;
  align-items: center;
  gap: 14px;
}

.people img {
  flex: none;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.people .name {
  display: block;
  font-weight: 600;
}

.people .role {
  color: var(--muted);
  font-size: 0.9rem;
}

.sponsor {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Footer */

footer {
  margin-top: 72px;
  padding-top: 20px;
  padding-bottom: 40px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}
footer.wrap { border-top: none; }
footer p {
  margin: 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
footer a { color: inherit; }

/* On narrow screens the page title sits right below, so the bar only carries the section links. */
@media (max-width: 680px) {
  .brand { display: none; }
  .topbar nav { flex: 1; }
}

@media (max-width: 760px) {
  /* Narrow windows and phones: topics go under the lecture title. */
  table.schedule,
  .schedule tbody { display: block; min-width: 0; }
  .schedule thead { display: none; }
  .schedule tbody { border-top: 2px solid var(--text); }
  .schedule tr {
    display: grid;
    grid-template-columns: 1.5rem 6.5rem 1fr;
    padding: 13px 0;
    border-bottom: 1px solid var(--rule);
  }
  .schedule td { padding: 0; border-bottom: none; }
  .schedule .col-num,
  .schedule .col-date { width: auto; }
  .schedule .col-topics { grid-column: 3; margin-top: 4px; }
  .schedule .col-topics:empty { display: none; }
  .schedule .col-topics { color: var(--muted); }
  .schedule .col-topics::before { content: "Potential topics: "; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .masthead { padding-top: 40px; }
  .topbar nav { gap: 14px; }
  .topbar nav a { font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
