/* article.css (移动端适配: 目录浮窗样式) */
.article-page-container {
  max-width: 1300px;
  margin: 94px auto 40px;
  padding: 0 20px;
  display: flex;
  gap: 28px;
  position: relative;
}

.toc-container {
  width: 26%;
  background: var(--surface-color-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md), var(--shadow-offset);
  position: sticky;
  top: 94px;
  align-self: flex-start;
  max-height: calc(100vh - 124px);
  overflow-y: auto;
  transition: all var(--transition-normal);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) var(--border-color);
}
.toc-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.toc-container::-webkit-scrollbar-track {
  background: var(--border-color);
  border-radius: 4px;
}
.toc-container::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 4px;
}

.article-right-column {
  width: 74%;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.toc-title {
  font-size: 1.4rem;
  text-align: center;
  margin-bottom: 18px;
  color: var(--accent-color);
  border-bottom: 2px dotted var(--border-color);
  padding-bottom: 8px;
  font-weight: 600;
  letter-spacing: 1px;
}

.toc-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.toc-list li {
  margin-bottom: 8px;
  padding-left: 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  opacity: 0;
  transform: translateX(-16px);
  animation: tocItemSlideIn 0.5s ease forwards;
}
.toc-list li:nth-child(1) { animation-delay: 0.05s; }
.toc-list li:nth-child(2) { animation-delay: 0.1s; }
.toc-list li:nth-child(3) { animation-delay: 0.15s; }
.toc-list li:nth-child(4) { animation-delay: 0.2s; }
.toc-list li:nth-child(n+5) { animation-delay: 0.25s; }

.toc-list a {
  color: var(--text-color);
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  transition: all 0.2s;
  font-size: 0.9rem;
}
.toc-list a:hover {
  background: rgba(165, 88, 96, 0.1);
  color: var(--accent-color);
  transform: translateX(2px);
}
.toc-list li.active {
  border-left-color: var(--accent-color);
  background: rgba(165, 88, 96, 0.06);
  border-radius: 0 8px 8px 0;
}
.toc-list li.active a {
  color: var(--accent-color);
  font-weight: 600;
}

.toc-list li.toc-h1 { margin-left: 0; font-weight: 700; }
.toc-list li.toc-h2 { margin-left: 12px; font-weight: 600; }
.toc-list li.toc-h3 { margin-left: 24px; font-weight: normal; }
.toc-list li.toc-h4 { margin-left: 36px; font-size: 0.85rem; }

@keyframes tocItemSlideIn {
  0% { opacity: 0; transform: translateX(-16px); }
  100% { opacity: 1; transform: translateX(0); }
}

.article-content-wrapper {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-offset);
  padding: 48px;
  transition: all var(--transition-normal);
}

.article-content-wrapper:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-md), var(--shadow-offset);
  transform: none;
  background: var(--surface-color);
}

[data-theme="dark"] .article-content-wrapper {
  background: var(--surface-color);
}

