/* ========================================
   Hibi Notes Frontend - Notion 极简扁平风格
   ======================================== */

:root {
  --bg: #ffffff;
  --bg-secondary: #fbfbfa;
  --bg-tertiary: #f7f6f3;
  --text: #37352f;
  --text-secondary: #787774;
  --text-light: #b4b4b0;
  --border: #e5e5e5;
  --border-hover: #d0d0d0;
  --tag-bg: #f1f1ef;
  --accent: #37352f;
  --max-width: 900px;
  --side-width: 240px;
  --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow: 0 2px 8px rgba(15, 15, 15, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 15, 15, 0.08);
  --shadow-lg: 0 8px 32px rgba(15, 15, 15, 0.1);
  --radius-sm: 3px;
  --radius: 6px;
  --radius-lg: 10px;
  --transition: 0.2s ease;
}

/* ---- 深色主题 ---- */
[data-theme="dark"] {
  --bg: #191919;
  --bg-secondary: #202020;
  --bg-tertiary: #252525;
  --text: #e5e5e5;
  --text-secondary: #9b9b9b;
  --text-light: #5a5a5a;
  --border: #2e2e2e;
  --border-hover: #3a3a3a;
  --tag-bg: #2a2a2a;
  --accent: #e5e5e5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.02) 1px, transparent 0);
}

[data-theme="dark"] .alert-success {
  background: #1a2e1a;
  border-color: #2a4a2a;
  color: #8fcf8f;
}

[data-theme="dark"] .alert-danger {
  background: #2e1a1a;
  border-color: #4a2a2a;
  color: #cf8f8f;
}

[data-theme="dark"] .hero {
  background:
    linear-gradient(90deg, rgba(25, 25, 25, 0.96) 0%, rgba(25, 25, 25, 0.88) 44%, rgba(25, 25, 25, 0.48) 100%),
    url("/images/hero-bg.svg") center right / cover no-repeat;
}

[data-theme="dark"] .hero::before {
  background:
    linear-gradient(180deg, rgba(25, 25, 25, 0.32), rgba(25, 25, 25, 0.72)),
    radial-gradient(circle at 22% 35%, rgba(25, 25, 25, 0.82) 0, rgba(25, 25, 25, 0) 34%);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(55, 53, 47, 0.03) 1px, transparent 0);
  background-size: 48px 48px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- 页面结构 ---- */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 100;
  transition: box-shadow var(--transition);
}

.topbar.scrolled {
  box-shadow: var(--shadow);
}

.topbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-mark {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.brand-title {
  font-size: 14px;
  font-weight: 500;
  display: block;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-secondary);
  display: block;
  line-height: 1.2;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  position: relative;
}

.nav a:hover {
  background: var(--tag-bg);
  color: var(--text);
}

.nav a.active {
  color: var(--text);
  font-weight: 500;
  background: var(--tag-bg);
}

.nav a.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* ---- 导航栏滚动阴影 ---- */
.topbar.scrolled {
  box-shadow: 0 1px 3px var(--shadow);
}

/* ---- 导航栏操作按钮 ---- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  border-radius: 3px;
  transition: background 0.15s;
  color: var(--text-secondary);
}

.icon-btn:hover {
  background: var(--tag-bg);
  color: var(--text);
}

.hamburger {
  display: none;
}

/* ---- 分类下拉菜单 ---- */
.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-top: 0;
  padding-top: 6px;
  z-index: 200;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  overflow: hidden;
}

.dropdown-menu::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
}

.nav-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
  display: block;
}

.dropdown-menu a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.dropdown-menu a:hover {
  background: var(--tag-bg);
  color: var(--text);
}

.dropdown-menu .count {
  font-size: 11px;
  color: var(--text-light);
  background: var(--tag-bg);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ---- 主题图标 ---- */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

/* ---- 搜索弹窗 ---- */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 300;
  justify-content: center;
  padding-top: 22vh;
  backdrop-filter: blur(2px);
}

.search-overlay.open {
  display: flex;
}

