/*
 * Theme: theme-Serenity
 * Author: Serenity
 * Build: 2026-09-06 17:19:05
 * Fingerprint: aadec520d901c075
 * Copyright (c) 2026 Serenity. All rights reserved.
 */

/*
 * Theme: theme-Serenity
 * Author: Serenity
 * Build: 2026-08-31 17:36:30
 * Fingerprint: 897f796e1b7f0d91
 * Copyright (c) 2026 Serenity. All rights reserved.
 */

/*
 * Theme: theme-Serenity
 * Author: Serenity
 * Build: 2026-07-05 00:01:15
 * Fingerprint: 1a93cc3686d739b8
 * Copyright (c) 2026 Serenity. All rights reserved.
 */

.page-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: linear-gradient(180deg, 
    color-mix(in srgb, var(--color-accent) 8%, transparent) 0%,
    transparent 100%);
  pointer-events: none;
  z-index: -1;
}

/* 页面标题样式已提取到 base.css */
.page-header {
  margin-bottom: var(--space-6);
  padding-top: calc(var(--header-height) + var(--space-8));
  text-align: center;
}

.archive-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-6);
  align-items: start;
  padding-bottom: var(--space-8);
}

.archive-layout > .archive-sidebar {
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--header-height) + 16px);
  align-self: start;
}

.archive-main {
  min-width: 0;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .archive-layout {
    grid-template-columns: 1fr;
  }
  
  .archive-layout > .archive-sidebar {
    order: -1;
    position: static;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

@media (max-width: 600px) {
  .archive-sidebar {
    grid-template-columns: 1fr;
  }
}

.archive-main {
  min-width: 0;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.archive-card {
  position: relative;
  display: flex;
  min-height: 120px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal);
  overflow: hidden;
}

/* 置顶文章样式 */
.archive-card.pinned {
  border-color: var(--color-accent);
}

/* 置顶图标 */
.archive-card-pin {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  z-index: 10;
  transition: all var(--duration-fast);
}

.archive-card-pin svg {
  width: 22px;
  height: 22px;
}

.archive-card:hover .archive-card-pin {
  transform: scale(1.15) rotate(-10deg);
}

[data-theme="light"] .archive-card {
  background: var(--color-bg-soft);
}

.archive-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .archive-card:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

/* 封面图 - 绝对定位在左侧，使用mask渐变 */
.archive-card-cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 25%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.archive-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(to left, transparent, #fff 50%);
  mask-image: linear-gradient(to left, transparent, #fff 50%);
  transition: transform var(--duration-normal);
}

.archive-card:hover .archive-card-cover img {
  transform: scale(1.05);
}

.archive-card-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: var(--space-4);
  padding-left: 22%;
}

.archive-card-title {
  font-size: 15px;
  font-weight: 700;
  font-style: italic;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: var(--space-2);
  transition: color var(--duration-fast);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.archive-card:hover .archive-card-title {
  color: var(--color-accent);
}

.archive-card-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.archive-card-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.archive-card-tags {
  display: flex;
  gap: var(--space-2);
}

.archive-card-categories {
  display: flex;
  gap: var(--space-2);
}

.archive-category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-accent);
}

.archive-category svg {
  flex-shrink: 0;
}

.archive-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-accent);
}

.archive-tag svg {
  flex-shrink: 0;
}

.archive-meta-ellipsis {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 1px;
}

.archive-card-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  padding-left: var(--space-3);
  border-left: 1px solid var(--color-border);
}

.archive-card-watermark {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-accent);
  opacity: 0.08;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

.archive-card-month {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem;
  font-weight: 700;
  font-style: italic;
  color: transparent;
  -webkit-text-stroke: 1px var(--color-accent);
  opacity: 0.3;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  transition: color var(--duration-normal), -webkit-text-fill-color var(--duration-normal), opacity var(--duration-normal);
}

.archive-card:hover .archive-card-month {
  color: var(--color-accent);
  -webkit-text-fill-color: var(--color-accent);
  opacity: 1;
}

