/*
 * SimpleAdaptive - 简约自适应 Typecho 主题
 *
 * 色彩 / 圆角 / 阴影风格说明：
 * - 想更「极简」：减小阴影、减小圆角、降低主色饱和度
 * - 想更「杂志风」：增大卡片间距、加大标题字号、提高阴影和对比度
 * 只需改这里的变量即可一键调整整站气质。
 */

:root {
  /* 基础色彩（默认 = 扁平·亮色） */
  --sa-bg: #f5f5f5;
  --sa-bg-card: #ffffff;
  --sa-text: #111827;
  --sa-text-muted: #6b7280;
  --sa-primary: #2563eb;
  --sa-border: #e5e7eb;

  /* 视觉风格（扁平化：小圆角 + 无阴影） */
  --sa-radius: 8px;
  --sa-shadow: none;

  /* 排版相关 */
  --sa-font-size-base: 15px;
  --sa-line-height-base: 1.7;
  --sa-heading-weight: 600;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.sa-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--sa-bg);
  color: var(--sa-text);
  font-size: var(--sa-font-size-base);
  line-height: var(--sa-line-height-base);
}

a {
  color: var(--sa-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.sa-header {
  position: static;            /* 不跟随滚动 */
  z-index: 1;
  background: transparent;     /* 头部背景跟页面一致 */
}

.sa-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--sa-border); /* 仅在网格宽度内画底线 */
}

.sa-brand {
  display: flex;
  flex-direction: column;
}

.sa-logo {
  font-size: 20px;
  font-weight: var(--sa-heading-weight);
  letter-spacing: 0.04em;
  color: #111827;
}

.sa-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--sa-text-muted);
}

.sa-nav-toggle {
  display: none;
  width: 40px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  cursor: pointer;
}

.sa-nav-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #111827;
}

.sa-nav {
  display: flex;
}

.sa-nav ul {
  display: flex;
  align-items: center;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.sa-nav a {
  font-size: 14px;
  color: #374151;
  padding: 4px 8px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.sa-nav a:hover {
  background: transparent;
  text-decoration: none;
  color: #111827;
}

.sa-nav a.is-active {
  background: transparent;
  color: #111827;
  border-bottom-color: #111827;
}

/* Main 布局 */
.sa-main {
  padding: 40px 0 56px;
}

.sa-narrow {
  max-width: 740px;
  margin: 0 auto;
}

/* 首页两栏布局 */
.sa-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-top: 16px; /* 与导航下横线拉开距离，避免竖线连在一起 */
}

.sa-content {
  flex: 1 1 auto;
  min-width: 0;
}

.sa-sidebar {
  flex: 0 0 260px;
  padding-left: 24px;
  border-left: 1px solid var(--sa-border);
}

.sa-post-card {
  background: var(--sa-bg-card);
  border-radius: var(--sa-radius);
  padding: 22px 22px 26px;
  box-shadow: var(--sa-shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  margin-bottom: 24px;
}

.sa-post-title {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0.02em;
}

.sa-post-title a {
  color: #111827;
}

.sa-post-title a:hover {
  color: var(--sa-primary);
}

.sa-post-meta {
  font-size: 13px;
  color: var(--sa-text-muted);
  margin-bottom: 10px;
}

.sa-post-excerpt {
  font-size: 14px;
  color: #374151;
}

.sa-post-readmore {
  display: inline-flex;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--sa-primary);
  color: var(--sa-primary);
}

.sa-post-readmore:hover {
  background: rgba(37, 99, 235, 0.06);
  text-decoration: none;
}

.sa-empty {
  text-align: center;
  color: var(--sa-text-muted);
  font-size: 14px;
}

/* 列表样式（首页 / 归档） */
.sa-post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sa-post-item {
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}

.sa-post-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.sa-post-thumb {
  display: block;
  width: 240px;
  flex: 0 0 240px;
  height: 133px; /* 接近 16:9 比例 */
  border-radius: 6px;
  overflow: hidden;
  background: #e5e7eb;
}

.sa-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sa-post-main {
  flex: 1 1 auto;
  min-width: 0;
}

.sa-post-line {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid #e5e7eb;
}

.sa-post-date {
  font-size: 13px;
  color: var(--sa-text-muted);
  min-width: 80px;
}

.sa-post-link {
  color: #111827;
  text-decoration: none;
  font-size: 15px;
}

.sa-post-link:hover {
  text-decoration: underline;
}

.sa-post-meta-line {
  margin-top: 8px;
  font-size: 13px;
  color: var(--sa-text-muted);
}

/* 单篇文章 / 页面 */
.sa-post,
.sa-page {
  background: var(--sa-bg-card);
  border-radius: var(--sa-radius);
  padding: 22px 20px 24px;
  box-shadow: var(--sa-shadow);
  border: 1px solid var(--sa-border);
}

/* 单篇文章 / 页面（阅读页，去卡片感） */
.sa-post.sa-post-single,
.sa-page.sa-post-single {
  background: transparent;
  border: none;
  padding: 0;
}

.sa-post + .sa-post-nav {
  margin-top: 18px;
}

.sa-post-content {
  margin-top: 14px;
  font-size: 15px;
  color: #111827;
}

.sa-post-content p {
  margin: 0 0 1em;
}

.sa-post-content pre {
  background: #111827;
  color: #e5e7eb;
  padding: 10px 12px;
  border-radius: 8px;
  overflow-x: auto;
}

.sa-post-content code {
  background: rgba(148, 163, 184, 0.12);
  padding: 1px 4px;
  border-radius: 4px;
}

.sa-post-tags {
  margin-top: 10px;
  font-size: 13px;
  color: var(--sa-text-muted);
}

.sa-post-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  margin-top: 18px;
}

