/* Yuchen He: site styles.
   Ground and ink are cool blue-greys picked around the resume's navy. Three faces: Archivo (variable width) for
   the voice and the interface, Source Serif 4 for long reading, JetBrains Mono for figures and labels.
   Colour carries meaning in charts only: orange is the number to worry about, teal the one that held. */

@font-face {
  font-family: "Archivo";
  src: url("/static/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/static/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "Source Han Sans CN";
  src: url("/static/fonts/SourceHanSansCN-Regular.subset.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Source Han Sans CN";
  src: url("/static/fonts/SourceHanSansCN-Bold.subset.woff2") format("woff2");
  font-weight: 600 900;
  font-display: swap;
}

:root {
  --ground: #eef1f5;
  --surface: #ffffff;
  --wash: #e3e8ef;
  --ink: #101b2b;
  --ink-2: #364559;
  --muted: #566579;
  --line: #d2d9e2;
  --line-strong: #aab6c5;
  --accent: #1f4e79;
  --accent-hover: #16395a;
  --accent-ink: #ffffff;
  --neutral: #4a76a3;
  --mute: #9aa7b8;
  --bad: #b8430f;
  --good: #0b7a69;

  --f-ui: "Archivo", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --f-read: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-ui-zh: "Source Han Sans CN", var(--f-ui), "PingFang SC", "Microsoft YaHei", sans-serif;
  --f-read-zh: "Source Han Sans CN", var(--f-ui), "PingFang SC", "Microsoft YaHei", sans-serif;
}

:lang(zh) { font-family: var(--f-ui-zh); }
:lang(zh) .prose, :lang(zh) .post-body { font-family: var(--f-read-zh); line-height: 1.85; }
:lang(zh) .lead, :lang(zh) h1, :lang(zh) h2, :lang(zh) h3 { font-family: var(--f-ui-zh); }
:lang(zh) .eyebrow, :lang(zh) code, :lang(zh) .chart-value, :lang(zh) .readout-figure { font-family: var(--f-mono); }

/* Chinese pages: denser glyphs, so a touch more size and air than the Latin layout */
html:lang(zh) body { font-size: 1.125rem; line-height: 1.65; }
html:lang(zh) .hero h1 { font-size: clamp(1.85rem, 3.8vw, 3rem); line-height: 1.18; letter-spacing: -0.01em; }
html:lang(zh) .page-title { font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
html:lang(zh) .lead { font-size: 1.22rem; line-height: 1.7; }
html:lang(zh) .prose { max-width: 37rem; font-size: 1.15rem; }
html:lang(zh) .facts dd { font-size: 1.08rem; }
html:lang(zh) .work-main p, html:lang(zh) .exp-entry ul, html:lang(zh) .readout-condition { line-height: 1.7; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0c141e;
    --surface: #121d2a;
    --wash: #1a2736;
    --ink: #e7edf4;
    --ink-2: #c3cedb;
    --muted: #93a1b3;
    --line: #243244;
    --line-strong: #3a4c62;
    --accent: #8cb8e8;
    --accent-hover: #b4d2f2;
    --accent-ink: #0c141e;
    --neutral: #6f9bc8;
    --mute: #566a82;
    --bad: #f28c5e;
    --good: #4fcbb5;
  }
}
:root[data-theme="dark"] {
  --ground: #0c141e;
  --surface: #121d2a;
  --wash: #1a2736;
  --ink: #e7edf4;
  --ink-2: #c3cedb;
  --muted: #93a1b3;
  --line: #243244;
  --line-strong: #3a4c62;
  --accent: #8cb8e8;
  --accent-hover: #b4d2f2;
  --accent-ink: #0c141e;
  --neutral: #6f9bc8;
  --mute: #566a82;
  --bad: #f28c5e;
  --good: #4fcbb5;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 1.0625rem;
  line-height: 1.55;
  font-stretch: 100%;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--accent); color: var(--accent-ink); padding: 0.5rem 0.9rem; z-index: 10; }
.skip:focus { top: 0.75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

h1, h2, h3 { font-family: var(--f-ui); text-wrap: balance; margin: 0; }

/* ---------- header ---------- */
.topbar { padding-block: 1.15rem; }
.topbar-inner { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.brand {
  font-weight: 700;
  font-stretch: 112%;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}
.topbar nav { display: flex; gap: 1.6rem; }
.topbar nav a { color: var(--ink-2); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.topbar nav a:hover { color: var(--accent); text-decoration: underline; }
.topbar nav a[aria-current="page"], .topbar nav a[aria-current="true"] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.theme {
  font: 500 0.75rem var(--f-mono);
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  min-width: 4.6rem;
}
.theme:hover { border-color: var(--accent); color: var(--accent); }
.lang {
  font: 500 0.75rem var(--f-mono);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0.3rem 0.6rem;
}
.lang:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: clamp(2.25rem, 6vw, 4.5rem) clamp(2.5rem, 5vw, 3.5rem);
}
.eyebrow {
  font: 500 0.75rem var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.1rem;
}
.eyebrow a { color: inherit; }
.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3.25rem);
  font-weight: 650;
  font-stretch: 108%;
  line-height: 1.06;
  letter-spacing: -0.025em;
}
.lead { font-size: 1.2rem; line-height: 1.5; color: var(--ink-2); max-width: 38rem; margin: 1.4rem 0 0; }
.seeking { margin: 1rem 0 0; color: var(--ink); max-width: 38rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.6rem; margin: 1.8rem 0 0; }
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 0.75rem 1.2rem;
  border-radius: 2px;
  text-decoration: none;
}
.button:hover { background: var(--accent-hover); color: var(--accent-ink); }
.text-link { font-weight: 500; }

