/**
 * UI 增强样式
 * 提供现代化、简洁美观的界面设计
 */

/* ===== 全局优化 ===== */

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 选择文本样式 */
::selection {
  background: rgba(0, 122, 204, 0.2);
  color: inherit;
}

/* 焦点样式优化 */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===== 布局优化 ===== */

/* 主容器优化 */
.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  transition: all 0.3s ease;
}

/* 文章容器优化 */
.post-single {
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin: 2rem 0;
  transition: all 0.3s ease;
}

.post-single:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* 文章头部优化 */
.post-header {
  padding: 3rem 3rem 2rem;
  background: linear-gradient(135deg, rgba(0, 122, 204, 0.05), rgba(0, 168, 255, 0.05));
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.post-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--primary), #0084ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.post-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
  opacity: 0.8;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 面包屑导航优化 */
.breadcrumbs {
  font-size: 0.875rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.breadcrumbs a:hover {
  opacity: 0.8;
}

/* ===== 内容区域优化 ===== */

.post-content {
  padding: 3rem;
  line-height: 1.7;
  font-size: 1.0625rem;
}

/* 标题层级优化 */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin: 2.5rem 0 1rem 0;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  position: relative;
}

.post-content h1 {
  font-size: 2rem;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.5rem;
}

.post-content h2 {
  font-size: 1.75rem;
}

.post-content h2::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.5rem;
  background: var(--primary);
  border-radius: 2px;
}

.post-content h3 {
  font-size: 1.5rem;
  color: var(--primary);
}

.post-content h4 {
  font-size: 1.25rem;
}

.post-content h5 {
  font-size: 1.125rem;
}

.post-content h6 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* 段落优化 */
.post-content p {
  margin: 1.5rem 0;
  text-align: justify;
}

/* 链接优化 */
.post-content a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
  position: relative;
}

.post-content a:hover {
  border-bottom-color: var(--primary);
}

.post-content a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--primary);
  transition: width 0.3s ease;
}

.post-content a:hover::after {
  width: 100%;
}

/* 列表优化 */
.post-content ul,
.post-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.post-content li {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.post-content ul li::marker {
  color: var(--primary);
}

.post-content ol li::marker {
  color: var(--primary);
  font-weight: 600;
}

/* 引用块优化 */
.post-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: rgba(0, 122, 204, 0.05);
  border-left: 4px solid var(--primary);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  position: relative;
}

.post-content blockquote::before {
  content: '"';
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  font-size: 3rem;
  color: var(--primary);
  opacity: 0.3;
  font-family: Georgia, serif;
}

.post-content blockquote p {
  margin: 0;
}

/* 表格优化 */
.post-content table {
  width: 100%;
  margin: 2rem 0;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.post-content th {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.post-content tr:hover {
  background: var(--bg-hover);
}

/* 图片优化 */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  margin: 2rem auto;
  display: block;
  transition: all 0.3s ease;
}

.post-content img:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* 分割线优化 */
.post-content hr {
  margin: 3rem 0;
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ===== 标签和分类优化 ===== */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0;
  padding: 2rem 3rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.tag:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 122, 204, 0.3);
}

.tag::before {
  content: '#';
  margin-right: 0.25rem;
  opacity: 0.8;
}

/* ===== 导航优化 ===== */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
  padding: 2rem 3rem;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}

.post-nav-item {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.post-nav-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.post-nav-prev {
  justify-content: flex-start;
}

.post-nav-next {
  justify-content: flex-end;
  text-align: right;
}

.post-nav-meta {
  flex: 1;
}

.post-nav-subtitle {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.post-nav-title {
  display: block;
  font-weight: 600;
  font-size: 1rem;
}

.post-nav-arrow {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

/* ===== 响应式设计 ===== */

@media (max-width: 768px) {
  .main {
    padding: 0 1rem;
  }

  .post-single {
    margin: 1rem 0;
    border-radius: 12px;
  }

  .post-header,
  .post-content,
  .post-tags {
    padding: 2rem 1.5rem;
  }

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

  .post-content h1 {
    font-size: 1.75rem;
  }

  .post-content h2 {
    font-size: 1.5rem;
  }

  .post-content h2::before {
    left: -0.75rem;
  }

  .post-nav {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }

  .post-nav-item {
    padding: 1rem;
  }

  .post-nav-next {
    text-align: left;
    justify-content: flex-start;
  }
}

/* ===== 打印样式 ===== */

@media print {
  .post-single {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .post-header {
    background: none;
    border-bottom: 2px solid #000;
  }

  .post-title {
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
  }

  .post-nav,
  .post-tags {
    display: none;
  }

  .post-content a::after {
    display: none;
  }

  .post-content img {
    box-shadow: none;
  }
}

/* ===== 无障碍优化 ===== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .post-single:hover {
    transform: none;
  }

  .post-content img:hover {
    transform: none;
  }

  .post-nav-item:hover {
    transform: none;
  }

  .tag:hover {
    transform: none;
  }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  .post-single {
    border: 2px solid var(--border);
  }

  .post-content a {
    border-bottom: 2px solid var(--primary);
  }

  .tag {
    border: 2px solid var(--primary);
  }
}
