:root {
  --bg: #fbfaf8;
  --text: #2a2926;
  --heading: #0f0e0d;
  --muted: #6f6c66;
  --rule: #e4e1db;
  --accent: #1c8a4a;
  --code-kw: #8a3fa0;
  --code-str: #a4572a;
  --code-num: #1f6fa8;
  --code-fn: #1c7a6e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --text: #dcd8d1;
    --heading: #f8f6f2;
    --muted: #96928a;
    --rule: #2c2b29;
    --accent: #4fd486;
    --code-kw: #d19ae6;
    --code-str: #e6b17a;
    --code-num: #7fb8e6;
    --code-fn: #6fd1c2;
  }
}

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

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

body {
  margin: 0;
  padding: 18vh 16px 4rem;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main,
footer {
  max-width: 34rem;
  margin: 0 auto;
}

h1 {
  margin: 0 0 1.5rem;
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--heading);
}

h2 {
  margin: 3.5rem 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.bio {
  margin: 0;
  text-wrap: pretty;
}

.running {
  white-space: nowrap;
}

.running::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-left: 0.4em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
  animation: pulse 2.4s ease-out infinite;
}

.work {
  margin: 0;
}

.work > div:hover dd {
  color: var(--text);
}

.work dd {
  transition: color 0.15s;
}

.now {
  margin-left: 0.5em;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.work > div {
  display: grid;
  grid-template-columns: 12rem 1fr;
  column-gap: 1.5rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.work dt {
  grid-row: 1 / span 3;
  font-weight: 500;
}

.work dd {
  grid-column: 2;
  margin: 0;
  color: var(--muted);
}

a {
  color: inherit;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--muted);
  transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.links {
  display: flex;
  gap: 1.25rem;
  margin: 1.25rem 0 0;
}

.sections {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin: 2.25rem 0 0;
  font-family: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.625rem;
  line-height: 1.25;
}

.sections a {
  text-decoration: none;
}

.sections span {
  display: inline-block;
  margin-left: 0.15em;
  color: var(--muted);
  transition: transform 0.15s, color 0.15s;
}

.sections a:hover span {
  color: var(--accent);
  transform: translateX(0.15em);
}

footer {
  margin-top: 4.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  body {
    padding-top: 10vh;
  }

  .work > div {
    grid-template-columns: 1fr;
  }

  .work dt {
    grid-row: auto;
  }

  .work dd {
    grid-column: 1;
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }
  70%,
  100% {
    box-shadow: 0 0 0 0.45em transparent;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

main > *,
footer {
  animation: rise 0.6s ease-out both;
}

main > :nth-child(2) { animation-delay: 0.08s; }
main > :nth-child(3) { animation-delay: 0.16s; }
main > :nth-child(4) { animation-delay: 0.24s; }
main > :nth-child(5) { animation-delay: 0.32s; }
main > :nth-child(n+6) { animation-delay: 0.4s; }
footer { animation-delay: 0.48s; }

@media (prefers-reduced-motion: reduce) {
  main > *,
  footer,
  .running::after {
    animation: none;
  }
}

/* Ramblings */

.blog main,
.blog footer {
  max-width: 52.1rem; /* 15% wider than the 34rem default */
}

.back {
  margin: 0 0 2.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.back a {
  text-decoration: none;
}

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

.post-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule);
}

.post-list time {
  font-size: 0.8125rem;
}

.post-list time,
.post-meta {
  color: var(--muted);
}

.post-meta {
  margin: -0.75rem 0 2rem;
  font-size: 0.875rem;
}

article {
  text-wrap: pretty;
}

article h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--heading);
}

article h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--heading);
}

article img {
  max-width: 100%;
  height: auto;
}

article code {
  font: 0.875em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: color-mix(in srgb, var(--rule) 60%, transparent);
}

article pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--rule) 60%, transparent);
}

article pre code {
  padding: 0;
  background: none;
}

/* Syntax highlighting (Pygments classes, generated at build time by codehilite) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .ch, .highlight .cs { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kc, .highlight .kr, .highlight .kt, .highlight .ow { color: var(--code-kw); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd, .highlight .se, .highlight .sa, .highlight .si, .highlight .sr { color: var(--code-str); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .il, .highlight .l { color: var(--code-num); }
.highlight .nf, .highlight .fm, .highlight .nc, .highlight .na, .highlight .nt, .highlight .nb, .highlight .bp { color: var(--code-fn); }

article blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

article table {
  border-collapse: collapse;
  width: 100%;
}

article th,
article td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