.article-content-wrapper h1 {
  font-size: 2.4rem;
  text-align: center;
  margin-top: 0.3em;
  margin-bottom: 0.2em;
  animation: articleTitleSlideDown 0.6s ease;
  font-weight: 700;
}
@keyframes articleTitleSlideDown {
  0% { opacity: 0; transform: translateY(-20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.article-subtitle {
  text-align: center;
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 1.8em;
  padding-bottom: 0.8em;
  border-bottom: 1px dashed var(--border-color);
  font-style: italic;
}
[data-theme="dark"] .article-subtitle {
  color: #aaa;
}

.article-meta {
  margin-bottom: 32px;
  padding: 14px 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}
.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: help;
  position: relative;
}
.meta-item i {
  font-size: 1rem;
  color: var(--accent-color);
}
.meta-value {
  font-size: 0.9rem;
  font-weight: 500;
}
.meta-item:hover::after {
  content: attr(data-label);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.meta-item:hover::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 6px;
  height: 6px;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99;
}

[data-theme="dark"] .meta-item:hover::after {
  background: rgba(255, 255, 255, 0.9);
  color: #1e1e1e;
}
[data-theme="dark"] .meta-item:hover::before {
  background: rgba(255, 255, 255, 0.9);
}

.article-content-wrapper {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-color);
}
.article-content-wrapper h2 {
  font-size: 1.9rem;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.3em;
  margin-top: 1.6em;
  font-weight: 600;
}
.article-content-wrapper h3 {
  font-size: 1.5rem;
  margin-top: 1.4em;
  font-weight: 600;
}
.article-content-wrapper p {
  margin-bottom: 1.3em;
}
.article-content-wrapper a {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.article-content-wrapper a:hover {
  color: var(--link-hover);
}
.article-content-wrapper blockquote {
  margin: 1.8em 0;
  padding: 1em 1.5em;
  border-left: 4px solid var(--accent-color);
  background: var(--header-bg);
  border-radius: 0 16px 16px 0;
  font-style: normal;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.article-content-wrapper pre,
.article-content-wrapper code {
  background: var(--header-bg);
  border-radius: 8px;
  font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
}
.article-content-wrapper pre {
  padding: 16px;
  overflow-x: auto;
  line-height: 1.5;
  scrollbar-width: thin;
  background: var(--code-bg, #0f1724);
  color: var(--code-color);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 18px 14px 14px 14px;
  border-radius: 12px;
  position: relative;
}
.article-content-wrapper code {
  background: var(--code-bg);
  color: var(--code-color);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.92em;
}
.code-block-wrapper,
.article-content-wrapper .code-block-wrapper {
  background: var(--code-bg);
  color: var(--code-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  margin: 20px 0;
  overflow: hidden;
  position: relative;
  transition: all 0.12s ease;
  box-shadow: 0 6px 18px rgba(0,0,0,0.03);
}
.code-block-wrapper pre {
  margin: 0;
  padding: 18px;
  background: transparent;
}
.code-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 5;
  font-size: 0.85rem;
}
.code-filetype {
  background: rgba(255,255,255,0.06);
  color: var(--code-color, #e6eef6);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.03);
}
.code-copy-btn {
  background: rgba(255,255,255,0.06);
  color: var(--code-color, #e6eef6);
  border: none;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.code-copy-btn:hover {
  background: rgba(255,255,255,0.12);
}
@media (max-width: 480px) {
  .code-toolbar { top: auto; bottom: 8px; right: 8px; }
}
.article-content-wrapper code {
  padding: 2px 6px;
  font-size: 0.9em;
}
.article-content-wrapper table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.95rem;
}
.article-content-wrapper th,
.article-content-wrapper td {
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  text-align: left;
}
.article-content-wrapper th {
  background: rgba(165, 88, 96, 0.05);
  font-weight: 600;
}
.article-content-wrapper tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}
[data-theme="dark"] .article-content-wrapper tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}
.lazy-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2em auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s, transform 0.2s, box-shadow 0.2s;
}
.lazy-image.loaded {
  opacity: 1;
}
.lazy-image:hover {
  transform: scale(1.01);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}
.image-modal {
  display: none;
  position: fixed;
  z-index: 1050;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}
.modal-content {
  display: block;
  margin: 5% auto;
  max-width: 90%;
  max-height: 80%;
}
#modalImage {
  display: block;
  margin: auto;
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}
.close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: #ccc;
}
.article-footer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 2.5rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border-color);
}
.footer-tag {
  background: rgba(100, 100, 100, 0.1);
  color: var(--accent-color);
  padding: 6px 16px;
  border-radius: 40px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}
