/* ============================================================
   松饼Nya 的博客 — 手写静态主题「松饼」
   无框架、无构建、无外部依赖，拖到哪都能跑
   ============================================================ */

:root {
  --bg: #faf7f9;
  --bg-card: #ffffff;
  --bg-soft: #f4eef2;
  --text: #3a3440;
  --text-soft: #85798a;
  --accent: #e0619b;
  --accent-deep: #c74e83;
  --accent-soft: #fceef4;
  --border: #eee2ea;
  --shadow: 0 2px 16px rgba(199, 78, 131, 0.08);
  --shadow-lift: 0 8px 28px rgba(199, 78, 131, 0.16);
  --radius: 16px;
  --code-bg: #f6eff3;
  --header-bg: rgba(250, 247, 249, 0.85);
}

[data-theme="dark"] {
  --bg: #171419;
  --bg-card: #211d24;
  --bg-soft: #2a2530;
  --text: #e8e2ea;
  --text-soft: #a296a8;
  --accent: #f083b6;
  --accent-deep: #f5a0c6;
  --accent-soft: #3a2432;
  --border: #372f3c;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 8px 28px rgba(0, 0, 0, 0.5);
  --code-bg: #2a2530;
  --header-bg: rgba(23, 20, 25, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: var(--accent-deep); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

img, svg { vertical-align: middle; }

.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.5px;
}
.logo:hover { color: var(--accent-deep); }
.logo svg { display: block; }

.main-nav { display: flex; align-items: center; gap: 6px; }

.main-nav a {
  color: var(--text-soft);
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: all 0.2s;
}
.main-nav a:hover { color: var(--accent-deep); background: var(--accent-soft); }
.main-nav a.active { color: var(--accent-deep); background: var(--accent-soft); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-1px); }

#navToggle { display: none; }

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
  background:
    radial-gradient(ellipse 60% 50% at 85% 10%, var(--accent-soft), transparent 70%),
    radial-gradient(ellipse 50% 40% at 10% 90%, var(--accent-soft), transparent 70%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-avatar { flex: 0 0 auto; }
.hero-avatar svg {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  box-shadow: var(--shadow-lift);
  border: 4px solid var(--bg-card);
}

.hero-text h1 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.3;
}
.hero-text h1 .nya { color: var(--accent); }

.hero-bio {
  margin-top: 8px;
  font-size: 18px;
  color: var(--text-soft);
}

.hero-desc {
  margin-top: 18px;
  max-width: 560px;
  font-size: 15px;
  color: var(--text-soft);
}

.hero-tags { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 10px; }

.hero-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--accent-deep); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--bg-card); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }

/* 樱花飘落装饰 */
.petal {
  position: absolute;
  top: -30px;
  width: 18px;
  height: 18px;
  opacity: 0.55;
  pointer-events: none;
  animation: petal-fall linear infinite;
}
.petal-1 { left: 8%; animation-duration: 11s; animation-delay: 0s; }
.petal-2 { left: 26%; animation-duration: 14s; animation-delay: 3s; width: 13px; height: 13px; }
.petal-3 { left: 55%; animation-duration: 10s; animation-delay: 5s; }
.petal-4 { left: 72%; animation-duration: 13s; animation-delay: 1s; width: 14px; height: 14px; }
.petal-5 { left: 90%; animation-duration: 12s; animation-delay: 7s; }

@keyframes petal-fall {
  0%   { transform: translateY(-30px) translateX(0) rotate(0deg); }
  25%  { transform: translateY(25vh) translateX(28px) rotate(90deg); }
  50%  { transform: translateY(50vh) translateX(-20px) rotate(200deg); }
  75%  { transform: translateY(75vh) translateX(24px) rotate(300deg); }
  100% { transform: translateY(110vh) translateX(0) rotate(360deg); }
}

/* ---------- 区块 ---------- */
.section { padding: 56px 0; }
.section-alt { background: var(--bg-soft); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}
.section-head h2 {
  font-size: 26px;
  font-weight: 800;
  position: relative;
  padding-left: 14px;
}
.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
.section-more { font-size: 14px; color: var(--text-soft); white-space: nowrap; }
.section-more:hover { color: var(--accent-deep); }

/* ---------- 卡片网格 ---------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

/* 文章卡片 */
.post-card .card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 12px;
}
.post-card h3 { font-size: 18px; font-weight: 700; line-height: 1.5; }
.post-card h3 a { color: var(--text); }
.post-card h3 a:hover { color: var(--accent-deep); }
.post-card p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-soft);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-deep);
}

/* 项目卡片 */
.project-card .lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 10px;
}
.lang-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.project-card h3 { font-size: 17px; font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
.project-card h3 a { color: var(--text); }
.project-card h3 a:hover { color: var(--accent-deep); }
.project-card p { margin-top: 8px; font-size: 13.5px; color: var(--text-soft); flex: 1; }
.project-card .stars { margin-top: 12px; font-size: 13px; color: var(--text-soft); }

/* fork 列表 */
.fork-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.fork-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text);
  transition: all 0.2s;
}
.fork-item:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }
.fork-item .fork-mark { font-size: 11px; color: var(--text-soft); }