.hero-figure { min-width: 0; }
.panel-title {
  font: 500 0.75rem var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 1.5rem 1.5rem 1.25rem; }
.panel-link { margin: 0.9rem 0 0; font-size: 0.95rem; }

/* ---------- sections ---------- */
.section { padding-block: clamp(2rem, 4vw, 3rem); }
.section-title { font-size: 1.6rem; font-weight: 650; font-stretch: 106%; letter-spacing: -0.015em; margin-bottom: 1.4rem; }
.page-title {
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  font-weight: 650;
  font-stretch: 106%;
  line-height: 1.1;
  letter-spacing: -0.022em;
}
.narrow-head { max-width: 62rem; }

/* work */
.work { list-style: none; margin: 0; padding: 0; }
.work-row {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1.25fr) minmax(0, 1fr) 7.5rem;
  gap: 1.25rem 2rem;
  padding-block: 1.7rem;
  border-top: 1px solid var(--line);
}
.work-row:last-child { border-bottom: 1px solid var(--line); }
.work-row { border-left: 2px solid transparent; padding-left: 0.9rem; margin-left: -0.9rem; }
.work-row p { margin: 0; }
.kind { font: 500 0.72rem var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-top: 0.45rem; }
.badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 0.7rem;
  font: 600 0.66rem var(--f-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.12rem 0.42rem;
}
.work-main h3 { font-size: 1.4rem; font-weight: 650; font-stretch: 106%; letter-spacing: -0.015em; margin-bottom: 0.4rem; }
.work-main p { color: var(--ink-2); max-width: 34rem; }
.readout-figure { display: block; font: 600 1.65rem/1.15 var(--f-mono); letter-spacing: -0.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.readout-condition { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 0.4rem; max-width: 30rem; }
.work-links { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.92rem; padding-top: 0.35rem; }

.tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }
.tag {
  font: 500 0.72rem var(--f-mono);
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--wash);
  border-radius: 2px;
  padding: 0.18rem 0.5rem;
}

.evidence { grid-column: 1 / -1; margin-top: 0.3rem; }
.evidence > summary {
  cursor: pointer;
  list-style: none;
  font: 500 0.85rem var(--f-ui);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
}
.evidence > summary::-webkit-details-marker { display: none; }
.evidence > summary::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}
.evidence[open] > summary::before { transform: rotate(45deg); }
.evidence:hover > summary { color: var(--accent-hover); }
.evidence-body { padding: 0.9rem 0 0.3rem; display: grid; gap: 0.8rem; max-width: 42rem; }

.readout-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.7rem; }
.readout-card { border-left: 2px solid var(--line-strong); padding-left: 0.8rem; }
.readout-card.is-measured { border-left-color: var(--good); }
.readout-card.is-judgment { border-left-color: var(--neutral); }
.readout-card-label {
  display: block;
  font: 600 0.7rem var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}
