/* ============================================================
   personal-site · 张元辰律师
   设计语言：白底极简 · 大留白 · 编号系统 · 编辑式排版
   ============================================================ */

:root {
  --paper: #faf9f6;        /* 米白纸感背景 */
  --ink: #141414;          /* 近黑文字 */
  --muted: #8a8a86;        /* 次级文字 */
  --line: #e2e0da;         /* 细分隔线 */
  --accent: #a33d2e;       /* 克制砖红（印章/律） */
  --accent-soft: #f3e7e3;  /* 砖红淡底 */

  --font-cn: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-lat: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-display: "Cormorant Garamond", "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;

  --huge: clamp(2.8rem, 7.5vw, 6.5rem);
  --title: clamp(1.9rem, 4vw, 3.2rem);
  --sub: clamp(1.05rem, 1.6vw, 1.35rem);
  --body: clamp(0.95rem, 1.1vw, 1.05rem);
  --small: 0.8rem;
  --sec-num: clamp(0.7rem, 0.9vw, 0.85rem);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-cn);
  font-size: var(--body);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--paper); }

/* ---------- 排版基础 ---------- */
.huge { font-size: var(--huge); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; }
.title { font-size: var(--title); line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.sub { font-size: var(--sub); line-height: 1.7; color: var(--ink); font-weight: 400; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.en { font-family: var(--font-lat); }

a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
a.link { border-bottom: 1px solid var(--line); transition: border-color .2s; }
a.link:hover { border-bottom-color: var(--accent); color: var(--accent); }

/* ---------- 导航 ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 2rem clamp(1.4rem, 4vw, 4rem);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
}
.nav.scrolled { border-bottom-color: var(--line); }
.nav-logo { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.04em; }
.nav-logo em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: .4em; font-size: .85rem; }
.nav-links { display: flex; gap: clamp(1.2rem, 3vw, 2.6rem); font-size: .92rem; }
.nav-links a { color: var(--muted); transition: color .2s; border-bottom: none; }
.nav-links a:hover { color: var(--ink); }

/* ---------- 通用板块 ---------- */
.section { padding: clamp(6rem, 16vh, 12rem) clamp(1.4rem, 5vw, 5rem); position: relative; }
.section.alt { background: #f1efe9; }

.section-head {
  display: grid; grid-template-columns: 1fr; gap: 1.4rem;
  margin-bottom: clamp(3rem, 8vh, 6rem);
}
.sec-no {
  font-family: var(--font-mono); font-size: var(--sec-num);
  letter-spacing: 0.35em; color: var(--accent);
}
.sec-label { color: var(--muted); font-size: .9rem; letter-spacing: .08em; }
.sec-title { max-width: 22ch; }

/* 全屏愿景屏（含 3D 背景层） */
.hero { position: relative; overflow: hidden; }
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
}
.hero-inner {
  position: relative; z-index: 1;
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center;
  padding: 7rem clamp(1.4rem, 5vw, 5rem) 4rem;
}
.hero-no {
  font-family: var(--font-mono); font-size: var(--sec-num);
  letter-spacing: 0.4em; color: var(--muted); margin-bottom: 3rem;
}
.hero-vision {
  max-width: 16ch; margin-bottom: 1.4rem;
  font-family: var(--font-display); font-weight: 900;
  letter-spacing: 0.01em;
}
.hero-en {
  font-family: "Cormorant Garamond", var(--font-lat);
  font-style: italic; font-weight: 500;
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  letter-spacing: 0.2em; color: var(--accent);
  margin-bottom: 2.2rem;
}
.hero-sub { max-width: 46ch; color: var(--muted); }

/* 打字机光标 */
.caret {
  display: inline-block; width: 2px; height: 0.92em;
  margin-left: 0.05em; background: var(--accent);
  vertical-align: -0.08em;
  animation: caret-blink 1.1s steps(1, end) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.hero-meta {
  margin-top: auto; padding-top: 2rem;
  display: flex; flex-wrap: wrap; gap: .4rem 2.2rem;
  font-family: var(--font-mono); font-size: var(--small);
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.hero-meta b { color: var(--ink); font-weight: 600; }

/* ---------- 关于 · 形象照 / 自述 / 差异优势 / 团队展示 ---------- */
.about-note { margin-bottom: clamp(3rem, 7vh, 5rem); }

/* 开场：形象照（左）+ 自述（右），照片带缓慢推近动效 */
.about-hero {
  display: grid; grid-template-columns: minmax(200px, 300px) 1fr;
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
  margin-bottom: clamp(2.8rem, 6vh, 4.2rem);
}
.portrait {
  margin: 0; line-height: 0; overflow: hidden;
  border: 1px solid var(--line); background: #fff;
}
.portrait img {
  display: block; width: 100%; height: auto;
  animation: kenburns 22s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.09); } }
@media (prefers-reduced-motion: reduce) { .portrait img { animation: none; } }

.about-lead { display: grid; gap: 1.6rem; }
.about-lead p { max-width: 58ch; font-size: var(--sub); line-height: 1.95; }

.strength-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  margin-bottom: clamp(2.6rem, 6vh, 4rem);
}
.strength { background: var(--paper); padding: 2rem 1.8rem; transition: background .25s; }
.strength:hover { background: var(--accent-soft); }
.strength-no { font-family: var(--font-mono); font-size: var(--small); color: var(--accent); letter-spacing: .12em; }
.strength-t { font-size: 1.2rem; font-weight: 700; margin: .7rem 0 .5rem; }
.strength-d { color: var(--muted); font-size: .94rem; line-height: 1.85; }

/* 团队：两张不同比例照片，统一高度上限、底边对齐的照片墙 */
.about-team { border-top: 1px solid var(--line); padding-top: 2.6rem; }
.team-eyebrow { margin-bottom: 1rem; }
.team-intro { max-width: 56ch; margin-bottom: 1.8rem; }
.team-photos {
  display: flex; flex-wrap: wrap; justify-content: center;
  align-items: flex-end; gap: clamp(1.4rem, 3vw, 2.4rem);
}
.team-photo { margin: 0; }
.team-photo img {
  display: block; max-height: clamp(300px, 42vh, 460px); width: auto;
  max-width: min(100%, 640px);
  border: 1px solid var(--line); background: #fff;
}

/* ---------- 执业领域 ---------- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.field { background: var(--paper); padding: 2.4rem 2rem; transition: background .25s; }
.field:hover { background: var(--accent-soft); }
.field-no { font-family: var(--font-mono); font-size: var(--small); color: var(--muted); }
.field-name { font-size: 1.35rem; font-weight: 700; margin: .8rem 0 .6rem; }
.field-desc { color: var(--muted); font-size: .95rem; }

/* ---------- 精选案例 ---------- */
.case-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(360px, 82vw);
  gap: 1.2rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding-bottom: 1rem; margin-right: calc(-1 * clamp(1.4rem, 5vw, 5rem));
  padding-right: clamp(1.4rem, 5vw, 5rem);
}
.case-card {
  scroll-snap-align: start;
  background: var(--paper); border: 1px solid var(--line);
  padding: 2rem; display: flex; flex-direction: column; gap: 1rem;
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.case-card:hover { transform: translateY(-4px); border-color: var(--ink); box-shadow: 0 18px 40px rgba(20,20,20,.08); }
.case-tag { font-family: var(--font-mono); font-size: var(--small); color: var(--accent); letter-spacing: .12em; }
.case-title { font-size: 1.5rem; font-weight: 800; line-height: 1.3; }
/* 两端对齐 + 允许换行：结果描述长时不再挤压左侧标签。
   原先只写 justify-content: space-between，结果描述一长，左侧「进行中」这类
   三字标签会被 flex 压缩折成「进行/中」两行。给标签加 nowrap 锁住。 */
.case-meta {
  margin-top: auto; display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: baseline;
  gap: .2rem .9rem; font-size: .85rem; color: var(--muted);
}
.case-meta > span:first-child { white-space: nowrap; }
.case-meta .result { font-weight: 700; color: var(--ink); }
.case-note { margin-top: -.4rem; font-size: .76rem; color: var(--muted); letter-spacing: .02em; }
.case-placeholder {
  border-style: dashed; color: var(--muted); justify-content: center; align-items: center;
  text-align: center; min-height: 240px;
}
.case-placeholder .plus { font-size: 2.4rem; color: var(--line); margin-bottom: .6rem; }
.case-placeholder:hover { transform: none; border-color: var(--line); box-shadow: none; }

/* ---------- 数据 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--paper); padding: 2.4rem 1.6rem; text-align: center; }
.stat-num { font-family: var(--font-lat); font-weight: 800; font-size: clamp(2.6rem, 5vw, 4rem); line-height: 1; letter-spacing: -0.02em; }
.stat-num span { font-size: .45em; font-weight: 500; color: var(--muted); margin-left: .15em; }
.stat-label { margin-top: .8rem; color: var(--muted); font-size: .92rem; }

/* ---------- 联系 ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 3rem; }
.contact-line {
  padding: 1.8rem 0; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 9rem 1fr; gap: 1.5rem; align-items: baseline;
}
.contact-line:last-child { border-bottom: 1px solid var(--line); }
.contact-k { font-family: var(--font-mono); font-size: var(--small); color: var(--accent); letter-spacing: .15em; }
.contact-v { font-size: clamp(1.4rem, 2.6vw, 2.1rem); font-weight: 700; letter-spacing: .01em; }
.contact-v.small { font-size: var(--sub); font-weight: 500; }
.qr-box {
  width: 180px; height: 180px;
  padding: 10px; box-sizing: border-box;
  background: #fff;            /* 二维码白底：深浅主题下都可被正常识别 */
  border: 1px solid var(--line);
}
.qr-img { object-fit: contain; display: block; }

