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

:root {
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-text: #c9d1d9;
  --color-text-muted: #8b949e;
  --color-text-bright: #e6edf3;
  --color-accent: #d4a843;
  --color-accent-hover: #e8c36a;
  --color-border: #21262d;
  --color-link: var(--color-accent);
  --max-width: 720px;
  --breakout-width: 900px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

/* Nav */
header nav {
  margin-bottom: 3.5rem;
}

header nav a {
  text-decoration: none;
  color: var(--color-text-bright);
  font-weight: 600;
  font-size: 1.1rem;
}

header nav a:hover {
  color: var(--color-accent);
}

main {
  min-height: 60vh;
}

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

/* Links */
a {
  color: var(--color-link);
  transition: color 0.15s ease;
}

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

/* Article header */
article header {
  margin-bottom: 2.5rem;
}

article header h1 {
  font-size: 1.85rem;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--color-text-bright);
}

article header time {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

article header .tags {
  margin-top: 0.5rem;
}

.tag {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  margin-right: 0.25rem;
}

/* Series navigation */
.series-nav {
  margin-bottom: 2.5rem;
  padding: 1rem 1.25rem;
  background: var(--color-surface);
  border-radius: 6px;
  border-left: 3px solid var(--color-accent);
}

.series-nav ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: series;
}

.series-nav li {
  counter-increment: series;
  padding: 0.2rem 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.series-nav li::before {
  content: counter(series) ". ";
  font-weight: 600;
  color: var(--color-text-muted);
}

.series-nav li.current {
  color: var(--color-text-bright);
  font-weight: 600;
}

.series-nav li.current::before {
  color: var(--color-accent);
}

.series-nav li a {
  text-decoration: none;
}

.series-nav li a:hover {
  text-decoration: underline;
}

.series-next {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.series-next a {
  font-weight: 600;
  text-decoration: none;
  font-size: 1.05rem;
}

.series-next a:hover {
  text-decoration: underline;
}

/* Article typography */
article h2 {
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--color-text-bright);
}

article h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-bright);
}

article p {
  margin-bottom: 1rem;
}

article ul,
article ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

article li {
  margin-bottom: 0.25rem;
}

article blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

article pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

article code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

article p code {
  background: var(--color-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

/* Images: break out of prose column */
article img {
  max-width: var(--breakout-width);
  width: var(--breakout-width);
  margin-left: calc((var(--max-width) - var(--breakout-width)) / 2);
  height: auto;
  border-radius: 8px;
}

/* On small screens, images just go full width */
@media (max-width: 940px) {
  article img {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-1.25rem);
    border-radius: 0;
  }
}

/* Tables */
article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

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

article th {
  background: var(--color-surface);
  color: var(--color-text-bright);
  font-weight: 600;
}

article tr:nth-child(even) {
  background: rgba(22, 27, 34, 0.5);
}

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

/* Post list (index page) */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.75rem;
}

.post-list a {
  text-decoration: none;
  font-weight: 500;
  color: var(--color-text-bright);
}

.post-list a:hover {
  color: var(--color-accent);
}

.post-list time {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.post-list .excerpt {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}