.search-box {
  width: min(92%, 480px);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: searchSlide 0.15s ease;
  align-self: flex-start;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@keyframes searchSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-light);
}

.search-header svg {
  flex-shrink: 0;
  opacity: 0.4;
}

.search-header form {
  flex: 1;
  margin: 0;
}

.search-header input {
  width: 100%;
  border: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  outline: none;
}

.search-header input::placeholder {
  color: var(--text-light);
}

.search-header kbd {
  font-size: 10px;
  font-family: inherit;
  color: var(--text-light);
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* ---- 移动端导航 ---- */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 400;
}

.mobile-overlay.open {
  display: block;
}

.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 500;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  padding: 20px 0;
  box-shadow: var(--shadow-lg);
}

.mobile-nav.open {
  transform: translateX(0);
}

.mobile-nav a {
  display: block;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.mobile-nav a:hover {
  background: var(--tag-bg);
  color: var(--text);
}

.mobile-nav-label {
  padding: 16px 24px 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mobile-nav-sub {
  padding-left: 40px !important;
  font-size: 13px !important;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 24px;
}

body.menu-open {
  overflow: hidden;
}

/* ---- 回到顶部 ---- */
.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 100;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ---- 用户菜单 ---- */
.user-menu .user-name {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.user-menu .user-name:hover {
  color: var(--text);
}

.nav-login-link {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: all 0.15s;
}

.nav-login-link:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ---- 用户中心 ---- */
.user-page {
  padding: 40px 0;
}

.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.user-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.user-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 40px;
}

.user-section {
  margin-bottom: 32px;
}

.user-section h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  margin: 0;
  padding: 0;
  border: none;
}

.profile-card {
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.profile-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.profile-info {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.profile-avatar img,
.avatar-placeholder {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
}

.avatar-placeholder {
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--tag-bg);
  color: var(--text-secondary);
}

.profile-name {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 2px;
}

.profile-username {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.profile-email {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.profile-bio {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.profile-actions {
  display: flex;
  gap: 8px;
}

.btn {
  display: inline-block;
  padding: 8px 18px;
  border: 1px solid var(--border);
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.btn:hover::before {
  transform: scaleX(1);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--tag-bg);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.quick-links {
  display: flex;
  flex-direction: column;
}

.quick-links a {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
}

.quick-links a:hover {
  color: var(--text);
}

.post-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.post-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  transition: all var(--transition);
}

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

.post-row:hover {
  background: var(--bg-secondary);
}

.post-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-row-title a {
  font-size: 14px;
}

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

.status-badge {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--border);
}

.status-badge.published {
  background: #f6fef6;
  border-color: #d4e8d4;
  color: #2d6a2d;
}

.status-badge.draft {
  background: var(--tag-bg);
}

.post-row-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.post-row-actions {
  display: flex;
  gap: 12px;
  font-size: 13px;
}

.post-row-actions a {
  color: var(--text-secondary);
}

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

.link-btn {
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  color: #c0392b;
}

.more-link {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

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

.user-form {
  max-width: 600px;
}

.user-form .form-group {
  margin-bottom: 16px;
}

.user-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.user-form input[type="text"],
.user-form input[type="password"],
.user-form input[type="email"],
.user-form textarea,
.user-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.user-form input:focus,
.user-form textarea:focus,
.user-form select:focus {
  border-color: var(--text);
}

.user-form textarea {
  resize: vertical;
  min-height: 80px;
}

.user-form select {
  cursor: pointer;
}

.form-hint {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.tag-checkbox input {
  cursor: pointer;
}

.empty a {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .user-layout {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

.main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  background: var(--bg-tertiary);
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-light);
}

.footer-inner a {
  color: var(--text-secondary);
}

.footer-inner a:hover {
  color: var(--text);
}

/* ---- 首页 Hero ---- */
.hero {
  margin-top: 28px;
  padding: 88px 40px 68px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.88) 44%, rgba(255, 255, 255, 0.48) 100%),
    url("/images/hero-bg.svg") center right / cover no-repeat;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.72)),
    radial-gradient(circle at 22% 35%, rgba(255, 255, 255, 0.82) 0, rgba(255, 255, 255, 0) 34%);
  opacity: 0.95;
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 46%;
  height: 1px;
  background: rgba(55, 53, 47, 0.12);
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  font-size: 12px;
  color: var(--text-light);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 16px;
  letter-spacing: 0;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.8;
  margin-bottom: 24px;
}

.hero-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--text-light);
}

