/* ==========================================================
   06-reading-modal.css — 阅读弹窗
   遮罩 / 面板 / 自定义滚动条 / 关闭按钮 / 头部元信息 / 标签 / 加载态
   (正文排版单独放在 07-reading-body.css)
   ========================================================== */

/* ── 遮罩层 ── */
.reading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(30px) saturate(60%);
  -webkit-backdrop-filter: blur(30px) saturate(60%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
}
.reading-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── 面板外壳:圆角裁剪 + 阴影,不滚动 ── */
.reading-panel {
  /* ★ 阅读面板专用旋钮:比卡片实,保证长文可读性 */
  --panel-alpha: 0.975;
  --panel-blur: 24px;

  width: 92vw;
  max-width: 860px;
  max-height: 90vh;
  background: rgba(
    255,
    255,
    255,
    var(--panel-alpha)
  ); /* 改:原来是 var(--white) */
  backdrop-filter: blur(var(--panel-blur)); /* 加 */
  -webkit-backdrop-filter: blur(var(--panel-blur)); /* 加 */
  border-radius: var(--radius-lg);
  box-shadow:
    0 40px 80px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(24px) scale(0.97);
  opacity: 0;
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
  will-change: transform, opacity;
}
.reading-overlay.active .reading-panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ── 内层滚动容器 ── */
.reading-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;

  /* ★ 关键：禁用 Chromium 的 Scroll Anchoring，
     防止它在滚动中途偷偷改 scrollTop 导致滑块回弹 */
  overflow-anchor: none;
}
.reading-scroll::-webkit-scrollbar {
  display: none;
}

/* ── 轨道 ── */
.custom-scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}
/* ── ★ 自定义浮动滚动条 – 滑块 ★ ── */
/* ── 滑块 ── */
.custom-scrollbar-thumb {
  position: absolute;
  top: 0;
  right: 2px;
  width: 5px;
  min-height: 32px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 5px;
  pointer-events: auto;
  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;

  will-change: transform, opacity;
}

.custom-scrollbar-thumb.visible {
  opacity: 1;
  visibility: visible;
}

.custom-scrollbar-thumb:hover {
  width: 7px;
  right: 1px;
  background: rgba(0, 0, 0, 0.45);
}

.custom-scrollbar-thumb.dragging {
  width: 7px;
  right: 1px;
  background: rgba(0, 0, 0, 0.5);
  opacity: 1;
  visibility: visible;
}

.custom-scrollbar-thumb.dragging.on-hero {
  opacity: 0.85;
  background: rgba(0, 0, 0, 0.55);
}
/* ── 文章主图:宽度100%,完全铺满,无任何缝隙 ── */
.reading-hero {
  width: 100%;
  aspect-ratio: 21/9;
  overflow: hidden;
  position: relative;
}
.reading-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── 关闭按钮(暗色毛玻璃) ── */
.reading-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.5s ease,
    background 0.3s ease,
    opacity 0.35s ease;
}
.reading-close:hover {
  background: rgba(0, 0, 0, 0.65);
  transform: rotate(90deg) scale(1.1);
}
.reading-close:active {
  transform: rotate(90deg) scale(0.95);
}
.reading-close svg {
  width: 18px;
  height: 18px;
  stroke: #fff;
  stroke-width: 2;
  fill: none;
}

/* ── 弹窗内头部:分类 / 标题 / 作者元信息 ── */
.reading-header {
  padding: 48px 64px 0;
}
.reading-header .reading-category {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--brand);
  margin-bottom: 20px;
}
.reading-header .reading-category::before {
  content: "";
  width: 20px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}
.reading-header h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.reading-meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 14px;
  color: var(--text-tertiary);
}
.reading-meta-bar .meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.reading-meta-bar .author {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text-primary);
}
.reading-meta-bar .author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #ffdb4d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #1d1d1f;
}

/* ── 文末标签 ── */
.reading-tags {
  padding: 32px 64px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.reading-tag {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 16px;
  border-radius: 100px;
}

/* ── 加载态(文章列表 fetch 期间显示) ── */
.reading-loading {
  text-align: center;
  padding: 60px 0;
  color: var(--text-tertiary);
  font-size: 15px;
}
.reading-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.06);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: ldspin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes ldspin {
  to {
    transform: rotate(360deg);
  }
}

/* ── 响应式 ── */
@media (max-width: 1024px) {
  .reading-header {
    padding: 40px 40px 0;
  }
  .reading-tags {
    padding: 24px 40px;
  }
  .reading-header h1 {
    font-size: 28px;
  }
}
@media (max-width: 768px) {
  .reading-panel {
    border-radius: var(--radius-md);
  }
  .reading-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
  }
  .reading-header {
    padding: 28px 24px 0;
  }
  .reading-tags {
    padding: 20px 24px;
  }
  .reading-header h1 {
    font-size: 24px;
  }
}
