/* ===== 变量 ===== */
:root {
  --bg: #0E1116;
  --panel: #161B22;
  --line: #242C38;
  --fg: #E6EDF3;
  --dim: #8B98A8;
  --gold: #C8A15A;
  --gold-soft: #F2D9A0;
  --teal: #4FA8A0;
  --radius: 10px;
  --sidebar: 300px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }

body {
  margin: 0;
  background: transparent;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.75;
  font-variant-numeric: tabular-nums;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

h1, h2, h3 { line-height: 1.35; }

/* ===== 布局 ===== */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: 40px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 28px 80px;
  align-items: start;
}

.content { min-width: 0; }

/* ===== 侧栏 ===== */
.sidebar {
  position: sticky;
  top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px;
}

.avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-soft), #6B5122);
  color: #0E1116;
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.name { font-size: 22px; margin: 14px 0 2px; letter-spacing: .5px; }

.tagline { margin: 0 0 16px; color: var(--gold); font-size: 12px; letter-spacing: 1.5px; }

.contact { display: grid; gap: 7px; font-size: 13px; color: var(--dim); }

.contact-item { overflow-wrap: anywhere; }

.phone-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }

.phone-reveal {
  background: none; border: 1px dashed var(--line); color: var(--dim);
  font: inherit; font-size: 13px; padding: 2px 8px; border-radius: 6px; cursor: pointer;
}
.phone-reveal:hover { border-color: var(--gold); color: var(--gold); }

.phone-value { color: var(--fg); }
.phone-print { display: none; }

.links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.link-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--dim);
}
.link-chip:hover { border-color: var(--gold); color: var(--gold); text-decoration: none; }

.btn-download {
  display: block; margin-top: 16px; padding: 9px;
  text-align: center; font-size: 13px; font-weight: 600;
  background: var(--gold); color: #0E1116; border-radius: 8px;
}
.btn-download:hover { background: var(--gold-soft); text-decoration: none; }

.switcher { margin-top: 10px; }
.switcher-label { display: block; font-size: 11px; color: var(--dim); letter-spacing: 1px; margin-bottom: 4px; }
.switcher-select {
  width: 100%; padding: 7px 8px; font: inherit; font-size: 13px;
  background: #10161f; color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
}

/* 侧栏目录 */
.toc { margin-top: 16px; display: grid; gap: 4px; font-size: 12.5px; }
.toc a { color: var(--dim); padding: 2px 0; }
.toc a.active { color: var(--gold); border-left: 2px solid var(--gold); padding-left: 8px; }
.toc a:hover { text-decoration: none; color: var(--fg); }

/* ===== 章节 ===== */
.section { margin-bottom: 34px; }

.section-title {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--gold); margin: 0 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}

/* ===== 指标卡 ===== */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.metric-value { font-size: 20px; font-weight: 600; color: var(--teal); }
.metric-label { font-size: 11.5px; color: var(--dim); }

