/* 详情页专用样式 */

/* 页面基础 */
body.page-detail {
  --color-primary: #0D2B5E;
  --color-primary-light: #E7ECF4;
  --color-accent: #B8860B;
  --color-bg-gray: #F5F5F3;
  --color-border: #E0E0E0;
  overflow-x: hidden;
  background: #F9FAFB;
}

/* Banner 区域 */
.detail-banner {
  position: relative;
  height: 280px;
  margin-top: 64px;
  background: var(--color-primary);
  overflow: hidden;
}

.detail-banner-bg {
  position: absolute;
  inset: 0;
  display: block;
}

.detail-banner-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(13, 43, 94, 0.82) 0%, rgba(13, 43, 94, 0.4) 50%, transparent 100%);
  z-index: 1;
}

.detail-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(13, 43, 94, 0.18) 100%);
  pointer-events: none;
  z-index: 1;
}

.detail-banner-content {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #FFFFFF;
}

.detail-banner-title {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 12px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.detail-banner-subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin: 0;
}

/* 面包屑导航 */
.breadcrumb {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  padding: 16px 0;
}

.breadcrumb-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  color: #666666;
}

.breadcrumb-link {
  color: var(--color-primary);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 0.2s;
}

.breadcrumb-link:hover {
  color: var(--color-primary);
}

.breadcrumb-separator {
  color: #CCCCCC;
}

.breadcrumb-current {
  color: #333333;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* 文章容器 */
.article-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 40px 60px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}

.article-main {
  min-width: 0;
  width: 100%;
  max-width: 100%;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.article-sidebar {
  min-width: 0;
}

/* 文章头部 */
.article-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #E5E7EB;
}

.article-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.4;
  margin: 0 0 16px;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 14px;
  color: #6B7280;
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 文章内容 */
.article-content {
  max-width: 100%;
  font-size: 16px;
  line-height: 1.8;
  color: #374151;
  overflow-wrap: anywhere;
}

.article-content p {
  margin: 0 0 20px;
  text-indent: 2em;
}

.article-content p:last-child {
  margin-bottom: 0;
}

.article-content p:has(img) {
  text-indent: 0;
  text-align: center;
}

.article-content img {
  display: block;
  max-width: 100% !important;
  height: auto;
  margin: 24px auto;
  border-radius: 4px;
}

/* 文章图片 */
.article-image {
  margin: 32px 0;
  text-align: center;
}

.article-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 分享按钮 */
.article-share {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #E5E7EB;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.article-share-label {
  font-size: 14px;
  color: #6B7280;
}

.article-share .social-share {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.article-share .social-share .social-share-icon {
  margin: 0 4px 0 0;
  border: 0;
  font-size: 18px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.article-share .social-share .social-share-icon:hover {
  transform: translateY(-2px);
  opacity: 0.85;
}

.share-copy {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  color: #6B7280;
  font-size: 13px;
  background: #F3F4F6;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.share-copy:hover {
  color: var(--color-primary);
  background: #E5E7EB;
}

.share-copy.is-copied {
  color: #16A34A;
  background: #DCFCE7;
}

/* 侧边栏 */
.sidebar-section {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 20px;
}

.sidebar-header {
  position: relative;
  padding: 14px 16px 14px 22px;
  background: #FFFFFF;
  color: #1F2937;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid #E5E7EB;
}

.sidebar-header::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--color-primary);
  border-radius: 2px;
}

.sidebar-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-item {
  border-bottom: 1px solid #F3F4F6;
}

.sidebar-item:last-child {
  border-bottom: none;
}

.sidebar-link {
  display: block;
  padding: 12px 16px 12px 22px;
  font-size: 14px;
  line-height: 1.6;
  color: #374151;
  text-decoration: none;
  position: relative;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-link::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #CBD5E1;
}

.sidebar-link:hover {
  background: #F9FAFB;
  color: var(--color-primary);
}

.sidebar-link:hover::before {
  background: var(--color-primary);
}

.sidebar-link.active {
  color: var(--color-primary);
  font-weight: 500;
  background: #EFF6FF;
}

.sidebar-link.active::before {
  background: var(--color-primary);
}

/* 文章导航（上一篇/下一篇） */
.article-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #E5E7EB;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.article-nav-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: #F9FAFB;
  border-radius: 6px;
  text-decoration: none;
  color: #374151;
  transition: all 0.2s ease;
}

.article-nav-item:hover {
  background: #EFF6FF;
  transform: translateY(-2px);
}

.article-nav-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.article-nav-label {
  font-size: 12px;
  color: #9CA3AF;
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-nav-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-nav-prev {
  text-align: left;
}

.article-nav-next {
  text-align: right;
}

.article-nav-next .article-nav-label {
  justify-content: flex-end;
}

/* 响应式 */
@media (max-width: 768px) {
  .page-detail .site-header,
  .page-detail .site-header.scrolled,
  .page-detail .site-header.is-scrolled {
    height: 64px;
  }

  .page-detail .top-nav {
    height: 64px;
    padding: 0 16px;
  }

  .page-detail .nav-link {
    height: 64px;
  }

  .detail-banner {
    height: 200px;
    margin-top: 64px;
  }

  .detail-banner-content {
    padding: 0 20px;
  }

  .detail-banner-title {
    font-size: 24px;
  }

  .detail-banner-subtitle {
    font-size: 14px;
  }

  .breadcrumb-container {
    padding: 0 20px;
  }

  .article-container {
    padding: 20px 16px 40px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .article-main {
    padding: 24px 20px;
  }

  .article-sidebar {
    order: 2;
  }

  .article-title {
    font-size: 22px;
  }

  .article-content {
    font-size: 15px;
  }

  .article-meta {
    flex-direction: column;
    gap: 8px;
  }

  .article-nav {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .page-detail .floating-actions {
    right: 0;
    bottom: 0;
    left: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    gap: 0;
    border-radius: 0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
  }
}

@media (max-width: 767px) {
  body.page-detail {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .detail-banner {
    height: 220px;
  }

  .detail-banner-title {
    font-size: 27px;
    line-height: 1.32;
  }

  .detail-banner-subtitle,
  .breadcrumb,
  .article-meta {
    font-size: 15px;
    line-height: 1.65;
  }

  .article-container {
    padding: 18px 12px 40px;
    gap: 16px;
  }

  .article-main {
    padding: 20px 16px 24px;
    border-radius: 6px;
  }

  .article-title {
    font-size: 25px;
    line-height: 1.36;
  }

  .article-content {
    font-size: 16px;
    line-height: 1.85;
  }

  .article-content p,
  .article-content li {
    font-size: 16px;
    line-height: 1.85;
  }

  .article-content img {
    width: 100%;
    height: auto;
    margin: 14px 0;
    border-radius: 6px;
  }

  .article-sidebar {
    display: none;
  }
}
