/* ============================================================
   个人作品集网站 - 全局样式
   深色现代开发者风格
   ============================================================ */
:root {
  --bg: #0d1117;
  --bg-soft: #11161f;
  --bg-card: #161b22;
  --bg-hover: #1c2333;
  --border: #2d333b;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #3b82f6;
  --accent-2: #06b6d4;
  --green: #3fb950;
  --red: #f85149;
  --orange: #d29922;
  --grad: linear-gradient(120deg, #3b82f6 0%, #06b6d4 60%, #22d3ee 100%);
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #67e8f9;
}

img {
  max-width: 100%;
  display: block;
}

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

/* ---------------- 导航 ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}
.brand em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  position: relative;
  padding: 4px 0;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
}

/* ---------------- Hero ---------------- */
.hero {
  padding: 96px 0 72px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -180px;
  right: -120px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.18), transparent 65%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  bottom: -160px;
  left: -120px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.14), transparent 65%);
  pointer-events: none;
}
.hero .container {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .subtitle {
  font-size: 19px;
  color: var(--text-muted);
  margin-top: 16px;
  max-width: 640px;
}
.hero .tagline {
  font-size: 17px;
  color: var(--text);
  margin-top: 8px;
  max-width: 640px;
}
.hero-actions {
  margin-top: 30px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 18px rgba(59, 130, 246, 0.35);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
}
.btn-danger {
  background: rgba(248, 81, 73, 0.12);
  color: var(--red);
  border-color: rgba(248, 81, 73, 0.4);
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.22);
  color: var(--red);
}
.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hero-stats {
  display: flex;
  gap: 42px;
  margin-top: 44px;
  flex-wrap: wrap;
}
.stat b {
  display: block;
  font-size: 30px;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat span {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------------- 通用区块 ---------------- */
.section {
  padding: 56px 0;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.section-head h2::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 22px;
  border-radius: 3px;
  background: var(--grad);
  margin-right: 12px;
  vertical-align: -3px;
}
.link-more {
  font-size: 14px;
  color: var(--text-muted);
}
.link-more:hover {
  color: var(--accent-2);
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: var(--shadow);
}
.card-cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-soft);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.card-cover.no-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 800;
  background: linear-gradient(135deg, #1f2937, #111827);
  color: rgba(230, 237, 243, 0.12);
}
.card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}
.card-body h3 {
  font-size: 18px;
  font-weight: 700;
}
.card-body h3 a {
  color: var(--text);
}
.card-body h3 a:hover {
  color: var(--accent-2);
}
.card-summary {
  font-size: 14px;
  color: var(--text-muted);
  flex: 1;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(59, 130, 246, 0.12);
  color: #7cb3ff;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.tag-cyan {
  background: rgba(6, 182, 212, 0.12);
  color: #67e8f9;
  border-color: rgba(6, 182, 212, 0.3);
}
.tag-green {
  background: rgba(63, 185, 80, 0.12);
  color: #7ee787;
  border-color: rgba(63, 185, 80, 0.3);
}
.tag-orange {
  background: rgba(210, 153, 34, 0.14);
  color: #e3b341;
  border-color: rgba(210, 153, 34, 0.35);
}
.cat-badge {
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.cat-project {
  background: var(--grad);
  color: #fff;
}
.cat-blog {
  background: rgba(63, 185, 80, 0.15);
  color: #7ee787;
  border: 1px solid rgba(63, 185, 80, 0.35);
}
.cat-note {
  background: rgba(210, 153, 34, 0.14);
  color: #e3b341;
  border: 1px solid rgba(210, 153, 34, 0.35);
}
.date-text {
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------------- 技能 ---------------- */
.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 0.2s, transform 0.2s;
}
.skill-chip:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.skill-chip::before {
  content: "▸";
  color: var(--accent-2);
  font-size: 12px;
}

/* ---------------- 关于 ---------------- */
.about-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px;
}
.about-block p {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 22px;
  max-width: 760px;
}
.links-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.link-btn:hover {
  border-color: var(--accent);
  color: var(--accent-2);
  transform: translateY(-1px);
}

/* ---------------- 页脚 ---------------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 34px 0;
  margin-top: 40px;
}
.footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer p {
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------------- 筛选条 ---------------- */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.filter-btn {
  padding: 7px 18px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.filter-btn.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
}

