/* ==========================================================================
   Layout concept: an editor workspace. File-explorer sidebar = site nav,
   tab strip + breadcrumb = page header, status bar = live Scholar metrics.
   Syntax-highlight colours double as semantic colours (awards = string amber,
   types = keyword violet, numbers = constant blue). Accent = HSG green.
   ========================================================================== */

:root {
  /* dark-first palette */
  --bg: #0e1215;
  --panel: #13191d;
  --panel-2: #182026;
  --line: #24303a;
  --fg: #d9e1e6;
  --muted: #8494a0;
  --accent: #3cc46f;          /* HSG green, lifted for dark ground */
  --accent-ink: #062611;
  --kw: #c59bf0;              /* keyword violet  -> entry types */
  --str: #e7c27a;             /* string amber    -> awards */
  --num: #7db7ff;             /* constant blue   -> metrics */
  --danger: #ff7b72;
  --shadow: 0 18px 50px rgba(0,0,0,.45);

  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: .8125rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.55rem;
  --step-3: 2.1rem;
  --step-4: clamp(2.4rem, 5.5vw, 3.9rem);

  --side-w: 248px;
  --status-h: 28px;
  --radius: 6px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7f3; --panel: #ffffff; --panel-2: #eef2ec; --line: #d8dfd6;
    --fg: #17211b; --muted: #5b6a61; --accent: #00802f; --accent-ink: #ffffff;
    --kw: #7438ad; --str: #8f6200; --num: #1d5cc0; --danger: #c4302b;
    --shadow: 0 18px 50px rgba(20,40,25,.14);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f7f3; --panel: #ffffff; --panel-2: #eef2ec; --line: #d8dfd6;
  --fg: #17211b; --muted: #5b6a61; --accent: #00802f; --accent-ink: #ffffff;
  --kw: #7438ad; --str: #8f6200; --num: #1d5cc0; --danger: #c4302b;
  --shadow: 0 18px 50px rgba(20,40,25,.14);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--step-0)/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--panel); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0,1fr); min-height: 100vh; padding-bottom: calc(var(--status-h) + env(safe-area-inset-bottom, 0px)); }

.sidebar {
  position: sticky; top: env(safe-area-inset-top, 0px); height: calc(100vh - var(--status-h));
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto;
  padding-left: env(safe-area-inset-left, 0px);
  font-family: var(--font-mono); font-size: var(--step--1);
}
.side-head { padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.side-label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand { display: block; padding: 4px 16px 14px; color: var(--fg); text-decoration: none; }
.brand b { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; display: block; }
.brand span { color: var(--muted); font-size: .72rem; }
.tree { list-style: none; margin: 0; padding: 0 8px; }
.tree .folder { padding: 4px 8px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tree a {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 22px;
  color: var(--fg); text-decoration: none; border-radius: 4px; position: relative;
}
.tree a:hover { background: var(--panel-2); }
.tree a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--fg); }
.tree a[aria-current="page"]::before { content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); }
.ext { font-size: .68rem; padding: 0 5px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.ext.bib { color: var(--str); border-color: color-mix(in srgb, var(--str) 40%, var(--line)); }
.ext.md { color: var(--num); }
.ext.log { color: var(--kw); }
.ext.yml { color: var(--accent); }
.ext.dir { color: var(--muted); }
.side-sec { margin-top: 18px; }
.side-sec .side-label { padding: 0 16px 6px; display: block; }
.side-links { list-style: none; margin: 0; padding: 0 8px; }
.side-links a { display: flex; justify-content: space-between; padding: 4px 8px; color: var(--muted); text-decoration: none; border-radius: 4px; }
.side-links a:hover { color: var(--fg); background: var(--panel-2); }
.side-foot { margin-top: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }

.btn {
  font: 500 var(--step--1)/1 var(--font-mono); color: var(--fg); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 8px; font-size: .74rem; }
.btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 18%, var(--panel-2)); border-color: var(--accent); }
kbd { font: 500 .7rem var(--font-mono); padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--bg); }

