/* ====================================================
   倚栏听雨 · 11ty 迁移新增样式
   1. 学习笔记卡片：整张可点跳转
   2. 笔记详情页（baseline 中没有的页面）
   3. 翻页固定顶端（沿用 baseline 已有的 scroll-margin-top）
   不动 src/assets/styles.css
==================================================== */

/* ---------- 卡片整张可点 ----------
   不用 position:absolute;inset:0 —— 那会让卡片塌缩到 0
   改用普通块级 + ::after 扩展点击区到卡片 padding */
.card-link {
  display: block;
  color: inherit;
  position: relative;
}
.card-link:hover { color: inherit; }
.card-link::after {
  content: "";
  position: absolute;
  inset: -26px -26px -22px;
  z-index: 1;
}
/* ---------- 卡片固定高度 250px + 文字省略 ----------
   不用 line-clamp: 1 的硬截断，用 -webkit-line-clamp 多行省略
   高度约束是为了不让长正文撑爆布局、让所有页总高一致 */
.card {
  height: 250px;
  display: flex;
  flex-direction: column;
}
/* 修复：分页隐藏的卡片 —— 覆盖我们自己的 display: flex */
.card.is-hidden { display: none; }
.card h3 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
}
.card p {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1 1 auto;
  margin-bottom: 12px;
}
.card small {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 笔记详情页 ---------- */
.note-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 120px 32px 80px;
  position: relative;
  z-index: 1;
}
.note-container {
  background: rgba(255, 251, 240, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 56px 64px;
  box-shadow: var(--shadow);
  position: relative;
  min-width: 0;
}
.back-link {
  display: inline-block;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  margin-bottom: 32px;
  transition: color .2s;
}
.back-link:hover { color: var(--cinnabar); }
.note-header { margin-bottom: 40px; }
.note-meta-top {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.18em;
  margin-bottom: 18px;
}
.note-dot { color: var(--cinnabar); margin: 0 4px; }
.note-title {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.08em;
  line-height: 1.4;
  margin-bottom: 18px;
}
.note-excerpt {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.8;
  border-left: 2px solid var(--cinnabar);
  padding-left: 16px;
  margin: 0;
}
.note-body {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.95;
  color: var(--ink-2);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.note-body h2 {
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin: 36px 0 16px;
  letter-spacing: 0.08em;
}
.note-body p { margin-bottom: 16px; }
.note-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border-radius: 4px;
}
.note-body ul, .note-body ol {
  padding-left: 24px;
  margin-bottom: 16px;
}
.note-body li { margin-bottom: 6px; }
.note-body blockquote {
  border-left: 2px solid var(--cinnabar);
  padding: 4px 16px;
  background: rgba(217, 207, 185, 0.18);
  margin: 16px 0;
  color: var(--ink-2);
  font-style: italic;
  max-width: 100%;
  overflow-x: auto;
}
.note-body code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--cinnabar);
  overflow-wrap: anywhere;
}
.note-body pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 14px 16px;
  margin: 16px 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  line-height: 1.7;
}
.note-body pre code {
  display: block;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.note-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 16px 0;
}
.note-body th,
.note-body td {
  border: 1px solid var(--line);
  padding: 6px 10px;
  vertical-align: top;
}
.note-body strong { color: var(--ink); font-weight: 500; }
.note-footer { margin-top: 48px; padding-top: 32px; border-top: 1px dashed var(--line); }

/* ---------- 心得时间线段落首行缩进 ---------- */
.timeline p { text-indent: 2em; }

/* ---------- 翻页时版块停靠导航栏下 ---------- */
#study, #messages, #thoughts {
  scroll-margin-top: 80px;
}

/* ---------- Twikoo 真实留言区 ---------- */
.twikoo-panel {
  max-width: 1036px;
  margin: 0 auto 34px;
  padding: 28px 30px;
  background: rgba(255, 251, 240, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(58, 44, 28, 0.08);
}
.guestbook-subhead {
  max-width: 1036px;
  margin: 4px auto 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--serif);
}
.guestbook-subhead h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.12em;
}
.guestbook-subhead span {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
}

@media (max-width: 700px) {
  .note-container { padding: 32px 24px; }
  .note-page { padding: 100px 16px 60px; }
  .twikoo-panel { padding: 22px 18px; }
  .guestbook-subhead { flex-direction: column; gap: 4px; }
}
/* ---------- 心得体会：时间线在容器内上下滑动翻页 ----------
   不滚整页 — section 标题"叁 心得体会"保持在原位
   viewport 高度 = 6 * li 固定高度 = 6 * 110 = 660px
   翻页 = track translateY -(current-1) * 660px */
