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

/* Base */
:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #666666;
  --border: #e0e0e0;
  --accent: #0066cc;
  --icon: #888888;
  --code-bg: #f5f5f5;
  --font: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
  --width: 72ch;
}

html {
  font-size: 15px;
  line-height: 1.6;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  max-width: var(--width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-title:hover {
  text-decoration: none;
  color: var(--accent);
}

.site-nav a {
  font-size: 0.9rem;
  color: var(--muted);
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

.about-page {
  line-height: 1.75;
}

.about-page h1 {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.about-page p {
  margin-bottom: 1.25em;
}

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

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--muted);
}

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

/* Home: about blurb */
.about {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.7;
}

/* Home: post list */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.post-row {
  display: grid;
  grid-template-columns: 1.5ch 10ch 1fr;
  gap: 0 1rem;
  align-items: start;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.post-icon {
  color: var(--icon);
  text-align: center;
  font-style: normal;
  user-select: none;
}

.post-date {
  color: var(--muted);
  white-space: nowrap;
  font-size: 0.875rem;
}

.post-summary {
  min-width: 0;
}

.post-title {
  display: block;
  color: var(--text);
  font-weight: bold;
}

.post-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-description {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.15rem;
}

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

/* Post page */
.post {
  max-width: 100%;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1.3;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.post-header time {
  color: var(--muted);
  font-size: 0.875rem;
  display: block;
  margin-bottom: 0.4rem;
}

.post-type-badge {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--icon);
  border: 1px solid var(--border);
  padding: 0.1em 0.5em;
  border-radius: 2px;
}

/* Post body prose */
.post-body {
  line-height: 1.75;
}

.post-body p {
  margin-bottom: 1.25em;
}

.post-body h2 {
  font-size: 1.1rem;
  font-weight: bold;
  margin: 2em 0 0.5em;
  letter-spacing: -0.01em;
}

.post-body h3 {
  font-size: 1rem;
  font-weight: bold;
  margin: 1.5em 0 0.4em;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.25em 1.5em;
}

.post-body li {
  margin-bottom: 0.25em;
}

.post-body code {
  font-family: var(--font);
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 2px;
  font-size: 0.9em;
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.25em;
  border-radius: 2px;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
}

.post-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--muted);
  margin: 0 0 1.25em;
}

.post-body a {
  text-decoration: underline;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* CTA link (external posts) */
.post-cta {
  margin: 2rem 0;
}

.cta-link {
  display: inline-block;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4em 0.9em;
  border-radius: 2px;
  font-weight: bold;
}

.cta-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.cta-url {
  margin-top: 0.4em;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
}

/* Post nav */
.post-nav {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}

/* Images in posts */
.post-image {
  margin: 1.5em 0;
}

.post-image.block {
  display: block;
  text-align: center;
}

.post-image.block img {
  max-width: 100%;
  height: auto;
}

.post-image.float-right {
  float: right;
  margin: 0 0 1em 1.5em;
  max-width: 40%;
}

.post-image.float-left {
  float: left;
  margin: 0 1.5em 1em 0;
  max-width: 40%;
}

.post-image img {
  max-width: 100%;
  height: auto;
  display: block;
}

figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.4em;
  text-align: center;
}

/* Clearfix for floated images */
.post-body::after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive: collapse grid on narrow screens */
@media (max-width: 600px) {
  .post-row {
    grid-template-columns: 1.5ch 1fr;
    grid-template-rows: auto auto;
  }

  .post-date {
    grid-column: 2;
    grid-row: 1;
  }

  .post-summary {
    grid-column: 2;
    grid-row: 2;
  }

  .post-icon {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: start;
  }

  .post-image.float-right,
  .post-image.float-left {
    float: none;
    max-width: 100%;
    margin: 1.5em 0;
  }
}
