@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400&text=%E8%81%82%E4%BD%B3%E8%89%BA&display=swap");
@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;1,6..72,400&display=swap");

:root {
  --bg: #faf7f0;
  --ink: #23302b;
  --muted: #6f736a;
  --rule: #e3dece;
  --accent: #2c5a4d;
  --glow: #efe7d2;
  /* Strata of the compute stack, agents at the top, silicon at the bottom */
  --s1: #f1ebdb;
  --s2: #e0dfc9;
  --s3: #b9c9b4;
  --s4: #4f7a6a;
  --s5: #1f3b34;
  --s-ink: #23302b;
  --s-ink-deep: #f6f2e6;
  --display: "Instrument Serif", Georgia, serif;
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --top: clamp(72px, 15vh, 156px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a18;
    --ink: #ebe6d9;
    --muted: #979c92;
    --rule: #2b3430;
    --accent: #9cc7b6;
    --glow: #24302b;
    --s1: #d9d3c0;
    --s2: #c2c6b0;
    --s3: #9db3a0;
    --s4: #4f7a6a;
    --s5: #2a4c43;
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(48px, 7vw, 112px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 72px);
}

/* Fixed identity column */
.identity {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: var(--top) 0 44px;
}
.portrait {
  display: block;
  width: 216px;
  height: auto;
  margin-bottom: 26px;
  border-radius: 6px;
}
.identity h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 50px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.01em;
}
.cn {
  margin-left: 6px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 0.42em;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}
.role { margin: 14px 0 0; font-size: 17px; line-height: 1.4; color: var(--muted); }

.mono, .toc, .links, .stack-tag, .pub-meta, .colophon {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.toc { margin: 44px 0 0; padding: 0; list-style: none; }
.toc li { padding: 2px 0; }
.toc a { color: var(--muted); text-decoration: none; transition: color 0.2s ease, padding-left 0.2s ease; }
.toc a:hover, .toc a.is-active { color: var(--ink); }
.toc a.is-active { padding-left: 14px; box-shadow: inset 2px 0 0 var(--accent); }

.links { margin: auto 0 0; padding: 40px 0 0; list-style: none; }
.links li { padding: 3px 0; }
.links a { text-decoration: none; color: var(--muted); }
.links a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Content column */
.content { min-width: 0; padding: var(--top) 0 80px; }

section { margin-bottom: clamp(64px, 9vw, 112px); }
section > h2 {
  margin: 0 0 26px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
}

section > h2 .note { float: right; font-weight: 400; }

.prose {
  max-width: 680px;
  margin: 0;
  line-height: 1.55;
  text-wrap: pretty;
}
.prose + .stack { margin-top: 32px; }
.prose + .prose { margin-top: 0.9em; }

/* The compute stack */
.stack { margin: 0; padding: 0; list-style: none; border-radius: 6px; overflow: hidden; }
.stack li {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 2.6fr);
  gap: 6px 28px;
  padding: 24px 28px;
  color: var(--s-ink);
  transition: padding-left 0.2s ease;
}
.stack li:hover { padding-left: 36px; }
.stack a:hover { color: inherit; text-decoration-thickness: 2px; }
.stack-tag { padding-top: 0.32em; }
.stack p { margin: 0; line-height: 1.4; text-wrap: pretty; }
.s1 { background: var(--s1); }
.s2 { background: var(--s2); }
.s3 { background: var(--s3); }
.s4 { background: var(--s4); color: var(--s-ink-deep) !important; }
.s5 { background: var(--s5); color: var(--s-ink-deep) !important; }

/* Publications */
.pubs { margin: 0; padding: 0; list-style: none; }
.pub {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 4px 24px;
  padding: 16px 0;
  transition: background 0.4s ease;
}
.pub-meta { padding-top: 0.34em; color: var(--muted); }
.pub-meta b { display: block; font-weight: 500; color: var(--muted); }
.pub.is-venue .pub-meta b { color: var(--accent); }
.pub + .pub { border-top: 1px solid var(--rule); }
.pub:target { background: var(--glow); box-shadow: 0 0 0 12px var(--glow); border-top-color: transparent; }
.pub h3 { margin: 0; font-size: 18px; font-weight: 500; line-height: 1.3; text-wrap: pretty; }
.pub h3 a { text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.authors { margin: 4px 0 0; font-size: 15px; line-height: 1.42; color: var(--muted); }
.authors b { font-weight: 500; color: var(--ink); }

.entry { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 16px; align-items: start; }
.logo { display: block; width: 36px; height: 36px; margin-top: 2px; }
.logo img { display: block; width: 36px; height: 36px; object-fit: contain; }
.role-line { margin-top: 4px; }

.place { display: block; white-space: nowrap; }
.colophon { color: var(--muted); }

/* A quiet entrance */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.identity, .content { animation: rise 0.7s ease both; }
.content { animation-delay: 0.12s; }

@media (min-width: 901px) and (max-height: 960px) {
  :root { --top: clamp(56px, 10vh, 96px); }
  .portrait { width: 184px; }
}

@media (min-width: 901px) and (max-height: 820px) {
  :root { --top: 56px; }
  .portrait { width: 160px; margin-bottom: 20px; }
  .toc { margin-top: 28px; }
}

@media (min-width: 901px) and (max-height: 740px) {
  .portrait { width: 128px; }
  .toc { margin-top: 20px; }
  .links { padding-top: 20px; }
}

@media (max-width: 900px) {
  .layout { display: block; }
  .identity { position: static; min-height: 0; padding: 64px 0 0; }
  .portrait { width: 180px; margin-bottom: 22px; }
  .identity h1 { font-size: 38px; }
  .toc { display: none; }
  .links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 16px 0 0; padding: 0; }
  .content { padding-top: 56px; }
  .stack li { grid-template-columns: 1fr; padding: 18px 20px; }
  .stack li:hover { padding-left: 20px; }
}

@media (max-width: 560px) {
  .pub { grid-template-columns: 1fr; }
}

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

/* Links in running text */
.prose a, .authors a {
  color: var(--accent);
  font-weight: 500;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.prose a:hover, .authors a:hover { text-decoration-color: var(--accent); }
