:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #7a8194;
  --line: #e9ecf3;
  --brand: #3b6cff;
  --brand-2: #6a4bff;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(31, 36, 48, 0.06);
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; font-size: 14px;
  transition: .15s;
}
.btn:hover { border-color: #cfd6e6; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #2f5be0; }
.btn.danger { color: #e23b50; border-color: #f3c2c9; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .nav { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav-links { display: flex; gap: 6px; margin-left: auto; }
.nav-links a {
  padding: 8px 12px; border-radius: 9px; font-size: 14.5px; color: #40475a;
}
.nav-links a:hover, .nav-links a.active { background: #eef2ff; color: var(--brand); }
.nav-admin { font-weight: 600; }
.nav-avatar img {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; border: 2px solid rgba(255,255,255,.5);
  vertical-align: middle; margin-left: 4px;
}
.nav-toggle { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }

/* Layout */
.site-main { padding: 28px 20px 48px; }
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.content { min-width: 0; }
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 6px 0 16px; }
.section-title h2 { font-size: 20px; margin: 0; }

/* Featured */
.featured {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); margin-bottom: 26px;
}
.featured-cover { position: relative; min-height: 230px; overflow: hidden; }
.featured-cover img { width: 100%; height: 100%; object-fit: cover; }
.featured-badge {
  position: absolute; top: 14px; left: 14px; background: var(--brand);
  color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 100px; font-weight: 600;
}
.featured-body { padding: 26px; display: flex; flex-direction: column; justify-content: center; }
.featured-body .cat { color: var(--brand); font-size: 13px; font-weight: 600; }
.featured-body h2 { margin: 8px 0 10px; font-size: 23px; line-height: 1.3; }
.featured-body p { color: var(--muted); margin: 0 0 14px; }
.featured-body .meta { display: flex; gap: 16px; color: var(--muted); font-size: 13px; }

/* Grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s;
  display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(31,36,48,.1); }
.card-cover { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cat {
  position: absolute; left: 10px; bottom: 10px; background: rgba(20,22,30,.6);
  color: #fff; font-size: 12px; padding: 3px 9px; border-radius: 100px; backdrop-filter: blur(4px);
}
.card-body { padding: 14px 15px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 16px; line-height: 1.35; }
.card-body h3 a:hover { color: var(--brand); }
.card-excerpt {
  margin: 0; color: var(--muted); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: auto; }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg,var(--brand),var(--brand-2));
  color: #fff; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}

/* Gradients for covers without image */
.grad { position: absolute; inset: 0; display: block; }
.grad-1 { background: linear-gradient(135deg,#1f2a52,#3b6cff); }
.grad-2 { background: linear-gradient(135deg,#3a1c52,#a14bff); }
.grad-3 { background: linear-gradient(135deg,#063b3a,#16c2a3); }
.grad-4 { background: linear-gradient(135deg,#522400,#ff8a3b); }
.grad.small { position: relative; width: 56px; height: 40px; border-radius: 8px; }

/* Sidebar */
.sidebar { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }
.widget { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.widget h4 { margin: 0 0 12px; font-size: 15px; }
.search-widget form { display: flex; gap: 8px; }
.search-widget input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.search-widget button { border: 0; background: var(--brand); color: #fff; border-radius: 10px; padding: 0 12px; cursor: pointer; }
.about-widget { text-align: center; }
.about-avatar {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 10px; overflow: hidden;
  background: linear-gradient(135deg,var(--brand),var(--brand-2)); color: #fff;
  font-size: 26px; display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.about-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.about-widget p { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }
.cat-widget ul, .pop-list { list-style: none; margin: 0; padding: 0; }
.cat-widget li a { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); color: #40475a; font-size: 14px; }
.cat-widget li:last-child a { border-bottom: 0; }
.cat-widget li a:hover { color: var(--brand); }
.cat-widget li a span { color: var(--muted); }
.pop-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.pop-list li:last-child { border-bottom: 0; }
.pop-list a { color: #40475a; }
.pop-list a:hover { color: var(--brand); }
.pop-list span { color: var(--muted); flex: none; }

/* Pager */
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.pager a { padding: 8px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 14px; }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager a.cur { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Post detail */
.post .back { color: var(--muted); font-size: 14px; }
.post .back:hover { color: var(--brand); }
.post-cover { position: relative; aspect-ratio: 21/9; border-radius: var(--radius); overflow: hidden; margin: 10px 0 18px; box-shadow: var(--shadow); }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post h1 { font-size: 30px; line-height: 1.25; margin: 0 0 12px; }
.post-meta { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.post-meta .cat { background: #eef2ff; color: var(--brand); padding: 3px 10px; border-radius: 100px; font-size: 13px; }
.post-content { font-size: 16px; }
.post-content h2 { font-size: 22px; margin: 28px 0 12px; }
.post-content h3 { font-size: 18px; margin: 22px 0 10px; }
.post-content p { margin: 12px 0; }
.post-content pre { background: #1f2430; color: #e6e9f0; padding: 14px 16px; border-radius: 10px; overflow: auto; font-size: 13.5px; }
.post-content code { background: #eef1f7; padding: 2px 6px; border-radius: 6px; font-size: 13.5px; }
.post-content pre code { background: none; padding: 0; }
.post-content blockquote { border-left: 4px solid var(--brand); margin: 14px 0; padding: 4px 16px; color: var(--muted); background: #f3f6ff; border-radius: 0 8px 8px 0; }
.post-content ul, .post-content ol { padding-left: 22px; }
.post-content img { border-radius: 10px; margin: 12px 0; }
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.post-tags a { background: #eef2ff; color: var(--brand); padding: 5px 12px; border-radius: 100px; font-size: 13px; }
.related { margin-top: 36px; }
.related h3 { font-size: 18px; margin: 0 0 14px; }

/* About / empty */
.about-page { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.about-hero { width: 72px; height: 72px; border-radius: 18px; background: linear-gradient(135deg,var(--brand),var(--brand-2)); color: #fff; font-size: 34px; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-bottom: 14px; }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--muted); }
.empty.center h1 { font-size: 60px; margin: 0 0 8px; color: var(--brand); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 22px 0; color: var(--muted); font-size: 13px; text-align: center; }

/* Responsive */
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .featured { grid-template-columns: 1fr; }
  .featured-cover { min-height: 180px; }
  .nav-links { display: none; position: absolute; top: 64px; right: 12px; left: 12px; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; margin-left: auto; }
}