.timeline-viewport {
  overflow: hidden;
  position: relative;
  height: 660px;
}
.timeline-viewport-empty {
  height: 360px;
}
.timeline-viewport .timeline {
  transition: transform 0.55s cubic-bezier(.2,.7,.2,1);
  will-change: transform;
}
.timeline-viewport-empty .timeline {
  min-height: 100%;
}
.timeline-empty-art {
  position: absolute;
  left: 28px;
  top: 8px;
  bottom: 28px;
  width: 120px;
  pointer-events: none;
}
.timeline-empty-art::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(181, 67, 43, 0.32) 10%, var(--line) 50%, rgba(181, 67, 43, 0.24) 88%, transparent);
}
.timeline-empty-art span {
  position: absolute;
  left: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid rgba(181, 67, 43, 0.58);
  box-shadow: 0 0 0 5px rgba(181, 67, 43, 0.06);
}
.timeline-empty-art span::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 5px;
  width: 64px;
  height: 1px;
  background: linear-gradient(90deg, rgba(181, 67, 43, 0.32), transparent);
}
.timeline-empty-art span:nth-child(1) { top: 0%; }
.timeline-empty-art span:nth-child(2) { top: 18%; }
.timeline-empty-art span:nth-child(3) { top: 38%; }
.timeline-empty-art span:nth-child(4) { top: 58%; }
.timeline-empty-art span:nth-child(5) { top: 78%; }
.timeline-empty-art span:nth-child(6) { top: 96%; }
.timeline-empty-art span:nth-child(even) {
  width: 9px;
  height: 9px;
  left: 2px;
  border-color: rgba(105, 91, 74, 0.34);
  box-shadow: 0 0 0 4px rgba(105, 91, 74, 0.05);
}
.timeline-empty-art span:nth-child(even)::after {
  width: 38px;
  background: linear-gradient(90deg, rgba(105, 91, 74, 0.22), transparent);
}
.timeline-viewport .timeline li {
  min-height: 110px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.timeline-viewport .timeline li p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ---------- 心得时间线:整条 li 标题+摘要可点跳详情 ---------- */
.timeline-link {
  display: block;
  color: inherit;
  overflow: hidden;
}
.timeline-link:hover h4 { color: var(--cinnabar); }
/* ---------- 长文:左目录 + 右正文 ---------- */
.note-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.note-toc {
  position: sticky;
  top: 24px;
  align-self: start;
  font-size: 13px;
  color: var(--ink-2);
  border-left: 2px solid var(--line);
  padding: 4px 0 4px 14px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.note-toc .toc-title {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-3);
  margin: 0 0 10px;
  font-weight: 500;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toc-item a {
  color: var(--ink-2);
  text-decoration: none;
  display: block;
  padding: 2px 0;
  line-height: 1.55;
  border-left: 2px solid transparent;
  margin-left: -16px;
  padding-left: 14px;
  transition: color .15s, border-color .15s;
}
.toc-item a:hover {
  color: var(--cinnabar);
  border-left-color: var(--cinnabar);
}
.toc-item.toc-depth-1 a { font-weight: 500; }
.toc-item.toc-depth-2 a { padding-left: 14px; }
.toc-item.toc-depth-3 a { padding-left: 28px; font-size: 12px; }
.toc-item.toc-depth-4 a,
.toc-item.toc-depth-5 a,
.toc-item.toc-depth-6 a { padding-left: 42px; font-size: 12px; }
.toc-empty {
  color: var(--ink-3);
  font-style: italic;
  font-size: 12px;
  list-style: none;
}
/* 响应式:窄屏隐藏侧边 TOC,正文占满 */
@media (max-width: 900px) {
  .note-layout { grid-template-columns: 1fr; gap: 24px; }
  .note-toc { position: static; max-height: none; border-left: none; border-top: 1px dashed var(--line); padding: 12px 0 0; }
  .note-toc .toc-title { margin-top: 0; }
  .toc-list { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
  .toc-item a { padding: 2px 0; border-left: none; margin-left: 0; }
}

@media (max-width: 700px) {
  .timeline-viewport-empty { height: 300px; }
  .timeline-empty-art { left: 22px; width: 96px; }
  .timeline-empty-art span::after { width: 48px; }
  .timeline-empty-art span:nth-child(even)::after { width: 30px; }
}
