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

/* ===== CSS Variables — Light (default) ===== */
:root {
  --bg: #ffffff;
  --bg-secondary: #f7f7f8;
  --text: #1a1a2e;
  --text-secondary: #555;
  --accent: #4361ee;
  --accent-hover: #3a56d4;
  --border: #e0e0e0;
  --code-bg: #f4f4f5;
  --tag-bg: #eef1ff;
  --tag-text: #4361ee;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-width: 720px;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --text: #e0e0e0;
  --text-secondary: #a0a0b0;
  --accent: #7c8cf8;
  --accent-hover: #9aa5ff;
  --border: #2a2a3e;
  --code-bg: #1e1e30;
  --tag-bg: #1e1e30;
  --tag-text: #7c8cf8;
}

/* ===== Body ===== */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background 0.3s, color 0.3s;
}

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

/* ===== Header ===== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

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

/* ===== Theme Toggle ===== */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  line-height: 1;
  transition: border-color 0.2s;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

.icon-moon { display: none; }

[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: inline; }

/* ===== Hero ===== */
.hero {
  padding: 4rem 0 2rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
}

/* ===== Post List ===== */
.recent-posts h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

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

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

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

.post-list h2,
.post-list h3 {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.2rem;
}

.post-list h2 a,
.post-list h3 a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

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

.post-list p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.see-all {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.see-all:hover {
  text-decoration: underline;
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ===== Single Post ===== */
.post-header {
  padding: 3rem 0 1.5rem;
}

.post-header h1 {
  font-size: 2rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

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

/* ===== Post Content ===== */
.post-content {
  padding-bottom: 3rem;
}

.post-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
}

.post-content h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem;
}

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

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

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

.post-content ul, .post-content ol {
  margin: 0 0 1.25rem 1.5rem;
}

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

.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 code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

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

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

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

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

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

.social-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.social-links a {
  font-weight: 500;
  transition: color 0.2s;
}

.social-links a:hover {
  text-decoration: underline;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
  list-style: none;
}

.pagination a, .pagination span {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

.pagination .active a {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.8rem; }
  .post-header h1 { font-size: 1.5rem; }
  .header-inner { gap: 0.5rem; }
}