.readout-card.is-measured .readout-card-label { color: var(--good); }
.readout-card.is-judgment .readout-card-label { color: var(--neutral); }
.readout-card p { margin: 0; font-size: 0.92rem; color: var(--ink-2); line-height: 1.5; }

/* small architecture diagram (RadixGates) */
.diagram { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; font-size: 0.85rem; }
.diagram-box {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  padding: 0.55rem 0.8rem;
  text-align: center;
  font-weight: 600;
}
.diagram-arrow { color: var(--mute); font-family: var(--f-mono); flex: none; }
.diagram-nodes { display: grid; gap: 0.4rem; }
.diagram-node {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}
.diagram-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; flex: none; }
.diagram-node.is-ok .diagram-dot { background: var(--good); }
.diagram-node.is-open .diagram-dot { background: var(--bad); }
.diagram-node small { color: var(--muted); margin-left: auto; padding-left: 0.5rem; }

/* posts list */
.posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.6rem; }
.posts li { max-width: 46rem; }
.posts h2, .posts h3 { font-size: 1.2rem; font-weight: 600; font-stretch: 104%; letter-spacing: -0.01em; }
.posts h2 a, .posts h3 a { color: var(--ink); text-decoration: none; }
.posts h2 a:hover, .posts h3 a:hover { color: var(--accent); text-decoration: underline; }
.posts p { margin: 0.3rem 0 0; color: var(--ink-2); max-width: 40rem; }
.posts--page { margin-top: 2.5rem; gap: 2.2rem; }
.now p { max-width: 44rem; margin: 0; color: var(--ink-2); }

/* experience */
.exp-entry { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0.4rem 2rem; padding-block: 1.2rem; border-top: 1px solid var(--line); }
.exp-entry:last-of-type { border-bottom: 1px solid var(--line); }
.exp-when { font: 500 0.8rem var(--f-mono); color: var(--muted); padding-top: 0.15rem; }
.exp-role { font-weight: 650; }
.exp-org { color: var(--ink-2); }
.exp-where { color: var(--muted); font-size: 0.85rem; margin-top: 0.1rem; }
.exp-entry ul { margin: 0.6rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; color: var(--ink-2); font-size: 0.95rem; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: clamp(2rem, 5vw, 4rem); margin-top: 2.2rem; align-items: start; }
.prose { max-width: 40rem; font-family: var(--f-read); font-size: 1.15rem; line-height: 1.7; }
.prose p { margin: 0 0 1.1rem; }
.prose h2 { font-family: var(--f-ui); font-size: 1.35rem; font-weight: 650; font-stretch: 106%; margin: 2.2rem 0 0.9rem; }
.principles { padding-left: 1.4rem; display: grid; gap: 0.8rem; }
.facts dl { margin: 0; display: grid; gap: 0.2rem; }
.facts dt { font: 500 0.72rem var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 0.9rem; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0; font-size: 1.03rem; }