/* ---------- 页脚 ---------- */
.footer {
  padding: 3rem clamp(1.4rem, 5vw, 5rem);
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem;
  font-size: .85rem; color: var(--muted);
}

/* ============================================================
   案例库页 cases.html
   ============================================================ */
.page { padding-top: 7rem; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center;
  margin-bottom: 3rem;
}
.filter-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-label { font-family: var(--font-mono); font-size: var(--small); color: var(--muted); margin-right: .4rem; }
.chip {
  font-size: .85rem; padding: .35rem .9rem; border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer; color: var(--muted);
  background: transparent; transition: all .2s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.2rem; }
.case-grid .case-card { border-radius: 0; }

.count-line { font-family: var(--font-mono); font-size: var(--small); color: var(--muted); margin-bottom: 1.4rem; }

/* ---------- 案例详情弹层 ---------- */
.detail-mask {
  position: fixed; inset: 0; background: rgba(20,20,20,.55);
  z-index: 200; display: none; align-items: center; justify-content: center; padding: 2rem;
}
.detail-mask.open { display: flex; }
.detail-panel {
  background: var(--paper); max-width: 760px; width: 100%;
  max-height: 86vh; overflow-y: auto; padding: clamp(2rem, 5vw, 3.6rem);
  position: relative;
}
.detail-close {
  position: absolute; top: 1.2rem; right: 1.4rem;
  font-family: var(--font-mono); font-size: .85rem; color: var(--muted);
  background: none; border: none; cursor: pointer;
}
.detail-close:hover { color: var(--ink); }
.detail-tags { display: flex; gap: .5rem; margin: 1.4rem 0; flex-wrap: wrap; }
.dtag { font-family: var(--font-mono); font-size: var(--small); padding: .25rem .7rem; border: 1px solid var(--line); color: var(--muted); }
.dtag.r { color: var(--accent); border-color: var(--accent); }
.detail-block { margin-top: 1.8rem; }
.detail-h { font-family: var(--font-mono); font-size: var(--small); color: var(--accent); letter-spacing: .15em; margin-bottom: .6rem; }
.detail-p { color: var(--ink); max-width: 60ch; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .contact-line { grid-template-columns: 1fr; gap: .4rem; }
  .hero-vision { max-width: 14ch; }
  .about-hero { grid-template-columns: 1fr; justify-items: center; gap: 2rem; }
  .portrait { width: min(300px, 80vw); }
}

