:root {
  --paper: #f4f1e8;
  --paper-2: #ebe6d8;
  --card: #faf8f2;
  --ink: #15181d;
  --muted: #5a5e65;
  --line: #d8d0bf;
  --accent: #d55e00;
  --blue: #0072b2;
  --green: #009e73;

  --night: #111417;
  --night-2: #191d21;
  --night-line: #2c3137;
  --night-text: #ebe7dc;
  --night-muted: #9da2a8;

  --cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC";
  --serif: "Instrument Serif", Georgia, var(--cjk), serif;
  --sans: "IBM Plex Sans", var(--cjk), system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.4  0 0 0 0 0.3  0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); }

/* ---------- Header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.top.scrolled { border-bottom-color: var(--line); }
.top-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 500 18px/1 var(--sans); letter-spacing: -.01em; }
.brand b { font-weight: 600; color: var(--accent); }
.mark { width: 26px; height: 26px; }
.nav { display: flex; gap: 26px; margin-left: auto; }
.nav a {
  font: 500 13px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  text-decoration: none;
  color: var(--muted);
  padding: 6px 0;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1.5px no-repeat;
  transition: color .2s, background-size .3s;
}
.nav a:hover { color: var(--ink); background-size: 100% 1.5px; }
html[lang="zh-CN"] .nav a { font-family: var(--sans); font-size: 14px; letter-spacing: .04em; }
.lang {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 7px 13px;
  font: 500 12.5px/1 var(--mono);
  color: var(--muted);
  cursor: pointer;
  transition: border-color .2s;
}
.lang:hover { border-color: var(--ink); }
.lang .sep { opacity: .4; }
html[lang="en"] .lang [data-l="en"],
html[lang="zh-CN"] .lang [data-l="zh"] { color: var(--ink); font-weight: 600; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  min-height: min(calc(92vh - 64px), 860px);
  padding-top: clamp(32px, 6vw, 72px);
  padding-bottom: clamp(48px, 7vw, 96px);
}
.eyebrow, .kicker, .tag, .tools, .step-n, .readout, .checklist-title {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.eyebrow { color: var(--accent); margin: 0 0 22px; display: flex; align-items: center; gap: 12px; }
.eyebrow::before { content: ""; width: 28px; height: 1.5px; background: currentColor; }
h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(2.7rem, 6.2vw, 5.4rem); line-height: .98; }
h1 em { font-style: italic; color: var(--accent); }
.lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--muted); max-width: 34em; margin: 28px 0 36px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  transition: transform .2s, background .2s, color .2s, border-color .2s;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary::after { content: "→"; transition: transform .2s; }
.btn.primary:hover { background: var(--accent); }
.btn.primary:hover::after { transform: translateX(3px); }
.btn.ghost { border: 1px solid var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink); }

/* Chinese headings: CJK sans reads better than a fallback serif at display sizes */
html[lang="zh-CN"] h1,
html[lang="zh-CN"] h2 { font-family: var(--cjk), sans-serif; font-weight: 600; letter-spacing: .01em; }
html[lang="zh-CN"] h1 { line-height: 1.2; font-size: clamp(2.1rem, 4.3vw, 3.6rem); text-wrap: balance; }
html[lang="zh-CN"] h1 em { font-style: normal; }
html[lang="zh-CN"] .eyebrow,
html[lang="zh-CN"] .kicker,
html[lang="zh-CN"] .checklist-title { font-family: var(--sans); letter-spacing: .12em; }

