/* ============================================================
   BINGLAN.COM — V3 编辑式双栏风格
   黑白为主，杂志感排版，左栏关于，右栏文章
   ============================================================ */

/* ===== CSS 变量 ===== */
:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #888888;
  --text-tertiary: #bbbbbb;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --sidebar-width: 260px;
  --max-width: 1000px;
  --transition: 0.3s ease;
}

[data-theme="dark"] {
  --bg: #0d0d0d;
  --text: #d4d4d4;
  --text-secondary: #777777;
  --text-tertiary: #444444;
  --border: #2a2a2a;
  --border-light: #1a1a1a;
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "DengXian", "等线", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== 通用容器（后台管理依赖）===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ===== 双栏布局 ===== */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 72px 40px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 80px;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding-right: 40px;
  transition: border-color var(--transition);
}

.main-content {
  min-width: 0;
}

/* ===== 左栏：品牌 ===== */
.brand {
  margin-bottom: 28px;
}

.logo {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.site-name {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1.2;
}

/* ===== 分割线 ===== */
.line {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  transition: border-color var(--transition);
}

.sidebar > .line {
  margin: 28px 0;
}

.main-content > .line {
  margin: 28px 0;
}

/* ===== 左栏：导航 ===== */
.sidebar-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.sidebar-nav a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
  letter-spacing: 0.06em;
  position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
}


/* ===== 左栏：关于文字 ===== */
.about-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 2.2;
  letter-spacing: 0.04em;
}

.about-text p {
  margin-bottom: 1.2em;
}

.about-text p:last-of-type {
  margin-bottom: 0;
}

.about-text .signature {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  margin-top: 1.5em;
}

/* ===== 左栏：底部 ===== */
.sidebar-footer {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.8;
  letter-spacing: 0.04em;
}

.sidebar-footer p {
  margin-bottom: 0.2em;
}

/* ===== 主题切换：右上角固定 ===== */
.theme-toggle {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 100;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition);
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* ===== 右栏：标语 ===== */
.taglines {
  margin-bottom: 4px;
}

.taglines p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 2;
  letter-spacing: 0.04em;
}

.taglines .symbol {
  display: inline-block;
  width: 1.5em;
  color: var(--text-tertiary);
  font-size: 0.75em;
  text-align: center;
  margin-right: 2px;
}

.taglines .divider {
  color: var(--text-tertiary);
  margin-right: 8px;
  opacity: 0.6;
}

/* ===== 页面切换动画 ===== */
.page-content {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 文章列表：双栏编辑式 ===== */
.post-list {
  list-style: none;
}

.post-item {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 28px;
  align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px dotted var(--border);
  transition: border-color var(--transition);
}

.post-item:first-child {
  padding-top: 0;
}

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

.post-item a {
  display: contents;
  text-decoration: none;
  color: inherit;
}

.post-date {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
  align-self: center;
}

.post-title {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.5;
  transition: color var(--transition);
}

.post-item a:hover .post-title {
  color: var(--text-secondary);
}

/* ===== 文章详情页 ===== */
.post-header {
  margin-bottom: 40px;
}

.post-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  line-height: 1.4;
}

.post-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.post-body {
  font-size: 1rem;
  line-height: 1.9;
}

.post-body p {
  margin-bottom: 1.2em;
}

.post-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2em 0 1em;
}

.post-body h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.5em 0 0.8em;
}

.post-body blockquote {
  border-left: 2px solid var(--border);
  padding-left: 20px;
  margin: 1.5em 0;
  color: var(--text-secondary);
  transition: border-color var(--transition);
}

.post-body figure {
  margin: 2em 0;
  text-align: center;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 2px;
}

.post-body figcaption {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 10px;
  letter-spacing: 0.02em;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5em 0;
  transition: border-color var(--transition);
}

.post-body strong { font-weight: 600; }
.post-body em { font-style: italic; }

.post-body ul, .post-body ol {
  margin: 1em 0;
  padding-left: 1.5em;
}

.post-body li {
  margin-bottom: 0.5em;
}

.post-body .poem {
  text-align: center;
  line-height: 2.4;
  margin: 1.5em 0;
}

.post-body .poem p {
  margin: 0;
}

.back-link {
  display: inline-block;
  margin-top: 48px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}

.back-link:hover {
  color: var(--text);
}

/* ===== 关于页（右栏独立展示）===== */
.about-page h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 32px;
}

.about-page p {
  font-size: 1rem;
  line-height: 2;
  margin-bottom: 1.4em;
}

.about-page .signature {
  margin-top: 40px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

/* ===== 响应式 ===== */
@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 48px 28px;
  }

  .sidebar {
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 40px;
  }

  .brand {
    margin-bottom: 24px;
  }

  .logo {
    font-size: 0.6875rem;
  }

  .site-name {
    font-size: 1.5rem;
  }

  .about-text {
    max-width: 480px;
  }

  .sidebar > .line,
  .main-content > .line {
    margin: 24px 0;
  }

  .taglines {
    margin-bottom: 0;
  }

  .post-item {
    grid-template-columns: 60px 1fr 50px;
    gap: 20px;
    padding: 18px 0;
  }

  .post-title {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .layout {
    padding: 32px 22px;
    padding-left: max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
  }

  .theme-toggle {
    top: 18px;
    right: 18px;
  }

  .theme-toggle svg {
    width: 16px;
    height: 16px;
  }

  .site-name {
    font-size: 1.375rem;
  }

  .sidebar-nav {
    gap: 16px;
  }

  .about-text {
    font-size: 0.75rem;
  }

  .taglines p {
    font-size: 0.8125rem;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 16px 0;
  }

  .post-date {
    order: -1;
  }

  .post-tag {
    text-align: left;
  }

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

  .post-body {
    font-size: 0.9375rem;
  }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ===== 文字选中 ===== */
::selection {
  background: var(--text);
  color: var(--bg);
}
