/* ===================================================================
   Zolastrap Global Styles — Design Token System
   基于Bootstrap 5.3 CSS变量，自动适配Bootswatch主题
   =================================================================== */

/* ===== Design Tokens ===== */
:root {
  /* 从Bootstrap继承主题色 */
  --site-primary: var(--bs-primary, #667eea);
  --site-primary-rgb: 102, 126, 234;
  --site-secondary: var(--bs-secondary, #764ba2);
  --site-success: var(--bs-success, #198754);
  --site-surface: var(--bs-body-bg, #fff);
  --site-surface-rgb: 255, 255, 255;
  --site-text: var(--bs-body-color, #212529);
  --site-text-muted: var(--bs-secondary-color, #6c757d);
  --site-border: var(--bs-border-color, #dee2e6);

  /* 语义色 — 语义功能色（危险/警告/信息/白色）从BS继承 */
  --site-danger: var(--bs-danger, #dc3545);
  --site-warning: var(--bs-warning, #ffc107);
  --site-info: var(--bs-info, #0dcaf0);
  --site-white: var(--bs-white, #fff);
  --site-dark: var(--bs-dark, #212529);

  /* 功能色 — 代码块 */
  --code-inline-bg: var(--code-inline-bg);
  --code-inline-color: var(--bs-pink, #d63384);
  --code-block-bg: var(--bs-dark, #1a1a2e);
  --code-block-color: var(--bs-secondary-color, #adb5bd);

  /* 功能色 — 遮罩/覆盖 */
  --overlay-dark: rgba(0, 0, 0, 0.8);
  --overlay-medium: rgba(0, 0, 0, 0.5);

  /* 功能色 — Footer 深色系 */
  --footer-bg: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --footer-text: rgba(255, 255, 255, 0.75);
  --footer-text-muted: rgba(255, 255, 255, 0.45);
  --footer-divider: rgba(255, 255, 255, 0.1);

  /* 排版比例尺 — 基于 1.25 Major Third */
  --font-xs: 0.75rem;      /* 12px */
  --font-sm: 0.875rem;     /* 14px */
  --font-base: 1rem;       /* 16px */
  --font-md: 1.125rem;     /* 18px */
  --font-lg: 1.25rem;      /* 20px */
  --font-xl: 1.5rem;       /* 24px */
  --font-2xl: 2rem;        /* 32px */
  --font-3xl: 2.5rem;      /* 40px */
  --font-4xl: 3rem;        /* 48px */

  /* 行高 */
  --lh-tight: 1.25;
  --lh-snug: 1.375;
  --lh-normal: 1.6;
  --lh-relaxed: 1.75;
  --lh-loose: 1.9;

  /* 字重 */
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  /* 间距 */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* 渐变 */
  --primary-gradient: linear-gradient(135deg, var(--site-primary) 0%, var(--site-secondary) 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);

  /* 阴影 */
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* 动画 */
  --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* 背景渐变 */
  --site-bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* ===== Dark Mode ===== */
[data-bs-theme="dark"] {
  --site-primary-rgb: 102, 126, 234;
  --site-surface: var(--bs-body-bg);
  --site-surface-rgb: 33, 37, 41;
  --site-bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* 暗色模式仅在 data-bs-theme="dark" 显式设置时激活 */

/* ===== Base ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', 'Hiragino Sans GB', sans-serif;
  background: var(--site-bg-gradient);
  min-height: 100vh;
  font-size: var(--font-base);
  line-height: var(--lh-normal);
  color: var(--site-text);
  word-break: break-word;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== Typography Reset ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--site-text);
  line-height: var(--lh-tight);
  margin-top: 0;
}

h1 { font-size: var(--font-3xl); font-weight: var(--fw-extrabold); }
h2 { font-size: var(--font-2xl); font-weight: var(--fw-bold); }
h3 { font-size: var(--font-xl); font-weight: var(--fw-semibold); }
h4 { font-size: var(--font-lg); font-weight: var(--fw-semibold); }
h5 { font-size: var(--font-md); font-weight: var(--fw-medium); }
h6 { font-size: var(--font-base); font-weight: var(--fw-medium); }

p {
  margin-bottom: var(--space-md);
  line-height: var(--lh-normal);
}

small {
  font-size: var(--font-sm);
  line-height: var(--lh-normal);
}

.text-muted {
  color: var(--site-text-muted) !important;
}

/* 列表排版 */
ul, ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

li {
  margin-bottom: var(--space-xs);
  line-height: var(--lh-normal);
}

/* 中英文混排优化 — 自动间距 */
body *:not(pre):not(code) {
  text-autospace: ideograph-alpha;
}

/* ===== Navbar ===== */
.navbar {
  z-index: 1030;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: var(--transition-base);
}

.navbar-light {
  background: rgba(var(--site-surface-rgb), 0.95);
}

.navbar-dark {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.navbar-brand {
  font-weight: var(--fw-bold);
  font-size: var(--font-xl);
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-dark .navbar-brand {
  background: linear-gradient(135deg, var(--site-white) 0%, rgba(255, 255, 255, 0.8) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-link {
  position: relative;
  font-weight: var(--fw-medium);
  font-size: var(--font-lg);
  transition: var(--transition-base);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-gradient);
  transition: var(--transition-base);
  transform: translateX(-50%);
}

.nav-link:hover::after {
  width: 80%;
}

/* Navbar collapse 动画 */
.navbar-collapse.collapsing {
  transition: height 0.35s ease;
  overflow: hidden;
}

/* ===== Cards ===== */
.card {
  border: none;
  border-radius: 1rem;
  box-shadow: var(--card-shadow);
  transition: var(--transition-base);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.card-img-top {
  border-radius: 1rem 1rem 0 0;
  object-fit: cover;
  transition: var(--transition-base);
}

.card:hover .card-img-top {
  transform: scale(1.05);
}

/* ===== Article Cards ===== */
.article-card {
  background: var(--site-surface);
  border-radius: 0.875rem;
  overflow: hidden;
  transition: var(--transition-base);
  display: flex;
  flex-direction: column;
}

.article-card > .card-body,
.article-card > .overflow-hidden + .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.12);
}

.article-card .card-body {
  padding: 1.25rem;
}

.article-title {
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
}

.article-title a {
  color: var(--site-text);
  text-decoration: none;
  transition: var(--transition-base);
}

.article-title a:hover {
  color: var(--site-primary);
}

.summary-text {
  font-size: var(--font-base);
  color: var(--site-text-muted);
  line-height: 1.5;
  max-height: 4.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body-accent {
  border-left: 3px solid transparent;
  border-image: var(--primary-gradient) 1;
  padding-left: 1rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  color: var(--site-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.article-meta-sep {
  color: var(--site-border);
  font-size: 0.7rem;
}

/* ===== Badges ===== */
.badge {
  font-weight: var(--fw-medium);
  padding: 0.5em 1em;
  border-radius: 2rem;
  transition: var(--transition-base);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.badge-tag {
  font-size: 0.7rem;
  font-weight: var(--fw-medium);
  padding: 0.25rem 0.65rem;
  border-radius: 2rem;
  text-decoration: none;
  color: var(--site-white);
  background: var(--site-success);
  transition: var(--transition-base);
}

.badge-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

.badge-tag-primary {
  background: var(--site-primary);
}

/* ===== Buttons ===== */
.btn {
  border-radius: 2rem;
  padding: 0.5rem 1.5rem;
  font-weight: var(--fw-medium);
  transition: var(--transition-base);
  border: none;
}

.btn-primary {
  background: var(--primary-gradient);
  box-shadow: 0 4px 15px rgba(var(--site-primary-rgb), 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--site-primary-rgb), 0.5);
  background: var(--primary-gradient);
}

.btn-outline-primary {
  border: 2px solid var(--site-primary);
  color: var(--site-primary);
}

.btn-outline-primary:hover {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
}

/* ===== Section Headers ===== */
.section-header {
  position: relative;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  font-weight: var(--fw-bold);
  font-size: var(--font-xl);
  color: var(--site-text);
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 4px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

.section-title {
  font-weight: var(--fw-bold);
  color: var(--site-text);
  margin: 0;
}

/* ===== Feature Cards ===== */
.feature-card {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: var(--transition-base);
  margin-bottom: 1rem;
  background: var(--site-surface);
}

.feature-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 20px 40px rgba(var(--site-primary-rgb), 0.25);
}

.feature-card-img-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.feature-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover .feature-card-img {
  transform: scale(1.1);
}

.feature-card-placeholder {
  width: 100%;
  height: 100%;
  background: var(--primary-gradient);
}

.feature-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--site-primary-rgb), 0.85) 0%, rgba(118, 75, 162, 0.85) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover .feature-card-overlay {
  opacity: 1;
}

.feature-card-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-align: center;
  padding: 1rem;
}

.feature-card-label {
  font-size: var(--font-base);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.05em;
}

.feature-card-title {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.1rem;
  font-weight: var(--fw-bold);
  color: var(--site-text);
  text-align: center;
  transition: color 0.3s ease;
}

.feature-card:hover .feature-card-title {
  color: var(--site-primary);
}

.feature-card-desc {
  font-size: 0.95rem;
  color: var(--site-text-muted);
  text-align: center;
  margin: 0;
  padding: 0 0.5rem 0.75rem;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: var(--space-xl) 0 var(--space-md);
  margin-top: auto;
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
}

.site-footer a {
  color: var(--footer-text);
  text-decoration: none;
  transition: var(--transition-base);
}

.site-footer a:hover {
  color: var(--site-primary);
}

/* 主行：Logo — 导航 — 社交 */
.footer-row {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.footer-logo {
  font-size: var(--font-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--site-white);
  white-space: nowrap;
}

.footer-logo:hover {
  color: var(--site-primary);
}

/* 横向导航 */
.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-links a {
  font-size: var(--font-lg);
  color: rgba(255, 255, 255, 0.65);
}

.footer-links a:hover {
  color: var(--site-white);
}

/* 社交图标 */
.footer-social {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.5);
  transition: var(--transition-base);
}

.footer-social a:hover {
  color: var(--site-white);
  background: rgba(255, 255, 255, 0.1);
}

/* 分割线 */
.footer-divider {
  border: none;
  border-top: 1px solid var(--footer-divider);
  margin: var(--space-md) 0;
}

/* 底行：版权 + 备案 */
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-sm);
  font-size: var(--font-base);
  color: rgba(255, 255, 255, 0.35);
}

.footer-bottom a {
  color: rgba(255, 255, 255, 0.45);
  font-size: var(--font-base);
}

.footer-bottom a:hover {
  color: rgba(255, 255, 255, 0.75);
}

.footer-compliance {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-compliance a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: var(--font-lg);
}

.footer-compliance-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* Footer 响应式 */
@media (max-width: 768px) {
  .footer-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .footer-social {
    margin-left: 0;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Main Content ===== */
main {
  background: transparent;
}

.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

/* ===== Hero Section ===== */
.hero-section {
  background: var(--primary-gradient);
  color: white;
  padding: 4rem 2rem;
  border-radius: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
}

.hero-title {
  font-size: var(--font-4xl);
  font-weight: var(--fw-extrabold);
  margin-bottom: 1rem;
  position: relative;
}

.hero-subtitle {
  font-size: var(--font-lg);
  opacity: 0.9;
  position: relative;
}

/* ===== Stats Cards ===== */
.stat-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: var(--transition-base);
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-3px);
}

.stat-number {
  font-size: var(--font-3xl);
  font-weight: var(--fw-extrabold);
  display: block;
}

.stat-label {
  font-size: var(--font-sm);
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ===== Article Page ===== */
.article-page {
  background: var(--site-surface);
  border-radius: 1.5rem;
  padding: var(--space-2xl);
  margin: var(--space-xl) auto;
  max-width: 900px;
  box-shadow: var(--card-shadow);
}

.article-page h1 {
  font-size: var(--font-3xl);
  font-weight: var(--fw-extrabold);
  color: var(--site-text);
  margin-bottom: var(--space-lg);
  line-height: var(--lh-tight);
}

.article-page .content {
  font-size: var(--font-md);
  line-height: var(--lh-relaxed);
  color: var(--site-text);
}

.article-page .content h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-md);
  font-size: var(--font-2xl);
  font-weight: var(--fw-bold);
  color: var(--site-text);
  line-height: var(--lh-tight);
  border-left: 4px solid var(--site-primary);
  padding-left: var(--space-md);
}

.article-page .content h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  font-size: var(--font-xl);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--site-text);
}

.article-page .content h4 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: var(--font-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--site-text);
}

.article-page .content h5 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
  font-size: var(--font-md);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--site-text);
}

.article-page .content h6 {
  margin-top: var(--space-md);
  margin-bottom: var(--space-xs);
  font-size: var(--font-base);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  color: var(--site-text-muted);
}

.article-page .content p {
  margin-bottom: var(--space-lg);
  line-height: var(--lh-relaxed);
}

.article-page .content code {
  background: var(--code-inline-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--code-inline-color);
}

.article-page .content pre {
  background: var(--code-block-bg);
  border-radius: 0.75rem;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-page .content pre code {
  background: transparent;
  color: var(--code-block-color);
  padding: 0;
}

.article-page .content blockquote {
  border-left: 4px solid var(--site-primary);
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--site-bg-gradient);
  border-radius: 0 0.75rem 0.75rem 0;
}

.article-page .content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  box-shadow: var(--card-shadow);
}

.article-page .content ul,
.article-page .content ol {
  margin-bottom: 1.5rem;
  padding-left: 2rem;
}

.article-page .content li {
  margin-bottom: 0.5rem;
}

.article-page .content a {
  color: var(--site-primary);
  text-decoration: none;
  border-bottom: 1px dashed var(--site-primary);
  transition: var(--transition-base);
}

.article-page .content a:hover {
  border-bottom-style: solid;
}

/* ===== Author Box ===== */
.author-box {
  background: var(--site-bg-gradient);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-top: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.author-box img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--site-primary);
}

.author-box .author-info h5 {
  margin: 0 0 0.25rem;
  font-weight: var(--fw-semibold);
}

.author-box .author-info p {
  margin: 0;
  color: var(--site-text-muted);
  font-size: 0.9rem;
}

/* ===== Text Overflow ===== */
.summary-text small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}

.article-card .card-title {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== Card Image Overlap ===== */
.article-card .overflow-hidden ~ .card-body {
  margin-top: -1rem;
  position: relative;
  z-index: 1;
}

/* ===== Dropdown ===== */
.dropdown-menu {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
}

.dropdown-item {
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  transition: var(--transition-base);
}

.dropdown-item:hover {
  background: var(--primary-gradient);
  color: white;
}

/* ===== Form Controls ===== */
.form-control {
  border-radius: 2rem;
  border: 2px solid var(--site-border);
  padding: 0.5rem 1rem;
  transition: var(--transition-base);
}

.form-control:focus {
  border-color: var(--site-primary);
  box-shadow: 0 0 0 3px rgba(var(--site-primary-rgb), 0.15);
}

/* ===== Sidebar Overlay ===== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== Sidebar Toggle ===== */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1050;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(var(--site-primary-rgb), 0.4);
  font-size: var(--font-lg);
  cursor: pointer;
  transition: var(--transition-base);
}
.sidebar-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(var(--site-primary-rgb), 0.5);
}
.sidebar-toggle:active {
  transform: scale(0.95);
}

/* ===== Page with Sidebar ===== */
.page-with-sidebar {
  display: flex;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

.page-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 100px;
  height: fit-content;
  background: var(--site-surface);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--card-shadow);
}

.page-content {
  flex: 1;
  min-width: 0;
}

.sidebar-nav .nav-item {
  list-style: none;
}

.sidebar-nav .nav-link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--site-text-muted);
  border-radius: 0.5rem;
  text-decoration: none;
  transition: var(--transition-base);
  font-size: 0.9rem;
}

.sidebar-nav .nav-link:hover {
  color: var(--site-primary);
  background: var(--code-inline-bg);
  padding-left: 1.25rem;
}

.sidebar-nav .nav-link.active {
  color: var(--site-primary);
  background: rgba(var(--site-primary-rgb), 0.1);
  font-weight: var(--fw-semibold);
}

.sidebar-nav .nav-header {
  color: var(--site-text);
  font-weight: var(--fw-bold);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem 0.25rem;
}

.sidebar-nav .nav-divider {
  height: 1px;
  background: var(--site-border);
  margin: 0.5rem 0;
}

/* Sidebar Search */
.sidebar-search {
  padding: 0 1rem 0.75rem;
}
.sidebar-search input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid var(--site-border);
  border-radius: 2rem;
  font-size: 0.85rem;
  outline: none;
  background: var(--site-surface);
  color: var(--site-text);
  transition: var(--transition-base);
}
.sidebar-search input:focus {
  border-color: var(--site-primary);
  box-shadow: 0 0 0 3px rgba(var(--site-primary-rgb), 0.15);
}

/* ===== Responsive Sidebar ===== */
@media (max-width: 991.98px) {
  .page-with-sidebar {
    flex-direction: column;
  }
  .page-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    z-index: 1045;
    border-radius: 0;
    overflow-y: auto;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2);
  }
  .page-sidebar.show {
    display: block;
  }
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 992px) {
  .sidebar-toggle {
    display: none;
  }
}

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease-out forwards;
}

