:root {
  --bg: #f4f0e6;
  --bg-2: #ece6d8;
  --fg: #1c1b18;
  --muted: #5d5a52;
  --dim: #6e6a60;
  --rule: #d9d1bf;
  --accent: #1c1b18;
  --accent-dim: #9a958a;
  --ink: #1c1b18;
  --sans: "EB Garamond", "Noto Serif SC", "Songti SC", Georgia, serif;
  --mono: "IBM Plex Mono", "Noto Serif SC", ui-monospace, Menlo, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fg); text-decoration: none; }
::selection { background: var(--accent-dim); color: var(--fg); }

/* language switching */
html[data-lang="en"] [lang="zh"] { display: none !important; }
html[data-lang="zh"] [lang="en"] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--fg); color: var(--bg); padding: 8px 12px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 72px); }

/* ---- header ---- */
header.site { border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: rgba(244, 240, 230, 0.9); backdrop-filter: blur(8px); z-index: 5; }
header.site .container { display: flex; align-items: stretch; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 14px; font-weight: 500; font-size: 19px; letter-spacing: 0.08em; text-transform: uppercase; }
.brand svg { width: 28px; height: 28px; flex: none; }
nav.tabs { display: flex; align-items: stretch; gap: 0 28px; flex-wrap: wrap; }
nav.tabs a {
  display: flex; align-items: center; font-size: 16px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; min-height: 44px;
}
nav.tabs a:hover { color: var(--fg); }
nav.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }
.langs { display: flex; align-items: center; gap: 2px; }
.langs button {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  background: none; border: 1px solid transparent; color: var(--muted);
  padding: 6px 8px; min-height: 30px; cursor: pointer; border-radius: 2px;
}
.langs button[aria-pressed="true"] { color: var(--fg); border-color: var(--rule); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---- shared type ---- */
.micro { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin: 0 0 10px; }
.lede { font-size: clamp(21px, 2.3vw, 26px); line-height: 1.55; letter-spacing: -0.02em; color: var(--muted); margin: 0 0 28px; font-weight: 400; }
.lede strong { color: var(--fg); font-weight: 500; }
.lede { font-size: clamp(23px, 2.5vw, 29px); }
.body { font-size: 18px; line-height: 1.75; color: var(--muted); margin: 0 0 18px; max-width: 34em; }
.body strong { color: var(--fg); font-weight: 500; }
.arrow-links { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 30px 0 34px; }
.arrow-links a, a.arrow { font-size: 17px; color: var(--fg); display: inline-flex; gap: 10px; align-items: center; min-height: 32px; }
.arrow-links a::after, a.arrow::after { content: "↗"; color: var(--accent); font-size: 15px; }
.arrow-links a:hover, a.arrow:hover { color: var(--accent); }

/* ---- home hero ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; min-height: calc(100vh - 77px); padding: 56px 0; }
.hero-text { max-width: 520px; }
.hero-viz { position: relative; aspect-ratio: 1 / 0.9; }
.hero-viz canvas { width: 100%; height: 100%; display: block; }
.hero-viz figcaption { position: absolute; left: 0; right: 112px; bottom: -4px; line-height: 1.5; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.pause {
  position: absolute; right: 0; bottom: -14px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--rule);
  padding: 8px 14px; min-height: 36px; cursor: pointer; border-radius: 2px;
}
.pause:hover { color: var(--fg); border-color: var(--dim); }
.convo { border-top: 1px solid var(--rule); padding-top: 22px; max-width: 460px; }
.convo-head { display: flex; justify-content: space-between; gap: 16px; }
.convo p.text { font-size: 16.5px; line-height: 1.65; color: var(--muted); margin: 6px 0 14px; }

/* ---- numbered focus sections ---- */
.section-head { padding: 96px 0 36px; border-top: 1px solid var(--rule); }
.section-head h2 { font-size: 34px; font-weight: 450; letter-spacing: -0.035em; margin: 0; }
.focus { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px 72px; padding: 48px 0 56px; border-top: 1px solid var(--rule); }
.focus:first-of-type { border-top: 0; }
.focus-title { display: flex; gap: 22px; align-items: baseline; margin-bottom: 30px; }
.focus-title .n { font-family: var(--mono); font-size: 10.5px; color: var(--accent); }
.focus-title h3 { font-size: 27px; font-weight: 450; letter-spacing: -0.025em; margin: 0; }
.diagram { width: 100%; max-width: 340px; height: auto; display: block; margin-left: 32px; }
.diagram .ln { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; }
.diagram .ln-dim { fill: none; stroke: var(--accent-dim); stroke-width: 1; }
.diagram .box { fill: rgba(28, 27, 24, 0.035); stroke: var(--accent-dim); stroke-width: 1; }
.diagram .dot { fill: var(--accent); }
.diagram text { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.08em; fill: var(--muted); text-transform: uppercase; }
.question { font-size: 22px; line-height: 1.55; letter-spacing: -0.015em; color: var(--fg); margin: 0 0 30px; }
.sub { margin-bottom: 24px; }
.sub p { font-size: 17px; line-height: 1.7; color: var(--muted); margin: 0; max-width: 40em; }
.sub p.micro { font-size: 10px; line-height: 1.4; color: var(--dim); margin: 0 0 8px; }
.work-item { margin-bottom: 18px; }
.work-item .t { font-size: 17px; color: var(--fg); line-height: 1.55; }
.work-item .m { font-size: 12px; color: var(--dim); margin-top: 4px; }

/* ---- inner pages ---- */
.page-head { padding: 88px 0 40px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px 72px; align-items: end; }
.page-head h1 { font-size: clamp(34px, 4.4vw, 48px); font-weight: 450; letter-spacing: -0.04em; line-height: 1.05; margin: 0; }
.page-head .lede { margin: 0; }

.timeline { border-top: 1px solid var(--rule); }
.tl-row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 16px 72px; padding: 36px 0; border-bottom: 1px solid var(--rule); }
.tl-row .when { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: var(--accent); padding-top: 6px; }
.tl-row h3 { font-size: 24px; font-weight: 450; letter-spacing: -0.02em; margin: 0 0 4px; }
.tl-row .org { font-size: 16.5px; color: var(--muted); margin: 0 0 12px; }
.tl-row p.d { font-size: 17px; color: var(--muted); line-height: 1.7; margin: 0; max-width: 40em; }
.group-label { padding: 64px 0 14px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.tags li { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted); border: 1px solid var(--rule); padding: 7px 11px; border-radius: 2px; }

