:root {
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --fg: #1c1917;
  --fg-secondary: #44403c;
  --accent: #b45309;
  --accent-hover: #92400e;
  --muted: #78716c;
  --border: #e7e5e4;
  --code-bg: #f5f5f4;
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.06);
  --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --bg-alt: #292524;
    --fg: #e7e5e4;
    --fg-secondary: #a8a29e;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --muted: #a8a29e;
    --border: #44403c;
    --code-bg: #292524;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  font-size: 19px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--accent);
  transition: color 0.15s ease;
}

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

/* Header */
.site-header {
  padding: 2.5rem 0 2rem;
  margin-bottom: 3rem;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  text-decoration: none;
  color: var(--fg);
}

.site-brand:hover {
  color: var(--fg);
}

.site-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.site-avatar-default {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

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

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--fg);
}

/* Main */
.site-main {
  min-height: 60vh;
  padding-bottom: 4rem;
}

/* About Section */
.about-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.about-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.about-text {
  color: var(--fg-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Posts List */
.posts-list > h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2rem;
}

/* Post Card */
.post-card {
  margin-bottom: 4rem;
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
}

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

.post-card-image {
  margin-bottom: 1rem;
}

.post-card-image img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

.post-card-title {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
}

.post-card-title a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.post-card-date {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.post-card-tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.post-card-content {
  margin-top: 0;
}

/* Single Post */
.post {
  max-width: var(--max-width);
}

.post-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.post-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-author {
  color: var(--fg);
  font-weight: 600;
  font-size: 0.9rem;
}

.post-date {
  font-size: 0.9rem;
}

.post-tags {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.post-cover {
  margin-bottom: 2.5rem;
}

.post-cover img {
  width: 100%;
  height: auto;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

/* Post Content */
.post-content {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.post-content h2 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.post-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

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

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

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

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

.post-content code {
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1.25rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

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

.post-content img,
.post-content video {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

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

.post-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--fg-secondary);
}

.post-source-link {
  color: var(--fg-secondary);
  text-decoration: none;
}

.post-source-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--bg-alt);
  color: var(--muted);
  text-decoration: none;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}

.tag:hover {
  background: var(--accent);
  color: white;
}

/* Footer */
.site-footer {
  padding: 2.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

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

/* No posts */
.no-posts {
  color: var(--muted);
  text-align: center;
  padding: 4rem 0;
  font-size: 1.05rem;
}

/* Archive */
.archive-page h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

.archive-year-section {
  margin-bottom: 3rem;
}

.archive-year-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.archive-year-section h2 a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}

.archive-year-section h2 a:hover {
  color: var(--accent);
}

.archive-year-nav {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.archive-year-nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.archive-year-nav a:hover {
  color: var(--accent);
}

.archive-month {
  margin-bottom: 1.5rem;
}

.archive-month h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-secondary);
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.archive-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.4rem 0;
}

.archive-item time {
  color: var(--muted);
  font-size: 0.875rem;
  min-width: 2rem;
  font-variant-numeric: tabular-nums;
}

.archive-item a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

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

.archive-loading {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  padding: 0.5rem 0;
}

/* Older posts link */
.older-posts-link {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
}

.older-posts-link a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}

.older-posts-link a:hover {
  color: var(--accent);
}

/* Tag Page */
.tag-page h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

/* Pagination */
.pagination {
  margin-top: 3rem;
  padding-top: 2rem;
}

.pagination-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
}

.pagination-link {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

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

.pagination-current {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
  cursor: default;
}

.pagination-current:hover {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Comments Section */
.comments-section {
  margin-top: 3.5rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.comments-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.comments-list {
  margin-bottom: 2rem;
}

.comment {
  padding: 1.25rem 1.5rem;
  background: var(--bg-alt);
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
}

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

.comment-author a:hover {
  text-decoration: underline;
}

.comment-date {
  color: var(--muted);
  font-size: 0.8rem;
}

.comment-body {
  line-height: 1.6;
  font-size: 0.95rem;
  color: var(--fg-secondary);
}

.no-comments {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* Comment Form */
.comment-form-wrapper {
  margin-top: 2rem;
  padding: 1.75rem;
  background: var(--bg-alt);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

.comment-form-wrapper h3 {
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.comment-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.comment-form .form-group {
  margin-bottom: 1rem;
}

.comment-form label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.15s ease;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form textarea {
  resize: vertical;
}

.submit-comment {
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.submit-comment:hover {
  background: var(--accent-hover);
}

.comment-notice {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.success-message {
  color: #16a34a;
  padding: 1rem;
  background: rgba(22, 163, 74, 0.08);
  border-radius: 0.375rem;
  font-weight: 500;
}

/* About Page */
.about-page h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 2.5rem;
}

.about-page-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
}

.about-page-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.about-page-author {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.about-page-body {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.about-page-body h2 {
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.about-page-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.about-page-body p {
  margin-bottom: 1.25rem;
}

.about-page-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-page-body ul,
.about-page-body ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
}

.about-page-body li {
  margin-bottom: 0.375rem;
}

.about-page-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin-left: 0;
  margin-bottom: 1.25rem;
  color: var(--fg-secondary);
  font-style: italic;
}

.about-page-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    font-size: 17px;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .site-nav {
    gap: 1.25rem;
  }

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

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

  .about-section {
    flex-direction: column;
    text-align: center;
  }

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

  .pagination-list {
    gap: 0.25rem;
  }

  .pagination-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.85rem;
  }

  .comment-form .form-row {
    grid-template-columns: 1fr;
  }
}
