/* ---- tokens ---- */
:root {
  --bg: #ffffff;
  --fg: #1b1d21;
  --muted: #5f6570;
  --faint: #8a9099;
  --rule: #e6e8eb;
  --link: #1a4fa0;
  --link-hover: #0f2f66;
  --accent-bg: #f5f7fa;
  --code-bg: #f2f4f7;
  --maxw: 820px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --fg: #e6e8ec;
    --muted: #a6adb8;
    --faint: #7d848f;
    --rule: #2a2e35;
    --link: #7fb2ff;
    --link-hover: #a8ccff;
    --accent-bg: #1b1e24;
    --code-bg: #1f232a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ---- layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

nav.top {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
}
nav.top .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}
nav.top .brand { font-weight: 650; letter-spacing: .01em; color: var(--fg); }
nav.top .brand:hover { text-decoration: none; color: var(--link); }
nav.top .links { display: flex; gap: 18px; flex-wrap: wrap; }
nav.top .links a { color: var(--muted); font-size: 15px; }
nav.top .links a.here { color: var(--fg); font-weight: 600; }

header.hero { padding: 44px 0 8px; }
header.hero h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
header.hero .tagline { color: var(--muted); margin: 0 0 14px; }

/* home: centered name, then text + portrait column */
header.home { padding: 40px 0 4px; }
header.home h1.name {
  font-size: 38px; font-weight: 400; letter-spacing: .06em;
  text-align: center; margin: 0 0 34px; text-transform: uppercase;
}
header.home .row { display: flex; gap: 34px; align-items: flex-start; }
header.home .txt { flex: 1 1 auto; min-width: 0; }
header.home .side { flex: 0 0 172px; text-align: center; }
header.home .side .links { margin-top: 12px; font-size: 14.5px; line-height: 1.9; color: var(--muted); }
.portrait {
  width: 172px; height: auto; border-radius: 4px;
  display: block; background: var(--accent-bg); border: 1px solid var(--rule);
}

main { padding-bottom: 64px; }
section { margin-top: 38px; }
h2 {
  font-size: 15px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--faint); font-weight: 650; margin: 0 0 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--rule);
}
h3 { font-size: 17.5px; margin: 0 0 4px; line-height: 1.35; }
p { margin: 0 0 14px; }
ul { margin: 0 0 14px; padding-left: 20px; }
li { margin-bottom: 6px; }
.meta { color: var(--faint); font-size: 14.5px; }

/* ---- entries ---- */
.entry { margin-bottom: 26px; }
.entry .line {
  display: flex; justify-content: space-between; gap: 16px;
  align-items: baseline; flex-wrap: wrap;
}
.entry .venue { color: var(--muted); font-size: 15px; margin: 2px 0 8px; }
.entry p { margin-bottom: 8px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.tags a, .tags span {
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 1px 8px; color: var(--muted); background: var(--accent-bg);
}
.tags a:hover { color: var(--link); border-color: var(--link); text-decoration: none; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 18px; }
.kv .r { color: var(--faint); font-size: 14.5px; white-space: nowrap; }

/* ---- tables ---- */
.tablewrap { overflow-x: auto; margin: 0 0 10px; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
caption { caption-side: bottom; color: var(--faint); font-size: 13.5px; text-align: left; padding-top: 8px; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
thead th { color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--fg); }
tbody tr.best td { font-weight: 650; background: var(--accent-bg); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em;
  background: var(--code-bg); padding: 1px 5px; border-radius: 3px; }

blockquote {
  margin: 0 0 16px; padding: 12px 16px; background: var(--accent-bg);
  border-left: 3px solid var(--rule); color: var(--muted);
}
blockquote p:last-child { margin-bottom: 0; }

footer {
  border-top: 1px solid var(--rule); padding: 20px 0 40px;
  color: var(--faint); font-size: 14px;
}
.back { font-size: 14.5px; color: var(--muted); display: inline-block; margin: 28px 0 4px; }

/* bracketed link rows, e.g. [Details] [Code] [Weights] */
.brackets { font-size: 14.5px; color: var(--muted); }
.brackets a { white-space: nowrap; }

.work { margin: 0; padding-left: 20px; }
.work > li { margin-bottom: 20px; }
.work .title { font-weight: 650; }
.work .who { color: var(--muted); }
.work .note { display: block; margin: 2px 0 3px; }

@media (max-width: 620px) {
  header.home .row { flex-direction: column-reverse; align-items: flex-start; gap: 18px; }
  header.home h1.name { font-size: 30px; margin-bottom: 24px; }
  header.home .side { flex: none; text-align: left; }
  .portrait { width: 128px; }
  header.hero h1 { font-size: 26px; }
}
