/* ===================================
   CSS Variables
   =================================== */
:root {
  --color-bg: #F5F1E8;
  --color-text: #1A1A1A;
  --color-accent: #E63946;
  --color-subtle: #D0C9B8;
  --font-serif: Charter, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: Consolas, Monaco, "Courier New", monospace;
  --max-width: 700px;
  --spacing-unit: 1.5rem;
}

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

html {
  font-size: 18px;
  line-height: 1.7;
}

body {
  font-family: var(--font-serif);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   Typography
   =================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1.5rem;
}

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

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

/* ===================================
   Layout
   =================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-unit);
}

main {
  min-height: calc(100vh - 200px);
  padding: var(--spacing-unit) 0;
}

/* ===================================
   Header & Navigation
   =================================== */
.site-header {
  padding: var(--spacing-unit) 0;
  border-bottom: 1px solid var(--color-subtle);
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.site-title a {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}

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

.site-nav {
  margin-top: 0.5rem;
}

.site-nav a {
  color: var(--color-text);
  margin-right: 1.5rem;
  text-decoration: none;
  font-family: var(--font-sans);
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--color-accent);
}

/* ===================================
   Footer
   =================================== */
.site-footer {
  padding: var(--spacing-unit) 0;
  margin-top: calc(var(--spacing-unit) * 2);
}

.site-footer p {
  font-size: 0.9rem;
  color: var(--color-subtle);
  margin-bottom: 0;
}

/* ===================================
   Lists
   =================================== */
ul, ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* ===================================
   Code Blocks
   =================================== */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 0.2em 0.4em;
  border-radius: 3px;
}

pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  background-color: rgba(0, 0, 0, 0.05);
  padding: 1rem;
  border-radius: 5px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

pre code {
  background-color: transparent;
  padding: 0;
  border-radius: 0;
}

/* ===================================
   Blockquotes
   =================================== */
blockquote {
  border-left: 3px solid var(--color-accent);
  padding-left: 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #4A4A4A;
}

/* ===================================
   Home Page
   =================================== */
.home-intro {
  margin-bottom: calc(var(--spacing-unit) * 2);
}

.home-intro h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

/* ===================================
   Blog Listing
   =================================== */
.post-list {
  list-style: none;
  padding-left: 0;
}

.post-list-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-subtle);
}

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

.post-list-item h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-list-item h2 a {
  color: var(--color-text);
}

.post-list-item h2 a:hover {
  color: var(--color-accent);
}

.post-meta {
  font-size: 0.9rem;
  color: var(--color-subtle);
  font-family: var(--font-sans);
  margin-bottom: 0.5rem;
}

.post-excerpt {
  margin-top: 0.75rem;
}

/* Compact blog list by year */
.year-section {
  margin-bottom: 3rem;
}

.year-heading {
  font-size: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.posts-by-year {
  list-style: none;
  padding-left: 0;
}

.post-item-compact {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-family: var(--font-sans);
}

.post-month {
  min-width: 2.5rem;
  text-align: left;
  font-size: 0.95rem;
  color: var(--color-text);
}

.post-day {
  min-width: 1.5rem;
  text-align: right;
  font-size: 0.95rem;
  color: var(--color-text);
}

.post-title-link {
  flex: 1;
  color: var(--color-text);
  text-decoration: underline;
}

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

.post-category {
  font-size: 0.9rem;
  color: var(--color-subtle);
  margin-left: auto;
}

.post-count {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--color-subtle);
}

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

.post-title {
  margin-bottom: 0.5rem;
}

.post-tags,
.post-categories {
  margin-top: 2rem;
  font-size: 0.9rem;
}

.post-tags a,
.post-categories a {
  display: inline-block;
  margin-right: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.75rem;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 3px;
  color: var(--color-text);
}

.post-tags a:hover,
.post-categories a:hover {
  background-color: var(--color-accent);
  color: var(--color-bg);
  text-decoration: none;
}

.post-nav {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-subtle);
  display: flex;
  justify-content: space-between;
}

.post-nav a {
  font-family: var(--font-sans);
}

.post-nav-next {
  text-align: right;
}

/* ===================================
   Projects
   =================================== */
.project-list {
  list-style: none;
  padding-left: 0;
}

.project-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--color-subtle);
}

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

.project-item h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.project-item h2 a {
  color: var(--color-text);
}

.project-item h2 a:hover {
  color: var(--color-accent);
}

/* ===================================
   Pagination
   =================================== */
.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  font-family: var(--font-sans);
}

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

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

.pagination .disabled {
  color: var(--color-subtle);
  pointer-events: none;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .site-nav {
    display: flex;
    gap: 1rem;
  }

  .site-nav a {
    margin-right: 0;
  }

  .post-nav {
    flex-direction: column;
    gap: 1rem;
  }

  .post-nav-next {
    text-align: left;
  }
}
