/* CSS Variables */
:root {
  --color-bg: #faf9f7;
  --color-bg-secondary: #f0efed;
  --color-text: #2c2c2c;
  --color-text-secondary: #666;
  --color-accent: #c84b31;
  --color-link: #2c2c2c;
  --color-link-hover: var(--color-accent);
  --color-border: #e0ddd9;
  --color-code-bg: #f5f4f2;
  
  --font-serif: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;
  
  --max-width: 640px;
  --spacing: 1.5rem;
}

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

/* Base */
html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-serif);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--spacing);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 0.75em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }

p {
  margin-bottom: 1.25em;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

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

/* Header */
header {
  padding: 2rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.01em;
}

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

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

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-text);
}

/* Main */
main {
  flex: 1;
}

/* Home */
.home h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.home > p:first-of-type {
  font-size: 1.15rem;
  color: var(--color-text-secondary);
}

.recent-posts {
  margin-top: 3rem;
}

.recent-posts h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

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

.post-list li {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
  align-items: baseline;
}

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

.post-list time {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  width: 75px;
  white-space: nowrap;
  word-spacing: -0.15em;
}

.post-list a {
  text-decoration: none;
}

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

/* Post */
.post-header {
  margin-bottom: 2.5rem;
}

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

.post-header time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.post-content {
  font-size: 1rem;
}

.post-content h2 {
  margin-top: 2.5rem;
}

.post-content h3 {
  margin-top: 2rem;
}

/* Heading anchor links */
.heading-anchor {
  position: relative;
  margin-left: -1.5em;
  padding-left: 1.5em;
}

.anchor-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
  align-items: center;
}

.anchor-link svg {
  width: 0.8em;
  height: 0.8em;
}

.heading-anchor:hover .anchor-link {
  opacity: 1;
}

.anchor-link:hover {
  color: var(--color-accent);
}

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

.post-content li {
  margin-bottom: 0.5em;
}

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

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--color-code-bg);
  padding: 1.25rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.15;
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.75rem;
  line-height: 1.15;
}

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

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

/* Page */
.page h1 {
  margin-bottom: 1.5rem;
}

/* Footer */
footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
}

footer p {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Responsive */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }
  
  .home h1 {
    font-size: 2rem;
  }
  
  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .post-list time {
    width: auto;
  }
}