/* ---------------- 文章详情 ---------------- */
.article-head {
  padding: 48px 0 10px;
}
.article-head h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.4px;
  margin-top: 14px;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14px;
}
.article-cover {
  margin: 28px 0 8px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.markdown-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px clamp(22px, 5vw, 52px);
  margin: 26px 0 40px;
  font-size: 16px;
  line-height: 1.85;
  color: #d7dee6;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  color: var(--text);
  font-weight: 700;
  margin: 1.6em 0 0.6em;
  line-height: 1.35;
}
.markdown-body h1 {
  font-size: 28px;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}
.markdown-body h2 {
  font-size: 23px;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--border);
}
.markdown-body h3 {
  font-size: 19px;
}
.markdown-body p {
  margin: 0.9em 0;
}
.markdown-body a {
  color: #58a6ff;
  border-bottom: 1px solid rgba(88, 166, 255, 0.35);
}
.markdown-body strong {
  color: var(--text);
}
.markdown-body ul,
.markdown-body ol {
  padding-left: 1.6em;
  margin: 0.9em 0;
}
.markdown-body li {
  margin: 0.35em 0;
}
.markdown-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--bg-soft);
  padding: 12px 18px;
  margin: 1.2em 0;
  border-radius: 0 10px 10px 0;
  color: var(--text-muted);
}
.markdown-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(110, 118, 129, 0.2);
  padding: 2px 7px;
  border-radius: 6px;
  color: #79c0ff;
}
.markdown-body pre {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 1.3em 0;
  line-height: 1.6;
}
.markdown-body pre code {
  background: none;
  padding: 0;
  color: #d7dee6;
  font-size: 14px;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.3em 0;
  font-size: 14.5px;
}
.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
}
.markdown-body th {
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 600;
}
.markdown-body tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}
.markdown-body img {
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 1em 0;
}
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

/* ---------------- 表单 ---------------- */
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
}
.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14.5px;
  font-family: var(--font);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.textarea {
  resize: vertical;
  line-height: 1.6;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ---------------- 管理后台 ---------------- */
.admin-body {
  background: var(--bg);
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.login-card h1 {
  font-size: 22px;
  margin-bottom: 6px;
}
.login-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 26px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.admin-side {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-side .brand {
  padding: 0 12px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.side-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.side-btn.active {
  background: rgba(59, 130, 246, 0.14);
  color: #7cb3ff;
  border-color: rgba(59, 130, 246, 0.3);
}
.admin-main {
  padding: 30px 34px;
  overflow-x: hidden;
}
.admin-main h2 {
  font-size: 22px;
  margin-bottom: 22px;
}
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.search-input {
  width: 260px;
}

/* 文章表格 */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}
.data-table th,
.data-table td {
  padding: 13px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  background: var(--bg-soft);
}
.data-table tr:last-child td {
  border-bottom: none;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.row-actions {
  display: flex;
  gap: 8px;
}

/* 编辑器 */
.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.editor-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.editor-pane .pane-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.editor-pane textarea {
  min-height: 460px;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
}
.preview-body {
  min-height: 460px;
  max-height: 640px;
  overflow-y: auto;
  font-size: 14.5px;
}
.preview-body img {
  max-width: 100%;
}

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-published {
  background: rgba(63, 185, 80, 0.14);
  color: #7ee787;
  border: 1px solid rgba(63, 185, 80, 0.35);
}
.status-draft {
  background: rgba(210, 153, 34, 0.14);
  color: #e3b341;
  border: 1px solid rgba(210, 153, 34, 0.35);
}

/* 空状态 / 提示 */
.empty-tip {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 15px;
}
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 22px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: all 0.25s;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.ok {
  border-color: rgba(63, 185, 80, 0.5);
  color: #7ee787;
}
.toast.err {
  border-color: rgba(248, 81, 73, 0.5);
  color: #ffa198;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-side {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
  }
  .admin-side .brand {
    border-bottom: none;
    margin-bottom: 0;
    padding: 0 12px 0 0;
    white-space: nowrap;
  }
  .side-btn {
    white-space: nowrap;
  }
}
@media (max-width: 620px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .nav-toggle {
    display: block;
  }
  .nav-links {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 24px 20px;
    gap: 14px;
  }
  .nav-links.open {
    display: flex;
  }
  .hero {
    padding: 64px 0 52px;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .admin-main {
    padding: 22px 18px;
  }
  .markdown-body {
    padding: 24px 18px;
  }
}
