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

/* Variables */
:root {
  --text: #333;
  --text-secondary: #666;
  --text-muted: #999;
  --bg: #fff;
  --border: #eee;
  --accent: #333;
  --accent-hover: #000;
  --code-bg: #f7f7f7;
  --sidebar-width: 240px;
}

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

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: #ccc;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: #333;
}

img {
  max-width: 100%;
  height: auto;
}

/* Layout: Sidebar + Content */
.site-wrapper {
  display: flex;
  min-height: 100vh;
  max-width: 1000px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  padding: 3rem 2rem 2rem 2rem;
  border-right: 1px solid var(--border);
}

.sidebar-inner {
  position: sticky;
  top: 3rem;
}

.avatar-link {
  display: block;
  text-decoration: none;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: block;
  margin-bottom: 1.2rem;
}

.site-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

.site-tagline {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1.8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.4;
}

/* Sidebar Navigation */
.site-nav {
  margin-bottom: 1.8rem;
}

.site-nav a {
  display: block;
  padding: 0.25rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Social Links */
.social-links {
  margin-bottom: 1.5rem;
}

.social-links a {
  display: block;
  padding: 0.15rem 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

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

/* Language Switch */
.lang-switch {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.lang-switch a {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--text);
}

/* Main Content Area */
.content {
  flex: 1;
  min-width: 0;
  padding: 3rem 3rem 2rem 3rem;
  display: flex;
  flex-direction: column;
}

.page-content {
  max-width: 640px;
  flex: 1;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

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

.post-date {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.2rem;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

.post-title a:hover {
  text-decoration: underline;
  text-decoration-color: #ccc;
}

.post-summary {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* Single Post */
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.6rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.post-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

.post-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

.post-content h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 2rem 0 0.8rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

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

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

.post-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--code-bg);
  padding: 1.2rem 1.4rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

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

.post-content blockquote {
  border-left: 3px solid #ddd;
  padding-left: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 1.3rem;
  font-style: italic;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
  text-align: left;
}

.post-content th {
  background: var(--code-bg);
  font-weight: 600;
}

.post-content img {
  border-radius: 2px;
  margin: 1rem 0;
}

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

/* Pagination */
.pagination {
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.88rem;
}

.page-link {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

a.page-link:hover {
  color: var(--text);
  background: var(--border);
  text-decoration: none;
}

.page-link.current {
  color: var(--bg);
  background: var(--text);
  font-weight: 600;
}

.page-link.disabled {
  color: var(--text-muted);
  cursor: default;
}

.page-numbers {
  display: flex;
  gap: 0.15rem;
}

.page-prev {
  margin-right: 0.5rem;
}

.page-next {
  margin-left: 0.5rem;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding-top: 3rem;
}

.site-footer p {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Experience Section */
.experience-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

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

.experience-item .role {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.experience-item .company {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.experience-item .period {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Skills */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skills-list span {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--code-bg);
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
  .site-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 2rem 1.5rem 1.5rem;
  }

  .sidebar-inner {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
  }

  .avatar {
    width: 60px;
    height: 60px;
    margin-bottom: 0;
  }

  .site-name {
    margin-bottom: 0;
  }

  .site-tagline {
    width: 100%;
    margin-bottom: 0.8rem;
  }

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

  .social-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
  }

  .lang-switch {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
  }

  .content {
    padding: 2rem 1.5rem;
  }

  .post-header h1 {
    font-size: 1.3rem;
  }
}
