:root {
  color-scheme: light dark;

  --bg: light-dark(#ffffff, #1a1a1a);
  --fg: light-dark(#1a1a1a, #e6e6e6);
  --accent: light-dark(#b35900, #e8a050);
  --accent-hover: light-dark(#994d00, #f0b870);
  --muted: light-dark(#666666, #999999);
  --border: light-dark(#dddddd, #444444);
  --surface: light-dark(#f5f5f5, #2d2d2d);
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  background-color: var(--bg);
  color: var(--fg);
  margin: 0;
  padding: 0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

p {
  margin: 0 0 1em 0;
}

/* Layout */

main {
  max-width: 88ch;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 768px) {
  main {
    padding: 1.5rem 2rem;
  }
}

header {
  border-bottom: 1px solid var(--border);
  padding: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

@media (min-width: 768px) {
  header {
    padding: 1rem 2rem;
    align-items: baseline;
  }
}

header > a {
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

header > a svg {
  vertical-align: middle;
	height: 50px;
	width: 50px;
}
header > a svg path {
  fill: none;
}

/* Mobile nav toggle */

nav label {
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

nav label svg {
  vertical-align: middle;
}

.nav-links {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  left: 0;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

#nav-toggle:checked ~ .nav-links {
  display: block;
}

.nav-links a {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.nav-links a:hover {
  background-color: var(--surface);
  text-decoration: underline;
}

@media (min-width: 768px) {
  nav label {
    display: none;
  }

  .nav-links {
    display: flex;
    position: static;
    gap: 1rem;
    background: none;
    border: none;
  }

  .nav-links a {
    display: inline;
    padding: 0;
    border: none;
  }
}

/* Links */

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

a:hover,
a:focus {
  color: var(--accent-hover);
}

article {
  margin-bottom: 2em;
}

article header {
  border: none;
  padding: 0;
  display: block;
}

article header h1 {
  margin-top: 0;
}

time {
  color: var(--muted);
  font-size: 0.9em;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

.sum svg,
.sum img {
  height: 10vmax;
  width: auto;
}

/* Code */

pre, code {
  font-family: ui-monospace, Menlo, Monaco, "Cascadia Code", monospace;
  font-size: 0.9em;
}

pre {
  background-color: var(--surface);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
}

/* Footer */

footer {
  border-top: 1px solid var(--border);
  margin-top: 4em;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9em;
}

@media (min-width: 768px) {
  footer {
    padding: 2rem;
  }
}

/* Series navigation */

.series-nav {
  background-color: var(--surface);
  padding: 1rem;
  margin: 2em 0;
  border-radius: 4px;
}

.series-nav ol {
  margin: 0.5em 0;
  padding-left: 1.5em;
}

.series-nav .current {
  font-weight: bold;
}

/* Print */

@media print {
  header nav,
  footer {
    display: none;
  }

  body {
    background: none;
    color: #000;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  main a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }

  main a[href^="#"]::after,
  main a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    border: 1px solid #ccc;
    background: none;
  }
}
