/*
Theme Name: 星尘小记
Theme URI: https://your-domain.com
Author: 小星
Author URI: https://your-domain.com
Description: 一个简约、优雅、支持深色模式的个人博客主题。适合写作者、程序员、设计师使用。
Version: 1.0.0
License: GPL v2 or later
Text Domain: xingchen-blog
*/

/* ===== CSS Variables ===== */
:root {
  --bg: #faf9f7;
  --bg-card: #ffffff;
  --bg-nav: rgba(255,255,255,0.85);
  --text: #2c2c2c;
  --text-light: #6b6b6b;
  --border: #e8e5e0;
  --accent: #d4a574;
  --accent-hover: #c4915e;
  --tag-bg: #f3ede7;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --radius: 16px;
}
[data-theme="dark"] {
  --bg: #1a1a1e;
  --bg-card: #242428;
  --bg-nav: rgba(26,26,30,0.88);
  --text: #e8e6e3;
  --text-light: #9c9a96;
  --border: #333337;
  --accent: #d4a574;
  --accent-hover: #e0b88c;
  --tag-bg: #2e2e33;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

/* ===== Reset & Base ===== */
*,*::before,*::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  transition: background .4s, color .4s;
}

/* ===== Nav ===== */
nav {
  position: fixed; top:0; left:0; right:0; z-index:100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);
  transition: background .4s, border .4s;
}
.nav-inner {
  max-width: 1100px; margin:0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
}
.nav-logo {
  font-size: 1.3rem; font-weight: 700; letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent), #b8a0c0);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  text-decoration: none; color: var(--text-light); font-size: .92rem;
  transition: color .3s; position: relative;
}
.nav-links a::after {
  content:''; position:absolute; bottom:-4px; left:0; width:0; height:2px;
  background: var(--accent); transition: width .3s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { width: 100%; }

.theme-toggle {
  background: none; border: 2px solid var(--border); border-radius: 50%;
  width: 38px; height: 38px; cursor: pointer; font-size: 1.15rem;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); transition: all .3s;
  padding: 0;
}
.theme-toggle:hover { border-color: var(--accent); transform: rotate(15deg); }

/* ===== Hero ===== */
.hero {
  margin-top: 64px; padding: 80px 24px 60px;
  text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: '✧'; position: absolute; top: 30px; left: 10%;
  font-size: 4rem; opacity: 0.08; animation: float 6s ease-in-out infinite;
}
.hero::after {
  content: '✦'; position: absolute; bottom: 20px; right: 12%;
  font-size: 3rem; opacity: 0.07; animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}
.hero h1 {
  font-size: 2.8rem; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 12px;
}
.hero p {
  color: var(--text-light); font-size: 1.08rem; max-width: 500px; margin:0 auto 28px;
}

/* ===== Page Hero ===== */
.page-hero {
  margin-top: 64px; padding: 50px 24px 40px;
  text-align: center;
}
.page-hero h1 {
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 8px;
}
.page-hero p { color: var(--text-light); }

/* ===== Layout ===== */
.container {
  max-width: 1100px; margin:0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 1fr 300px; gap: 40px;
}
.container-full {
  max-width: 800px; margin:0 auto; padding: 0 24px 60px;
}

/* ===== Posts ===== */
.posts { padding-bottom: 60px; }
.posts-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px;
}
.posts-header h2 { font-size: 1.4rem; }