/* ---------- 文章列表页 ---------- */
.page-hero { padding: 52px 0 8px; }
.page-hero h1 { font-size: 34px; font-weight: 800; }
.page-hero p { margin-top: 8px; color: var(--text-soft); font-size: 15px; }

.post-row {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 26px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.22s, box-shadow 0.22s, border-color 0.22s;
}
.post-row + .post-row { margin-top: 18px; }
.post-row:hover {
  transform: translateX(4px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-lift);
}
.post-row time {
  flex: 0 0 92px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
}
.post-row h2 { font-size: 19px; font-weight: 700; line-height: 1.5; }
.post-row h2 a { color: var(--text); }
.post-row h2 a:hover { color: var(--accent-deep); }
.post-row .excerpt { margin-top: 8px; font-size: 14px; color: var(--text-soft); }

/* ---------- 文章正文 ---------- */
.article {
  max-width: 760px;
  margin: 0 auto;
  padding: 52px 0 64px;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-soft);
  margin-bottom: 30px;
}
.article-back:hover { color: var(--accent-deep); }

.article-header h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.5px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 18px 0 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-soft);
}

.article-body { font-size: 16px; }
.article-body p { margin: 0 0 1.2em; }
.article-body h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 2em 0 0.8em;
  position: relative;
  padding-left: 14px;
}
.article-body h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
.article-body h3 { font-size: 18px; font-weight: 700; margin: 1.8em 0 0.7em; }
.article-body ul, .article-body ol { margin: 0 0 1.2em; padding-left: 1.6em; }
.article-body li { margin-bottom: 0.4em; }
.article-body blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-soft);
  color: var(--text);
}
.article-body blockquote p { margin: 0; }
.article-body code {
  font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--accent-deep);
}
.article-body pre {
  margin: 1.4em 0;
  padding: 18px 20px;
  border-radius: 14px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  line-height: 1.7;
}
.article-body pre code { background: none; padding: 0; color: var(--text); font-size: 13.5px; }
.article-body hr { border: none; border-top: 1px dashed var(--border); margin: 2.2em 0; }
.article-body strong { font-weight: 700; }
.article-body table { width: 100%; border-collapse: collapse; margin: 1.4em 0; font-size: 14px; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: 9px 14px; text-align: left; }
.article-body th { background: var(--bg-soft); font-weight: 700; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
.post-nav a {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
}
.post-nav a:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }
.post-nav .nav-label { display: block; font-size: 12px; color: var(--text-soft); margin-bottom: 3px; }
.post-nav .next { text-align: right; }

/* ---------- 关于页 ---------- */
.about-hero {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.about-hero svg { width: 128px; height: 128px; border-radius: 50%; border: 4px solid var(--accent-soft); }
.about-hero h1 { font-size: 32px; font-weight: 800; }
.about-hero .bio { color: var(--text-soft); margin-top: 4px; }
.about-hero .links { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; }

.about-section { margin-top: 40px; }
.about-section h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 18px;
  position: relative;
  padding-left: 14px;
}
.about-section h2::before {
  content: "";
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 5px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}

.interest-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.interest-card {
  padding: 20px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.interest-card h3 { font-size: 16px; font-weight: 700; }
.interest-card h3 .emoji { margin-right: 8px; }
.interest-card p { margin-top: 6px; font-size: 13.5px; color: var(--text-soft); }

.timeline { list-style: none; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 26px 30px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}
.timeline li:last-child { padding-bottom: 4px; border-left-color: transparent; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.timeline time { font-size: 13px; font-weight: 700; color: var(--accent-deep); font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: 15.5px; font-weight: 700; margin-top: 2px; }
.timeline p { font-size: 14px; color: var(--text-soft); margin-top: 4px; }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 40px;
  padding: 36px 0 44px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
}
.site-footer .footer-links { margin-top: 8px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.site-footer .footer-links a, .site-footer .footer-links span { color: var(--text-soft); }
.site-footer .footer-links a:hover { color: var(--accent-deep); }
.site-footer .pancake { opacity: 0.7; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .interest-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .hero { padding: 48px 0 40px; }
  .hero-inner { flex-direction: column; text-align: center; gap: 28px; }
  .hero-text h1 { font-size: 34px; }
  .hero-tags, .hero-actions { justify-content: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .about-hero { flex-direction: column; text-align: center; padding: 34px 24px; }
  .about-hero .links { justify-content: center; }

  .post-row { flex-direction: column; gap: 8px; padding: 22px; }

  #navToggle { display: inline-flex; }
  .main-nav {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 18px;
    gap: 4px;
    display: none;
  }
  .site-header.nav-open .main-nav { display: flex; }
  .main-nav a { padding: 12px 14px; }
}
