/* ============================================================
   陆嵩元 · 个人站点 公共样式
   上半部分：从原 index.template.html 原样抽出（首页视觉不变）
   下半部分：多页站点新增（导览卡 / 详情页 / 过渡 / 导航高亮 / 联系页）
   ============================================================ */

:root {
  --paper: #F7F5EF;
  --ink: #191813;
  --ink-soft: #5C5950;
  --ink-faint: #8E8B80;
  --hair: rgba(25, 24, 19, 0.18);
  --hair-strong: rgba(25, 24, 19, 0.85);
  --seal: #A63B2A;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "Menlo", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
section.chapter { scroll-margin-top: 80px; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--seal); color: var(--paper); }
.page { max-width: 1060px; margin: 0 auto; padding: 0 28px; }

.label {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--ink-soft);
}
.mono { font-family: var(--mono); }

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  margin: 0 -28px;
  padding: 18px 28px 14px;
  border-bottom: 1px solid var(--hair-strong);
}
.masthead .mono { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.08em; }
.masthead nav { display: flex; gap: 28px; }
.masthead nav a {
  font-family: var(--sans); font-size: 13px; letter-spacing: 0.2em;
  color: var(--ink); text-decoration: none; position: relative;
  white-space: nowrap;
}
.masthead nav a::after {
  content: ""; position: absolute; left: 0; bottom: -4px;
  width: 100%; height: 1px; background: var(--seal);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.masthead nav a:hover::after { transform: scaleX(1); }
.masthead nav a:hover { color: var(--seal); }

.hero { position: relative; padding: 88px 0 64px; border-bottom: 1px solid var(--hair-strong); }
.hero-kicker { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.hero-kicker .rule { flex: 0 0 56px; height: 1px; background: var(--ink); }
h1.name {
  font-size: clamp(84px, 15vw, 168px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.06em;
  margin-left: -6px;
}
.hero-tagline {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
  margin-top: 36px;
  max-width: 30em;
}
.hero-intro {
  margin-top: 20px;
  max-width: 38em;
  color: var(--ink-soft);
  font-size: 15px;
}
.hero-vertical {
  position: absolute; top: 92px; right: 0;
  writing-mode: vertical-rl;
  font-size: 15px; letter-spacing: 0.6em;
  color: var(--ink-soft);
  border-left: 1px solid var(--hair);
  padding-left: 18px;
  height: 300px;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 12px 36px;
  margin-top: 48px; padding-top: 18px;
  border-top: 1px solid var(--hair);
}
.hero-meta div { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); letter-spacing: 0.04em; }
.hero-meta b { font-weight: 500; color: var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--hair-strong); }
.stat { padding: 34px 8px 30px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--hair); }
.stat .num { font-family: var(--mono); font-size: clamp(30px, 4.5vw, 44px); font-weight: 500; line-height: 1.2; }
.stat .num em { font-style: normal; font-size: 0.5em; color: var(--seal); }
.stat .cap { font-family: var(--sans); font-size: 12px; letter-spacing: 0.24em; color: var(--ink-soft); margin-top: 8px; }

section.chapter { padding: 76px 0 70px; border-bottom: 1px solid var(--hair-strong); }
.chapter-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 52px; }
.chapter-head .no { font-size: 15px; color: var(--seal); letter-spacing: 0.3em; }
.chapter-head h2 { font-size: clamp(30px, 4.2vw, 42px); font-weight: 900; letter-spacing: 0.12em; }
.chapter-head .en { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); letter-spacing: 0.18em; margin-left: auto; }

.work-block { display: grid; grid-template-columns: 220px 1fr; gap: 28px; padding: 30px 0; border-top: 1px solid var(--hair); }
.work-block:first-of-type { border-top: none; padding-top: 0; }
.work-side .org { font-size: 19px; font-weight: 600; line-height: 1.5; }
.work-side .role { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: 6px; letter-spacing: 0.06em; }
.work-side .period { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-top: 10px; }
.work-main ul { list-style: none; }
.work-main li { position: relative; padding-left: 22px; margin-bottom: 10px; font-size: 15px; color: var(--ink-soft); }
.work-main li::before { content: "—"; position: absolute; left: 0; color: var(--seal); }
.work-main li b { color: var(--ink); font-weight: 600; margin-right: 0.45em; }