/* ---------- main column ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.tabbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: stretch; background: var(--panel); border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: var(--step--1); min-height: 40px;
}
.tab { display: flex; align-items: center; gap: 8px; padding: 0 16px; border-right: 1px solid var(--line); background: var(--bg); position: relative; }
.tab::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.crumbs { display: flex; align-items: center; gap: 6px; padding: 0 16px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }
.tabbar .spacer { flex: 1; }
.palette-btn { margin: 6px 12px; padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.menu-btn { display: none; }

.content {
  width: 100%; max-width: 1080px; margin: 0 auto;
  padding-block: 40px 80px;
  padding-left: max(28px, env(safe-area-inset-left, 0px));
  padding-right: max(28px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 56px;
}

/* ---------- typography ---------- */
h1, h2, h3 { text-wrap: balance; margin: 0; }
.page-title { font: 700 var(--step-3)/1.1 var(--font-display); letter-spacing: -.02em; }
.page-title .path { font: 500 var(--step-0) var(--font-mono); color: var(--muted); display: block; margin-bottom: 10px; letter-spacing: 0; }
.lead { max-width: 68ch; color: var(--fg); font-size: 1.06rem; margin: 14px 0 0; }
.sec-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; font: 600 var(--step-1)/1.3 var(--font-mono); }
.sec-h .hash { color: var(--accent); }
.sec-h .count { margin-left: auto; font-size: var(--step--1); color: var(--muted); font-weight: 400; }
.prose { max-width: 70ch; }
.prose p { margin: 0 0 1em; }
.todo {
  font: 500 .72rem var(--font-mono); color: var(--str); border: 1px dashed color-mix(in srgb, var(--str) 55%, transparent);
  padding: 2px 7px; border-radius: 4px; display: inline-block; vertical-align: middle;
}
.todo-block { border: 1px dashed color-mix(in srgb, var(--str) 45%, var(--line)); border-radius: var(--radius); padding: 14px 16px; font: 400 var(--step--1)/1.6 var(--font-mono); color: var(--muted); }
.todo-block b { color: var(--str); font-weight: 600; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0,1fr) 220px; gap: 36px; align-items: center; padding-top: 8px; }
.term { font-family: var(--font-mono); font-size: var(--step--1); color: var(--muted); min-width: 0; }
.term .ps { color: var(--accent); }
.term .cmd { color: var(--fg); }
.term .line { display: block; }
.hero-name { font: 800 var(--step-4)/.98 var(--font-display); letter-spacing: -.035em; color: var(--fg); margin: 10px 0 18px; }
.hero-name .dot { color: var(--accent); }
.roles { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; font-size: var(--step--1); }
.roles li { color: var(--fg); }
.roles .k { color: var(--kw); }
.roles .at { color: var(--muted); }
.cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: -.2em; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.portrait {
  aspect-ratio: 4/5; width: 100%; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    repeating-linear-gradient(45deg, var(--line) 0 1px, transparent 1px 9px);
  display: grid; place-items: center; overflow: hidden; position: relative;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .ph { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); text-align: center; line-height: 1.5; }