.outside { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.outside h2 { font-size: 1.35rem; font-weight: 650; font-stretch: 106%; margin: 0 0 0.9rem; }
.outside-lead { font-family: var(--f-read); font-size: 1.05rem; color: var(--ink-2); margin: 0 0 1.4rem; max-width: 40rem; }
:lang(zh) .outside-lead { font-family: var(--f-read-zh); }
.hobbies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.1rem, 2.5vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}
.hobby { display: flex; flex-direction: column; gap: 0.3rem; }
.hobby-photo {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--wash);
  margin-bottom: 0.3rem;
}
.hobby-label { font-weight: 650; font-size: 0.98rem; }
.hobby-trait {
  font: 600 0.68rem var(--f-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.15rem;
}
.outside-close { margin: 1.8rem 0 0; max-width: 40rem; font-family: var(--f-read); font-size: 1.05rem; line-height: 1.65; color: var(--ink-2); }
:lang(zh) .outside-close { font-family: var(--f-read-zh); line-height: 1.85; }
.hobby-note { font-size: 0.88rem; line-height: 1.45; color: var(--muted); }

/* ---------- post ---------- */
.post-head { padding-top: clamp(2rem, 5vw, 3.5rem); }
.post-head > * { max-width: 46rem; }
.post-head .lead { font-family: var(--f-read); font-size: 1.3rem; }
.post-body { padding-block: 2rem 1rem; }
.post-body > * { max-width: 46rem; }
.post-body { font-family: var(--f-read); font-size: 1.15rem; line-height: 1.72; }
.post-body p { margin: 0 0 1.2rem; }
.post-body h2 { font-family: var(--f-ui); font-size: 1.5rem; font-weight: 650; font-stretch: 106%; letter-spacing: -0.015em; margin: 2.8rem 0 1rem; line-height: 1.2; }
.post-body h3 { font-family: var(--f-ui); font-size: 1.15rem; font-weight: 650; margin: 2rem 0 0.7rem; }
.post-body ul, .post-body ol { padding-left: 1.4rem; margin: 0 0 1.3rem; display: grid; gap: 0.5rem; }
.post-body li > p { margin: 0; }
.post-body strong { font-weight: 650; }
.post-body blockquote {
  margin: 1.8rem 0;
  padding: 1.1rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: var(--f-ui);
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
}
.post-body blockquote p { margin: 0 0 0.6rem; }
.post-body blockquote p:last-child { margin: 0; }
code { font-family: var(--f-mono); font-size: 0.86em; background: var(--wash); padding: 0.1em 0.35em; border-radius: 2px; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 1rem 1.2rem; overflow-x: auto; margin: 1.6rem 0; }
pre code { background: none; padding: 0; font-size: 0.82rem; line-height: 1.6; }
.table-wrap { overflow-x: auto; margin: 1.6rem 0; }
table { border-collapse: collapse; font-family: var(--f-ui); font-size: 0.92rem; width: 100%; }
th { font: 500 0.72rem var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0.55rem 0.9rem 0.55rem 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding-block: 3rem 4rem; }
.post-nav a { display: block; font-weight: 600; text-decoration: none; color: var(--ink); max-width: 22rem; }
.post-nav a:hover { color: var(--accent); }
.post-nav span { display: block; font: 500 0.72rem var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.3rem; }
.post-nav a:last-child { text-align: right; justify-self: end; }

/* ---------- charts ---------- */
.chart { margin: 2rem 0; font-family: var(--f-ui); }
.chart-rows { display: grid; gap: 0.9rem; }
.chart-row { display: grid; grid-template-columns: minmax(8rem, 12.5rem) minmax(0, 1fr) 4.8rem; align-items: center; column-gap: 1rem; }
.chart-label { font-size: 0.92rem; line-height: 1.25; font-weight: 500; }
.chart-label small { display: block; font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.chart-track {
  position: relative;
  height: 1.1rem;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: var(--grid, 25%) 100%;
  border-right: 1px solid var(--line);
}
.bar { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); display: block; }
.bar-neutral, .swatch.bar-neutral { background: var(--neutral); }
.bar-mute { background: var(--mute); }
.bar-bad { background: var(--bad); }
.bar-good { background: var(--good); }
.chart-track .bar { min-width: 2px; }
.mark { position: absolute; top: -5px; bottom: -5px; left: var(--p); width: 2px; background: var(--ink); display: block; }
.mark-key { position: static; display: inline-block; width: 2px; height: 0.9rem; vertical-align: -2px; margin-right: 0.4rem; }
.chart-value { font: 500 0.9rem var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; letter-spacing: -0.02em; }
.chart-axis { margin-top: -0.35rem; }
.chart-ticks { position: relative; height: 1rem; font: 400 0.7rem var(--f-mono); color: var(--muted); }
.chart-ticks span { position: absolute; top: 0; left: var(--p); transform: translateX(-50%); }
.chart-legend { margin: 0.9rem 0 0; font-size: 0.82rem; color: var(--ink-2); }
.chart figcaption { margin: 0.9rem 0 0; font-size: 0.82rem; line-height: 1.5; color: var(--muted); max-width: 44rem; }
.chart figcaption code { font-size: 0.95em; }

.chart--stack .chart-rows { gap: 1.5rem; }
.stack-row { display: grid; gap: 0.5rem; }
.stack { display: flex; gap: 2px; height: 1.4rem; }
.seg { display: block; flex: 0 1 var(--w); min-width: 2px; }
.stack-values { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.swatch { display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.4rem; vertical-align: -1px; }

.chart--compact .chart-rows { gap: 1.05rem; }
.chart--compact .chart-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.4rem; }
.chart--compact .chart-row .chart-track { grid-column: 1 / -1; grid-row: 2; }
.chart--compact .chart-axis { grid-template-columns: minmax(0, 1fr); margin-top: -0.3rem; }
.chart--compact .chart-axis > span { display: none; }
.chart--compact figcaption { font-size: 0.78rem; }

/* ---------- footer ---------- */
.foot { margin-top: 3rem; padding-block: 2rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.foot-inner { display: grid; grid-template-columns: 1fr auto; gap: 0.6rem 2rem; }
.foot p { margin: 0; }
.foot-note { grid-column: 1 / -1; font-size: 0.8rem; max-width: 46rem; }
.foot a { color: var(--ink-2); }

/* ---------- motion ----------
   Progressive enhancement only: every rule here is guarded so that with JS off, or reduced
   motion requested, the page renders exactly as if this block did not exist -- nothing is ever
   hidden by default. motion.js adds "js-motion" to <html> and toggles "is-visible"/"is-charted". */
@media (prefers-reduced-motion: no-preference) {
  * { transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease; }

  .js-motion .section,
  .js-motion .now {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .js-motion .section.is-visible,
  .js-motion .now.is-visible {
    opacity: 1;
    transform: none;
  }

  .js-motion .chart .bar,
  .js-motion .chart .seg {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .js-motion .chart.is-charted .bar,
  .js-motion .chart.is-charted .seg {
    transform: scaleX(1);
  }

  .work-row { transition: border-color 0.18s ease; }
  .work-row:hover, .work-row:focus-within { border-left-color: var(--accent); }
}

/* ---------- small screens ---------- */
@media (max-width: 62rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .work-row { grid-template-columns: 6rem minmax(0, 1fr); }
  .work-row .readout { grid-column: 2; }
  .work-row .work-links { grid-column: 2; flex-direction: row; gap: 1.2rem; padding-top: 0; }
  .tags, .evidence { grid-column: 2 / -1; }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .exp-entry { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
}
@media (max-width: 40rem) {
  body { font-size: 1rem; }
  html:lang(zh) body { font-size: 1.0625rem; }
  .topbar-inner { row-gap: 0.7rem; }
  .topbar nav { order: 3; flex: 1 0 100%; flex-wrap: wrap; gap: 0.6rem 1rem; }
  .theme { min-width: 0; padding-inline: 0.5rem; }
  .work-row { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
  .work-row .readout, .work-row .work-links { grid-column: 1; }
  .tags, .evidence { grid-column: 1; }
  .kind { padding-top: 0; }
  .diagram { flex-direction: column; align-items: stretch; }
  .diagram-arrow { text-align: center; transform: rotate(90deg); }
  .readout-pair { grid-template-columns: minmax(0, 1fr); }
  .hobbies { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 0.9rem; }
  .chart-row, .chart--compact .chart-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0.35rem; }
  .chart-row .chart-track { grid-column: 1 / -1; grid-row: 2; }
  .chart-axis { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
  .chart-axis > span { display: none; }
  .post-body, .post-head .lead { font-size: 1.08rem; }
  .post-nav { grid-template-columns: minmax(0, 1fr); }
  .post-nav a:last-child { text-align: left; justify-self: start; }
  .foot-inner { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}


/* ---------- recruiting hierarchy / capability layer ---------- */
.section-kicker {
  margin: 0 0 0.35rem;
  font: 600 0.7rem var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.capabilities { padding-top: clamp(1rem, 2vw, 1.6rem); }
.capability-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 54%, transparent);
}
.capability-card {
  min-width: 0;
  padding: 1.3rem 1.25rem 1.4rem;
  border-left: 1px solid var(--line);
}
.capability-card:first-child { border-left: 0; }
.capability-index {
  margin: 0 0 0.75rem;
  font: 600 0.68rem var(--f-mono);
  color: var(--accent);
  letter-spacing: 0.08em;
}
.capability-card h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.55rem;
}
.capability-body {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.93rem;
  line-height: 1.5;
}
.capability-proof {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font: 500 0.72rem/1.45 var(--f-mono);
}

.work-row.is-featured {
  margin: 0 -1rem 0.7rem;
  padding: 1.8rem 1rem 1.55rem;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
}
.work-row.is-featured .readout-figure { font-size: 1.9rem; }
.work-row.is-featured .work-main h3 { font-size: 1.5rem; }

/* Notes on the home page are evidence cards, not a generic blog list. */
.field-notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}
.field-note {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.field-note:hover,
.field-note:focus-within {
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.field-note-no {
  font: 600 0.68rem var(--f-mono);
  color: var(--accent);
  letter-spacing: 0.06em;
  padding-top: 0.2rem;
}
.field-note h3 {
  font-size: 1.08rem;
  margin: 0;
}
.field-note h3 a { color: var(--ink); text-decoration: none; }
.field-note h3 a:hover { color: var(--accent); text-decoration: underline; }
.field-note p {
  margin: 0.4rem 0 0;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.5;
}
.field-note-link {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

/* A factual progression: background -> tools -> data systems -> systems -> hardware. */
.journey { margin: 2rem 0 2.4rem; }
.prose .journey h2 { margin-top: 0; }
.journey-list {
  position: relative;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
}
.journey-list::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  right: 0.45rem;
  top: 0.38rem;
  height: 1px;
  background: var(--line-strong);
}
.journey-list li {
  position: relative;
  min-width: 0;
  padding-top: 1.15rem;
}
.journey-dot {
  position: absolute;
  top: 0;
  left: 0.18rem;
  width: 0.78rem;
  height: 0.78rem;
  border-radius: 50%;
  border: 2px solid var(--ground);
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.journey-list strong {
  display: block;
  font-family: var(--f-ui);
  font-size: 0.82rem;
  line-height: 1.3;
}
.journey-list li > span:last-child {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-family: var(--f-ui);
  font-size: 0.75rem;
  line-height: 1.35;
}

/* The hobbies are personal evidence, not soft-skill badges. */
.hobby-trait { display: none; }

/* Closing conversion point: the page should not simply stop. */
.final-cta {
  margin-top: clamp(2rem, 5vw, 4rem);
  margin-bottom: clamp(1rem, 3vw, 2rem);
  padding-block: clamp(1.5rem, 4vw, 2.3rem);
  border-block: 1px solid var(--line-strong);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 3rem;
  align-items: center;
}
.final-cta h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  margin: 0;
}
.final-cta p {
  margin: 0.45rem 0 0;
  color: var(--ink-2);
  max-width: 45rem;
}
.final-cta-actions {
  display: flex;
  align-items: center;
  gap: 1.1rem;
}

/* Charts: make the evidence explorable with mouse and keyboard without adding decorative animation. */
.chart-row:not(.chart-axis) {
  border-radius: 3px;
  transition: background-color 0.18s ease, opacity 0.18s ease;
}
.chart-row:not(.chart-axis):hover,
.chart-row:not(.chart-axis):focus-visible {
  background: var(--wash);
}
.chart-row:not(.chart-axis):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.chart-row:not(.chart-axis):hover .bar,
.chart-row:not(.chart-axis):focus-visible .bar {
  filter: saturate(1.15) brightness(1.04);
}

/* A single functional fault cue when the RadixGates evidence is opened. */
@media (prefers-reduced-motion: no-preference) {
  details[open] .diagram-node.is-open {
    animation: fault-cue 0.65s ease-out 1;
  }
  @keyframes fault-cue {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 40%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: none; }
  }
}

@media (max-width: 62rem) {
  .capability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .capability-card:nth-child(odd) { border-left: 0; }
  .capability-card:nth-child(n+3) { border-top: 1px solid var(--line); }
  .journey-list { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 1rem; }
  .journey-list::before { display: none; }
  .journey-list li { border-top: 1px solid var(--line); padding-top: 0.75rem; }
  .journey-dot { display: none; }
}
@media (max-width: 40rem) {
  .capability-grid { grid-template-columns: minmax(0, 1fr); }
  .capability-card,
  .capability-card:nth-child(odd) { border-left: 0; }
  .capability-card:nth-child(n+2) { border-top: 1px solid var(--line); }
  .field-notes { grid-template-columns: minmax(0, 1fr); }
  .journey-list { grid-template-columns: minmax(0, 1fr); }
  .final-cta { grid-template-columns: minmax(0, 1fr); }
  .final-cta-actions { justify-content: flex-start; }
  .work-row.is-featured { margin-inline: 0; }
}


/* Keep navigation available on a long recruiting page without turning it into app chrome. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--ground) 90%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
@supports not (background: color-mix(in srgb, white 90%, transparent)) {
  .topbar { background: var(--ground); }
}
@media (hover: hover) and (pointer: fine) {
  .capability-card {
    transition: background-color 0.18s ease;
  }
  .capability-card:hover {
    background: var(--surface);
  }
}