.proj { padding: 56px 0; border-top: 1px solid var(--hair); }
.proj:first-of-type { border-top: none; padding-top: 0; }
.proj-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.proj-head .idx { font-family: var(--mono); font-size: 14px; color: var(--seal); }
.proj-head h3 { font-size: clamp(26px, 3.6vw, 36px); font-weight: 900; letter-spacing: 0.04em; }
.proj-head .slogan { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); letter-spacing: 0.12em; }
.proj-body { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 48px; margin-top: 30px; }
.proj-cell .cell-label { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.3em; color: var(--ink-faint); margin-bottom: 8px; }
.proj-cell p { font-size: 15px; color: var(--ink-soft); }
.proj-cell p b { color: var(--ink); font-weight: 600; }
.proj-term {
  grid-column: 1 / -1;
  font-family: var(--mono); font-size: 13px;
  background: var(--ink); color: #E8E5DC;
  padding: 14px 20px; margin-top: 10px;
  overflow-x: auto; white-space: nowrap;
}
.proj-term .ps { color: #9A968A; }
.proj-term .cmd-out { color: #8FA88F; }
.proj-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.proj-tags span {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
  border: 1px solid var(--hair); padding: 4px 12px; letter-spacing: 0.04em;
}

.edu-row { padding: 26px 0; border-top: 1px solid var(--hair); }
.edu-row:first-of-type { border-top: none; padding-top: 0; }
.edu-head { display: grid; grid-template-columns: 150px 1fr 220px; gap: 24px; align-items: baseline; }
.edu-head .period { font-family: var(--mono); font-size: 12.5px; color: var(--ink-faint); }
.edu-head .school { font-size: 20px; font-weight: 600; }
.edu-head .degree { font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); text-align: right; letter-spacing: 0.06em; }
.edu-detail { margin-top: 16px; margin-left: 174px; display: grid; row-gap: 8px; }
.edu-detail .row { display: grid; grid-template-columns: 80px 1fr; gap: 14px; align-items: baseline; }
.edu-detail .label { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); letter-spacing: 0.18em; text-transform: uppercase; padding-top: 2px; }
.edu-detail .val { font-size: 14px; color: var(--ink-soft); line-height: 1.75; }
.edu-detail .courses span { display: inline-block; margin-right: 14px; }
.edu-detail .courses span::after { content: "·"; color: var(--ink-faint); margin-left: 14px; }
.edu-detail .courses span:last-child::after { content: ""; margin-left: 0; }

.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.skill .skill-no { font-family: var(--mono); font-size: 12px; color: var(--seal); margin-bottom: 12px; }
.skill p { font-size: 15px; color: var(--ink-soft); }
.skill p b { color: var(--ink); font-weight: 600; margin-right: 0.45em; }

