/* ============================================
   pages.css — 页面级样式
   依赖 tokens.css + components.css
   ============================================ */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--space-10) + var(--space-8)) 0 var(--space-9);
  text-align: center;
  /* 底图是「出血」式装饰：旋转后外接盒会超出视口宽度（375 下约 425px），
     裁掉横向溢出以免撑出横向滚动条；纵向保持 visible，不切掉底部投影。 */
  overflow-x: clip;
  overflow-y: visible;
}

/* 大饼底图：铺在 hero 内容之下，微微倾斜，只做氛围不抢戏
   pie.webp 是手绘描边插画（黑描边 + 奶油色饼身 + 彩色配料）：
   · 降一点饱和度，彩色配料不跟正文抢注意力
   · 中心按 --app-art-mask 柔化，正文落得干净，饼边与配料在四周显现 */
.hero-art {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(660px, 104vw);
  height: auto;
  transform: translate(-50%, -52%) rotate(-6deg);
  opacity: 0.6;
  filter: saturate(0.78) drop-shadow(0 20px 34px var(--app-art-shadow));
  -webkit-mask-image: var(--app-art-mask);
  mask-image: var(--app-art-mask);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

/* 内容层抬到饼之上 */
.hero > .container {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--app-border-hover);
  background: var(--app-tint-cyan-soft);
  color: var(--app-cyan-ink);
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  margin-bottom: var(--space-5);
}

.hero-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background: var(--app-cyan-bright);
  box-shadow: 0 0 8px var(--app-cyan-bright);
  animation: pulse 2.4s var(--ease-out) infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.hero h1 {
  font-size: var(--fs-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-5);
  text-wrap: balance; /* 窄屏避免标题尾字孤行（旧浏览器忽略，无害降级） */
  background: linear-gradient(120deg, var(--app-text) 0%, var(--app-cyan-deep) 55%, var(--app-purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  max-width: 680px;
  margin: 0 auto var(--space-7);
  color: var(--app-text-dim);
  font-size: var(--fs-md);
}

/* 三行短句：一行一事，断行由结构决定，窄屏也不串行 */
.hero-desc .hero-line { display: block; }

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* 统计条：暖色玻璃药丸（呼应暖金「饼」元素），数字+小单位+标签，中间细分隔线 */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  width: fit-content;
  gap: clamp(12px, 2.6vw, 26px);
  margin: clamp(28px, 4vh, 44px) auto 0;
  padding: 11px clamp(18px, 2.8vw, 28px);
  border-radius: 999px;
  background: var(--stat-glass);
  border: 1px solid var(--stat-glass-border);
  box-shadow: var(--stat-shadow);
  backdrop-filter: blur(14px) saturate(1.6);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}

.hero-stats .stat {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas:
    "icon num"
    "icon label";
  align-items: center;
  column-gap: 10px;
  line-height: 1.1;
}

/* 大图标：暖橘微染圆牌，置于左侧与数字+标签成行（方案 A 左徽章），呼应饼人卡通调性 */
.hero-stats .stat-icon {
  grid-area: icon;
  align-self: center;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--stat-icon-bg);
  border: 1px solid var(--stat-icon-ring);
  font-size: 25px;
  line-height: 1;
  box-shadow: var(--stat-icon-shadow);
}

/* 数字为主角：大号深暖棕；单位（件/篇/%）缩小并染暖橘，紧跟数字之后 */
.hero-stats .stat-num {
  grid-area: num;
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--stat-ink);
  line-height: 1;
}

.hero-stats .stat-unit {
  font-size: 0.5em;
  font-weight: 600;
  color: var(--stat-accent);
  margin-left: 1px;
}

.hero-stats .stat-label {
  grid-area: label;
  font-size: var(--fs-xs);
  color: var(--stat-muted);
  letter-spacing: 0.06em;
  margin-top: 3px;
}

/* 栏间细分隔线 */
.hero-stats .stat-divider {
  width: 1px;
  height: 34px;
  background: var(--stat-line);
}

/* ---------- 区块 ---------- */
.section { padding: var(--space-9) 0; }

