@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #fcfcfb;
  --ink: #1b1e22;
  --muted: #5a6068;
  --rule: #e3e5e8;
  --link: #1f5fae;
  /* same colours as the lab2clock results figure */
  --right: #2a78d6;
  --missing: #c9c7bf;
  --wrong: #d03b3b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141619;
    --ink: #e8e9eb;
    --muted: #9ea4ab;
    --rule: #2b2f35;
    --link: #8db8f2;
    --right: #3987e5;
    --missing: #4a4945;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 "Atkinson Next", system-ui, sans-serif;
}

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: 4.5rem 16px 5rem;
}

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.25rem;
  margin-top: 3rem;
}

h3 {
  font-size: 1.125rem;
}

p, ul, ol, figure {
  margin: 1rem 0 0;
}

ul, ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.5rem;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

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

/* Home */

.links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.links li + li {
  margin-top: 0;
}

.skills li + li {
  margin-top: 0.75rem;
}

.project {
  margin-top: 1.25rem;
}

/* Projects need more space between them than their own paragraphs do */
.project + .project {
  margin-top: 2.5rem;
}

.project > p {
  margin-top: 0.75rem;
}

.project h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
}

.project h3 .muted {
  font-size: 0.875rem;
  font-weight: 400;
}

/* The result bar: right, wrong, then missing, in the order of the figure */

.tally {
  margin-top: 1.25rem;
}

.tally p {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.bar {
  display: flex;
  height: 0.875rem;
  border-radius: 3px;
  overflow: hidden;
  background: var(--missing);
}

.bar span {
  display: block;
}

.bar .right { background: var(--right); }
.bar .wrong { background: var(--wrong); }

.legend {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.legend li + li {
  margin-top: 0;
}

.legend li::before {
  content: "";
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  margin-right: 0.4rem;
  border-radius: 2px;
}

.legend .right::before { background: var(--right); }
.legend .wrong::before { background: var(--wrong); }
.legend .missing::before { background: var(--missing); }

.project-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1rem;
}

.project-links li + li {
  margin-top: 0;
}

/* Write-up pages */

.home {
  display: inline-block;
  margin-bottom: 2.5rem;
  font-weight: 700;
}

.lede {
  font-size: 1.125rem;
  margin-top: 0.75rem;
}

.meta {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.figure {
  margin: 2rem 0 0;
}

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

.figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.figure-scroll {
  overflow-x: auto;
}

.scroll-hint {
  display: none;
}

/* Wide screens: the figure gets its full 760px, wider than the text */
@media (min-width: 800px) {
  .figure {
    margin-left: -56px;
    margin-right: -56px;
  }
  .figure figcaption {
    margin-left: 56px;
    margin-right: 56px;
  }
}

/* Narrow screens: shrinking the figure makes its text unreadable, so it scrolls */
@media (max-width: 799px) {
  .figure-scroll img {
    width: 760px;
    max-width: none;
  }
  .scroll-hint {
    display: inline;
  }
}

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

footer a {
  color: inherit;
}