.portrait .ph b { display: block; font: 800 3rem/1 var(--font-display); color: var(--accent); margin-bottom: 8px; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.fact { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.fact:first-child { border-left: 0; }
.fact .v { font: 700 var(--step-2)/1.1 var(--font-mono); color: var(--num); font-variant-numeric: tabular-nums; }
.fact .l { font-size: var(--step--1); color: var(--muted); margin-top: 6px; line-height: 1.4; }

/* ---------- structs (affiliations) ---------- */
.structs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.struct { font: 400 var(--step--1)/1.7 var(--font-mono); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; overflow-wrap: anywhere; }
.struct .t { color: var(--kw); }
.struct .n { color: var(--fg); font-weight: 600; }
.struct .f { color: var(--muted); }
.struct .s { color: var(--str); }
.struct a { color: var(--accent); }
.copy-mail { cursor: pointer; background: none; border: 0; padding: 0; font: inherit; color: var(--str); text-align: left; }
.copy-mail:hover { text-decoration: underline; }

/* current vs. previous affiliation */
.roles li.prev { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.aff { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(0,1fr); gap: 14px; align-items: stretch; }
.struct.now { position: relative; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); padding-top: 40px; font-size: .86rem; }
.live { position: absolute; top: 12px; right: 14px; display: inline-flex; align-items: center; gap: 6px; font: 600 .68rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.struct.past { background: transparent; border-style: dashed; display: flex; flex-direction: column; justify-content: center; }
.struct.past .cm { display: block; color: var(--muted); white-space: pre-wrap; }
.struct.past .cm b { color: var(--fg); font-weight: 600; opacity: .75; }
@media (max-width: 820px) { .aff { grid-template-columns: minmax(0,1fr); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: 500 var(--step--1) var(--font-mono); padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg); background: var(--panel); }
.chip::before { content: "#"; color: var(--accent); margin-right: 2px; }

/* ---------- scholar panel ---------- */
.scholar { display: grid; grid-template-columns: 280px minmax(0,1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.scholar-metrics { padding: 18px; border-right: 1px solid var(--line); }
.metric-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--step--1); font-variant-numeric: tabular-nums; }
.metric-table th { text-align: right; color: var(--muted); font-weight: 400; padding: 0 0 8px; }
.metric-table th:first-child { text-align: left; }
.metric-table td { padding: 7px 0; border-top: 1px solid var(--line); text-align: right; }
.metric-table td:first-child { text-align: left; color: var(--muted); }
.metric-table td.big { font-size: 1.35rem; color: var(--num); font-weight: 700; }
.scholar-chart { padding: 18px 18px 10px; min-width: 0; }
.scholar-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.scholar-foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--line); font: 400 .74rem var(--font-mono); color: var(--muted); background: var(--panel-2); }
.badge { font: 600 .68rem var(--font-mono); padding: 2px 7px; border-radius: 4px; letter-spacing: .04em; text-transform: uppercase; }
.badge.sample { color: var(--str); border: 1px solid color-mix(in srgb, var(--str) 55%, transparent); }
.badge.live { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---------- git-log CV ---------- */
.gitlog { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: var(--step--1); position: relative; }
.gitlog li { display: grid; grid-template-columns: 22px 92px minmax(0,1fr); gap: 12px; padding: 8px 0; position: relative; }
.gitlog li::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.gitlog li:first-child::before { top: 16px; }
.gitlog li:last-child::before { bottom: calc(100% - 16px); }
.gitlog .node { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); margin-top: 3px; position: relative; z-index: 1; }
.gitlog li.head .node { background: var(--accent); }
.gitlog .hash { color: var(--str); }
.gitlog .msg { color: var(--fg); min-width: 0; }
.gitlog .msg .type { color: var(--kw); }
.gitlog .msg .ref { color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 3px; padding: 0 4px; margin-right: 6px; font-size: .7rem; }
.gitlog .msg small { display: block; color: var(--muted); font-size: .74rem; }

/* ---------- publications ---------- */
.toolbar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 40px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
}
.search { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 0 12px; font-family: var(--font-mono); }
.search:focus-within { border-color: var(--accent); }
.search .ps { color: var(--accent); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg); font: 400 var(--step-0) var(--font-mono); padding: 11px 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { font: 500 .76rem var(--font-mono); background: var(--panel); color: var(--muted); border: 0; border-left: 1px solid var(--line); padding: 7px 10px; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); color: var(--fg); }
.seg button .n { color: var(--muted); margin-left: 4px; font-size: .68rem; }
select.sel { font: 500 .76rem var(--font-mono); background: var(--panel); color: var(--fg); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 8px; }
.filters .grow { flex: 1; }
.result-line { font: 400 .76rem var(--font-mono); color: var(--muted); }

.year-group { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 20px; padding-top: 22px; }
.year-label { font: 700 var(--step-1) var(--font-mono); color: var(--muted); align-self: start; font-variant-numeric: tabular-nums; }
.pubs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.pub { display: grid; grid-template-columns: 28px minmax(0,1fr); gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }
.pub:first-child { border-top: 0; padding-top: 4px; }
.pub.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.ptype { font: 700 .72rem/1 var(--font-mono); width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: var(--kw); margin-top: 2px; }
.pub-body { min-width: 0; }
.pub-title { font: 600 1.04rem/1.4 var(--font-body); margin: 0; color: var(--fg); }
.pub-title a { color: inherit; text-decoration: none; }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: .93rem; color: var(--muted); margin-top: 3px; }
.pub-authors .me { color: var(--fg); font-weight: 600; }
.pub-venue { font-size: .93rem; margin-top: 2px; }
.pub-venue i { color: var(--fg); }
.pub-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 10px; align-items: center; }
.tag { font: 500 .72rem var(--font-mono); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); }
.tag.award { color: var(--str); border-color: color-mix(in srgb, var(--str) 50%, var(--line)); background: color-mix(in srgb, var(--str) 8%, transparent); }
.tag.status { color: var(--kw); border-color: color-mix(in srgb, var(--kw) 45%, var(--line)); }
.tag.cites { color: var(--num); border-color: color-mix(in srgb, var(--num) 40%, var(--line)); font-variant-numeric: tabular-nums; }
.act { font: 500 .72rem var(--font-mono); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; text-decoration: none; display: inline-flex; gap: 5px; align-items: center; }
.act:hover { border-color: var(--accent); color: var(--accent); }
.act[aria-pressed="true"], .act[aria-expanded="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pick { display: inline-flex; align-items: center; gap: 6px; font: 500 .72rem var(--font-mono); color: var(--muted); cursor: pointer; padding: 3px 4px; }
.pick input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

.bibbox { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.bibbox-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); font: 400 .72rem var(--font-mono); color: var(--muted); }
.bibbox-head .grow { flex: 1; }
.code { margin: 0; padding: 12px 14px; overflow-x: auto; font: 400 .8rem/1.6 var(--font-mono); color: var(--fg); white-space: pre; tab-size: 2; }
.code .t-at { color: var(--kw); }
.code .t-key { color: var(--accent); }
.code .t-f { color: var(--num); }
.code .t-v { color: var(--str); }
.code .t-p { color: var(--muted); }

