/* =========================================================================
   CSC4801 — AI-assisted Software Engineering
   Design system: GitHub Primer light theme on a neutral base.
   Two pages: the course introduction (index) and the project leaderboard.

   Color rule: accents come from Primer's syntax palette and are spent the way
   an editor spends them — to mark a *kind* of thing, never as decoration. The
   paired fills are deliberately faint (~8-10% of the accent over white) so a
   hue that reads as a hint on a small badge doesn't turn garish at scale.
   Every text/background pair clears WCAG AA.
   ========================================================================= */

:root {
  /* ---- neutrals ---- */
  --canvas:      #FFFFFF;
  --canvas-sub:  #F6F8FA;
  --surface:     #FFFFFF;

  --ink:         #1F2328;
  --ink-soft:    #59636E;
  --ink-faint:   #656D76;   /* AA on both section fills */

  --line:        #D1D9E0;
  --line-strong: #AFB8C1;

  /* ---- syntax accents + their faint fills ---- */
  --syn-key:  #B32028;   /* keyword  — dates, project weeks */
  --syn-fn:   #6639BA;   /* entity   — exercises */
  --syn-num:  #0550AE;   /* constant — lectures */
  --syn-var:  #953800;   /* variable */
  --syn-tag:  #116329;   /* tag      — guest speakers */
  --link:     #0969DA;

  --tint-key: #FAEFEE;
  --tint-fn:  #F1EDF9;
  --tint-num: #EDF3F9;
  --tint-tag: #EEF4F0;
  --tint-var: #F8F1ED;

  /* ---- type ---- */
  --f-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* ---- geometry: GitHub's 6px box language ---- */
  --radius:   6px;
  --radius-s: 4px;
  --maxw:     1120px;
  --gutter:   clamp(20px, 5vw, 56px);
  --shadow:   0 1px 0 rgba(31,35,40,.04), 0 1px 3px rgba(66,74,83,.10);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--f-body);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* prose links take GitHub's link blue; chrome links override back to ink,
   so blue reliably means "a link in the text". */
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.2; letter-spacing: -.015em; font-weight: 600; }
code { color: #0A3069; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* mono eyebrow label */
.tag {
  font-family: var(--f-mono); font-size: .72rem;
  letter-spacing: .07em; text-transform: uppercase; color: var(--ink-faint);
  display: inline-flex; align-items: center; gap: .55em;
}
.tag::before { content: ""; width: 20px; height: 1px; background: var(--line-strong); }

/* =============================================================== NAV === */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; gap: 24px;
}
/* course identity: the code leads, the full title supports it underneath */
.brand {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--f-display); font-weight: 600;
  color: var(--ink); letter-spacing: -.01em; line-height: 1.2;
}
.brand:hover { text-decoration: none; }
.brand b { font-size: 1.06rem; font-weight: 700; letter-spacing: -.015em; }
.brand small {
  display: block; color: var(--ink-soft);
  font-family: var(--f-body); font-weight: 400; font-size: .74rem;
  letter-spacing: 0; white-space: nowrap;
}
/* the university crest, sized by height with a hairline before the title */
.brand__mark {
  height: 38px; width: auto; flex: none; display: block;
  padding-right: 13px; border-right: 1px solid var(--line);
}

.nav__links { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.nav__links a {
  color: var(--ink-soft); font-size: .9rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius); transition: .15s;
}
.nav__links a:hover { color: var(--ink); background: var(--canvas-sub); text-decoration: none; }
.nav__links a.active { color: var(--ink); background: var(--canvas-sub); font-weight: 600; }

.nav__toggle {
  display: none; margin-left: auto;
  background: var(--canvas); border: 1px solid var(--line); border-radius: var(--radius);
  width: 38px; height: 34px; cursor: pointer; color: var(--ink); font-size: 1.05rem;
}
.nav__toggle:hover { background: var(--canvas-sub); }

@media (max-width: 780px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--canvas); border-bottom: 1px solid var(--line);
    padding: 10px var(--gutter) 16px; margin: 0; display: none;
  }
  .nav__links.open { display: flex; }
  .nav__links a { padding: 10px 12px; }
}
/* very narrow phones: drop the long subtitle, keep the course code */
@media (max-width: 400px) {
  .brand small { display: none; }
  .brand__mark { height: 32px; padding-right: 11px; }
}

