/* ============================================================
   Card Theme — Dark, Clean, Responsive
   ============================================================ */
:root {
  --bg: #0d1117;
  --card: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #e94560;
  --tag-bg: #1c2541;
  --tag-text: #58a6ff;
  --code-bg: #1c2129;
  --sidebar-w: 240px;
  --radius: 10px;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  line-height: 1.7;
}

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

/* Layout */
.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: #0b0f16;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 40px 0;
  overflow-y: auto;
}

.sidebar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
}

.sidebar-avatar img {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: border-color .2s;
}
.sidebar-avatar img:hover { border-color: var(--accent); }

.sidebar-name {
  font-size: 20px; font-weight: 600;
  margin-top: 14px;
  color: var(--text);
}

.sidebar-bio {
  font-size: 12px; color: var(--muted);
  margin-top: 4px; text-align: center;
}

.sidebar-nav {
  margin-top: 32px;
  display: flex; flex-direction: column;
  gap: 4px; width: 100%;
}

.sidebar-nav a {
  display: block;
  padding: 8px 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  transition: all .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--card);
  color: var(--text);
}

.sidebar-links {
  margin-top: auto;
  display: flex; gap: 14px;
  padding-top: 24px;
}

.sidebar-links a {
  color: var(--muted); font-size: 13px;
  transition: color .15s;
}
.sidebar-links a:hover { color: var(--accent); }

/* Main */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 40px 32px 80px;
}

.main-inner {
  max-width: 720px;
  margin: 0 auto;
}

/* Category Cards */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 48px;
}

.category-card {
  position: relative;
  height: 220px;
  border-radius: 12px;
  overflow: hidden;
  display: block;
  border: 1px solid var(--border);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.category-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform .4s;
}

.category-card:hover .category-card-bg {
  transform: scale(1.05);
}

.category-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.35) 45%,
    rgba(0,0,0,0.5) 100%);
}

.category-card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
}

.category-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.category-card-count {
  font-size: 12px;
  color: var(--muted);
}

.category-card-desc {
  font-size: 13px;
  color: #aaa;
  margin-top: 6px;
  line-height: 1.5;
}

.section-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

/* Post Cards */
.post-list { display: flex; flex-direction: column; gap: 14px; }

.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: border-color .2s;
}

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

.post-card-meta {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}

.post-card-meta time {
  color: var(--muted);
  font-size: 12px;
  font-family: 'Menlo', 'Consolas', monospace;
}

.post-card-tags { display: flex; gap: 6px; }
.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 1px 8px;
  font-size: 11px;
  border-radius: 12px;
  white-space: nowrap;
}

.post-card-title {
  font-size: 18px; font-weight: 600;
  margin-bottom: 6px;
}

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

.post-card-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin-top: 40px;
  color: var(--muted); font-size: 13px;
}

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

.pagination .disabled {
  color: #444;
  pointer-events: none;
}

/* Post page */
.post { }
.post-header { margin-bottom: 28px; }

.post-header .post-title {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.5px; line-height: 1.3;
}

.post-meta {
  margin-top: 10px;
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px;
}

.post-tags { display: flex; gap: 6px; }
.post-tags .tag { font-size: 11px; }

.post-content {
  font-size: 15px; line-height: 1.8;
}

.post-content h1 { font-size: 24px; margin: 36px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.post-content h2 { font-size: 20px; margin: 32px 0 12px; }
.post-content h3 { font-size: 17px; margin: 24px 0 8px; color: var(--muted); }
.post-content h4 { font-size: 15px; margin: 20px 0 6px; color: var(--muted); }

.post-content p { margin: 12px 0; }
.post-content ul, .post-content ol { margin: 12px 0; padding-left: 24px; }
.post-content li { margin: 6px 0; }
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 18px; margin: 16px 0;
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
}

.post-content code {
  background: var(--code-bg);
  padding: 2px 6px; border-radius: 4px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 13px;
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  line-height: 1.6;
}

.post-content pre code {
  background: none; padding: 0; border-radius: 0;
}

.post-content table {
  width: 100%; border-collapse: collapse;
  margin: 16px 0; font-size: 14px;
}

.post-content th {
  background: var(--card);
  text-align: left; padding: 8px 14px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
}

.post-content td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}

.post-content tr:hover td { background: rgba(255,255,255,0.02); }

.post-content img {
  max-width: 100%; height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 12px 0;
}

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

.post-content strong { color: #f0f0f0; }

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

/* Lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  color: #888;
  font-size: 36px;
  cursor: pointer;
  transition: color .2s;
  line-height: 1;
}
.lightbox-close:hover { color: #fff; }

.post-content a:has(img) {
  cursor: zoom-in;
}

/* Responsive */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
  }
  .sidebar-nav { flex-direction: row; justify-content: center; gap: 0; }
  .sidebar-links { margin-top: 16px; }
  .main { margin-left: 0; padding: 24px 16px 60px; }
  .category-grid { grid-template-columns: 1fr; }
  .post-header .post-title { font-size: 22px; }
}