/* ---- 内容区域 ---- */
.content-area {
  display: grid;
  grid-template-columns: 1fr var(--side-width);
  gap: 64px;
  padding-top: 48px;
}

.section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
  display: inline-block;
}

/* ---- 文章列表 ---- */
.post-list {
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 28px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 36px;
  align-items: center;
  min-height: 150px;
  background: var(--bg);
  transition: all var(--transition);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.post-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.post-body-area {
  min-width: 0;
  padding: 4px 0;
}

.post-cover {
  width: 200px;
  height: 130px;
  overflow: hidden;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transform: translateY(12px);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.post-item:hover .post-cover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--text-light);
  background: var(--tag-bg);
  background-image:
    linear-gradient(45deg, rgba(55, 53, 47, 0.02) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(55, 53, 47, 0.02) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(55, 53, 47, 0.02) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(55, 53, 47, 0.02) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.post-date {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.post-item h2 {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 12px;
}

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

.post-excerpt {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 14px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.post-item:hover .post-category {
  color: var(--text);
}

.tag {
  display: inline-block;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--tag-bg);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
}

.tag:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.post-item .tag {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.read-link {
  display: none;
}

/* ---- 侧边栏 ---- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-block {
  padding: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.sidebar-block:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.sidebar-block h3 {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-block p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-list {
  list-style: none;
}

.archive-list li {
  padding: 4px 0;
}

.archive-list a {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

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

/* ---- 订阅表单 ---- */
.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subscribe-form input {
  width: 100%;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: transparent;
  color: var(--text);
  transition: border-color 0.15s;
}

.subscribe-form input:focus {
  border-bottom-color: var(--text);
}

.subscribe-form input::placeholder {
  color: var(--text-light);
}

.subscribe-form button {
  align-self: flex-start;
  padding: 8px 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.subscribe-form button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.subscribe-form button:hover {
  color: var(--bg);
  border-color: var(--text);
}

.subscribe-form button:hover::before {
  transform: scaleX(1);
}

.subscribe-form button span {
  position: relative;
  z-index: 1;
}

/* ---- 文章详情 ---- */
.post-header {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.post-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 80px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
}

.post-header h1 {
  font-size: 36px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.post-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.post-info span::before {
  content: "·";
  margin-right: 16px;
  color: var(--text-light);
}

.post-info span:first-child::before {
  display: none;
}

.post-body {
  padding: 40px 0;
  max-width: 720px;
}

.post-body h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.post-body h2::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--text);
}

.post-body h3 {
  font-size: 20px;
  font-weight: 500;
  margin: 32px 0 12px;
}

.post-body p {
  margin-bottom: 16px;
  line-height: 1.8;
}

.post-body ul, .post-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.post-body li {
  margin-bottom: 4px;
}

.post-body blockquote {
  border-left: 3px solid var(--text);
  padding: 12px 20px;
  margin: 20px 0;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.post-body code {
  font-size: 0.9em;
  background: var(--tag-bg);
  padding: 2px 6px;
  border-radius: 3px;
}

.post-body pre {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 20px 0;
  position: relative;
}

.post-body pre::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5f56;
  box-shadow: 14px 0 0 #ffbd2e, 28px 0 0 #27c93f;
}

.post-body pre code {
  background: none;
  padding: 0;
}

.post-body img {
  border: 1px solid var(--border);
  margin: 24px 0;
}

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ---- 评论区 ---- */
.comments-section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  max-width: 720px;
}

.comments-section h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 24px;
}

.comment-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: all var(--transition);
}

.comment-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.comment-avatar img,
.comment-avatar .avatar-placeholder {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.comment-avatar .avatar-placeholder {
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--tag-bg);
  color: var(--text-secondary);
}

.comment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.comment-author {
  font-size: 14px;
  font-weight: 500;
}

.comment-date {
  font-size: 12px;
  color: var(--text-light);
}

.comment-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.comment-form {
  margin-top: 32px;
}

.comment-form h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}