.section-alt {
  background: var(--app-panel-deep);
  border-top: 1px solid var(--app-border);
  border-bottom: 1px solid var(--app-border);
}

.section-head { margin-bottom: var(--space-7); }

.section-head h2 {
  font-size: var(--fs-xl);
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  color: var(--app-text);
}

.section-head h2::before {
  content: "// ";
  color: var(--app-cyan);
  opacity: 0.8;
}

.section-head p { color: var(--app-text-dim); }

.section-more {
  margin-top: var(--space-7);
  text-align: center;
}

.section-more a {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--app-cyan-ink);
  letter-spacing: 0.04em;
  transition: color var(--dur-fast) var(--ease-out);
}

.section-more a:hover { color: var(--app-cyan-bright); }

/* ---------- 网格（显式断点：桌面 3 列 / 平板 2 列 / 手机 1 列，卡片填满行） ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 960px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 通用页面容器 ---------- */
.page {
  padding: var(--space-9) 0;
  max-width: 800px;
}

/* 宽版页面容器（工具箱总览等需要完整网格宽度的页面） */
.page-wide { max-width: var(--container-max); }

.page-head { margin-bottom: var(--space-8); }

.page-head h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  color: var(--app-text);
  text-wrap: balance;
}

.page-head h1::before {
  content: "// ";
  color: var(--app-cyan);
  opacity: 0.8;
}

.page-head p { color: var(--app-text-dim); }

/* ---------- 工具介绍页 ---------- */
.tool-detail {
  padding: var(--space-9) 0;
  max-width: 840px;
}

.tool-detail-head {
  display: flex;
  gap: var(--space-5);
  align-items: center;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.tool-detail-head h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  color: var(--app-text);
}

.tool-sub {
  color: var(--app-text-dim);
  margin-bottom: var(--space-3);
}

.detail-section { margin-bottom: var(--space-8); }

.detail-section > h2 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  color: var(--app-cyan-ink);
}

.detail-section > h2::before { content: "▸ "; opacity: 0.8; }

/* 手记底部 · 对应装备跳转按钮：无外框、左对齐，仅保留按钮本身 */
.detail-cta {
  margin: var(--space-8) 0 0;
}

.detail-cta .btn {
  width: auto;
}

/* 下载引导框（手记 / 手册共用视觉）：醒目但不越界，全 token 无硬编码 */
.download-cta {
  margin: var(--space-6) 0;
  padding: var(--space-5) var(--space-6);
  background: var(--app-tint-cyan);
  border: 2px solid var(--app-cyan);
  border-radius: var(--radius-md);
  box-shadow: var(--app-shadow);
}

.download-cta .dl-lead {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  font-size: var(--fs-lg);
  color: var(--app-cyan-ink);
}

.download-cta .dl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0;
}

.download-cta .dl-label {
  color: var(--app-text);
  white-space: nowrap;
}