/* ===== 核心优势 ===== */
.highlights { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.highlight { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 14px; }
.highlight strong { display: block; color: var(--fg); font-size: 14px; }
.highlight .detail { color: var(--dim); font-size: 13px; }

/* ===== 项目 ===== */
.project { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; transition: transform .18s, border-color .18s; }
.project:hover { transform: translateY(-2px); border-color: #3A4658; }
.project-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.project-name { font-size: 16px; margin: 0; }
.project-meta { font-size: 12px; color: var(--dim); }
.project-summary { color: var(--dim); font-size: 13.5px; margin: 6px 0 8px; }
.bullets { margin: 0; padding-left: 18px; font-size: 13.5px; color: #C6D2DF; }
.bullets li { margin-bottom: 3px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 11.5px; color: var(--teal); border: 1px solid #23413F; background: #12211F; border-radius: 999px; padding: 2px 9px; }

.project-links { margin-top: 10px; display: flex; gap: 14px; font-size: 12.5px; }

/* ===== 经历 / 教育 ===== */
.timeline { display: grid; gap: 14px; }
.entry { border-left: 1px solid var(--line); padding-left: 16px; position: relative; }
.entry::before { content: ""; position: absolute; left: -4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.entry-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.entry-org { font-size: 15px; margin: 0; }
.entry-meta { font-size: 12px; color: var(--dim); }

/* ===== 技能 ===== */
.skill-groups { display: grid; gap: 10px; }
.skill-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.skill-group-name { font-size: 12px; color: var(--dim); letter-spacing: 1px; min-width: 72px; }
.skill-group .chip { color: var(--dim); border-color: var(--line); background: transparent; }

/* ===== 首页方向卡 ===== */
.hero { margin-bottom: 28px; }
.hero-title { font-size: 30px; margin: 0 0 6px; font-weight: 600; }
.hero-line { color: var(--dim); margin: 0; }

.variant-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }

.variant-card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; color: inherit;
  transition: transform .18s, border-color .18s;
}
.variant-card:hover { transform: translateY(-2px); border-color: var(--gold); text-decoration: none; }
.variant-card h3 { margin: 0 0 4px; font-size: 16px; color: var(--gold-soft); }
.variant-card p { margin: 0; font-size: 13px; color: var(--dim); }
.variant-card .card-metrics { margin-top: 12px; display: flex; gap: 14px; font-size: 12px; color: var(--teal); }

.noscript-note { max-width: 640px; margin: 40px auto; text-align: center; color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===== 打印 ===== */
@page {
  size: A4;
  margin: 14mm;
}

@media print {
  body {
    background: #fff;
    color: #111;
    font-size: 10.5pt;
    line-height: 1.55;
  }

  .layout {
    display: block;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  /* 侧栏隐去，改由页眉一行承载 */
  .sidebar { display: none; }

  .print-header { display: block !important; }

  .content { display: block; }

  .section { margin-bottom: 12pt; }

  .section-title {
    color: #111;
    border-bottom: 1px solid #999;
    font-size: 9pt;
    letter-spacing: 1.5pt;
    margin-bottom: 6pt;
    padding-bottom: 2pt;
  }

  .project, .highlight, .metric, .entry {
    background: none;
    border: none;
    border-left: 0;
    padding: 0;
    margin: 0 0 8pt;
    transform: none;
  }

  .project-name, .entry-org, .name { color: #111; }
  .project-summary, .project-meta, .entry-meta, .metric-label,
  .highlight .detail, .tagline, .hero-line { color: #444; }

  .highlight strong { color: #111; }
  .highlight { padding-left: 8pt; border-left: 1.5pt solid #111; }

  .metrics { grid-template-columns: repeat(4, 1fr); gap: 6pt; }
  .metric { border: 1px solid #ccc; border-radius: 4pt; padding: 4pt 6pt; }
  .metric-value { color: #111; font-size: 12pt; }

  .chip, .link-chip { border: 1px solid #bbb; color: #333; background: none; }

  /* 屏上交互物：隐去 */
  .switcher, .btn-download, .toc, .phone-reveal,
  .gallery, .lightbox, .project-links, .links,
  .terminal { display: none !important; }

  body::before, body::after { display: none !important; }
  html { background: #fff; }

  /* 号码在纸上可见 */
  .phone-print { display: inline !important; color: #111; }
  .phone-box { display: inline; }

  a { color: #111; text-decoration: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }

  /* 分页 */
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .project, .entry, .highlight { break-inside: avoid; page-break-inside: avoid; }
  .print-header { break-after: avoid; }
}

.print-header { display: none; }

/* ===== 画廊 ===== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font: inherit;
  transition: transform .18s, border-color .18s;
}
.gallery-item:hover { transform: translateY(-2px); border-color: var(--gold); }

.gallery-item img { display: block; width: 100%; height: 140px; object-fit: cover; }

.gallery-cap { display: block; font-size: 12px; color: var(--dim); padding: 8px 10px; }

.lightbox {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  padding: 16px;
  max-width: min(92vw, 900px);
}
.lightbox::backdrop { background: rgba(0, 0, 0, .72); }
.lightbox-img { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; }
.lightbox-cap { text-align: center; font-size: 13px; color: var(--dim); margin: 10px 0 0; }
.lightbox-close {
  display: block; margin: 12px auto 0;
  background: none; border: 1px solid var(--line); color: var(--fg);
  font: inherit; font-size: 13px; padding: 4px 16px; border-radius: 8px; cursor: pointer;
}
.lightbox-close:hover { border-color: var(--gold); color: var(--gold); }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px 16px 60px;
  }
  .sidebar { position: static; }
  .toc { display: none; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 24px; }
}

@media (max-width: 480px) {
  body { font-size: 14.5px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-value { font-size: 17px; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .gallery-item img { height: 110px; }
  .project { padding: 13px 14px; }
}

/* ===== 氛围背景 ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 12% -8%, rgba(200, 161, 90, .10), transparent 60%),
    radial-gradient(760px 460px at 88% 8%, rgba(79, 168, 160, .09), transparent 62%),
    radial-gradient(620px 620px at 50% 120%, rgba(200, 161, 90, .06), transparent 65%);
  animation: bgDrift 26s ease-in-out infinite alternate;
  will-change: transform;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .7;
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .028) 0 1px, transparent 1px 56px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 42%, transparent 88%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 42%, transparent 88%);
}

.layout {
  position: relative;
  z-index: 1;
}

@keyframes bgDrift {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
  to   { transform: translate3d(1.5%, 1%, 0) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* ===== Baize 终端演示 ===== */
.terminal {
  background: #0B0F14;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 0 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #10161F;
}

.terminal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2B3543;
  flex: 0 0 auto;
}

.terminal-dot.hot { background: var(--gold); opacity: .85; }

.terminal-title {
  margin-left: 8px;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal-body {
  padding: 12px 14px;
  min-height: 348px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 12.5px;
  line-height: 1.85;
}

.terminal-line {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
}

.t-cmd { color: var(--gold-soft); }
.t-dim { color: var(--dim); }
.t-ok { color: var(--teal); }
.t-add { color: #7BC47F; }
.t-del { color: #D98A8A; }

.t-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--gold);
  animation: caret 1s steps(1) infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

.terminal-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--dim);
}

@media (prefers-reduced-motion: reduce) {
  .t-cursor { animation: none; }
}

/* 画廊图片微动 */
.gallery-item img {
  transition: transform .6s ease-out, filter .6s ease-out;
}

.gallery-item:hover img {
  transform: scale(1.06);
  filter: saturate(1.08);
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .55s ease-out, transform .55s ease-out;
}

.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .gallery-item:hover img { transform: none; }
}

/* ===== 移动端终端微调（置于末尾以确保覆盖） ===== */
@media (max-width: 480px) {
  .terminal-body { font-size: 11.5px; line-height: 1.75; min-height: 300px; }
  .terminal-foot { font-size: 10px; }
}