.hero-copy > * { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero-copy > :nth-child(2) { animation-delay: .08s; }
.hero-copy > :nth-child(3) { animation-delay: .18s; }
.hero-copy > :nth-child(4) { animation-delay: .28s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.hero-plot {
  position: relative;
  margin: 0;
  aspect-ratio: 520 / 440;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(var(--paper-2) 1px, transparent 1px) 0 0 / 26px 26px,
    linear-gradient(90deg, var(--paper-2) 1px, transparent 1px) 0 0 / 26px 26px,
    var(--card);
  box-shadow: 0 1px 0 #fff inset, 0 30px 60px -40px rgba(40, 30, 10, .35);
}
.hero-plot svg { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.readout {
  position: absolute;
  left: 16px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: .02em;
}
.swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background .2s; }

#umap .pt { animation: settle 1.4s cubic-bezier(.16, .8, .2, 1) both; }
@keyframes settle { from { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
#umap .k { transition: opacity .25s; }
#umap.focus .k:not(.on) { opacity: .12; }
#umap .lbl { font: 500 11px var(--mono); fill: var(--muted); opacity: 0; animation: fade .6s 1.4s forwards; pointer-events: none; }
#umap .k.on .lbl { fill: var(--ink); }
#umap .axis { stroke: var(--muted); stroke-width: 1.2; fill: none; }
#umap .axis-t { font: 10px var(--mono); fill: var(--muted); letter-spacing: .05em; }
@keyframes fade { to { opacity: 1; } }

/* ---------- Sections ---------- */
.section { position: relative; padding: clamp(72px, 10vw, 128px) 0; }
.section-head { max-width: 640px; margin-bottom: clamp(36px, 5vw, 56px); }
.kicker { display: flex; align-items: center; gap: 14px; color: var(--muted); margin: 0 0 18px; }
.kicker .num { color: var(--accent); }
.kicker .num::after { content: ""; display: inline-block; width: 22px; height: 1px; background: var(--line); vertical-align: middle; margin-left: 14px; }
h2 { font-size: clamp(2.1rem, 4.4vw, 3.5rem); line-height: 1.04; }
.section-lede { color: var(--muted); margin: 18px 0 0; max-width: 36em; }

.track { position: absolute; top: 0; left: 0; right: 0; height: 64px; transform: translateY(-100%); opacity: .9; }
.track svg { width: 100%; height: 100%; display: block; }
.track rect { fill: #c9bfaa; }
.track rect.peak { fill: var(--accent); }

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.card {
  position: relative;
  padding: 30px 28px 26px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  transition: background .3s;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width .4s cubic-bezier(.2, .7, .2, 1);
}
.card:hover { background: var(--card); }
.card:hover::before { width: calc(100% + 1px); }
.tag { color: var(--accent); margin: 0 0 22px; letter-spacing: .02em; text-transform: none; font-size: 13px; }
.card h3 { font: 600 1.2rem/1.25 var(--sans); margin: 0 0 10px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: 15.5px; }
.card .tools { margin-top: auto; padding-top: 22px; text-transform: none; letter-spacing: 0; font-size: 12px; color: #8a8478; }

/* ---------- Process (dark) ---------- */
.night { background: var(--night); color: var(--night-text); }
.night .kicker { color: var(--night-muted); }
.night .kicker .num::after { background: var(--night-line); }
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  counter-reset: s;
}
.steps li { position: relative; padding: 28px 28px 8px 0; border-top: 1px solid var(--night-line); }
.steps li::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--night);
  border: 1.5px solid var(--accent);
}
.step-n { color: var(--accent); display: block; margin-bottom: 14px; }
.steps h3 { font: 600 1.15rem/1.3 var(--sans); margin: 0 0 8px; }
.steps p { margin: 0; color: var(--night-muted); font-size: 15.5px; }

/* ---------- Deliverables ---------- */
.split { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 96px); align-items: start; }
.split .section-head { margin-bottom: 0; }
.tree-box {
  background: var(--night);
  color: var(--night-text);
  border-radius: 8px;
  padding: 26px 28px 22px;
  font-family: var(--mono);
  font-size: 14px;
  box-shadow: 0 30px 60px -40px rgba(10, 10, 10, .6);
}
.tree-box::before {
  content: "";
  display: block;
  width: 42px;
  height: 10px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle, #e0645a 4px, transparent 4.5px) 0 0 / 14px 10px no-repeat,
    radial-gradient(circle, #e2b24a 4px, transparent 4.5px) 14px 0 / 14px 10px no-repeat,
    radial-gradient(circle, #5fb36b 4px, transparent 4.5px) 28px 0 / 14px 10px no-repeat;
}
.tree-root { margin: 0 0 6px; color: var(--accent); }
.tree { list-style: none; margin: 0; padding: 0; }
.tree li {
  position: relative;
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 14px;
  padding: 7px 0 7px 2.6em;
}
.tree li::before { content: "├──"; position: absolute; left: 0; color: var(--night-line); }
.tree li:last-child::before { content: "└──"; }
.tree code { font: inherit; color: #f1ede3; }
.tree span { color: var(--night-muted); font-family: var(--sans); font-size: 14.5px; }

.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 4vw, 56px);
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.principles h3 { font: 400 1.7rem/1.1 var(--serif); margin: 0 0 10px; }
html[lang="zh-CN"] .principles h3 { font: 600 1.3rem/1.3 var(--cjk), sans-serif; }
.principles p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ---------- Contact ---------- */
.contact { background: var(--paper-2); }
.email {
  display: inline-block;
  margin-top: 30px;
  font: 500 clamp(1.05rem, 2.4vw, 1.5rem)/1.2 var(--mono);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  word-break: break-all;
  transition: color .2s;
}
.email:hover { color: var(--accent); }
.checklist { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 26px 28px; }
.checklist-title { color: var(--muted); margin: 0 0 14px; }
.checklist ul { list-style: none; margin: 0; padding: 0; }
.checklist li { padding: 11px 0 11px 30px; border-top: 1px dashed var(--line); position: relative; }
.checklist li:first-child { border-top: 0; }
.checklist li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 17px;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
}

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--line); padding: 28px 0; font-size: 14px; color: var(--muted); }
.foot-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
}
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .split { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .nav { display: none; }
  .lang { margin-left: auto; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .cards { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .tree li { grid-template-columns: 1fr; gap: 2px; }
  .tree-box, .checklist { padding: 22px 18px; }
  .card { padding: 26px 20px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #umap .lbl { opacity: 1; }
  html { scroll-behavior: auto; }
}
