/* ========================================
   SINGLE POST PAGE STYLES
   ======================================== */

.single-post {
  display: flex;
  flex-direction: column;
}

/* Post Header */
.post-header {
  background: var(--bg-light);
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb-nav {
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.breadcrumb-nav a {
  color: var(--primary-color);
}

.breadcrumb-nav a:hover {
  text-decoration: underline;
}

.post-title-section {
  margin-bottom: 1.5rem;
}

.post-title {
  margin: 0 0 1rem 0;
  font-size: 2.5rem;
  line-height: 1.3;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--text-gray);
}

.meta-label {
  font-weight: 600;
  color: var(--text-dark);
}

.post-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-meta a {
  color: var(--primary-color);
}

/* Risk Badge */
.risk-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.risk-badge--high {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.risk-badge--medium {
  background: rgba(243, 156, 18, 0.1);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}

.risk-badge--low {
  background: rgba(39, 174, 96, 0.1);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
}

/* Post Content Wrapper */
.post-content-wrapper {
  padding: 3rem 0;
}

/* Featured Image */
.post-thumbnail {
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
}

.featured-image {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
}

/* Post Body - Image Styles */
.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: 8px;
  object-fit: contain;
  object-position: center;
}

.post-body figure {
  margin: 2rem 0;
  padding: 0;
}

.post-body figure img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
}

.post-body figcaption {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-gray);
  margin-top: 0.75rem;
  font-style: italic;
}

/* Post Body */
.post-body {
  margin-bottom: 3rem;
}

/* Post Navigation (Previous/Next) */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 3rem 0;
  padding: 2rem;
  background: var(--bg-light);
  border-radius: 8px;
}

.post-navigation a {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.post-navigation a:hover {
  transform: translateX(5px);
}

.nav-subtitle {
  font-size: 0.85rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
}

.nav-title {
  font-weight: 600;
}

/* CTA Section */
.post-cta-section {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 2px solid var(--border-color);
}

.learning-path {
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--bg-light);
  border-radius: 8px;
}

.learning-path h3 {
  margin-top: 0;
}

.related-posts-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.related-post-item {
  padding: 1.5rem;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.related-post-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.related-post-item h4 {
  margin-top: 0;
  font-size: 1.1rem;
}

.related-post-item p {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text-gray);
}

/* Sidebar */
.post-sidebar {
  position: relative;
}

.post-sidebar.sticky {
  position: sticky;
  top: 20px;
}

.toc-wrapper {
  margin-bottom: 2rem;
}

/* Table of Contents */
.toc {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
}

.toc-title {
  font-size: 1.1rem;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc ul ul {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
}

.toc li {
  margin-bottom: 0.5rem;
}

.toc a {
  color: var(--text-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

.toc a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.toc a.active {
  color: var(--primary-color);
  font-weight: 600;
}

/* Quick Answer Box */
.quick-answer-box {
  margin-top: 1.5rem;
  padding: 1rem;
  background: rgba(39, 174, 96, 0.05);
  border-radius: 4px;
  border-left: 3px solid var(--accent-color);
}

.quick-answer-box h4 {
  margin-top: 0;
  color: var(--accent-color);
}

.quick-answer-box p {
  margin-bottom: 0;
  font-size: 0.95rem;
}

/* Risk Disclaimer */
.risk-disclaimer {
  margin-top: 2rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1200px) {
  .content-wrapper {
    grid-template-columns: 1fr !important;
  }

  .post-sidebar {
    margin-top: 3rem;
    padding-top: 3rem;
    border-top: 2px solid var(--border-color);
  }

  .post-sidebar.sticky {
    position: static;
  }
}

@media (max-width: 768px) {
  .post-title {
    font-size: 2rem;
  }

  .post-meta {
    flex-direction: column;
    gap: 0.75rem;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .related-posts-list {
    grid-template-columns: 1fr;
  }

  .toc {
    display: none;
  }

  /* 图片响应式优化 */
  .post-body img {
    margin: 1rem auto;
    border-radius: 6px;
  }

  .post-body figure {
    margin: 1.5rem 0;
  }

  .post-thumbnail {
    margin-bottom: 1.5rem;
  }

  .featured-image {
    border-radius: 6px;
  }

  /* Mobile TOC toggle */
  .toc-toggle {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 1rem;
  }

  .toc-toggle.active ~ .toc {
    display: block;
  }
}

/* Extra Small Devices - 480px and below */
@media (max-width: 480px) {
  .post-title {
    font-size: 1.5rem;
  }

  .post-header {
    padding: 1.5rem 0;
  }

  .post-meta {
    gap: 0.5rem;
    font-size: 0.85rem;
  }

  .breadcrumb-nav {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }

  /* 需要随改或移除一些不容易显示 */
  .post-meta span {
    display: block;
    margin-bottom: 0.5rem;
  }

  /* 图片超终优化 */
  .post-body img {
    margin: 0.75rem auto;
    border-radius: 4px;
    max-width: 100%;
    width: 100%;
    height: auto !important;
  }

  .post-body figure {
    margin: 1rem 0;
    overflow: hidden;
  }

  .featured-image {
    max-width: 100%;
    width: 100%;
    height: auto !important;
    border-radius: 4px;
  }

  .post-content-wrapper {
    padding: 1.5rem 0;
  }

  .post-navigation {
    gap: 1rem;
    margin: 2rem 0;
    padding: 1.5rem;
  }

  .nav-subtitle {
    font-size: 0.75rem;
  }

  .nav-title {
    font-size: 0.95rem;
  }

  .learning-path {
    padding: 1.5rem;
  }

  .related-posts-list {
    gap: 1rem;
  }

  .related-post-item {
    padding: 1rem;
  }

  .related-post-item h4 {
    font-size: 1rem;
  }

  .related-post-item p {
    font-size: 0.85rem;
  }
}