/* ========================================================== OVERVIEW == */
.ov { padding-top: clamp(36px, 5vw, 56px); }
.ov__title { font-size: clamp(1.7rem, 3.2vw, 2.2rem); line-height: 1.15; }
/* the course title sits under the code as a lighter second line */
.ov__title span {
  display: block; margin-top: 4px;
  font-size: .72em; font-weight: 500; color: var(--ink-soft); letter-spacing: -.01em;
}
.ov__lede { font-size: 1.04rem; color: var(--ink-soft); margin-top: 18px; max-width: 74ch; }

/* course logistics */
.facts {
  margin-top: 26px; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px 30px; max-width: 900px;
}
.facts dt {
  font-family: var(--f-mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-faint);
}
.facts dd { font-size: .95rem; color: var(--ink); font-weight: 500; margin-top: 4px; }
/* marks a value the course staff still needs to fill in */
.tpl {
  display: inline-block; margin-left: 7px; vertical-align: 1px;
  font-family: var(--f-mono); font-size: .58rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint);
  background: var(--canvas-sub); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 20px;
}

.hero__jump { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hero__jump > span {
  font-family: var(--f-mono); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .07em; color: var(--ink-faint); margin-right: 2px;
}
.hero__jump a {
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 20px;
  color: var(--ink-soft); font-size: .86rem; font-weight: 500; transition: .15s;
}
.hero__jump a:hover { border-color: var(--ink); color: var(--ink); background: var(--canvas-sub); text-decoration: none; }

/* ============================================================ SECTION == */
.section { padding: clamp(40px, 5.5vw, 68px) 0; }
.section--alt { background: var(--canvas-sub); border-block: 1px solid var(--line); }
.section__head { max-width: 64ch; margin-bottom: 30px; }
.section__head h2 { font-size: clamp(1.5rem, 2.8vw, 1.9rem); margin-top: 12px; }
.section__head p { color: var(--ink-soft); margin-top: 12px; font-size: 1rem; }

/* page header (interior pages) */
.phead { padding: clamp(40px,5.5vw,68px) 0 clamp(24px,3.5vw,36px); }
.phead h1 { font-size: clamp(1.7rem, 3.4vw, 2.2rem); }
.phead p { color: var(--ink-soft); font-size: 1.02rem; margin-top: 14px; max-width: 68ch; }

/* =========================================================== SCHEDULE = */
/* A dense table, not cards: 28 meetings need to be scannable at a glance.
   Each week's two rows share one row-spanning week number. */
.sched {
  border-collapse: collapse; width: 100%; font-size: .92rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.sched th, .sched td {
  text-align: left; padding: 9px 14px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.sched th {
  font-family: var(--f-mono); font-size: .66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-faint); background: var(--canvas-sub);
  border-bottom: 1px solid var(--line-strong);
}
.sched tbody tr:last-child td { border-bottom: 0; }
.sched tbody tr:hover td { background: var(--canvas-sub); }

/* the week number spans its two meetings */
.sched__wk {
  font-family: var(--f-mono); font-size: .92rem; font-weight: 700;
  color: var(--ink); width: 46px;
  border-right: 1px solid var(--line);
  background: var(--canvas);
}
.sched__date {
  font-family: var(--f-mono); font-size: .78rem; color: var(--ink-soft);
  white-space: nowrap; width: 118px;
}
.sched__topic { font-weight: 500; }
.sched__slides { width: 130px; font-family: var(--f-mono); font-size: .78rem; color: var(--ink-faint); }
.sched__read { font-size: .82rem; color: var(--ink-soft); }
.sched__read a { color: var(--link); }
.sched__read ul { margin: 0; padding-left: 1.1em; }
.sched__read li + li { margin-top: 3px; }

/* project weeks: a red left edge on the first cell of the row */
.sched tr.is-project .sched__date { box-shadow: inset 3px 0 0 var(--syn-key); }

@media (max-width: 700px) {
  .sched, .sched thead, .sched tbody, .sched tr, .sched th, .sched td { display: block; }
  .sched thead { display: none; }
  .sched__wk { display: none; }
  .sched tbody tr {
    border-bottom: 1px solid var(--line); padding: 10px 14px;
  }
  .sched tbody tr:last-child { border-bottom: 0; }
  .sched td { border: 0; padding: 1px 0; }
  .sched__date, .sched__slides { width: auto; }
  .sched tr.is-project .sched__date { box-shadow: none; color: var(--syn-key); }
}

/* ======================================================== LEADERBOARD = */
.lb {
  border-collapse: collapse; width: 100%; font-size: .94rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.lb th, .lb td {
  text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.lb th {
  font-family: var(--f-mono); font-size: .66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-faint); background: var(--canvas-sub);
  border-bottom: 1px solid var(--line-strong);
}
.lb tbody tr:last-child td { border-bottom: 0; }
.lb tbody tr:hover td { background: var(--canvas-sub); }
.lb__rank {
  font-family: var(--f-mono); font-weight: 700; color: var(--ink);
  border-right: 1px solid var(--line);
}
/* the top three ranks carry a medal-weight left edge */
.lb tbody tr:nth-child(1) .lb__rank { box-shadow: inset 3px 0 0 var(--syn-key); }
.lb tbody tr:nth-child(2) .lb__rank { box-shadow: inset 3px 0 0 var(--line-strong); }
.lb tbody tr:nth-child(3) .lb__rank { box-shadow: inset 3px 0 0 var(--syn-var); }
/* placeholder rows, until results are posted */
.lb__empty {
  color: var(--ink-faint); font-family: var(--f-mono); font-size: .78rem;
  font-style: normal;
}

/* ===================================================== ACKNOWLEDGEMENT = */
/* Course supporter credit: compact enough to stay secondary to the page
   content, but structured as a distinct widget rather than footer copy. */
.ack {
  margin-top: 44px; padding: 18px 20px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 18px;
  background: var(--canvas-sub); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.ack--standalone { margin-top: 0; }
.ack__mark {
  width: 64px; height: 64px; display: grid; place-items: center;
  flex: none; border-radius: var(--radius);
  background: var(--ink); color: var(--canvas);
  font-family: var(--f-display); font-size: 1rem; font-weight: 700;
  letter-spacing: -.04em;
}
.ack__label {
  font-family: var(--f-mono); font-size: .67rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ink-faint);
}
.ack__body > p:last-child { margin-top: 4px; color: var(--ink-soft); font-size: .92rem; }
.ack__body strong { color: var(--ink); font-weight: 600; }
.ack__link {
  white-space: nowrap; padding: 7px 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); background: var(--canvas);
  font-family: var(--f-mono); font-size: .72rem; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.ack__link:hover { border-color: var(--ink); background: var(--surface); text-decoration: none; }

@media (max-width: 620px) {
  .ack { grid-template-columns: auto minmax(0, 1fr); gap: 14px; }
  .ack__mark { width: 54px; height: 54px; }
  .ack__link { grid-column: 1 / -1; text-align: center; }
}

/* ============================================================ PEOPLE === */
.staff-groups { display: grid; gap: clamp(36px, 5vw, 52px); }
.staff-group__title { font-size: 1.18rem; margin-bottom: 22px; }
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 36px); }
.person {
  padding: 0 8px; text-align: center;
}
.person .avatar {
  width: clamp(116px, 14vw, 156px); height: clamp(116px, 14vw, 156px);
  border-radius: 50%; margin: 0 auto 16px; overflow: hidden;
}
.person .avatar__image {
  width: 100%; height: 100%; object-fit: cover; object-position: center 22%;
}
.person .avatar__image--zoomed-out {
  object-fit: contain; object-position: center;
}
.person h3 { font-size: 1rem; }
.person .role {
  font-family: var(--f-mono); font-size: .64rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink-faint); margin-top: 6px;
}

@media (max-width: 760px) {
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 34px; }
}

@media (max-width: 420px) {
  .people { grid-template-columns: 1fr; }
}

/* ============================================================ FOOTER === */
.footer { border-top: 1px solid var(--line); background: var(--canvas-sub); padding: 40px 0 34px; }
.footer .brand__mark { border-right-color: var(--line-strong); }
.footer__grid { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; align-items: flex-start; }
.footer p { color: var(--ink-faint); font-size: .86rem; max-width: 40ch; }
.footer__links { display: flex; flex-wrap: wrap; gap: 24px; }
.footer__links a { color: var(--ink-soft); font-size: .88rem; }
.footer__mono { font-family: var(--f-mono); font-size: .72rem; color: var(--ink-faint); margin-top: 20px; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--radius-s); }
