/* 李依伦作品集 · 共用样式
   颜色、字号与间距统一用这里的变量；交互演示放在各项目 demo/ 目录，通过 iframe 嵌入。 */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --surface-3: #e9ebf0;
  --text: #121317;
  --text-2: #4a4d57;
  --text-3: #5e626d;
  --line: #e4e6eb;
  --line-2: #d6d9e0;
  --accent: #3355e0;
  --accent-hover: #2441b8;
  --accent-soft: #e8eeff;
  --ok: #1f9d61;
  --ink: #121317;
  --on-ink: #ffffff;
  --ink-muted: #c9ccd4;
  --shadow: 0 1px 2px rgba(18, 19, 23, .05), 0 12px 32px rgba(18, 19, 23, .08);
  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --max: 1180px;
  --max-wide: 1280px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214;
    --surface: #1a1b1f;
    --surface-2: #222429;
    --surface-3: #1e2025;
    --text: #ecedf0;
    --text-2: #b3b6bf;
    --text-3: #9a9ea8;
    --line: #2c2e34;
    --line-2: #3a3d44;
    --accent: #8aa2ff;
    --accent-hover: #a9bbff;
    --accent-soft: #232a45;
    --ok: #4cc08a;
    --ink: #ecedf0;
    --on-ink: #111214;
    --ink-muted: #3d4048;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111214;
  --surface: #1a1b1f;
  --surface-2: #222429;
  --surface-3: #1e2025;
  --text: #ecedf0;
  --text-2: #b3b6bf;
  --text-3: #9a9ea8;
  --line: #2c2e34;
  --line-2: #3a3d44;
  --accent: #8aa2ff;
  --accent-hover: #a9bbff;
  --accent-soft: #232a45;
  --ok: #4cc08a;
  --ink: #ecedf0;
  --on-ink: #111214;
  --ink-muted: #3d4048;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--font);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.wrap-wide { max-width: var(--max-wide); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap, .wrap-wide { padding: 0 16px; } }