@media (max-width: 500px) {
  .archive-card {
    min-height: 140px;
  }
  
  .archive-card-cover {
    width: 30%;
  }
  
  .archive-card-content {
    padding-left: 25%;
  }
  
  .archive-card-month {
    font-size: 1.2rem;
  }

}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-6);
  padding: var(--space-4) 0;
  padding-bottom: var(--space-8);
  border-top: 1px solid var(--color-border);
}

.pagination-info {
  font-size: 13px;
  color: var(--color-text-muted);
}

.pagination-info strong {
  color: var(--color-accent);
  font-weight: 600;
  font-family: var(--font-mono);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pagination-current {
  font-size: 13px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  min-width: 60px;
  text-align: center;
}

.pagination-arrow {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
  text-decoration: none;
  cursor: pointer;
}

.pagination-arrow svg {
  width: 18px;
  height: 18px;
  color: white;
}

.pagination-arrow:hover {
  background: var(--color-accent-secondary);
  transform: scale(1.1);
}

.pagination-arrow.disabled {
  background: var(--color-bg-mute);
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.pagination-arrow.disabled svg {
  color: var(--color-text-muted);
}

/* 标签云 - 3D 旋转球形 */
.widget-tags-sphere.tag-sphere-ready {
  position: relative;
  display: block;
  /* 抵消卡片左右下内边距(--space-5:24px)，让球面铺满到卡片真实边缘，
     截断线即卡片边缘，而非内容区边缘 */
  width: auto;
  height: 240px;
  margin: 4px -24px -24px;
  perspective: 700px;
  overflow: hidden;
  /* 底部跟随卡片圆角(--radius-lg:16px)裁切，视觉与卡片贴合 */
  border-bottom-left-radius: 16px;
  border-bottom-right-radius: 16px;
  cursor: grab;
}

.widget-tags-sphere.tag-sphere-ready.tag-sphere-grabbing {
  cursor: grabbing;
}

.widget-tags-sphere.tag-sphere-ready .widget-tag {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  padding: 3px 9px;
  font-size: 12px;
  /* 以容器中心为原点，translate3d 由 JS 接管 */
  transform-origin: center center;
  will-change: transform, opacity;
  transition: none; /* 自转期间禁用过渡，避免抖动 */
  backface-visibility: hidden;
}

/* hover 单个标签时高亮，不影响球面定位（颜色变化交给 base.css 的 :hover） */
.widget-tags-sphere.tag-sphere-ready .widget-tag:hover {
  filter: none !important;
  opacity: 1 !important;
}

/* ==========================================================================
   xhj 定制（2026-09-19）：按需加载 + 虚拟列表 + 左侧时间轴
   --------------------------------------------------------------------------
   配套：templates/archives.html（.a-block 结构）、assets/js/archives.js（全部逻辑）
   约定：.archive-list 的 gap 必须 = .a-block 的 gap = 16px（archives.js 里的 BLOCK_GAP），
        两者任一改动都会让滚动位置与时间轴刻度算错。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 分块 .a-block
   --------------------------------------------------------------------------
   每块 = 一页。JS 以块为单位做虚拟列表：视口附近的块真渲染，远处清空但保留
   估算高度撑住滚动条。块内 gap 必须与 .archive-list 一致，这样「块内卡片间距」
   与「块间间距」完全相同，视觉上看不出分块边界。
   -------------------------------------------------------------------------- */
.a-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);      /* = 16px = BLOCK_GAP */
  position: relative;       /* 供加载/失败提示绝对定位 */
  min-height: 0;
}

.a-block[data-loading]::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: atl-spin 0.8s linear infinite;
}

@keyframes atl-spin {
  to { transform: rotate(360deg); }
}

.a-block[data-error]::after {
  content: '加载失败 · 滚动可重试';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   2. 底部状态条（取数中 / 进度）
   -------------------------------------------------------------------------- */
.archive-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: var(--space-5) 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.archive-status[hidden] {
  display: none;
}

.archive-status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: atl-spin 0.8s linear infinite;
}

