/* ============================================================
   stevel — 一个极简 Hexo 主题
   ============================================================ */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: #d2d2d7;
  --accent: #0066cc;
  --accent-hover: #004499;
  --code-bg: #f5f5f7;
  --radius: 12px;
  --content-width: 720px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161617;
    --bg-soft: #1d1d1f;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --border: #3a3a3c;
    --accent: #409cff;
    --accent-hover: #7ab8ff;
    --code-bg: #1d1d1f;
  }
}

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

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

a:hover {
  color: var(--accent-hover);
}

/* ---------- 顶栏（毛玻璃） ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

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

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
  display: block;
}

.site-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.site-nav a:hover {
  color: var(--text);
}

/* ---------- 导航栏分类下拉 ---------- */
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-arrow {
  font-size: 0.65rem;
  margin-left: 3px;
  opacity: 0.6;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  min-width: 150px;
  padding: 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 200;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(6px);
}

.dropdown a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
}

.dropdown a:hover {
  background: var(--bg-soft);
  color: var(--accent);
}

.dd-count {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* ---------- 主体 ---------- */
.site-main {
  padding-top: 64px;
  padding-bottom: 96px;
  min-height: calc(100vh - 180px);
}

/* ---------- 首页品牌区 ---------- */
.hero {
  text-align: center;
  padding: 40px 0 48px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.hero-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: #ffffff;
  object-fit: cover;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 18px;
}

.hero-subtitle {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ---------- 首页文章列表 ---------- */
.post-item {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child {
  border-bottom: none;
}

.post-item h2 {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.post-item h2 a {
  color: var(--text);
}

.post-item h2 a:hover {
  color: var(--accent);
}

.post-item .excerpt {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* ---------- 文章列表信息行 ---------- */
.post-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.post-meta time {
  font-variant-numeric: tabular-nums;
}

.post-meta a {
  color: var(--text-secondary);
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.post-meta a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.meta-group::before {
  margin-right: 5px;
  opacity: 0.6;
}

.meta-group:first-of-type::before {
  content: "·";
}

.meta-tags::before {
  content: "#";
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 40px;
  font-size: 0.9rem;
}

.page-number {
  color: var(--text-secondary);
}

/* ---------- 文章页头部 ---------- */
.post-header {
  margin-bottom: 48px;
}

.post-header time {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.post-category {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.post-category a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.post-category a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.post-tags {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.post-tags a {
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-soft);
  padding: 3px 12px;
  border-radius: 999px;
  transition: color 0.2s ease;
}

.post-tags a:hover {
  color: var(--accent);
}

/* ---------- 正文排版 ---------- */
.post-content {
  font-size: 1rem;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content pre,
.post-content table,
.post-content figure {
  margin-bottom: 1.5em;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  scroll-margin-top: 80px; /* 锚点跳转时避开吸顶导航 */
}

.post-content h2 {
  font-size: 1.45rem;
  font-weight: 600;
  margin: 2.2em 0 0.8em;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.8em 0 0.6em;
}

.post-content h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.6em 0 0.5em;
}

.post-content ul,
.post-content ol {
  padding-left: 1.4em;
}

.post-content li {
  margin-bottom: 0.4em;
}

.post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1.1em;
  color: var(--text-secondary);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}

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

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.post-content th,
.post-content td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.post-content th {
  font-weight: 600;
  background: var(--bg-soft);
}

/* ---------- 代码 ---------- */
code {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas,
    "Courier New", monospace;
  font-size: 0.88em;
}

.post-content p code,
.post-content li code,
.post-content td code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 6px;
}

.post-content figure.highlight,
.post-content pre {
  position: relative;
  background: var(--code-bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.post-content figure.highlight table {
  margin: 0;
  border: none;
}

.post-content figure.highlight td {
  border: none;
  padding: 0;
  background: none;
}

.post-content figure.highlight .gutter {
  color: var(--text-secondary);
  opacity: 0.5;
  padding-right: 16px;
  text-align: right;
  user-select: none;
}

/* ---------- 代码块复制按钮 ---------- */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.72rem;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.post-content pre:hover .copy-btn,
.post-content figure.highlight:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  color: var(--accent);
}

.copy-btn.copied {
  color: #34a853;
  opacity: 1;
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
  }
}

/* ---------- 目录导航（post-toc，避开 Hexo 内置 toc 类名） ---------- */
.post-toc {
  background: var(--bg-soft);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 40px;
  font-size: 0.88rem;
}

.post-toc .toc-title {
  font-weight: 600;
  margin-bottom: 10px;
}

.post-toc ol {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.post-toc ol ol {
  padding-left: 1.2em;
}

.post-toc li {
  margin: 4px 0;
}

.post-toc a {
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.post-toc a:hover {
  color: var(--text);
}

.post-toc a.active {
  color: var(--accent);
  font-weight: 600;
}

/* 宽屏时目录悬浮到正文右侧 */
@media (min-width: 1400px) {
  .post-toc {
    position: fixed;
    top: 120px;
    left: calc(50% + var(--content-width) / 2 + 48px);
    width: 250px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    background: transparent;
    border-left: 2px solid var(--border);
    border-radius: 0;
    padding: 0 0 0 20px;
    margin-bottom: 0;
  }
}

/* ---------- 返回顶部 ---------- */
#back-to-top {
  position: fixed;
  right: 32px;
  bottom: 40px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease, color 0.2s ease;
  z-index: 90;
}

#back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#back-to-top:hover {
  color: var(--accent);
}

/* ---------- 归档页 ---------- */
.archive-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
}

.archive-year {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--text-secondary);
}

.archive-item {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  align-items: baseline;
}

.archive-item time {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.archive-item a {
  color: var(--text);
}

.archive-item a:hover {
  color: var(--accent);
}

/* ---------- 分类页（卡片） ---------- */
.cat-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.cat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-soft);
  border-radius: var(--radius);
  color: var(--text);
  transition: transform 0.15s ease;
}

.cat-card:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.cat-name {
  font-weight: 600;
}

.cat-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ---------- 标签页（云图，文章越多字越大越深） ---------- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  align-items: baseline;
  line-height: 2;
}

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

.tag-cloud a:hover {
  color: var(--accent);
  opacity: 1 !important;
}

.tag-cloud-hint {
  margin-top: 32px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }

  .site-main {
    padding-top: 40px;
  }

  .post-header h1 {
    font-size: 1.6rem;
  }

  .site-nav {
    gap: 16px;
  }

  .site-nav a {
    font-size: 0.82rem;
  }

  .hero {
    padding: 24px 0 32px;
  }

  .hero-logo {
    width: 64px;
    height: 64px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  #back-to-top {
    right: 20px;
    bottom: 24px;
  }
}

/* ---------- 导航栏搜索入口 ---------- */
.search-trigger {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.search-trigger:hover {
  color: var(--text);
}

/* ---------- 搜索弹窗 ---------- */
.search-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
}

.search-modal[hidden] {
  display: none !important;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.search-panel {
  position: relative;
  max-width: 560px;
  margin: 12vh auto 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

#search-input {
  width: 100%;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  padding: 18px 22px;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

#search-input::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.search-results {
  max-height: 52vh;
  overflow-y: auto;
  padding: 8px;
}

.search-item {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text);
}

.search-item:hover {
  background: var(--bg-soft);
}

.search-item-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.search-item-snippet {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hint {
  padding: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ---------- 移动端搜索 ---------- */
@media (max-width: 640px) {
  .search-panel {
    margin: 8vh 16px 0;
  }
}

/* 顶栏图标去掉白色底，让火柴人直接"站"在毛玻璃上 */
.site-logo {
  background: transparent;
  box-shadow: none;
}

/* 深色模式：纯黑线条反转为白色，否则会隐身 */
@media (prefers-color-scheme: dark) {
  .site-logo {
    filter: invert(1);
  }
}