/* ===== Scroll to Top ===== */
.scroll-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(var(--site-primary-rgb), 0.4);
  font-size: var(--font-base);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: var(--transition-base);
  z-index: 1000;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(var(--site-primary-rgb), 0.5);
}

/* ===== Author Cards ===== */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.author-card {
  background: var(--site-surface);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--card-shadow);
  transition: var(--transition-base);
  text-decoration: none;
  display: block;
}

.author-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(var(--site-primary-rgb), 0.2);
}

.author-card .author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 3px solid var(--site-primary);
}

.author-card h5 {
  color: var(--site-text);
  font-weight: var(--fw-semibold);
  margin-bottom: 0.5rem;
}

.author-card p {
  color: var(--site-text-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.5;
}

.author-header {
  text-align: center;
  margin-bottom: 2rem;
}

.author-header .author-avatar-lg {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 4px solid var(--site-primary);
}

.author-header h1 {
  font-size: var(--font-2xl);
  font-weight: var(--fw-bold);
  color: var(--site-text);
}

.author-bio {
  font-size: 1.1rem;
  color: var(--site-text-muted);
  max-width: 600px;
  margin: 0.5rem auto 0;
}

.author-posts-header {
  border-bottom: 2px solid var(--site-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: var(--fw-bold);
  color: var(--site-text);
}

/* ===== Topic Cards ===== */
.topic-header {
  text-align: center;
  margin-bottom: 2rem;
}

.topic-header h1 {
  font-size: var(--font-2xl);
  font-weight: var(--fw-bold);
  color: var(--site-text);
}

.topic-description {
  font-size: 1.1rem;
  color: var(--site-text-muted);
}

.topic-posts-header {
  border-bottom: 2px solid var(--site-success);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: var(--fw-bold);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.topic-card {
  background: var(--site-surface);
  border: 1px solid var(--site-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  transition: var(--transition-base);
  text-decoration: none;
  display: block;
}

.topic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--site-success);
}

.topic-card .topic-icon {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 50%;
  margin-bottom: 1rem;
  background: rgba(var(--site-primary-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topic-card .topic-icon i {
  font-size: var(--font-3xl);
  color: var(--site-success);
}

.topic-card .topic-image-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(var(--site-primary-rgb), 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topic-card .topic-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.topic-card h5 {
  color: var(--site-text);
  font-weight: var(--fw-semibold);
  margin-bottom: 0.5rem;
}

.topic-card p {
  color: var(--site-text-muted);
  font-size: 0.9rem;
  margin-bottom: 0;
  line-height: 1.6;
}

/* ===== Site Navigation ===== */
.site-nav {
  background: var(--site-surface);
  border-bottom: 1px solid var(--site-border);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.nav-tab a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--site-text);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: var(--fw-medium);
}

.nav-tab a:hover {
  background: var(--code-inline-bg);
  color: var(--site-primary);
}

.nav-tab.active a {
  background: var(--site-primary);
  color: var(--site-white);
}

.nav-search {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-engines {
  display: flex;
  gap: 0.25rem;
}

.search-engine {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--site-border);
  background: var(--site-surface);
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--site-text);
}

.search-engine:hover {
  background: var(--code-inline-bg);
}

.search-engine.active {
  background: var(--site-primary);
  color: var(--site-white);
  border-color: var(--site-primary);
}

.search-form {
  display: flex;
  flex: 1;
  max-width: 500px;
}

.search-input {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--site-border);
  border-radius: 4px 0 0 4px;
  font-size: 0.95rem;
  background: var(--site-surface);
  color: var(--site-text);
}

.search-input:focus {
  outline: none;
  border-color: var(--site-primary);
}

.search-btn {
  padding: 0.5rem 1rem;
  background: var(--site-primary);
  color: var(--site-white);
  border: 1px solid var(--site-primary);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

.search-btn:hover {
  filter: brightness(1.1);
}

/* ===== Category Tree ===== */
.category-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.category-item {
  margin-bottom: 0.5rem;
}

.category-item > a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--site-text);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.category-item > a:hover {
  background: var(--code-inline-bg);
  color: var(--site-primary);
}

.category-item.active > a {
  background: var(--site-primary);
  color: var(--site-white);
}

.category-children {
  list-style: none;
  padding-left: 1.5rem;
  margin: 0.25rem 0;
}

.category-child a {
  display: block;
  padding: 0.35rem 1rem;
  color: var(--site-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-radius: 4px;
}

.category-child a:hover {
  color: var(--site-primary);
  background: rgba(var(--site-primary-rgb), 0.05);
}

.category-child.active a {
  color: var(--site-primary);
  font-weight: var(--fw-medium);
}

/* ===== Breadcrumb ===== */
.breadcrumb-nav {
  margin-bottom: 1rem;
  padding: 0.5rem 0;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  list-style: none;
  background: transparent;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  padding: 0 0.5rem;
  color: var(--site-text-muted);
}

.breadcrumb-item a {
  color: var(--site-primary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--site-text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .feature-card-img-wrapper {
    height: 140px;
  }

  .page-wrapper {
    padding: 0.5rem 0.75rem;
  }

  .article-page {
    padding: var(--space-lg);
    border-radius: 1rem;
  }

  .article-page h1 {
    font-size: var(--font-2xl);
  }

  .article-page .content h2 {
    font-size: var(--font-xl);
  }

  .article-page .content h3 {
    font-size: var(--font-lg);
  }

  .hero-section {
    padding: var(--space-xl);
  }

  .hero-title {
    font-size: var(--font-2xl);
  }

  h1 { font-size: var(--font-2xl); }
  h2 { font-size: var(--font-xl); }
  h3 { font-size: var(--font-lg); }

  .nav-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .nav-search {
    flex-direction: column;
    align-items: stretch;
  }

  .search-engines {
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .search-form {
    max-width: none;
  }
}

/* ===== Inline Style Replacements ===== */
/* 从模板内联样式提取，统一管理 */

/* post.html — overlay 卡片渐变遮罩 */
.card-overlay-gradient {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

/* post.html — vertical 卡片固定图片区 */
.card-img-vertical {
  height: 200px;
  overflow: hidden;
}

/* post.html — horizontal 卡片固定图片区 */
.card-img-horizontal {
  height: 140px;
  overflow: hidden;
}

/* post.html — carousel 图片 */
.carousel-img-400 {
  height: 400px;
  object-fit: cover;
}

/* post.html — default 卡片图片范围 */
.card-img-compact {
  min-height: 110px;
  max-height: 140px;
  overflow: hidden;
}

/* page.html — 文章页特色图片 */
.article-featured-img {
  max-height: 400px;
  object-fit: cover;
}

/* about.html — 关于页布局 */
.about-container {
  max-width: 800px;
}

.about-avatar {
  width: 120px;
  height: 120px;
  object-fit: cover;
}

/* coding-plan.html — 表格首列宽度 */
.cp-col-platform {
  width: 180px;
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