/* basket */
.basket-fab {
  position: fixed; z-index: 40;
  right: calc(20px + env(safe-area-inset-right, 0px));
  bottom: calc(var(--status-h) + 18px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow);
}
.basket-fab .n { background: var(--accent-ink); color: var(--accent); border-radius: 999px; padding: 1px 7px; font-size: .7rem; }
.drawer {
  position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
  transform: translateX(100%); transition: transform .22s ease; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); }
.drawer-head .grow { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.drawer-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.drawer-item code { font: 500 .72rem var(--font-mono); color: var(--accent); display: block; }
.drawer-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.drawer-foot .row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { display: flex; gap: 8px; align-items: center; font: 400 .76rem var(--font-mono); color: var(--muted); }
.opt input { accent-color: var(--accent); }
.scrim { position: fixed; inset: 0; z-index: 65; background: rgba(0,0,0,.45); }

/* ---------- generic cards / lists ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.card h3 { font: 600 1.08rem/1.35 var(--font-body); }
.card .eyebrow { font: 500 .72rem var(--font-mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; display: flex; gap: 10px; flex-wrap: wrap; }
.card .eyebrow .funder { color: var(--kw); }
.card p { margin: 0; color: var(--fg); font-size: .95rem; }
.kv { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 4px 12px; font: 400 .78rem var(--font-mono); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.card.feature { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

.log { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: var(--step--1); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.log li { display: grid; grid-template-columns: 52px 92px minmax(0,1fr); gap: 14px; padding: 10px 16px; border-top: 1px solid var(--line); align-items: baseline; }
.log li:first-child { border-top: 0; }
.log .yr { color: var(--num); font-variant-numeric: tabular-nums; }
.log .lvl { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.log .lvl.paper { color: var(--str); }
.log .lvl.service { color: var(--accent); }
.log .lvl.teaching { color: var(--kw); }
.log .lvl.impact { color: var(--num); }
.log .lvl.honor { color: var(--fg); }
.log .txt { font-family: var(--font-body); font-size: .93rem; min-width: 0; }

.yaml { font: 400 var(--step--1)/1.75 var(--font-mono); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; overflow-x: auto; }
.yaml .k { color: var(--num); }
.yaml .c { color: var(--muted); }
.yaml .v { color: var(--fg); }
.yaml .s { color: var(--str); }
.yaml ul { list-style: none; margin: 0; padding-left: 2ch; }
.yaml li::before { content: "- "; color: var(--muted); }

/* ---------- media placeholders ----------
   <figure class="media" data-src="assets/img/x.jpg" style="--r:4/3"> — main.js
   tries to load data-src; if the file exists it replaces the placeholder.   */
.media { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media .frame {
  aspect-ratio: var(--r, 16/9); width: 100%; max-width: 100%; border-radius: var(--radius); overflow: hidden; position: relative;
  border: 1px dashed color-mix(in srgb, var(--str) 45%, var(--line));
  background:
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--line) 55%, transparent) 0 1px, transparent 1px 10px),
    var(--panel);
  display: grid; place-items: center;
}
.media.loaded .frame { border: 1px solid var(--line); background: var(--panel); }
.media .frame img { width: 100%; height: 100%; object-fit: var(--fit, cover); display: block; }
.media.contain .frame img { object-fit: contain; padding: 10%; }
.media .ph { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; text-align: center; font: 400 .7rem/1.45 var(--font-mono); color: var(--muted); max-width: 100%; }
.media .ph .ic { font-size: 1.4rem; line-height: 1; color: var(--str); }
.media .ph code { color: var(--str); overflow-wrap: anywhere; font: inherit; }
.media .ph .dim { opacity: .75; }
.media figcaption { font-size: .84rem; color: var(--muted); line-height: 1.45; }
.media figcaption a { font-family: var(--font-mono); font-size: .76rem; }
.media.video .frame { cursor: pointer; }
.media.video .play { position: absolute; inset: auto 12px 12px auto; font: 600 .74rem var(--font-mono); background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 6px 12px; border: 0; cursor: pointer; }
.media.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media.logo { width: 100%; max-width: 160px; }
.media.logo .ph { padding: 6px; font-size: .6rem; gap: 3px; }
.media.logo .ph .ic { font-size: 1rem; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.gallery.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.gallery.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card-head { display: grid; grid-template-columns: 96px minmax(0,1fr); gap: 14px; align-items: start; }
.card-head .media.logo { max-width: 96px; }
.pub.with-thumb { grid-template-columns: 28px minmax(0,1fr) 150px; }
.pub .thumb { align-self: start; }
.pub .thumb .frame img { position: absolute; inset: 0; object-fit: contain; padding: 4%; }

/* placeholder links: <a class="act todo-link" href="#" data-todo="what goes here"> */
.todo-link, .act.todo-link { color: var(--str) !important; border: 1px dashed color-mix(in srgb, var(--str) 55%, var(--line)) !important; background: transparent !important; cursor: help; }
a.todo-link:not(.act) { padding: 0 4px; border-radius: 3px; text-decoration: none; font-family: var(--font-mono); font-size: .8em; }
.todo-link::after { content: " · todo"; opacity: .8; }

@media (max-width: 960px) {
  .gallery, .gallery.four { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 560px) {
  .gallery, .gallery.two, .gallery.four { grid-template-columns: minmax(0,1fr); }
  .pub.with-thumb { grid-template-columns: 28px minmax(0,1fr); }
  .pub.with-thumb .thumb { grid-column: 2; max-width: 220px; }
  .card-head { grid-template-columns: 64px minmax(0,1fr); }
}

/* ---------- course table ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.courses { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 720px; }
table.courses th { text-align: left; font: 500 .7rem var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
table.courses td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.courses tr:first-child td { border-top: 0; }
table.courses td:nth-child(2), table.courses td:nth-child(3), table.courses td:nth-child(5) { font-family: var(--font-mono); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.courses td:nth-child(4) { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); }
.role { font: 500 .7rem var(--font-mono); padding: 2px 7px; border-radius: 4px; white-space: nowrap; border: 1px solid var(--line); }
.role.lec { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.role.ta { color: var(--kw); border-color: color-mix(in srgb, var(--kw) 45%, var(--line)); }

/* ---------- status bar ---------- */
.statusbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(var(--status-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 16px; background: var(--accent); color: var(--accent-ink);
  font: 500 .72rem var(--font-mono); white-space: nowrap; overflow: hidden;
}
.statusbar .grow { flex: 1; }
.statusbar span { display: inline-flex; gap: 6px; align-items: center; }
.statusbar .opt-hide { }

/* ---------- command palette ---------- */
.cmdk-wrap { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.5); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmdk { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; font-family: var(--font-mono); }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-in .ps { color: var(--accent); }
.cmdk-in input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--fg); font: 400 1rem var(--font-mono); padding: 15px 0; }
.cmdk-list { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.cmdk-list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .84rem; }
.cmdk-list li .g { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; width: 58px; flex: none; }
.cmdk-list li .x { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-list li[aria-selected="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: .7rem; color: var(--muted); }

.toast { position: fixed; z-index: 95; left: 50%; bottom: calc(var(--status-h) + 20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); font: 500 .8rem var(--font-mono); padding: 9px 14px; border-radius: 6px; box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .structs { grid-template-columns: minmax(0,1fr); }
  .scholar { grid-template-columns: minmax(0,1fr); }
  .scholar-metrics { border-right: 0; border-bottom: 1px solid var(--line); }
  .facts { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fact:nth-child(3) { border-left: 0; }
  .fact:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: fixed; z-index: 80; left: 0; top: 0; bottom: 0; height: auto; width: min(300px, 86vw); transform: translateX(-100%); transition: transform .2s ease; padding-top: env(safe-area-inset-top, 0px); visibility: hidden; }
  .sidebar.open { transform: none; visibility: visible; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; margin: 6px 0 6px max(10px, env(safe-area-inset-left, 0px)); }
  .tab { display: none; }
  .crumbs { padding: 0 10px; }
  .palette-btn .lbl { display: none; }
  .hero { grid-template-columns: minmax(0,1fr); }
  .portrait, .portrait-fig { max-width: 180px; order: -1; }
  .grid-2 { grid-template-columns: minmax(0,1fr); }
  .year-group { grid-template-columns: minmax(0,1fr); gap: 6px; }
  .year-label { position: static; }
  .content {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-block: 26px 80px; gap: 44px;
  }
  .statusbar .opt-hide { display: none; }
}
@media (max-width: 520px) {
  .facts { grid-template-columns: minmax(0,1fr); }
  .fact { border-left: 0 !important; border-top: 1px solid var(--line); }
  .fact:first-child { border-top: 0; }
  .log li { grid-template-columns: 46px minmax(0,1fr); }
  .log .lvl { grid-column: 2; grid-row: 1; }
  .log .txt { grid-column: 1 / -1; }
  .gitlog li { grid-template-columns: 22px minmax(0,1fr); }
  .gitlog .hash { grid-column: 2; }
  .gitlog .msg { grid-column: 2; }
  .toolbar { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* awards: large centered hero photo above the award-moments row */
.media.moment-hero { max-width: 880px; margin: 0 auto 20px; }
.media.moment-hero figcaption { text-align: center; }

/* monogram tile: fills a logo box when a project has no logo (data-mono on the figure) */
.media.mono .frame { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.mono-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; height: 100%; padding: 6px; text-align: center; }
.mono-tile b { font: 700 1.25rem/1 var(--font-mono); letter-spacing: -.02em; color: var(--accent); overflow-wrap: anywhere; }
.mono-tile.long b { font-size: .86rem; }
.mono-tile span { font: 400 .58rem/1.2 var(--font-mono); color: var(--muted); text-transform: lowercase; }
.card-head .mono-tile b { font-size: 1.05rem; }
.card-head .mono-tile.long b { font-size: .74rem; }

/* links back to the root (~/janson) in breadcrumb, explorer and page path */
.crumbs a, .tree .folder a, .page-title .path a { color: inherit; text-decoration: none; border-radius: 3px; }
.crumbs a:hover, .tree .folder a:hover, .page-title .path a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tree .folder a { display: inline; padding: 0; background: none; }
.tree .folder a:hover { background: none; }

/* real logos sit on white in both themes (dark logos such as LIFT vanish on the dark panel) */
.media.logo.loaded .frame { background: #fff; }
a.tag { text-decoration: none; }
a.tag:hover { text-decoration: underline; text-underline-offset: 2px; }

/* dotfiles (.legal): hidden in the explorer until "ls -a" (press ".") */
.tree .dotfile { display: none; }
.show-hidden .tree .dotfile { display: block; }
.tree .dotfile a { color: var(--muted); font-style: italic; }
.ext.dot { color: var(--muted); border-style: dashed; }
.statusbar .sb-legal { color: inherit; text-decoration: none; opacity: .8; }
.statusbar .sb-legal:hover { opacity: 1; text-decoration: underline; text-underline-offset: 2px; }

/* .legal page */
.term { font: 400 var(--step--1)/1.7 var(--font-mono); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; overflow-wrap: anywhere; }
.term .ps { color: var(--accent); }
.term .dim { color: var(--muted); }
.term .hl { color: var(--str); }
.legal-prose h3 { font: 600 var(--step-0) var(--font-mono); margin: 22px 0 6px; }
.legal-prose h3::before { content: "# "; color: var(--accent); }
.legal-prose p, .legal-prose li { max-width: 72ch; }
.statusbar .sb-legal { flex-shrink: 0; }
.statusbar #sb-scholar { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: block; }

/* hashtag chips: links on the home page, toggle filter on the publications page */
a.chip { text-decoration: none; transition: border-color .15s, background .15s; }
a.chip:hover, .tag-filter .chip:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.tag-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.tag-filter .lbl { font: 500 .72rem var(--font-mono); color: var(--muted); margin-right: 4px; }
.tag-filter .chip { cursor: pointer; font-size: .74rem; padding: 4px 9px; }
.tag-filter .chip .n { color: var(--muted); margin-left: 5px; font-size: .68rem; }
.tag-filter .chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.log.no-yr li { grid-template-columns: 92px minmax(0,1fr); }
@media (max-width: 520px) { .log.no-yr .lvl { grid-column: 1 / -1; } }
