@font-face {
  font-family: "Geist";
  src: url("fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfaf7;
  --fg: #1c1b19;
  --muted: #75706a;
  --rule: #e6e2da;
  --code-bg: #f3f1ec;

  /* The playful part: four colours, used sparingly. */
  --coral: #f2545b;
  --sun: #f5b700;
  --mint: #1fab89;
  --sky: #3a86ff;

  /* Darker shades of the same four, for text on light backgrounds. */
  --coral-ink: #d23a48;
  --sun-ink: #a86b00;
  --mint-ink: #137f65;
  --sky-ink: #2563d9;

  color-scheme: light;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --fg: #ebe8e2;
    --muted: #9c978f;
    --rule: #2d2b28;
    --code-bg: #1f1e1c;

    --coral: #ff6b70;
    --sun: #ffc93c;
    --mint: #3fd6ae;
    --sky: #66a3ff;

    --coral-ink: #ff8a8e;
    --sun-ink: #ffd166;
    --mint-ink: #5fe0bd;
    --sky-ink: #8ab8ff;

    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0 auto;
  max-width: 42rem;
  padding: 2.5rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font: 1.125rem/1.65 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

::selection { background: color-mix(in srgb, var(--sun) 40%, transparent); }

h1, h2, h3, h4, .masthead, .hero, section h2, .listing, footer {
  font-family: var(--sans);
}

/* Masthead (handout pages) */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.75rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}
.masthead .course {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.masthead .term { color: var(--muted); }

.dot { color: var(--coral); }

/* Hero (home page) */

.hero { margin: 3.5rem 0 3.5rem; }
.hero .term {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}
.hero h1 {
  margin: 0.2rem 0 0.4rem;
  font-size: 4rem;
  font-weight: 750;
  letter-spacing: -0.045em;
  line-height: 1;
}
.hero .lede {
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
}

.dots { display: flex; gap: 0.45rem; margin-top: 1.5rem; }
.dots i { width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--coral); }
.dots i:nth-child(2) { background: var(--sun); border-radius: 2px; }
.dots i:nth-child(3) { background: var(--mint); }
.dots i:nth-child(4) { background: var(--sky); border-radius: 2px; }

/* Home page listing */

section + section { margin-top: 3rem; }

section h2 {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.listing { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.listing li { --c: var(--coral); margin: 0; border-bottom: 1px solid var(--rule); }
.listing li:nth-child(4n+2) { --c: var(--sun); }
.listing li:nth-child(4n+3) { --c: var(--mint); }
.listing li:nth-child(4n+4) { --c: var(--sky); }

.listing a {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.95rem 0;
  color: var(--fg);
  text-decoration: none;
}
.listing a::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--c);
  transition: transform 0.2s ease;
}
.listing .label {
  flex: 0 0 4.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.listing .name {
  font-size: 1.15rem;
  font-weight: 550;
  letter-spacing: -0.01em;
  text-decoration: underline 2px transparent;
  text-underline-offset: 0.3em;
  transition: text-decoration-color 0.2s ease;
}
.listing a:hover::before, .listing a:focus-visible::before { transform: scale(1.4); }
.listing a:hover .name, .listing a:focus-visible .name { text-decoration-color: var(--c); }

.empty { color: var(--muted); font-style: italic; }

/* Handout typography */

h1, h2, h3, h4 { line-height: 1.2; }

.handout h1 {
  margin: 0 0 2rem;
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.handout h1::after {
  content: "";
  display: block;
  width: 4rem;
  height: 4px;
  margin-top: 1rem;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--coral) 0 25%, var(--sun) 25% 50%, var(--mint) 50% 75%, var(--sky) 75% 100%);
}

.handout h2 {
  margin: 3rem 0 0.8rem;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.handout main > h2::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.55em;
  border-radius: 2px;
  background: var(--coral);
  vertical-align: 0.08em;
}
.handout main > h2:nth-of-type(4n+2)::before { background: var(--sun); border-radius: 50%; }
.handout main > h2:nth-of-type(4n+3)::before { background: var(--mint); }
.handout main > h2:nth-of-type(4n+4)::before { background: var(--sky); border-radius: 50%; }

.handout h3 { margin: 2.25rem 0 0.5rem; font-size: 1.1rem; font-weight: 650; }

p, ul, ol, pre { margin: 0 0 1.1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: 0.35rem 0; }
li > p { margin: 0; }
li::marker { color: var(--muted); }

a {
  color: inherit;
  text-decoration: underline 0.12em var(--coral);
  text-underline-offset: 0.2em;
  transition: background-color 0.15s ease;
}
a:hover { background: color-mix(in srgb, var(--sun) 30%, transparent); }

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

blockquote {
  margin: 0 0 1.1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--sun);
  color: var(--muted);
}

table { border-collapse: collapse; margin: 0 0 1.1rem; font-size: 0.95rem; }
th, td { padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: left; }
th { font-family: var(--sans); font-weight: 600; }

/* Code */

code, pre { font-family: var(--mono); }

:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.82em;
  overflow-wrap: anywhere;
}

pre {
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border-radius: 8px;
  background: var(--code-bg);
  font-size: 0.82rem;
  line-height: 1.55;
}
div.sourceCode { margin: 0 0 1.1rem; }
div.sourceCode pre { margin: 0; }
pre > code.sourceCode > span { display: inline; }
pre > code.sourceCode > span > a:first-child { pointer-events: none; }

code span.kw, code span.cf, code span.im { color: var(--coral-ink); }
code span.dt, code span.bu { color: var(--sky-ink); }
code span.st, code span.ch, code span.ss, code span.vs { color: var(--mint-ink); }
code span.dv, code span.fl, code span.bn, code span.cn { color: var(--sun-ink); }
code span.co, code span.cv, code span.do { color: var(--muted); font-style: italic; }

footer {
  margin-top: 4.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 540px) {
  body { font-size: 1.05rem; padding-top: 1.5rem; }
  .hero { margin-top: 2rem; }
  .hero h1 { font-size: 3.2rem; }
  .handout h1 { font-size: 1.9rem; }
  .listing a { flex-wrap: wrap; row-gap: 0.1rem; }
  .listing .label { flex: 1; }
  .listing .name { flex-basis: 100%; padding-left: 1.6rem; }
}