.download-cta .dl-link {
  word-break: break-all;
  color: var(--app-cyan-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.download-cta .dl-code {
  display: inline-block;
  padding: 2px 10px;
  background: var(--app-panel-solid);
  border: 1px solid var(--app-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  letter-spacing: 0.2em;
  color: var(--app-amber-ink);
}

.download-cta .dl-note {
  margin: var(--space-3) 0 var(--space-1);
  color: var(--app-text-dim);
  font-size: var(--fs-sm);
}

.download-cta .btn {
  margin-top: var(--space-3);
  color: var(--app-on-primary);
  text-decoration: none;
}

.muted {
  color: var(--app-text-dim);
  font-size: 0.88rem;
  margin-top: var(--space-4);
}

/* ---------- 特性网格（工具介绍页通用） ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
  list-style: none;
}

.feature-grid .feature-item {
  background: var(--app-panel);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--app-shadow);
  transition: border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.feature-grid .feature-item:hover {
  border-color: var(--app-border-hover);
  transform: translateY(-2px);
}

.feature-grid .feature-item h3 {
  font-size: var(--fs-base);
  color: var(--app-cyan-ink);
  margin-bottom: var(--space-1);
}

.feature-grid .feature-item p {
  font-size: var(--fs-sm);
  color: var(--app-text-dim);
}

/* ---------- 手记：年份分组 + 上/下一篇 ---------- */
.note-year-group + .note-year-group { margin-top: var(--space-8); }

.note-year {
  font-size: var(--fs-lg);
  font-family: var(--font-mono);
  color: var(--app-cyan-ink);
  margin-bottom: var(--space-4);
  letter-spacing: 0.04em;
}

.note-year::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: var(--space-2);
  background: var(--app-hairline);
}

.note-prevnext {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-9);
  padding-top: var(--space-6);
  border-top: 1px solid var(--app-border);
}

.pn-link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 48%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  background: var(--app-panel);
  transition: border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.pn-link:hover {
  border-color: var(--app-border-hover);
  transform: translateY(-2px);
}

.pn-link.pn-right { margin-left: auto; text-align: right; }

.pn-dir {
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  color: var(--app-text-dim);
  letter-spacing: 0.05em;
}

.pn-title {
  font-size: var(--fs-sm);
  color: var(--app-text-dim);
}

.pn-link.pn-empty { opacity: 0.55; pointer-events: none; }

/* ---------- 工具介绍页：正文排版（detail-section 内的文字/列表/行内码） ---------- */
.detail-section p { color: var(--app-text-dim); }

.detail-section p + p { margin-top: var(--space-3); }

.detail-section ul,
.detail-section ol {
  padding-left: 22px;
  color: var(--app-text-dim);
}

.detail-section li { margin-bottom: var(--space-2); }
.detail-section li::marker { color: var(--app-cyan); }

.detail-section code {
  background: var(--app-tint-cyan-soft);
  border: 1px solid var(--app-border);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--app-cyan-ink);
}

/* 更新记录列表（版本时间线） */
.update-list { list-style: none; padding-left: 0; }

.update-list li {
  margin-bottom: var(--space-3);
  padding-left: var(--space-5);
  position: relative;
  color: var(--app-text-dim);
}

.update-list li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--app-cyan);
}

.update-list strong { color: var(--app-text); font-family: var(--font-mono); }

/* 控制项网格（条幅生成器手册页参数说明） */
.control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.control-item {
  background: var(--app-tint-cyan);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  color: var(--app-text-dim);
}

.control-item strong { color: var(--app-text); font-family: var(--font-mono); }

/* 提示框（琥珀色，用于小技巧类提示） */
.callout-tip {
  background: var(--app-tint-amber);
  border: 1px solid var(--app-tint-amber-strong);
  border-left: 3px solid var(--app-amber);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-5);
  margin-top: var(--space-4);
  color: var(--app-text-dim);
}

.callout-tip strong { color: var(--app-amber); }

/* ---------- 手记详情页 ---------- */
.note-detail { max-width: 800px; }

.note-detail-head { margin-bottom: var(--space-8); }

.note-detail-head h1 {
  font-size: var(--fs-2xl);
  line-height: 1.3;
  margin-bottom: var(--space-4);
  color: var(--app-text);
  text-wrap: balance;
}

.note-meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--app-text-dim);
  font-family: var(--font-mono);
}

.note-meta .tag-row { gap: var(--space-2); }

/* 正文占位提示（正文整理中） */
.note-placeholder {
  background: var(--app-panel);
  border: 1px dashed var(--app-border-hover);
  border-left: 3px solid var(--app-cyan-bright);
  border-radius: var(--radius-sm);
  padding: var(--space-6);
  box-shadow: var(--app-shadow);
}

.note-placeholder p { color: var(--app-text-dim); }

.note-placeholder p + p { margin-top: var(--space-3); }

.note-placeholder .ph-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--app-cyan-ink);
  font-size: var(--fs-md);
}

.note-placeholder blockquote {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-left: 3px solid var(--app-cyan-bright);
  background: var(--app-tint-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--app-text-dim);
  font-style: italic;
}

/* ============================================
   全屏逐段滚动（fullpage）
   仅在 JS 判定可启用时才挂 class，无 class（JS 未跑/出错/被拦截）时
   退回普通文档流，布局与改造前完全一致：
     html.fp-on       —— 桌面 + 鼠标 + 允许动效：劫持滚轮/键盘，每次手势跳一段
     html.fp-fallback —— 触屏 / 减少动效：原生滚动 + 就近吸附，不劫持
   ============================================ */