.footer-tag:hover {
  background: var(--accent-color);
  color: white;
  transform: translateY(-2px);
  border-color: var(--accent-color);
}
.comments-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--shadow-offset);
  padding: 32px 36px;
  transition: all var(--transition-normal);
}
.comments-card:hover {
  border-color: var(--border-color);
  box-shadow: var(--shadow-md), var(--shadow-offset);
  transform: none;
  background: var(--surface-color);
}
[data-theme="dark"] .comments-card {
  background: var(--surface-color);
}
.comments-container h3 {
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
  color: var(--accent-color);
  border-left: 4px solid var(--accent-color);
  padding-left: 16px;
}
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: transparent;
  z-index: 1000;
  pointer-events: none;
}
.progress-bar {
  height: 100%;
  background: var(--accent-color);
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(165, 88, 96, 0.6);
}
.floating-buttons {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 99;
}
.floating-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(165, 88, 96, 0.92);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
  transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.floating-btn:hover {
  transform: scale(1.08);
  background: var(--accent-color);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .floating-btn {
  background: rgba(212, 165, 165, 0.92);
}
[data-theme="dark"] .floating-btn:hover {
  background: #d4a5a5;
  color: #1e1e1e;
}
.comment-btn {
  font-size: 0.9rem;
  font-weight: 600;
}
.top-btn {
  font-size: 1.8rem;
  line-height: 1;
}
/* 移动端目录浮窗按钮样式 */
.toc-float-btn {
  font-size: 1.4rem;
  line-height: 1;
}
.toc-float-btn.active {
  background: var(--accent-color);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(165, 88, 96, 0.6);
}
/* 移动端目录浮窗样式 */
@media (max-width: 768px) {
  .article-page-container {
    flex-direction: column;
    margin-top: 80px;
    padding: 0 16px;
    gap: 20px;
  }
  /* 原静态目录隐藏，浮窗模式下浮窗显示 */
  .toc-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    max-width: 320px;
    max-height: 70vh;
    background: var(--surface-color-secondary);
    backdrop-filter: blur(20px);
    z-index: 1000;
    border-radius: 24px;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.2), 0 0 0 100vw rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    padding: 20px 16px;
    transition: all 0.2s ease;
    border: none;
    display: none; /* 默认隐藏，由JS控制显示 */
    flex-direction: column;
  }
  .toc-container.mobile-float-toc {
    /* 浮窗模式下额外样式保持 */
  }
  .mobile-toc-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
    z-index: 1001;
  }
  .mobile-toc-close:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: rotate(90deg);
  }
  .toc-title {
    margin-top: 0;
    margin-right: 28px;
    text-align: left;
    font-size: 1.2rem;
  }
  .toc-list li {
    padding-left: 8px;
  }
  .toc-list a {
    padding: 8px 8px;
    font-size: 0.9rem;
  }
  .article-right-column {
    width: 100%;
  }
  .article-content-wrapper {
    padding: 28px;
  }
  .meta-grid {
    gap: 16px;
    justify-content: flex-start;
  }
  .floating-buttons {
    bottom: 20px;
    right: 20px;
  }
  .floating-btn {
    width: 48px;
    height: 48px;
  }
  body.toc-open {
    overflow: hidden;
  }
}
@media (max-width: 480px) {
  .article-content-wrapper {
    padding: 20px;
  }
  .article-content-wrapper h1 {
    font-size: 1.8rem;
  }
  .article-content-wrapper h2 {
    font-size: 1.5rem;
  }
  .comments-card {
    padding: 20px;
  }
  .toc-container {
    width: 90%;
    max-width: none;
    max-height: 75vh;
  }
}
.article-content-wrapper h1:target,
.article-content-wrapper h2:target,
.article-content-wrapper h3:target {
  animation: highlight 2s ease;
}
@keyframes highlight {
  0% { background-color: rgba(165, 88, 96, 0.15); }
  100% { background-color: transparent; }
}
.article-content-wrapper h1,
.article-content-wrapper h2,
.article-content-wrapper h3,
.article-content-wrapper h4 {
  scroll-margin-top: 100px;
}
.article-content-wrapper ul,
.article-content-wrapper ol {
  padding-left: 1.5em;
  margin-bottom: 1.3em;
}
.article-content-wrapper li {
  margin: 0.4em 0;
}
.article-content-wrapper hr {
  margin: 2em auto;
  width: 80px;
  border: none;
  height: 2px;
  background: var(--border-color);
  opacity: 0.6;
}
.image-alt-text {
  display: block;
  text-align: center;
  font-size: 0.8rem;
  color: #888;
  margin-top: 8px;
  margin-bottom: 1.2em;
  line-height: 1.4;
  font-style: italic;
  letter-spacing: 0.3px;
}
[data-theme="dark"] .image-alt-text {
  color: #aaa;
}
.article-body img {
  display: block;
  margin: 1.5em auto 0 auto;
  max-width: 100%;
  height: auto;
}
.footnote, .footnotes {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border-color);
  font-size: 0.95rem;
  color: var(--text-muted, #666);
}
.footnote hr,
.footnotes hr {
  display: none;
}
.footnote ol,
.footnotes ol {
  list-style: decimal;
  padding-left: 1.2rem;
  margin: 0.6rem 0 0 0;
}
.footnote li,
.footnotes li {
  margin: 0.6rem 0;
  padding: 0.6rem;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
}
.footnote-backref {
  margin-left: 8px;
  text-decoration: none;
  color: var(--accent-color);
  font-weight: 600;
}
.footnote a[href^="#fnref"], .footnotes a[href^="#fnref"] {
  text-decoration: none;
}