/* ==========================================================================
   CSS Variables & Base Styles
   ========================================================================== */

:root {
  --bg-primary: #faf9f7;
  --bg-secondary: #f0eeeb;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #737373;
  --accent: #c53030;
  --accent-hover: #e53e3e;
  --border: #e5e2de;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 680px;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

main {
  flex: 1;
  padding: 2rem 0;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

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

.nav-brand {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

.nav-brand:hover {
  color: var(--accent);
}

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

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

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

.nav-btn {
  background: var(--accent);
  color: #ffffff !important;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-weight: 500;
  transition: background var(--transition);
}

.nav-btn:hover {
  background: var(--accent-hover);
  color: #ffffff !important;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

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

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

/* ==========================================================================
   Hero Section (Home)
   ========================================================================== */

.hero {
  padding: 4rem 0;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.hero-bio {
  font-size: 1.1rem;
  line-height: 1.8;
  max-width: 580px;
}

.hero-bio a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ==========================================================================
   Social Links
   ========================================================================== */

.social-links {
  display: flex;
  gap: 1.25rem;
  margin-top: 2rem;
}

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

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

.social-links svg {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   Highlights Section
   ========================================================================== */

.highlights {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.highlights h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.highlights ul {
  list-style: none;
}

.highlights li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  padding-left: 1rem;
  position: relative;
}

.highlights li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ==========================================================================
   Blog List
   ========================================================================== */

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

.posts-year {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 2rem 0 1rem 0;
}

.posts-year:first-of-type {
  margin-top: 0;
}

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

.post-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

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

.post-link {
  display: block;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

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

.post-title {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

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

.post-excerpt {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* ==========================================================================
   Blog Post Content
   ========================================================================== */

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

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

.post-header .post-meta {
  font-size: 0.95rem;
}

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

.post-content h2 {
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.post-content h3 {
  color: var(--text-primary);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

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

.post-content ul,
.post-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

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

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-secondary);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.post-content pre {
  background: var(--bg-secondary);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

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

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

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

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   About Page
   ========================================================================== */

.about-content {
  padding: 2rem 0;
}

.about-content h1 {
  margin-bottom: 1.5rem;
}

.about-content p {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

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

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
  h1 {
    font-size: 2rem;
  }

  .hero {
    padding: 2.5rem 0;
  }

  .hero-bio {
    font-size: 1rem;
  }

  .nav-links {
    gap: 1rem;
  }
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.loading {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

.error {
  text-align: center;
  padding: 3rem 0;
  color: #ef4444;
}