/* 各段作为吸附锚点：仅当祖先有 scroll-snap-type 才生效，平时惰性无害 */
.fp-panel { scroll-snap-align: start; }

/* 段内内容垂直居中，做成「一屏一块」 */
html.fp-on .fp-panel,
html.fp-fallback .fp-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

html.fp-on .fp-panel {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;            /* 一屏一块，段内不滚动 */
}

html.fp-fallback .fp-panel {
  min-height: 100vh;
  min-height: 100dvh;
}

html.fp-fallback { scroll-snap-type: y proximity; }

/* hero 在 fp 模式下仍需保留出血裁切，避免饼图旋转后撑出横向滚动条 */
html.fp-on .hero { overflow: clip; }

/* footer 作为最后一段，去掉与上文的留白（它本身就是吸附段） */
html.fp-on .site-footer,
html.fp-fallback .site-footer { margin-top: 0; }

/* ---------- 右侧段点导航（章节跳转） ---------- */
.fp-dots {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: calc(var(--z-header) + 5);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 8px;
  border-radius: var(--radius-full);
  background: var(--app-panel);
  border: 1px solid var(--app-border);
  box-shadow: var(--app-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.fp-dots button {
  appearance: none;
  width: 11px;
  height: 11px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--app-border-hover);
  background: transparent;
  cursor: pointer;
  transition: height var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.fp-dots button:hover { transform: scale(1.15); border-color: var(--app-cyan); }

.fp-dots button.is-active {
  height: 30px;
  border-color: transparent;
  background: linear-gradient(180deg, var(--app-cyan-bright), var(--app-purple));
  box-shadow: var(--app-glow);
}

/* ---------- 首屏「向下滚动」提示 ---------- */
.fp-hint {
  display: none;              /* 仅 fp 模式下由 CSS 显示 */
  position: absolute;
  left: 50%;
  bottom: calc(var(--space-7) + 8px);
  transform: translateX(-50%);
  z-index: 2;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--app-border);
  background: var(--app-panel);
  color: var(--app-text-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  box-shadow: var(--app-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity var(--dur-base) var(--ease-out);
  animation: fp-bob 2s var(--ease-out) infinite;
}

.fp-hint .arrow { display: inline-block; }

html.fp-on .fp-hint,
html.fp-fallback .fp-hint { display: inline-flex; }

.fp-hint.is-hidden { opacity: 0; pointer-events: none; }

@keyframes fp-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 4px); }
}

/* 减少动效：停止提示浮动（JS 也不会挂 fp-on，交由原生滚动） */
@media (prefers-reduced-motion: reduce) {
  .fp-hint { animation: none; }
}

/* 窄屏隐藏段点导航（空间有限，触控滑动本就逐段） */
@media (max-width: 640px) {
  .fp-dots { right: 10px; gap: 11px; padding: 9px 6px; }
  .fp-dots button { width: 9px; height: 9px; }
  .fp-dots button.is-active { height: 22px; }
}

/* 工具本体（app.html）样式见 assets/app.css */

/* 表单行（工具 app 通用：80px 右对齐标签） */
.el-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.el-field > label {
  width: 80px;
  flex-shrink: 0;
  text-align: right;
  font-size: var(--fs-sm);
  color: var(--app-text-dim);
  font-family: var(--font-mono);
}

.el-field input[type="text"],
.el-field input[type="number"],
.el-field input[type="date"],
.el-field select,
.el-field textarea {
  flex: 1;
  min-width: 0;
  padding: 8px var(--space-3);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  background: var(--app-panel-solid);
  color: var(--app-text);
  font-size: var(--fs-sm);
  font-family: var(--font-sans);
  transition: border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.el-field input:focus,
.el-field select:focus,
.el-field textarea:focus {
  outline: none;
  border-color: var(--app-cyan-ink);
  box-shadow: 0 0 0 3px var(--app-selection);
}

.el-icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  background: var(--app-panel-solid);
  color: var(--app-text-dim);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.el-icon-btn:hover {
  border-color: var(--app-border-hover);
  color: var(--app-cyan-ink);
}
