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

/* Base */
:root {
  --text: #111;
  --text-light: #555;
  --accent: #7c3aed;
  --accent-hover: #5b21b6;
  --bg: #fff;
  --border: #e5e5e5;
  --code-bg: #f5f5f5;
  --max-width: 760px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

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

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

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

/* Hamburger Menu */
.menu-toggle {
  display: none;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 1001;
  position: relative;
}

.menu-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}

.menu-toggle:checked ~ .menu-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle:checked ~ .menu-btn span:nth-child(2) {
  opacity: 0;
}

.menu-toggle:checked ~ .menu-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Full-screen overlay nav */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.menu-toggle:checked ~ .menu-overlay {
  opacity: 1;
  visibility: visible;
}

.menu-close {
  display: none;
}

.menu-overlay ul {
  list-style: none;
  text-align: center;
}

.menu-overlay li {
  margin: 1.5rem 0;
}

.menu-overlay a {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

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

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

/* Home page */
.home-intro {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.headshot {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.home-intro h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.bio {
  color: var(--text-light);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

.home-posts h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

/* Post list */
.post-list {
  list-style: none;
}

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  font-weight: 500;
}

.post-list time {
  color: var(--text-light);
  font-size: 0.85rem;
  white-space: nowrap;
  margin-left: 1rem;
  font-variant-numeric: tabular-nums;
}

/* Single post */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-header time {
  color: var(--text-light);
  font-size: 0.9rem;
}

.post-tags {
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.post-tags a {
  font-weight: 500;
}

/* Post content */
.post-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.post-content h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.post-content h4 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.post-content li {
  margin-bottom: 0.35rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-style: italic;
}

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.post-content pre {
  margin-bottom: 1.5rem;
  overflow-x: auto;
  border-radius: 4px;
}

.post-content pre code {
  display: block;
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  background: var(--code-bg);
}

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

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.post-content th,
.post-content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.post-content th {
  font-weight: 600;
}

/* Figure shortcode */
figure {
  margin: 2rem 0;
}

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

figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-light);
  text-align: center;
}

/* List page */
.list-page h1 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

/* Tag list */
.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.tag-list a {
  font-weight: 500;
}

/* Series landing page */
.series-landing {
  max-width: var(--max-width);
  margin: 0 auto;
}

.series-landing-header {
  margin-bottom: 2rem;
}

.series-landing-header h1 {
  margin-bottom: 0.5rem;
}

.series-intro {
  color: var(--text-light);
  font-size: 1.05rem;
  line-height: 1.6;
}

.series-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-width: calc(3 * 260px + 2 * 0.75rem);
}

.series-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
  cursor: pointer;
}

.series-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: var(--text);
}

.series-card-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.series-card-description {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.5;
}

.series-card-count {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Mobile */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  main {
    padding: 1.5rem 1rem;
  }

  .header-inner {
    padding: 0.75rem 1rem;
  }

  .post-header h1 {
    font-size: 1.6rem;
  }

  .post-list li {
    flex-direction: column;
    gap: 0.15rem;
  }

  .post-list time {
    margin-left: 0;
  }

  .menu-overlay a {
    font-size: 1.5rem;
  }
}