.archive-progress {
  font-size: 13px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   3. 左侧时间轴
   --------------------------------------------------------------------------
   刻度纵向位置 = 该年份首篇的文档偏移 / 最大滚动距离，是比例而非像素，
   所以会随后续实测高度自动校正。拖动时浮标显示「年-月」，松手跳转。
   整块 pointer-events:none，只有 .atl-rail 接收事件 —— 只有它需要接拖拽，
   其余（进度轨、齿轮、浮标）都不该挡卡片点击。

   高度不写死，用 top/bottom 夹出一个「可用带」：
     · top:96px     避开固定页眉（页眉高 64px）
     · bottom:172px 避开右下角悬浮按钮（#back-to-top）
   横向**由 JS 定**（timeline-gear.js 的 place()）：原来是贴视口左边 12px，
   离卡片太远；现在贴在卡片列左外侧 14px 处，并用 data-tl 标记降级档位
   （full / thin / off，见下面第 4 节）。CSS 里的 left:12px 只是 JS 没跑时的兜底。
   -------------------------------------------------------------------------- */
.archive-timeline {
  position: fixed;
  left: 12px;
  top: 96px;
  bottom: 172px;
  width: 46px;
  z-index: 60;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* 窗口很矮时再收一点，给刻度留出可读间距 */
@media (max-height: 620px) {
  .archive-timeline {
    top: 84px;
    bottom: 164px;
  }
}

.atl-rail {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: pointer;
}

/* 轨道细线
   ⚠ 竖线贴在**轨道带的右侧**，年份文字落在竖线左侧（right:17px）。
     带子整体又贴在卡片列左外侧 16px 处（JS 定），所以从右往左依次是：
     卡片 → 16px 空隙 → 竖线 → 年份文字。 */
.atl-rail::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--color-border);
}

/* 已滚过的那一段轨道：随齿轮下行而变长，既是进度也是「齿轮压出来的轨」 */
.atl-fill {
  position: absolute;
  right: 8px;
  top: 0;
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: linear-gradient(to bottom,
    rgba(var(--color-accent-rgb), 0.35),
    var(--color-accent));
  pointer-events: none;
}

/* 齿轮：骑在轨道线上，随滚动按周长折算转角（不写死转速，见 timeline-gear.js）。
   横向靠 right:8px + translate(50%) 定死在轨道线中心，纵向由 JS 写 top:%；
   JS 只给 --gear-rot（角度），translate 这半截留在 CSS，
   这样切到别页锚点在左也不用来回改符号。 */
.atl-gear {
  position: absolute;
  right: 8px;
  top: 0;
  width: 16px;
  height: 16px;
  color: var(--color-accent);
  pointer-events: none;
  will-change: transform, top;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
  transform: translate(50%, -50%) rotate(var(--gear-rot, 0deg));
}

