/* Programming Fundamentals 3 — course page stylesheet */

:root {
  --paper: #f5f4f8;
  --ink: #26213a;
  --muted: #6e6a82;
  --purple: #5e5086;
  --purple-deep: #453a62;
  --marker: #f2c14e;
  --marker-ink: #26213a;
  --rule: #d9d6e3;

  --logo-1: #453a62;
  --logo-2: #5e5086;
  --logo-3: #8f4e8b;

  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono: "Fira Code", "SFMono-Regular", Menlo, monospace;

  --gutter: 11.5rem;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1b1828;
    --ink: #ece9f3;
    --muted: #a29db8;
    --purple: #b7a5dc;
    --purple-deep: #cdbfe8;
    --marker: #e9b949;
    --marker-ink: #1b1828;
    --rule: #35304a;
    --logo-1: #8f7fb8;
    --logo-2: #b7a5dc;
    --logo-3: #cf8fc9;
  }
}

:root[data-theme="dark"] {
  --paper: #1b1828;
  --ink: #ece9f3;
  --muted: #a29db8;
  --purple: #b7a5dc;
  --purple-deep: #cdbfe8;
  --marker: #e9b949;
  --marker-ink: #1b1828;
  --rule: #35304a;
  --logo-1: #8f7fb8;
  --logo-2: #b7a5dc;
  --logo-3: #cf8fc9;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  padding: 3rem 16px 6rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: var(--measure);
  margin: 0 auto;
}

a {
  color: var(--purple);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--purple) 45%, transparent);
}

a:hover {
  color: var(--purple-deep);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
  border-radius: 2px;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  font-variant-ligatures: contextual;
}

/* Title block ------------------------------------------------------- */

.course-head {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.haskell-logo {
  flex: none;
  width: 4.6rem;
  height: auto;
}

.haskell-logo .l1 { fill: var(--logo-1); }
.haskell-logo .l2 { fill: var(--logo-2); }
.haskell-logo .l3 { fill: var(--logo-3); }

.course-title {
  margin: 0;
  font-size: 2.75rem;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.course-sub {
  margin: 0.6rem 0 0;
  font-size: 1.375rem;
  font-style: italic;
  line-height: 1.3;
  color: var(--muted);
  text-wrap: balance;
}

/* Staff ------------------------------------------------------------- */

.staff {
  margin: 2.75rem 0 0;
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  column-gap: 1.25rem;
  row-gap: 0.15rem;
}

.staff dt {
  color: var(--muted);
}

.staff dd {
  margin: 0;
}

/* Sections ---------------------------------------------------------- */

section {
  margin-top: 3.5rem;
}

h2 {
  margin: 0 0 1.1rem;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Ledger: date gutter + entry -------------------------------------- */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ledger li {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  column-gap: 1.25rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--rule);
}

.ledger li:last-child {
  border-bottom: 1px solid var(--rule);
}

.when {
  color: var(--muted);
  line-height: 1.45;
}

.when time {
  display: block;
  color: var(--ink);
}

.what {
  min-width: 0;
}

.session-name {
  display: block;
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.3;
}

.session-name .n {
  color: var(--muted);
  font-weight: 400;
}

.room {
  display: block;
  color: var(--muted);
}

.files {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.files li,
.files li:last-child {
  display: block;
  padding: 0;
  border: 0;
}

.files span {
  color: var(--muted);
}

/* Topics: an inline run of keywords, dot-separated ----------------- */

.topics {
  margin: 0.4rem 0 0;
  display: flex;
  align-items: baseline;
  column-gap: 0.3em;
}

.topics > span {
  flex: none;
  color: var(--muted);
}

.topics ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.topics li,
.topics li:last-child {
  display: block;
  padding: 0;
  border: 0;
  white-space: nowrap;
}

.topics li + li::before {
  content: "·";
  margin: 0 0.4em;
  color: var(--muted);
}

/* Bibliography reuses the ledger without a date column ------------- */

.ledger.plain li {
  display: block;
}

.ledger.plain cite {
  font-style: italic;
}

/* Small screens ----------------------------------------------------- */

@media (max-width: 40rem) {
  html {
    font-size: 17px;
  }

  body {
    padding-top: 2rem;
  }

  .course-head {
    flex-direction: column;
    gap: 1rem;
  }

  .haskell-logo {
    width: 3.4rem;
    margin-top: 0;
  }

  .course-title {
    font-size: 2.1rem;
  }

  .course-sub {
    font-size: 1.2rem;
  }

  .staff,
  .ledger li {
    grid-template-columns: 1fr;
    row-gap: 0.2rem;
  }

  .when {
    display: flex;
    flex-wrap: wrap;
  }

  .when time {
    display: inline;
  }

  .when time + span::before {
    content: ", ";
  }
}

@media (prefers-reduced-motion: no-preference) {
  a {
    transition: color 120ms ease, text-decoration-color 120ms ease;
  }
}