/* 归档 */
.sa-archive-header {
  margin-bottom: 16px;
}

.sa-archive-title {
  margin: 0;
  font-size: 18px;
}

/* 分页 */
.sa-pagination {
  margin-top: 18px;
  font-size: 14px;
}

.sa-pagination div {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sa-pagination a,
.sa-pagination span {
  min-width: 28px;
  text-align: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #4b5563;
}

.sa-pagination a:hover {
  background: rgba(15, 23, 42, 0.06);
  text-decoration: none;
}

.sa-pagination .is-active {
  background: #111827;
  color: #f9fafb;
  border-color: #111827;
}

/* 评论 */
.sa-comments {
  margin-top: 24px;
}

.sa-section-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.sa-comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment-body {
  background: var(--sa-bg-card);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--sa-border);
}

.comment-author {
  font-weight: 500;
}

.comment-meta {
  font-size: 12px;
  color: var(--sa-text-muted);
}

.comment-content {
  margin-top: 6px;
  font-size: 14px;
}

.sa-comment-form {
  margin-top: 18px;
}

/* 底部 */
.sa-footer {
  border-top: 1px solid var(--sa-border);
  padding: 18px 0 26px;
  font-size: 13px;
  color: var(--sa-text-muted);
}

.sa-footer-inner {
  text-align: center;
}

.sa-footer-main {
  margin: 0 0 4px;
}

.sa-footer-custom {
  margin: 0 0 6px;
}

.sa-footer-social {
  display: inline-flex;
  gap: 10px;
  font-size: 13px;
}

.sa-footer-social a {
  color: var(--sa-text-muted);
}

.sa-footer-social a:hover {
  color: var(--sa-primary);
  text-decoration: none;
}

/* 侧栏组件 */
.sa-widget {
  background: transparent;      /* 与页面背景统一 */
  border-radius: 0;
  padding: 0 0 16px;
  box-shadow: none;
  border: none;
  margin-bottom: 16px;
}

.sa-widget-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: var(--sa-heading-weight);
  color: #111827;
}

.sa-widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.sa-widget-list li + li {
  margin-top: 6px;
}

.sa-widget-list a {
  color: #374151;
}

.sa-widget-list a:hover {
  color: var(--sa-primary);
  text-decoration: none;
}

.sa-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sa-tag-cloud a {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #4b5563;
}

.sa-tag-cloud a:hover {
  background: rgba(15, 23, 42, 0.06);
  text-decoration: none;
}

/* 暗色模式（手动 / 自动） */

/* 自动：跟随系统暗色，但仅当 body 带有 sa-theme-auto 时生效 */
@media (prefers-color-scheme: dark) {
  body.sa-theme-auto {
    --sa-bg: #020617;
    --sa-bg-card: #020617;
    --sa-text: #e5e7eb;
    --sa-text-muted: #9ca3af;
    --sa-primary: #fb923c;
    --sa-border: #1f2937;
    --sa-shadow: none;
  }

  body.sa-theme-auto.sa-body {
    background: #020617;
  }

  body.sa-theme-auto .sa-header {
    background: rgba(15, 23, 42, 0.9);
    border-bottom-color: rgba(15, 23, 42, 1);
  }

  body.sa-theme-auto .sa-logo {
    color: #f9fafb;
  }

  body.sa-theme-auto .sa-nav a {
    color: #e5e7eb;
  }

  body.sa-theme-auto .sa-nav a.is-active {
    background: #f9fafb;
    color: #020617;
  }

  body.sa-theme-auto .sa-post-card,
  body.sa-theme-auto .sa-post,
  body.sa-theme-auto .sa-page,
  body.sa-theme-auto .comment-body {
    background: #020617;
    border-color: rgba(30, 64, 175, 0.7);
  }

  body.sa-theme-auto .sa-footer {
    border-top-color: rgba(15, 23, 42, 1);
  }
}

/* 强制暗色：不看系统设置，只要选中“始终暗色”就启用 */
body.sa-theme-dark {
  --sa-bg: #020617;
  --sa-bg-card: #020617;
  --sa-text: #e5e7eb;
  --sa-text-muted: #9ca3af;
  --sa-primary: #fb923c;
  --sa-border: #1f2937;
  --sa-shadow: none;
}

body.sa-theme-dark.sa-body {
  background: #020617;
}

body.sa-theme-dark .sa-header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: rgba(15, 23, 42, 1);
}

body.sa-theme-dark .sa-logo {
  color: #f9fafb;
}

body.sa-theme-dark .sa-nav a {
  color: #e5e7eb;
}

body.sa-theme-dark .sa-nav a.is-active {
  background: #f9fafb;
  color: #020617;
}

body.sa-theme-dark .sa-post-card,
body.sa-theme-dark .sa-post,
body.sa-theme-dark .sa-page,
body.sa-theme-dark .comment-body {
  background: #020617;
  border-color: rgba(30, 64, 175, 0.7);
}

body.sa-theme-dark .sa-footer {
  border-top-color: rgba(15, 23, 42, 1);
}

/* 响应式 */
@media (max-width: 768px) {
  .sa-header-inner {
    align-items: flex-start;
    gap: 8px;
  }

  .sa-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    padding: 8px 16px 12px;
    background: rgba(248, 250, 252, 0.98);
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
    transform-origin: top;
    transform: scaleY(0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .sa-nav ul {
    flex-direction: column;
    align-items: flex-start;
  }

  .sa-nav.is-open {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
  }

  .sa-main {
    padding-top: 18px;
  }

  .sa-post-card,
  .sa-post,
  .sa-page {
    padding: 16px 14px 18px;
  }
}

@media (min-width: 769px) {
  .sa-nav-toggle {
    display: none;
  }
}