/* ============================================================
   图片放大灯箱（js/lightbox.js）
   ============================================================ */
.zoomable { cursor: zoom-in; }

/* ⚠️ 定位一律写字面量 top/right/bottom/left，**不要用 inset 简写**。
   .lightbox 是 JS 追加到 body 末尾的，一旦 inset 不被支持，fixed 元素的
   静态位置就是整页最底部——照片会跑到页面最下端，而不是浮在视口上。
   关掉时用 opacity + pointer-events，不用 display/visibility：
   这样图片的收缩动画不会被中途截断。 */
.lightbox {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 300;
  background: rgba(18,18,18,.94);
  opacity: 0; pointer-events: none;
  transition: opacity .26s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }

/* 位置与尺寸由 JS 按缩略图位置算好后写到行内样式上，这里不做任何约束 */
.lightbox img {
  position: absolute; left: 0; top: 0;
  cursor: zoom-out;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
  will-change: transform;
}

.lightbox-close {
  position: absolute; top: 1.2rem; right: 1.6rem;
  font-family: var(--font-mono); font-size: .85rem; letter-spacing: .12em;
  color: rgba(255,255,255,.72); background: none; border: none;
  cursor: pointer; padding: .5rem .7rem; transition: color .2s;
}
.lightbox-close:hover, .lightbox-close:focus-visible { color: #fff; }

/* 说明文字跟着放大的照片走，位置由 JS 贴着图片下沿（放不下则改到上沿）设置 */
.lightbox-cap {
  position: absolute; text-align: center;
  color: rgba(255,255,255,.55); font-size: .82rem;
}

@media (max-width: 720px) {
  .lightbox-close { top: .5rem; right: .6rem; }
  .lightbox-cap { font-size: .78rem; }
}