/* 顶栏 */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; color: var(--text); font-size: 17px; flex: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 2px; font-size: 15px; min-width: 0; }
.nav a { color: var(--text-2); padding: 10px 12px; border-radius: 999px; white-space: nowrap; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav .nav-cta { background: var(--ink); color: var(--on-ink); font-size: 14px; font-weight: 600; padding: 9px 16px; margin-left: 6px; }
.nav .nav-cta:hover { background: var(--ink); color: var(--on-ink); opacity: .88; }
.theme-toggle {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; margin-left: 6px; flex: none;
}
.theme-toggle svg { width: 16px; height: 16px; }
@media (max-width: 720px) { .nav .nav-hide { display: none; } }
@media (max-width: 420px) { .nav a { padding: 10px 8px; } .nav .nav-cta { padding: 9px 12px; } }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 22px;
  border-radius: 999px; font-size: 15px; font-weight: 600; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit;
}
.btn:hover { color: var(--text); border-color: var(--text-3); }
.btn-primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-primary:hover { color: var(--on-ink); border-color: var(--ink); opacity: .88; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* 通用标题 */
.kicker { font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 12px; }
.section { padding-block: 72px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 28px; }
.section-title { font-size: 34px; }
.section-sub { font-size: 15px; color: var(--text-3); }
.lead { font-size: 18px; line-height: 1.75; color: var(--text-2); max-width: 720px; }
.muted { color: var(--text-3); font-size: 14px; }
@media (max-width: 640px) { .section { padding-block: 52px; } .section-title { font-size: 28px; } }

/* 首页 Hero */
.hero { padding-block: 96px 72px; display: flex; flex-wrap: wrap; gap: 48px; align-items: flex-end; }
.hero-main { flex: 999 1 560px; min-width: 0; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.12; letter-spacing: -.02em; font-weight: 680; margin-bottom: 24px; }
.hero .lead { font-size: 19px; max-width: 660px; margin-bottom: 32px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 10px; margin-bottom: 22px; }
.status-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.hero-stats { flex: 1 1 320px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 24px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.hero-stats b { display: block; font-family: var(--mono); font-size: 30px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 13px; color: var(--text-3); }
.hero-stats p { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
@media (max-width: 640px) { .hero { padding-block: 56px 48px; gap: 32px; } .hero .lead { font-size: 17px; } }

/* 首页作品卡 */
.cases { display: flex; flex-direction: column; gap: 28px; }
.case { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; color: var(--text); transition: box-shadow .2s ease, transform .2s ease; }
.case:hover { color: var(--text); box-shadow: var(--shadow); transform: translateY(-2px); }
.case-body { flex: 1 1 400px; min-width: 0; padding: 40px; display: flex; flex-direction: column; gap: 18px; }
.case-body h3 { font-size: 30px; }
.case-body > p { font-size: 16px; line-height: 1.75; color: var(--text-2); }
.case-body .kicker { margin: 0; }
.case-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.case-metrics b { display: block; font-size: 20px; font-weight: 650; line-height: 1.3; }
.case-metrics span { font-size: 12px; color: var(--text-3); }
.case-role { font-size: 14px; color: var(--text-2); }
.case-more { margin-top: auto; font-size: 15px; font-weight: 600; color: var(--accent); }
.case-media { flex: 1.4 1 520px; min-width: 0; background: var(--surface-2); padding: 32px 0 0 32px; display: flex; align-items: flex-start; overflow: hidden; }
.case-media img { width: 100%; height: auto; border-radius: 14px 0 0 0; border: 1px solid var(--line-2); border-right: 0; border-bottom: 0; box-shadow: var(--shadow); }
@media (max-width: 640px) { .case-body { padding: 28px 22px; } .case-body h3 { font-size: 26px; } .case-media { padding: 20px 0 0 20px; } }

/* 做法步骤 */
.steps { --g: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.step small { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.step strong { font-size: 17px; line-height: 1.4; }
.step p { font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* 关于 */
.about { display: flex; flex-wrap: wrap; gap: 24px; padding-bottom: 88px; }
.about-card { flex: 1 1 340px; min-width: 0; background: var(--ink); color: var(--on-ink); border-radius: var(--radius-lg); padding: 36px; display: flex; flex-direction: column; gap: 16px; }
.about-card h2 { font-size: 28px; }
.about-card p { font-size: 15px; line-height: 1.8; color: color-mix(in srgb, var(--on-ink) 78%, var(--ink)); }
.about-card a { margin-top: auto; color: var(--on-ink); font-size: 15px; font-weight: 600; }
.about-card a:hover { color: var(--on-ink); opacity: .85; }
.skills { flex: 2 1 520px; min-width: 0; --g: 16px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.skill strong { font-size: 16px; }
.skill p { margin-top: 8px; font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* 项目页 Hero */
.project-hero { padding-block: 56px 32px; display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-end; justify-content: space-between; }
.project-hero > div:first-child { flex: 999 1 560px; min-width: 0; }
.project-hero h1 { font-size: clamp(34px, 5vw, 52px); line-height: 1.12; letter-spacing: -.02em; margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0; }
.facts div { background: var(--surface); padding: 18px 20px; }
.facts dt { font-size: 12px; color: var(--text-3); }
.facts dd { margin: 4px 0 0; font-size: 15px; line-height: 1.55; }
@media (max-width: 900px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr; } }

/* 交互演示：真实前端打包在 demo/，固定 1280×820 渲染后按容器宽度缩放 */
.demo { background: var(--surface-3); border-radius: 28px; padding: 28px; display: flex; flex-direction: column; gap: 20px; margin-top: 40px; }
.demo-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.demo-head strong { font-size: 20px; display: block; }
.demo-head p { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.demo-viewport { position: relative; width: 100%; aspect-ratio: 1280 / 820; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-2); background: #ffffff; box-shadow: var(--shadow); }
.demo-viewport iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 820px; border: 0; transform-origin: 0 0; background: #ffffff; }
.demo-tries { --g: 10px; margin: 0; padding: 0; list-style: none; counter-reset: try; }
.demo-tries li { counter-increment: try; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 12px 44px; font-size: 14px; line-height: 1.6; color: var(--text-2); position: relative; }
.demo-tries li::before { content: counter(try); position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
.demo-tries strong { color: var(--text); font-weight: 600; }
.demo-note { font-size: 13px; color: var(--text-3); }
@media (max-width: 640px) { .demo { padding: 16px; border-radius: 20px; } }

/* 项目页叙述：两列卡片，条目为奇数时最后一张拉满整行 */
/* 经历区：一块面板里的编号流程，左侧圆点串成时间轴，与上方的卡片组区分 */
.story-list { --d: 40px; --py: 24px; --cg: 28px; list-style: none; margin: 0; padding: 8px 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.story-list li { position: relative; display: grid; grid-template-columns: var(--d) minmax(160px, 240px) minmax(0, 1fr); column-gap: var(--cg); align-items: start; padding-block: var(--py); }
.story-list li::before { content: ""; position: absolute; left: calc(var(--d) / 2 - .5px); top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.story-list li:first-child::before { top: calc(var(--py) + var(--d)); }
.story-list li:last-child::before { bottom: auto; height: var(--py); }
.story-list li:only-child::before { display: none; }
.story-list li::after { content: ""; position: absolute; left: calc(var(--d) + var(--cg)); right: 0; bottom: 0; height: 1px; background: var(--line); }
.story-list li:last-child::after { display: none; }
.story-no { position: relative; z-index: 1; width: var(--d); height: var(--d); border-radius: 50%; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 6px var(--surface); }
.story-list h3 { font-size: 18px; line-height: 1.4; padding-top: calc((var(--d) - 25px) / 2); }
.story-list p { font-size: 15px; line-height: 1.8; color: var(--text-2); padding-top: calc((var(--d) - 27px) / 2); }
@media (max-width: 860px) {
  .story-list { --cg: 18px; padding: 4px 24px; }
  .story-list li { grid-template-columns: var(--d) minmax(0, 1fr); }
  .story-list p { grid-column: 2; padding-top: 4px; }
}
@media (max-width: 480px) {
  .story-list { --d: 32px; --py: 20px; --cg: 14px; padding: 2px 16px; }
  .story-list h3 { font-size: 17px; }
}

.prose { color: var(--text-2); max-width: 760px; font-size: 16px; line-height: 1.8; }
.prose p + p { margin-top: 12px; }

/* 卡片网格（问题、对照等） */
.card-grid { --g: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card small { display: block; font-family: var(--mono); font-size: 12px; color: var(--accent); margin-bottom: 8px; }
.card strong { font-size: 16px; }
.card p { margin-top: 6px; font-size: 14px; line-height: 1.7; color: var(--text-2); }
.card-ink { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.card-ink small { color: color-mix(in srgb, var(--on-ink) 70%, var(--ink)); }
.card-ink p, .card-ink li { color: color-mix(in srgb, var(--on-ink) 80%, var(--ink)); }
.ticks { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.ticks li { font-size: 14px; line-height: 1.7; color: var(--text-2); padding-left: 16px; position: relative; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .75em; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.ticks strong { color: inherit; }
.card .ticks strong { color: var(--text); }
.card-ink .ticks strong { color: var(--on-ink); }
.card-ink .ticks li { color: color-mix(in srgb, var(--on-ink) 80%, var(--ink)); }

/* 时间线 */
.timeline { --g: 16px; list-style: none; margin: 0 0 24px; padding: 0; }
.timeline li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.timeline time { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.timeline strong { font-size: 15px; line-height: 1.5; }
.timeline span { font-size: 14px; line-height: 1.7; color: var(--text-2); }

/* 数据 */
/* 换行后最后一行自动拉伸，格子始终填满外框；列数按条目数选：默认 4 列，.stats-3 / .stats-5 分别 3、5 列 */
.stats { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 20px 22px; flex: 1 1 calc(25% - 1px); min-width: 200px; }
.stats-3 .stat { flex-basis: calc(33.333% - 1px); }
.stats-5 .stat { flex-basis: calc(20% - 1px); min-width: 180px; }
@media (max-width: 560px) { .stat, .stats-5 .stat { flex-basis: calc(50% - 1px); min-width: 0; padding: 16px; } .stat-value { font-size: 19px; } }
.stat-value { font-family: var(--mono); font-size: 26px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13px; color: var(--text-3); margin-top: 4px; line-height: 1.55; }
.source-note { margin-top: 14px; font-size: 13px; color: var(--text-3); }

/* 流程条 */
.flow { --g: 12px; list-style: none; margin: 28px 0 0; padding: 0; }
.flow li { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.flow li.is-accent { border-color: var(--accent); background: var(--accent-soft); }
.flow small { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.flow strong { font-size: 15px; }
.flow span { font-size: 13px; color: var(--text-2); }

/* 卡片组：宽屏一行排完；变窄后按条目数换行（4 条 2+2，5 条 3+2，3 条以内保持一行），最后一行自动拉伸填满 */
:is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow) { display: flex; flex-wrap: wrap; gap: var(--g, 16px); }
:is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow) > * { flex: 1 1 0; min-width: 0; }
@media (max-width: 1100px) {
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow) > * { flex-basis: calc(50% - var(--g, 16px)); }
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):has(> :nth-child(5)) > * { flex-basis: calc(33.333% - var(--g, 16px)); }
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):not(:has(> :nth-child(4))) > * { flex-basis: 0; }
}
@media (max-width: 760px) {
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow) > *,
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):has(> :nth-child(5)) > *,
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):not(:has(> :nth-child(4))) > * { flex-basis: calc(50% - var(--g, 16px)); }
}
@media (max-width: 560px) {
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow) > *,
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):has(> :nth-child(5)) > *,
  :is(.steps, .skills, .demo-tries, .card-grid, .timeline, .flow):not(:has(> :nth-child(4))) > * { flex-basis: 100%; }
}

/* 上一个 / 下一个 */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-block: 8px 80px; }
.pager a { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; color: var(--text); font-size: 17px; font-weight: 600; }
.pager a:hover { color: var(--text); border-color: var(--text-3); }
.pager small { display: block; font-size: 12px; font-weight: 400; color: var(--text-3); margin-bottom: 4px; }
.pager .next { text-align: right; }
@media (max-width: 560px) { .pager { grid-template-columns: 1fr; } .pager .next { text-align: left; } }

.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap { padding-top: 28px; padding-bottom: 40px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-3); }

/* 进入视口时淡入 */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .case, .case:hover { transition: none; transform: none; }
}