.post-card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 28px 32px; margin-bottom: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: transform .3s, box-shadow .3s;
  position: relative; overflow: hidden;
  text-decoration: none; color: inherit; display: block;
}
.post-card::before {
  content:''; position:absolute; top:0; left:0; width:4px; height:100%;
  background: linear-gradient(180deg, var(--accent), #b8a0c0);
  opacity: 0; transition: opacity .3s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
.post-card:hover::before { opacity: 1; }
.post-card:hover .post-card-title { color: var(--accent); }

.post-card .post-meta {
  display: flex; gap: 16px; align-items: center;
  font-size: .82rem; color: var(--text-light); margin-bottom: 10px;
  flex-wrap: wrap;
}
.post-card .post-meta .category {
  background: var(--tag-bg); padding: 2px 12px; border-radius: 20px;
  font-size: .75rem; color: var(--accent); text-decoration: none;
}
.post-card-title {
  font-size: 1.25rem; margin-bottom: 8px; transition: color .3s;
}
.post-card .excerpt {
  color: var(--text-light); font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 14px;
}
.post-card .post-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.post-card .post-tags a {
  background: var(--tag-bg); padding: 2px 10px; border-radius: 12px;
  font-size: .75rem; color: var(--text-light); text-decoration: none;
  transition: color .3s;
}
.post-card .post-tags a:hover { color: var(--accent); }

/* Pagination */
.pagination {
  text-align: center; margin: 32px 0;
}
.pagination .page-numbers {
  display: inline-block; padding: 8px 16px; margin: 0 4px;
  border: 1px solid var(--border); border-radius: 10px;
  text-decoration: none; color: var(--text-light); transition: all .3s;
  background: var(--bg-card);
}
.pagination .page-numbers:hover,
.pagination .page-numbers.current {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ===== Article Detail ===== */
.article-detail {
  margin-top: 64px; padding: 40px 24px 60px;
}
.article-header {
  max-width: 800px; margin: 0 auto 32px; text-align: center;
}
.article-header .breadcrumb {
  font-size: .85rem; color: var(--text-light); margin-bottom: 12px;
}
.article-header .breadcrumb a {
  color: var(--accent); text-decoration: none;
}
.article-header .breadcrumb a:hover { text-decoration: underline; }
.article-header h1 {
  font-size: 2rem; font-weight: 800; margin-bottom: 12px;
}
.article-header .article-meta {
  display: flex; justify-content: center; gap: 20px;
  color: var(--text-light); font-size: .88rem; flex-wrap: wrap;
}
.article-content {
  max-width: 800px; margin: 0 auto;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 40px 48px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.article-content p {
  margin-bottom: 1.2em; font-size: 1.02rem;
}
.article-content h2 {
  font-size: 1.4rem; margin: 1.8em 0 0.6em;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.article-content h3 { font-size: 1.15rem; margin: 1.4em 0 0.5em; }
.article-content ul, .article-content ol {
  margin: 0.8em 0 1.2em 1.6em;
}
.article-content li { margin-bottom: 0.4em; }
.article-content blockquote {
  border-left: 4px solid var(--accent); margin: 1em 0;
  padding: 12px 20px; background: var(--tag-bg); border-radius: 0 8px 8px 0;
  color: var(--text-light);
}
.article-content code {
  background: var(--tag-bg); padding: 2px 8px; border-radius: 4px;
  font-size: .9em;
}
.article-content pre {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; overflow-x: auto;
  margin: 1em 0;
}
.article-content pre code {
  background: none; padding: 0; font-size: .88rem;
}
.article-content img {
  max-width: 100%; border-radius: 12px; margin: 1em 0;
  height: auto;
}
.article-content a { color: var(--accent); }
.article-content .wp-block-quote { border-left: 4px solid var(--accent); }
.article-content .wp-block-code { border-radius: 12px; }
.article-content .wp-block-image img { border-radius: 12px; }

.article-footer {
  max-width: 800px; margin: 32px auto 0;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px;
}
.article-footer .article-tags {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.article-footer .article-tags a {
  background: var(--tag-bg); padding: 4px 14px; border-radius: 20px;
  font-size: .82rem; color: var(--text-light); text-decoration: none;
  transition: all .3s;
}
.article-footer .article-tags a:hover { background: var(--accent); color: #fff; }

.article-nav {
  max-width: 800px; margin: 24px auto 0;
  display: flex; justify-content: space-between; gap: 16px;
}
.article-nav a {
  text-decoration: none; color: var(--accent); font-size: .92rem;
  padding: 10px 20px; border: 1px solid var(--border);
  border-radius: 12px; transition: all .3s;
  background: var(--bg-card); max-width: 45%;
}
.article-nav a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Comments */
.comments-area {
  max-width: 800px; margin: 40px auto 0;
}
.comments-area h2 {
  font-size: 1.2rem; margin-bottom: 20px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.comment-list { list-style: none; }
.comment {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
  border: 1px solid var(--border);
}
.comment .comment-body { font-size: .92rem; }
.comment .comment-meta { font-size: .8rem; color: var(--text-light); margin-bottom: 8px; }
.comment .comment-author .fn { font-weight: 600; font-style: normal; }
.comment .reply a { color: var(--accent); font-size: .8rem; text-decoration: none; }
.comment-form { margin-top: 24px; }
.comment-form input,
.comment-form textarea {
  width: 100%; padding: 10px 14px; margin-bottom: 12px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg-card); color: var(--text);
  font-size: .92rem;
}
.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent); outline: none;
}
.comment-form .submit {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 28px; border-radius: 10px; cursor: pointer;
  font-size: .92rem; font-weight: 600; width: auto;
}
.comment-form .submit:hover { background: var(--accent-hover); }

/* ===== Sidebar ===== */
.sidebar { padding-bottom: 60px; }
.sidebar-section {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.sidebar-section h3 {
  font-size: .9rem; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-light); margin-bottom: 16px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.sidebar-section ul { list-style: none; }
.sidebar-section ul li { margin-bottom: 8px; }
.sidebar-section ul li a {
  text-decoration: none; color: var(--text); font-size: .88rem;
  transition: color .3s;
}
.sidebar-section ul li a:hover { color: var(--accent); }

.avatar-wrap { text-align: center; margin-bottom: 16px; }
.avatar-img {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b8a0c0);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 2.2rem;
  overflow: hidden;
}
.avatar-img img { width: 100%; height: 100%; object-fit: cover; }
.bio-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.bio-desc { font-size: .85rem; color: var(--text-light); margin-bottom: 12px; }
.social-links { display: flex; justify-content: center; gap: 12px; }
.social-links a {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--tag-bg); display: flex; align-items: center;
  justify-content: center; text-decoration: none; color: var(--text-light);
  font-size: .9rem; transition: all .3s;
}
.social-links a:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cloud a {
  text-decoration: none; background: var(--tag-bg); color: var(--text-light);
  padding: 4px 14px; border-radius: 20px; font-size: .8rem;
  transition: all .3s;
}
.tag-cloud a:hover { background: var(--accent); color: #fff; }

/* ===== Archive Page ===== */
.archive-list { max-width: 800px; margin: 0 auto 60px; }
.archive-year { margin-bottom: 32px; }
.archive-year h2 {
  font-size: 1.5rem; color: var(--accent); margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.archive-item {
  display: flex; gap: 16px; align-items: baseline;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.archive-item .ar-date {
  font-size: .82rem; color: var(--text-light); min-width: 70px;
  font-family: 'Courier New', monospace;
}
.archive-item a {
  text-decoration: none; color: var(--text); font-size: .95rem;
  transition: color .3s;
}
.archive-item a:hover { color: var(--accent); }
.archive-item .ar-category {
  font-size: .72rem; background: var(--tag-bg);
  padding: 2px 10px; border-radius: 12px; color: var(--accent);
  text-decoration: none;
}

/* About page */
.about-content {
  max-width: 800px; margin: 0 auto 60px;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 40px 48px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.about-content h2 {
  font-size: 1.3rem; margin: 1.4em 0 0.6em;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
}
.about-content p { margin-bottom: 1em; }

/* ===== Footer ===== */
footer {
  text-align: center; padding: 32px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-light); font-size: .85rem;
}

/* ===== Back to top ===== */
.back-top {
  position: fixed; bottom: 28px; right: 28px; width: 44px; height: 44px;
  border-radius: 50%; background: var(--accent); color: #fff;
  border: none; cursor: pointer; font-size: 1.2rem;
  box-shadow: 0 4px 16px rgba(212,165,116,0.3);
  opacity: 0; transform: translateY(20px);
  transition: all .4s; z-index: 99;
}
.back-top.show { opacity: 1; transform: translateY(0); }
.back-top:hover { transform: translateY(-4px); }

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .container { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
  .page-hero h1 { font-size: 1.6rem; }
  .post-card { padding: 20px 24px; }
  .article-content { padding: 28px 24px; }
  .about-content { padding: 28px 24px; }
}
@media (max-width: 480px) {
  .nav-links a:not(.theme-toggle) { display: none; }
  .hero { padding: 40px 16px 36px; }
  .hero h1 { font-size: 1.6rem; }
  .post-card { padding: 16px 18px; }
  .article-header h1 { font-size: 1.4rem; }
}

/* ===== Scroll Animation ===== */
.scroll-fade {
  opacity: 0; transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.scroll-fade.visible { opacity: 1; transform: translateY(0); }

/* ===== WordPress Core ===== */
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .82rem; color: var(--text-light); text-align: center; }
.aligncenter { display: block; margin: 0 auto; }
.alignleft { float: left; margin: 0 16px 8px 0; }
.alignright { float: right; margin: 0 0 8px 16px; }
.sticky { }
.gallery-caption { }
.bypostauthor { }
.screen-reader-text { border: 0; clip: rect(1px,1px,1px,1px); height: 1px; overflow: hidden; position: absolute; width: 1px; }
</style>