.atl-gear svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* 拖动中：齿轮提亮，和浮标一起成为视觉焦点 */
.archive-timeline.dragging .atl-gear {
  color: #fff;
  filter: drop-shadow(0 0 6px rgba(var(--color-accent-rgb), 0.95))
          drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

@media (prefers-reduced-motion: reduce) {
  .atl-gear { filter: none; }
}

.atl-tick {
  position: absolute;
  right: 17px;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}

.atl-tick:hover {
  color: var(--color-accent);
}

.atl-tick.active {
  color: var(--color-accent);
  font-weight: 700;
  background: rgba(var(--color-accent-rgb), 0.12);
}

/* 跟随手指的「年-月」浮标：也放在竖线左侧，往外长（不再压到卡片上） */
.atl-bubble {
  position: absolute;
  right: 42px;
  transform: translateY(-50%);
  padding: 6px 13px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: opacity 0.18s ease;
}

.atl-bubble.show {
  opacity: 1;
}

/* 拖动中：刻度不抢镜，只留浮标 */
.archive-timeline.dragging .atl-tick {
  opacity: 0.25;
  transition: none;
}

/* --------------------------------------------------------------------------
   4. 留白不足时降级
   --------------------------------------------------------------------------
   data-tl 由 assets/js/timeline-gear.js 依「卡片列外侧实际还剩多少留白」
   实测后打上，不再用视口宽度写死断点 —— 写死断点会在 1248~1340px 这类区间
   把时间轴压到卡片上（实测 1440 视口留白 144px，1248 视口只剩 24px，
   而两者卡片列位置由容器 max-width 决定，和视口宽不是线性关系）。

     full  留白 ≥ 76px   细轨 + 年份文字
     thin  留白 ≥ 38px   细轨 + 短横刻度（年份只在浮标里出现）
     phone 宽 ≤ 768px 且没留白 → **改贴视口右边缘**（手机档，见 4.1）
     off   其余更窄       整块不显示
   -------------------------------------------------------------------------- */
.archive-timeline[data-tl='off'] {
  display: none;
}

.archive-timeline[data-tl='thin'] {
  width: 26px;
}

.archive-timeline[data-tl='thin'] .atl-rail::before {
  right: 7px;
  width: 3px;
}

.archive-timeline[data-tl='thin'] .atl-fill {
  right: 7px;
  width: 3px;
}

.archive-timeline[data-tl='thin'] .atl-gear {
  right: 8px;
  width: 11px;
  height: 11px;
}

.archive-timeline[data-tl='thin'] .atl-tick {
  right: 13px;
  width: 9px;
  height: 3px;
  padding: 0;
  font-size: 0;
  color: transparent;
  background: var(--color-text-muted);
  border-radius: 2px;
  opacity: 0.7;
}

.archive-timeline[data-tl='thin'] .atl-tick.active {
  background: var(--color-accent);
  opacity: 1;
}

.archive-timeline[data-tl='thin'] .atl-bubble {
  right: 26px;
}

/* --------------------------------------------------------------------------
   4.1 手机档：卡片列占满宽度、外侧没留白 ⇒ 改贴**视口右边缘**
   --------------------------------------------------------------------------
   与瞬间页 moments.css 的 5.1 节是同一套形态（两页共用 timeline-gear.js，
   档位判定在那边），只是类名前缀不同。窄视口下卡片列就是整屏宽，
   左边没位置放时间轴（原来直接 off ⇒ 手机上完全没有时间轴），
   这一档换成贴视口最右缘的细索引条：
     · 只有 2px 轨道 + 9px 短横刻度，年份只在拖动浮标里出现
     · 容器 22px 宽，落在卡片右内边距上，不遮正文
   ⚠ 容器宽度必须与 timeline-gear.js 里算 left 时用的宽度一致。
   -------------------------------------------------------------------------- */
.archive-timeline[data-tl='phone'] {
  width: 22px;
  top: 88px;
  bottom: 150px;
}

.archive-timeline[data-tl='phone'] .atl-rail::before {
  right: 7px;
  width: 2px;
  background: color-mix(in srgb, var(--color-text) 22%, transparent);
}

.archive-timeline[data-tl='phone'] .atl-fill {
  right: 7px;
  width: 2px;
}

.archive-timeline[data-tl='phone'] .atl-gear {
  right: 8px;
  width: 11px;
  height: 11px;
}

.archive-timeline[data-tl='phone'] .atl-tick {
  right: 12px;
  width: 9px;
  height: 2px;
  padding: 0;
  font-size: 0;
  color: transparent;
  background: color-mix(in srgb, var(--color-text) 48%, transparent);
  border-radius: 2px;
  opacity: 0.9;
}

/* 当前年份那根拉长一点，扫一眼就知道自己停在哪年 */
.archive-timeline[data-tl='phone'] .atl-tick.active {
  width: 14px;
  background: var(--color-accent);
  opacity: 1;
}

.archive-timeline[data-tl='phone'] .atl-bubble {
  right: 24px;
}

/* JS 未跑（没有 data-tl）时的兜底：窄视口直接不显示，别压在卡片上 */
@media (max-width: 1120px) {
  .archive-timeline:not([data-tl]) {
    display: none;
  }
}