.contact-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px 72px; padding: 40px 0 72px; border-top: 1px solid var(--rule); }
.big-mail { font-size: clamp(24px, 3.2vw, 34px); letter-spacing: -0.03em; display: inline-flex; gap: 14px; align-items: center; }
.big-mail::after { content: "↗"; color: var(--accent); font-size: 0.7em; }
.big-mail:hover { color: var(--accent); }
.copy { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; background: none; border: 1px solid var(--rule); color: var(--muted); padding: 7px 12px; min-height: 32px; margin-left: 16px; cursor: pointer; border-radius: 2px; vertical-align: middle; }
.copy:hover { color: var(--fg); }
.list { list-style: none; padding: 0; margin: 0; }
.list li { font-size: 18px; color: var(--fg); padding: 14px 0; border-bottom: 1px solid var(--rule); }
.list li:first-child { border-top: 1px solid var(--rule); }

/* ---- footer ---- */
footer.site { border-top: 1px solid var(--rule); margin-top: 40px; }
footer.site .container { padding-top: 36px; padding-bottom: 44px; display: grid; gap: 22px; }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.foot-row .name { font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; font-size: 14px; color: var(--fg); }
.foot-row .r { display: flex; gap: 24px; align-items: center; }
.foot-row .r span, .foot-row .r a { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.foot-row .r a:hover { color: var(--fg); }
.disclaimer { font-size: 13.5px; line-height: 1.7; color: var(--dim); max-width: 62em; margin: 0; }

@media (max-width: 860px) {
  .hero, .focus, .page-head, .tl-row, .contact-grid { grid-template-columns: 1fr; }
  .hero { min-height: 0; padding-top: 40px; }
  .hero-viz { order: -1; max-width: 520px; width: 100%; margin: 0 auto 10px; }
  .diagram { margin-left: 0; }
  .section-head { padding-top: 64px; }
  .page-head { padding-top: 56px; }
  nav.tabs { gap: 0 18px; }
  header.site .container { padding-top: 8px; }
}

/* ---- ink-wash additions ---- */
body {
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.11  0 0 0 0 0.10  0 0 0 0 0.09  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600'><filter id='f'><feTurbulence type='fractalNoise' baseFrequency='0.012 0.035' numOctaves='2' seed='7'/><feColorMatrix values='0 0 0 0 0.11  0 0 0 0 0.10  0 0 0 0 0.09  0 0 0 0.035 0'/></filter><rect width='100%' height='100%' filter='url(%23f)'/></svg>"),
    radial-gradient(1200px 600px at 85% -10%, rgba(28,27,24,0.05), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(28,27,24,0.045), transparent 60%);
}
header.site { background: rgba(244, 240, 230, 0.86); }
.brand { gap: 0; letter-spacing: 0.14em; }
.hero-viz { aspect-ratio: 1 / 1.02; }
.hero-viz .wash { display: none; }
.hero-viz canvas {
  -webkit-mask-image: radial-gradient(ellipse 52% 50% at 50% 50%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 52% 50% at 50% 50%, #000 62%, transparent 100%);
}
.focus-title .n { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
nav.tabs a[aria-current="page"] { border-bottom-color: var(--fg); }
.arrow-links a::after, a.arrow::after, .big-mail::after { color: var(--dim); }
.arrow-links a:hover, a.arrow:hover, .big-mail:hover { color: var(--muted); }
.diagram .dot { fill: var(--fg); }
.page-head h1, .section-head h2, .focus-title h3, .tl-row h3 { font-weight: 500; }
.page-head h1 { font-size: clamp(42px, 5vw, 58px); }
.pause { background: rgba(244,240,230,0.7); }
.tags li { background: rgba(255,255,255,0.3); }
.tl-row .when { color: var(--muted); }
