:root {
  --bg: #f8f6f1;
  --bg-alt: #efeae0;
  --text: #1a1a1a;
  --text-muted: #666;
  --accent: #8b4513;
  --border: #d4cfc4;
  --code-bg: #2d2d2d;
  --code-text: #f8f8f2;
}

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

html {
  font-size: 18px;
}

body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.7;
  position: relative;
}

/* Film grain overlay */
.grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

main {
  flex: 1;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

/* Profile header */
.profile {
  margin-bottom: 5rem;
  animation: fadeIn 0.8s ease-out;
}

.profile h1 {
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.tagline {
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.links {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.95rem;
}

.links a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

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

.separator {
  color: var(--text-muted);
}

/* Posts section */
.posts-section {
  animation: fadeIn 0.8s ease-out 0.2s backwards;
}

.posts-section h2 {
  font-size: 1rem;
  font-weight: 500;
  text-transform: lowercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.posts-list {
  list-style: none;
}

.posts-list li {
  margin-bottom: 1rem;
  animation: fadeIn 0.5s ease-out backwards;
}

.posts-list li:nth-child(1) { animation-delay: 0.3s; }
.posts-list li:nth-child(2) { animation-delay: 0.4s; }
.posts-list li:nth-child(3) { animation-delay: 0.5s; }
.posts-list li:nth-child(4) { animation-delay: 0.6s; }
.posts-list li:nth-child(5) { animation-delay: 0.7s; }

.posts-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  text-decoration: none;
  color: var(--text);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.posts-list a:hover {
  padding-left: 0.5rem;
  border-color: var(--text);
}

.post-title {
  font-size: 1.15rem;
}

.post-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 1rem;
}

.no-posts {
  font-style: italic;
  color: var(--text-muted);
  display: none;
}

/* Post page */
.post-page {
  padding-top: 3rem;
}

.back-nav {
  margin-bottom: 3rem;
}

.back-nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

article {
  animation: fadeIn 0.6s ease-out;
}

article h1 {
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

article .post-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 3rem;
}

article h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
}

article h3 {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
}

article p {
  margin-bottom: 1.25rem;
}

article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

article a:hover {
  text-decoration: none;
}

article ul, article ol {
  margin: 1.25rem 0;
  padding-left: 1.5rem;
}

article li {
  margin-bottom: 0.5rem;
}

article blockquote {
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-muted);
}

article code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: var(--bg-alt);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

article pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

article pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

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

/* Mermaid diagrams */
.mermaid {
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: 6px;
  margin: 1.5rem 0;
  text-align: center;
}

.loading {
  font-style: italic;
  color: var(--text-muted);
}

/* Footer */
footer {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }
  
  main {
    padding: 4rem 1.5rem 3rem;
  }
  
  .profile {
    margin-bottom: 4rem;
  }
  
  .profile h1 {
    font-size: 2rem;
  }
  
  .posts-list a {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .post-date {
    margin-left: 0;
  }
}