footer { padding: 80px 0 60px; position: relative; }
.foot-line { font-size: clamp(22px, 3vw, 30px); font-weight: 600; max-width: 26em; }
.foot-contact { margin-top: 44px; display: flex; flex-wrap: wrap; gap: 14px 48px; }
.foot-contact a, .foot-contact span { font-family: var(--mono); font-size: 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--hair); padding-bottom: 3px; }
.foot-contact a { position: relative; transition: color 0.35s ease; }
.foot-contact a::after {
  content: ""; position: absolute; left: 0; bottom: -1px;
  width: 100%; height: 1px; background: var(--seal);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.foot-contact a:hover { color: var(--seal); }
.foot-contact a:hover::after { transform: scaleX(1); }
.foot-note { margin-top: 56px; font-family: var(--sans); font-size: 12px; color: var(--ink-faint); letter-spacing: 0.1em; }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.on { opacity: 1; transform: none; }

.chapter-head.reveal { opacity: 1; transform: none; transition: none; }
.chapter-head h2 .ch {
  display: inline-block; opacity: 0; transform: translateY(0.5em);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.chapter-head.on h2 .ch { opacity: 1; transform: none; }

.stat .num .prefix { font-style: normal; }
.stat .num .count { display: inline-block; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .hero-vertical { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: none; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--hair); }
  .work-block, .proj-body { grid-template-columns: 1fr; }
  .edu-head { grid-template-columns: 1fr; gap: 4px; }
  .edu-head .degree { text-align: left; }
  .edu-detail { margin-left: 0; margin-top: 12px; }
  .edu-detail .row { grid-template-columns: 1fr; gap: 2px; }
  .skills-grid { grid-template-columns: 1fr; }
  .masthead nav { gap: 16px; }
  .masthead .mono, .masthead .label { display: none; }
  .masthead { justify-content: center; gap: 18px; }
  .masthead .brand { margin-right: 6px; }
}

/* —— 首页 4 屏分屏（桌面，:has 限定只在 home 生效，详情页不受影响）—— */
@media (min-width: 761px) {
  html:has(.panels) { scroll-snap-type: y mandatory; }
  .panel {
    min-height: 100vh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    padding: 80px 0 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
  }
  .panel-inner { width: 100%; }
  /* panel 内重置原章节容器的 padding/border —— 避免双重间距 */
  .panel .hero { padding: 0; border-bottom: none; }
  .panel .stats { margin-top: 40px; border-bottom: none; }
  .panel .chapter-head { margin-bottom: 44px; }
}

/* ============================================================
   ↓↓↓ 多页站点新增样式 ↓↓↓
   ============================================================ */

/* —— 跨页过渡（View Transitions API · MPA 模式）——
   支持的浏览器翻页时整页淡入推移；不支持的自动普通跳转 */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vt-out 0.32s cubic-bezier(0.4, 0, 0.2, 1) both; }
  ::view-transition-new(root) { animation: vt-in 0.42s cubic-bezier(0.4, 0, 0.2, 1) both; }
}
@keyframes vt-out { to { opacity: 0; transform: translateY(-14px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(22px); } }

/* —— 导航：品牌名 + 当前页高亮 —— */
.masthead .brand {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: 0.06em;
}
.masthead .brand:hover { color: var(--seal); }
.masthead nav a[aria-current="page"] { color: var(--seal); }
.masthead nav a[aria-current="page"]::after { transform: scaleX(1); }

/* —— 首页：作品导览卡（方案甲，精简） —— */
.work-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--hair); }
.work-card {
  display: flex; flex-direction: column;
  padding: 34px 26px 30px; text-decoration: none; color: inherit;
  border-left: 1px solid var(--hair);
  transition: background 0.4s ease;
  position: relative;
}
.work-card:first-child { border-left: none; }
.work-card:hover { background: rgba(166, 59, 42, 0.04); }
.work-card .wc-idx { font-family: var(--mono); font-size: 13px; color: var(--seal); }
.work-card .wc-name { font-size: 21px; font-weight: 900; letter-spacing: 0.04em; margin-top: 18px; line-height: 1.4; }
.work-card .wc-slogan { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-top: 12px; letter-spacing: 0.08em; }
.work-card .wc-pain { font-size: 14px; color: var(--ink-soft); margin-top: 16px; flex: 1; }
.work-card .wc-more {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink); margin-top: 22px;
  letter-spacing: 0.06em; position: relative; display: inline-block;
}
.work-card .wc-more .arrow { transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); display: inline-block; }
.work-card:hover .wc-more { color: var(--seal); }
.work-card:hover .wc-more .arrow { transform: translateX(6px); }

/* —— 作品详情页 —— */
.detail-hero { padding: 64px 0 40px; border-bottom: 1px solid var(--hair-strong); }
.issue-no { font-family: var(--mono); font-size: 13px; color: var(--seal); letter-spacing: 0.16em; }
.detail-hero h1 {
  font-size: clamp(40px, 7vw, 76px); font-weight: 900; line-height: 1.08;
  letter-spacing: 0.04em; margin-top: 22px;
}
.detail-hero .d-slogan { font-family: var(--sans); font-size: clamp(15px, 2vw, 18px); color: var(--ink-soft); margin-top: 24px; letter-spacing: 0.08em; }

