/* Layout: hairline header with the menu; a left rail (photo, name) and a reading column.
   Colors: light blue ground, blue-black ink, blues for accents only. */
:root {
  --bg: #e9f0f7;
  --fg: #182230;
  --muted: #4d6a8a;
  --navy: #163a5c;
  --rule: #c5d6e6;
  --accent: #1f5f8b;
  --card: #ffffff;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 17px; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
a:focus-visible, button:focus-visible, .node:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
img { max-width: 100%; }
h1, h2 { text-wrap: balance; }

.wrap {
  max-width: 1040px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* header */
header .wrap { display: flex; justify-content: flex-end; gap: 18px; padding-block: 22px 14px; border-bottom: 1px solid var(--rule); }
header nav { display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 0.95rem; }
header nav a { color: var(--muted); }
header nav a[aria-current="page"] { color: var(--navy); font-weight: 600; }
header .menu { display: none; }   /* the menu button exists for phones only */

/* two columns */
.page { display: grid; grid-template-columns: 300px minmax(0, 1fr); padding-block: 48px 72px; }
.page.inner { grid-template-columns: 180px minmax(0, 1fr); }
.page.inner .rail { padding-right: 24px; }
.page.inner .main { padding-left: 40px; }
.rail { padding-right: 48px; border-right: 1px solid var(--rule); }
.main { min-width: 0; padding-left: 56px; }

/* phones: the menu folds behind a button, the rail sits above the main column */
@media (max-width: 760px) {
  header .wrap { flex-wrap: wrap; padding-block: 14px 12px; }
  header .menu { display: block; color: var(--navy); background: transparent; border: 0; padding: 4px; margin: -4px; line-height: 0; cursor: pointer; }
  header nav { display: none; }
  header nav.open { display: flex; flex-direction: column; width: 100%; gap: 0; font-size: 1rem; }
  header nav.open a { padding: 9px 0; border-top: 1px solid var(--rule); }
  .page, .page.inner { grid-template-columns: 1fr; padding-block: 32px 48px; }
  .rail, .page.inner .rail { padding-right: 0; border-right: 0; padding-bottom: 28px; border-bottom: 1px solid var(--rule); }
  .main, .page.inner .main { padding-left: 0; padding-top: 28px; }
}

/* rail */
.rail img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; box-shadow: 0 1px 2px rgba(22,58,92,.12), 0 8px 24px rgba(22,58,92,.10); }
.rail h1 { font-family: var(--serif); font-weight: 600; color: var(--navy); font-size: 1.75rem; line-height: 1.15; margin: 22px 0 4px; }
.rail .role { color: var(--muted); margin: 0 0 18px; }
.rail.compact h1 { font-size: 1.3rem; margin-top: 6px; }
.rail.compact .role { font-size: 0.92rem; white-space: nowrap; margin-bottom: 14px; }
.rail.compact .icons { gap: 14px; margin-top: 0; }
.rail.compact .icons .ic { width: 19px; height: 19px; }
.facts { list-style: none; margin: 0; padding: 14px 0 0; border-top: 2px solid var(--accent); font-size: 0.95rem; }
.facts li { margin: 0 0 4px; }
.icons { list-style: none; margin: 18px 0 0; padding: 0; display: flex; gap: 18px; }
.icons a { color: var(--accent); display: inline-block; line-height: 0; }
.icons .ic { width: 22px; height: 22px; }

/* main column */
.main > h1 { font-family: var(--serif); color: var(--navy); font-weight: 600; font-size: 1.75rem; margin: 0 0 18px; }
.main h2 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; color: var(--navy); margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--rule); position: relative; }
.main h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 44px; height: 2px; background: var(--accent); }
.intro { max-width: 60ch; margin: 0 0 44px; }
.intro p { margin: 0 0 14px; }

/* news */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 16px; padding: 10px 0; }
.news li + li { border-top: 1px solid var(--rule); }
.news .nl { font-size: 0.88rem; margin-top: 2px; }
.news .nl a { font-weight: 600; margin-right: 14px; }
.news time { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 0.95rem; padding-top: 1px; font-weight: 600; }

/* publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.filters button { font: inherit; font-size: 0.9rem; color: var(--accent); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 3px 12px; cursor: pointer; }
.filters button:hover { border-color: var(--accent); }
.filters button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pubs, .list { list-style: none; margin: 0; padding: 0; }
.pubs li, .list li { display: grid; grid-template-columns: 4.2em minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); }
.pubs li { border-top: 0; padding-top: 0; }
.pubs li > div { border-top: 1px solid var(--rule); padding-top: 10px; }   /* lines between papers start at the text column */
.pubs li.yfirst { border-top: 1px solid var(--accent); padding-top: 10px; }  /* a year's first paper gets the full-width line */
.pubs li.yfirst > div { border-top: 0; padding-top: 0; }
.pubs li.yfirst .y { padding-top: 2px; }
.pubs li:last-child, .list li:last-child { border-bottom: 1px solid var(--rule); }
.pubs li[hidden] { display: none; }
.pubs li .y { visibility: hidden; }
.pubs li.yfirst .y { visibility: visible; }
.pubs li:target { background: rgba(31, 95, 139, .07); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }
.pubs .y, .list .y { color: var(--accent); font-variant-numeric: tabular-nums; font-size: 0.95rem; padding-top: 2px; }
.pubs .t, .list .t { color: var(--fg); font-weight: 600; }
a.t:hover { color: var(--accent); }
.pubs .a { color: var(--muted); font-size: 0.92rem; line-height: 1.4; }
.pubs .v, .list .v { font-size: 0.9rem; color: var(--muted); }
.pubs .v .venue { color: var(--navy); }
.pubs .v .n::before { content: " · "; }
.pubs .tag { color: var(--accent); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; margin-left: 10px; }
.pubs .links { margin-left: 6px; }
.pubs .links a { margin-left: 10px; font-weight: 600; font-size: 0.85rem; }
.list .y { white-space: nowrap; }
.list li { grid-template-columns: 6.2em minmax(0, 1fr); }

/* footer */
footer .wrap { border-top: 1px solid var(--rule); padding-block: 18px 36px; font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 18px; }

/* long-form pages (bio) */
.prose { max-width: 62ch; }
.prose p { margin: 0 0 14px; }
.prose h3 { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; color: var(--navy); margin: 28px 0 8px; }

/* projects: list of projects at the top */
.toc { list-style: none; margin: 0 0 36px; padding: 0; }
.toc li { padding: 5px 0; }
.toc a { color: var(--navy); font-weight: 600; }
.toc a:hover { color: var(--accent); }
.proj h2 { scroll-margin-top: 24px; }

/* projects */
.proj { position: relative; margin: 0 0 18px; }
.proj p { margin: 0 0 18px; }   /* as wide as the lineage below it */
.proj .collab { font-size: 0.92rem; color: var(--muted); margin-top: -8px; }
.proj .collab a { font-weight: 600; }
.lineage { width: 100%; height: auto; display: block; overflow: visible; margin-bottom: -8px; }
.lineage .axis { stroke: var(--rule); stroke-width: 1; }
.lineage .yr { fill: var(--muted); font: 600 11px var(--sans); letter-spacing: .04em; }
.lineage .row { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.lineage .rowname { fill: var(--navy); font: 600 11px var(--sans); letter-spacing: .03em; }
.lineage .edge { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: .75; pointer-events: none; }
.lineage .edge.dashed { stroke-dasharray: 4 3; }
.lineage .node { cursor: pointer; }
.lineage .hit { fill: transparent; }
.lineage .node circle:not(.hit) { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.lineage .node.main circle:not(.hit) { fill: var(--accent); }
.lineage .node:hover circle:not(.hit) { stroke: var(--navy); }
.lineage .node text { font: 500 12.5px var(--sans); fill: var(--fg); }
.lineage .node .venue { font: 11px var(--sans); fill: var(--muted); }
.proj .hint { font-size: 0.82rem; color: var(--muted); text-align: right; margin: 0 0 8px; }
.card { position: absolute; z-index: 5; width: 320px; max-width: 100%; background: var(--card); border: 1px solid var(--rule); border-radius: 6px; box-shadow: 0 8px 28px rgba(22,58,92,.14); padding: 14px; font-size: 0.9rem; line-height: 1.4; }
.card[hidden] { display: none; }
.card b { display: block; color: var(--navy); font-weight: 600; margin-bottom: 2px; }
.card .cv { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.card .note { margin: 0 0 8px; font-size: 0.88rem; }
.card .links a { margin-right: 12px; font-weight: 600; font-size: 0.85rem; }
@media (max-width: 760px) {
  .lineage .node text { font-size: 14px; }
  .lineage .node .venue { font-size: 12px; }
  .proj .hint { margin-top: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .filters button, a { transition: color .12s, background-color .12s, border-color .12s; }
}