.comment-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: transparent;
  color: var(--text);
  transition: border-color 0.15s;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--text);
}

.comment-form textarea {
  min-height: 100px;
  resize: vertical;
  margin-bottom: 12px;
}

.comment-form button {
  padding: 8px 20px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.comment-form button:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.login-hint {
  font-size: 14px;
  color: var(--text-secondary);
  padding: 16px 0;
}

.login-hint a {
  text-decoration: underline;
  color: var(--text);
}

/* ---- 分类列表 ---- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.category-card {
  background: var(--bg);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.category-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.category-name {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 4px;
}

.category-count {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 8px;
}

.category-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- 登录注册页面 ---- */
.auth-page {
  display: flex;
  justify-content: center;
  padding: 60px 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
}

.auth-card .form-group {
  margin-bottom: 16px;
}

.auth-card label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.auth-card input[type="text"],
.auth-card input[type="password"],
.auth-card input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.auth-card input:focus {
  border-color: var(--text);
}

.auth-card input::placeholder {
  color: var(--text-light);
}

.captcha-row {
  display: flex;
  gap: 10px;
}

.captcha-row input {
  flex: 1;
}

.captcha-img {
  height: 40px;
  cursor: pointer;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.auth-btn {
  width: 100%;
  padding: 12px;
  border: none;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.auth-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.auth-btn:hover::before {
  transform: scaleX(1);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--text);
  text-decoration: underline;
}

/* ---- 相关文章 ---- */
.related-posts {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  max-width: 720px;
}

.related-posts h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
}

.related-list {
  list-style: none;
}

.related-list li {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition);
}

.related-list li:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateX(4px);
}

.related-list a {
  font-size: 14px;
}

.related-list a:hover {
  color: var(--text-secondary);
}

.related-list .date {
  font-size: 12px;
  color: var(--text-light);
}

/* ---- 筛选/归档页面 ---- */
.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
  position: relative;
  margin-bottom: 8px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.page-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
}

.archive-group {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.archive-group h2 {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

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

.archive-item .date {
  font-size: 12px;
  color: var(--text-light);
  min-width: 80px;
  flex-shrink: 0;
}

.archive-item a {
  font-size: 14px;
}

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

.archive-item .cat {
  font-size: 11px;
  color: var(--text-light);
  margin-left: auto;
  flex-shrink: 0;
}

/* ---- Flash 消息 ---- */
.alert {
  padding: 14px 18px;
  margin: 16px 0;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s ease;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

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

.alert-success {
  background: #f6fef6;
  border-color: #d4e8d4;
  color: #2d6a2d;
}

.alert-success::before {
  background: #27ae60;
}

.alert-danger {
  background: #fef6f6;
  border-color: #e8d4d4;
  color: #6a2d2d;
}

.alert-danger::before {
  background: #e74c3c;
}

/* ---- 空状态 ---- */
.empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-light);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 24px 0;
}

/* ---- 响应式 ---- */
.post-header-cover {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.post-header-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.post-header-cover:hover img {
  transform: scale(1.02);
}

@media (max-width: 900px) {
  .content-area {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .post-header h1 {
    font-size: 28px;
  }

  .post-item {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .post-cover {
    width: 100%;
    height: 180px;
    order: -1;
    transform: none;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .nav {
    display: none;
  }

  .hamburger {
    display: grid;
  }

  .hero {
    margin-top: 18px;
    padding: 54px 22px 44px;
    background-position: 62% center;
    border-radius: var(--radius);
  }

  .hero h1 {
    font-size: 28px;
  }

  .post-item {
    padding: 20px;
    margin-bottom: 12px;
    gap: 16px;
  }

  .post-cover {
    height: 160px;
  }

  .comment-form .form-row {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    gap: 8px;
  }
}