.tldr {
  display: grid; grid-template-columns: 80px 1fr; gap: 20px; align-items: baseline;
  padding: 32px 0; border-bottom: 1px solid var(--hair);
}
.tldr .tl-label { font-family: var(--mono); font-size: 12px; color: var(--seal); letter-spacing: 0.2em; }
.tldr p { font-size: clamp(16px, 2vw, 19px); font-weight: 600; line-height: 1.7; }

.detail-sec { padding: 40px 0; border-bottom: 1px solid var(--hair); }
.detail-sec .ds-label { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.3em; color: var(--ink-faint); margin-bottom: 16px; }
.detail-sec p { font-size: 15.5px; color: var(--ink-soft); max-width: 42em; margin-bottom: 12px; }
.detail-sec p b { color: var(--ink); font-weight: 600; }

/* 截图区 */
.shot { margin: 40px 0; padding: 40px 0; border-bottom: 1px solid var(--hair); }
.shot-frame {
  border: 1px solid var(--hair); background: #fff;
  box-shadow: 0 18px 50px -28px rgba(25,24,19,0.5);
  overflow: hidden;
}
.shot-frame img { display: block; width: 100%; height: auto; }
.shot-cap { font-family: var(--sans); font-size: 12px; color: var(--ink-faint); letter-spacing: 0.1em; margin-top: 14px; text-align: center; }
.shot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* 命令行 demo（复用 proj-term 风格） */
.detail-term {
  font-family: var(--mono); font-size: 13px;
  background: var(--ink); color: #E8E5DC;
  padding: 16px 22px; margin: 28px 0;
  overflow-x: auto; white-space: nowrap;
}
.detail-term .ps { color: #9A968A; }
.detail-term .cmd-out { color: #8FA88F; }

/* 时间线 + 技术栈 */
.detail-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; padding: 40px 0; }
.timeline .tl-step { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 10px 0; border-top: 1px solid var(--hair); font-size: 14px; }
.timeline .tl-step:first-child { border-top: none; }
.timeline .tl-when { font-family: var(--mono); font-size: 12px; color: var(--seal); }
.timeline .tl-what { color: var(--ink-soft); }
.tech-stack .ts-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tech-stack .ts-tags span { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); border: 1px solid var(--hair); padding: 4px 12px; letter-spacing: 0.04em; }
.detail-foot .ds-label { font-family: var(--sans); font-size: 11.5px; letter-spacing: 0.3em; color: var(--ink-faint); margin-bottom: 16px; }

/* 上一篇 / 下一篇 */
.pager { display: flex; justify-content: space-between; gap: 20px; padding: 44px 0 10px; }
.pager a { text-decoration: none; color: var(--ink); max-width: 46%; }
.pager a .pg-dir { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); letter-spacing: 0.1em; }
.pager a .pg-name { display: block; font-size: 17px; font-weight: 600; margin-top: 8px; transition: color 0.3s ease; }
.pager a.next { text-align: right; margin-left: auto; }
.pager a:hover .pg-name { color: var(--seal); }
.pager a.disabled { visibility: hidden; }

/* —— 联系页 —— */
.contact-hero { padding: 72px 0 48px; }
.contact-hero h1 { font-size: clamp(48px, 9vw, 104px); font-weight: 900; letter-spacing: 0.05em; line-height: 1.05; }
.contact-hero .ch-sub { font-size: clamp(17px, 2.3vw, 22px); font-weight: 600; color: var(--ink-soft); margin-top: 26px; max-width: 24em; }
.contact-list { display: grid; gap: 0; border-top: 1px solid var(--hair-strong); margin-top: 8px; }
.contact-row {
  display: grid; grid-template-columns: 160px 1fr auto; gap: 20px; align-items: baseline;
  padding: 24px 0; border-bottom: 1px solid var(--hair); text-decoration: none; color: inherit;
}
.contact-row .cr-label { font-family: var(--sans); font-size: 12px; letter-spacing: 0.24em; color: var(--ink-faint); }
.contact-row .cr-val { font-family: var(--mono); font-size: clamp(16px, 2.4vw, 22px); color: var(--ink); letter-spacing: 0.02em; }
.contact-row .cr-act { font-family: var(--mono); font-size: 12.5px; color: var(--seal); opacity: 0; transition: opacity 0.3s ease; }
a.contact-row:hover .cr-val { color: var(--seal); }
a.contact-row:hover .cr-act { opacity: 1; }

