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

:root {
  --color-bg: #ffffff;
  --color-text: #111111;
  --color-text-secondary: #555555;
  --color-border: #e8e8e8;
  --color-muted: #999999;
  --max-width: 1100px;
  --max-width-narrow: 720px;
  --font-stack: "SF Pro Display", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  font-family: var(--font-stack);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

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

/* ===== Layout ===== */
header, main, footer {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.narrow {
  max-width: var(--max-width-narrow);
}

/* ===== Navigation ===== */
header {
  padding-top: 2rem;
  padding-bottom: 1rem;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.nav-name:hover {
  text-decoration: none;
}

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

.nav-links a {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

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

/* ===== Profile ===== */
.profile {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
  padding: 4rem 0 3rem;
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-info h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.0625rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.profile-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
}

.profile-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.profile-links a:hover {
  color: var(--color-text);
}

/* ===== Sections ===== */
section {
  padding: 1.5rem 0;
}

section h2 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

/* ===== About ===== */
.about p {
  margin-bottom: 1rem;
  color: var(--color-text-secondary);
}

.about p:last-child {
  margin-bottom: 0;
}

.about strong {
  color: var(--color-text);
}

.about a {
  color: var(--color-text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}

.about a:hover {
  text-decoration-color: var(--color-text-secondary);
}

/* ===== Recent Writing ===== */
.recent-writing {
  padding-top: 3rem;
}

.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  gap: 2rem;
}

.post-item:first-child {
  border-top: 1px solid var(--color-border);
}

.post-item:hover {
  text-decoration: none;
}

.post-item-title {
  font-weight: 500;
  font-size: 1rem;
  color: var(--color-text);
}

.post-item:hover .post-item-title {
  text-decoration: underline;
}

.post-item-date {
  font-size: 0.8125rem;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.view-all {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.view-all:hover {
  color: var(--color-text);
}

.placeholder {
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* ===== Footer ===== */
footer {
  margin-top: auto;
  padding-top: 3rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--color-border);
}

footer p {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* ===== Blog Listing ===== */
.blog-header {
  padding: 3rem 0 1rem;
}

.blog-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.blog-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: 0 0 2rem;
}

.blog-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.blog-list li:first-child {
  border-top: 1px solid var(--color-border);
}

.blog-list li:last-child {
  border-bottom: 1px solid var(--color-border);
}

.blog-list a {
  color: var(--color-text);
}

.blog-list a:hover {
  text-decoration: underline;
}

.blog-list h2 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.blog-list .post-date {
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* ===== Blog Post ===== */
.post-header {
  padding: 3rem 0 1rem;
}

.post-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.post-meta a {
  color: var(--color-muted);
}

.post-meta a:hover {
  color: var(--color-text);
}

article.post-content {
  padding: 1rem 0 2rem;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-text-secondary);
}

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

article.post-content h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

article.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

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

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

article.post-content blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 1rem;
  margin: 1.25rem 0;
  color: var(--color-muted);
  font-style: italic;
}

article.post-content img {
  border-radius: 4px;
  margin: 1rem 0;
}

article.post-content code {
  background: #f5f5f5;
  padding: 0.15em 0.35em;
  border-radius: 3px;
  font-size: 0.9em;
}

article.post-content pre {
  background: #1a1a1a;
  color: #e5e5e5;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

article.post-content pre code {
  background: none;
  padding: 0;
}

article.post-content a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-border);
  text-underline-offset: 2px;
}

article.post-content a:hover {
  text-decoration-color: var(--color-text);
}

.substack-attribution {
  padding: 1rem 0;
  font-size: 0.875rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
  margin-top: 1rem;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}

.post-nav a {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.post-nav a:hover {
  color: var(--color-text);
}

.post-nav .prev::before {
  content: "\2190\00a0";
}

.post-nav .next::after {
  content: "\00a0\2192";
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .profile {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 1.5rem;
    padding: 2.5rem 0 2rem;
  }

  .profile-photo {
    width: 140px;
    height: 140px;
  }

  .profile-links {
    justify-content: center;
  }

  .profile-info h1 {
    font-size: 1.75rem;
  }

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

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

  .blog-header h1 {
    font-size: 1.5rem;
  }

  .post-nav {
    flex-direction: column;
  }
}
