/* Profile Rail — the design itself. Tokens, shell, nav, module card, list rows. */

:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #efeeec;
  --ink: #1a1614;
  --ink-2: #56504c;
  --ink-3: #8a827c;
  --line: #e0ddd9;
  --line-2: #c9c4be;
  --accent: #9a3324;
  --accent-soft: #f7ebe7;
  --r: 5px;
  --shadow: 0 1px 2px rgba(26, 22, 20, .05);
  --font-body: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #12100f;
  --surface: #1a1817;
  --surface-2: #221f1d;
  --ink: #ece9e6;
  --ink-2: #aca5a0;
  --ink-3: #7c7570;
  --line: #2c2926;
  --line-2: #413d39;
  --accent: #e08a70;
  --accent-soft: #2a1a15;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.6 var(--font-body);
  font-variant-numeric: tabular-nums;
}
a { text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Navigation ─────────────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
/* Same cap and padding as .wrap, so the brand and the buttons line up with
   the content columns instead of floating out at the window edges. */
.nav__in {
  max-width: 1240px; margin: 0 auto; padding: 0 22px; height: 52px;
  display: flex; align-items: center; gap: 14px;
}
.brand { font-size: 21px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand i { font-style: normal; font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 7px; }
.nav__links { margin-left: auto; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav__links::-webkit-scrollbar { display: none; }
.nav__links a {
  padding: 6px 10px; border-radius: var(--r);
  font-size: 13px; color: var(--ink-2); white-space: nowrap;
}
.nav__links a:hover { background: var(--surface-2); color: var(--ink); }
.nav__links a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav__tools { display: flex; gap: 6px; }

.tbtn {
  padding: 4px 10px; border: 1px solid var(--line-2); border-radius: var(--r);
  background: var(--surface); color: var(--ink-2); font-size: 11.5px; cursor: pointer;
}
.tbtn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Shell ──────────────────────────────────────────────────────────────── */

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px; }
.cols { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: 22px; align-items: start; }
.stack { display: grid; gap: 14px; }

/* ── Profile rail ───────────────────────────────────────────────────────── */

.rail {
  position: sticky; top: 76px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
/* The rail runs about 900px with a portrait, four figures and contact details.
   Where that exceeds the viewport, top-anchored sticky pins the photo and
   leaves the contact block permanently below the fold — so pin the bottom edge
   instead and let the top scroll away. Raise this breakpoint if the rail grows. */
@media (max-height: 1000px) {
  .rail { top: auto; bottom: 22px; }
}
/* Four stacked bands — portrait, identity, figures, contact — separated by
   full-bleed rules. The rules carry the hierarchy, so nothing inside a band
   needs extra weight to look like a new section. */
.rail__id { padding: 15px 15px 17px; display: grid; gap: 7px; }
.rail__name { font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.rail__title { font-size: 14px; color: var(--ink-2); line-height: 1.4; }
/* The affiliation runs specific to general — his group, its school, the
   university. Each step down loses a little size and a little contrast, so the
   three lines read as a hierarchy rather than one grey paragraph. */
.rail__org { line-height: 1.4; }
.rail__org--group { font-size: 13px; font-weight: 600; color: var(--ink); }
.rail__org--school { font-size: 12.5px; color: var(--ink-2); }
.rail__org--university { font-size: 12px; color: var(--ink-3); }
.rail__org + .rail__org { margin-top: -2px; }
.rail__badge {
  justify-self: start; margin-top: 4px; padding: 5px 9px;
  border: 1px solid var(--accent); border-radius: var(--r);
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent);
}

.stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.stats div { background: var(--surface); padding: 11px 15px; }
.stats b { display: block; font-size: 19px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -.02em; }
.stats span { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }

.rail__contact { padding: 14px 15px 16px; display: grid; gap: 7px; }
.rail__email { font-size: 13.5px; font-weight: 700; color: var(--accent); word-break: break-word; }
.rail__email:hover { text-decoration: underline; }
.rail__meta { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.rail__meta + .rail__meta { margin-top: -3px; }
.rail__links { font-size: 12.5px; color: var(--ink-3); }
.rail__links a { color: var(--accent); }
.rail__links a:hover { text-decoration: underline; }

/* ── Module card ────────────────────────────────────────────────────────── */

.mod {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.mod__head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.mod__head h2 { font-size: 13px; font-weight: 700; }
.mod__head .meta { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.mod__body { padding: 16px; }
.mod__body.tight { padding: 0; }
.mod__body > p { font-size: 13.5px; color: var(--ink-2); }
.mod__body > p + p { margin-top: 10px; }

/* ── List rows ──────────────────────────────────────────────────────────── */

.rows { display: grid; }
.rows li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: baseline;
  padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2);
}
.rows li:nth-child(odd) { background: var(--surface-2); }
.rows li:last-child { border-bottom: 0; }
.rows b { font-weight: 700; color: var(--ink); }
.rows .sub { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.rows .yr { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rows--news li { grid-template-columns: 88px minmax(0, 1fr); }
.rows--news .yr { color: var(--accent); text-align: left; }

/* ── Buttons and tags ───────────────────────────────────────────────────── */

.btn, .linkbtn {
  display: inline-block; padding: 6px 12px; border-radius: var(--r);
  font-size: 12.5px; cursor: pointer; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.linkbtn { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700; }
.linkbtn:hover { background: var(--accent); color: var(--surface); }

.tag {
  display: inline-block; padding: 2px 7px; margin: 0 4px 4px 0;
  border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.tag--on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.label { font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.foot {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-3);
  display: flex; flex-wrap: wrap; gap: 12px;
}
.foot a:hover { color: var(--accent); }

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; }
}
@media (max-width: 960px) {
  .nav__in { gap: 10px; }
}
@media (max-width: 560px) {
  .brand { font-size: 18px; }
  .nav__in { padding: 0 14px; }
  .brand i { display: none; }
  .wrap { padding: 14px; }
  .rail .photo--portrait { aspect-ratio: 1 / 1; }
}