@media (max-width: 760px) {
  .work-cards { grid-template-columns: 1fr; }
  .work-card { border-left: none; border-top: 1px solid var(--hair); }
  .work-card:first-child { border-top: none; }
  .shot-grid { grid-template-columns: 1fr; }
  .detail-foot { grid-template-columns: 1fr; gap: 32px; }
  .contact-row { grid-template-columns: 1fr; gap: 4px; }
  .contact-row .cr-act { display: none; }
}

/* ============================================================
   ↓↓↓ about 详情页新区段 ↓↓↓
   ============================================================ */

/* 通用 tag 云（独立样式，不依赖 .tech-stack 父级） */
.ts-tags { display: flex; flex-wrap: wrap; gap: 10px; }
.ts-tags span { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); border: 1px solid var(--hair); padding: 4px 12px; letter-spacing: 0.04em; }
.ts-tags.ts-soft span { font-family: var(--serif); font-size: 13.5px; letter-spacing: 0; padding: 6px 14px; color: var(--ink); }

/* 代表产物 · 迷你卡 */
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--hair); margin-top: 4px; }
.proj-card { padding: 24px 22px; border-left: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.proj-card:first-child { border-left: none; }
.proj-card .pc-name { font-size: 16px; font-weight: 600; line-height: 1.5; }
.proj-card .pc-type { font-family: var(--mono); font-size: 12px; color: var(--seal); letter-spacing: 0.06em; }
.proj-card .pc-role { font-family: var(--sans); font-size: 12.5px; color: var(--ink-soft); }
.proj-foot { font-size: 14.5px; color: var(--ink-soft); margin-top: 18px; max-width: none; }
.proj-foot b { color: var(--seal); font-weight: 600; }

/* 跨学科 · 3 段并列 */
.cross-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--hair); margin-top: 4px; }
.cross-row { padding: 28px 22px; border-left: 1px solid var(--hair); display: flex; flex-direction: column; gap: 10px; }
.cross-row:first-child { border-left: none; }
.cross-row .cr-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cross-row .cr-no { font-family: var(--mono); font-size: 13px; color: var(--seal); letter-spacing: 0.12em; }
.cross-row .cr-name { font-size: 19px; font-weight: 900; letter-spacing: 0.05em; }
.cross-row .cr-from { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); flex-basis: 100%; margin-top: 2px; }
.cross-row .cr-blurb { font-size: 14px; color: var(--ink-soft); max-width: none; line-height: 1.85; }

/* 三条信条 · 卡片化 */
.creed-list { display: grid; gap: 0; border-top: 1px solid var(--hair); margin-top: 4px; }
.creed { padding: 30px 0 30px; border-bottom: 1px solid var(--hair); }
.creed:last-child { border-bottom: none; }
.creed-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 14px; }
.creed-head .creed-no { font-family: var(--mono); font-size: 14px; color: var(--seal); letter-spacing: 0.16em; }
.creed-head .creed-name { font-size: 22px; font-weight: 900; letter-spacing: 0.05em; }
.creed-lead { font-size: 16px; color: var(--ink); margin-bottom: 12px; max-width: 42em; }
.creed-ev { font-size: 14.5px; color: var(--ink-soft); max-width: 42em; line-height: 1.85; }

@media (max-width: 760px) {
  .proj-grid, .cross-grid { grid-template-columns: 1fr; }
  .proj-card, .cross-row { border-left: none; border-top: 1px solid var(--hair); }
  .proj-card:first-child, .cross-row:first-child { border-top: none; }
}
