/* ===== Fonts =====================================================
   Brill if you self-host it (see static/fonts/README.txt), otherwise
   Libertinus Serif if installed, otherwise Spectral (Google Fonts,
   loaded in head.html while params.useGoogleFonts = true). */
@font-face { font-family: 'Brill'; src: url('../fonts/Brill-Roman.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Brill'; src: url('../fonts/Brill-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Brill'; src: url('../fonts/Brill-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --accent: #2C5F8A;
  --ink: #1A2128;
  --text: #2B333B;
  --muted: #5B6570;
  --line: #E3E6E9;
  --line2: #C8CED4;
  --sea: #F2F4F6;
  --bg: #FDFDFC;
  --font: 'Brill', 'Libertinus Serif', 'Spectral', Georgia, serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4rem; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 18px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid var(--line2); }
a:hover { border-bottom-color: var(--accent); }
em, i { font-style: italic; }
p { margin: 0 0 1.1rem; }
.vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); border: 0; white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 6px 10px; z-index: 20; }
.lab { font-variant: small-caps; letter-spacing: .06em; font-size: 17px; color: var(--muted); }

/* ===== Layout ===================================================== */
.wrap { max-width: 880px; margin: 0 auto; padding: 0 32px 72px; }
.wrap--home { max-width: 1120px; }

/* ===== Top bar ==================================================== */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 28px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bar a { border-bottom: none; color: var(--text); font-size: 16px; padding: 10px 0; display: inline-block; }
.bar a:hover { color: var(--accent); }
.bar .bar-name { font-weight: 600; font-size: 18px; color: var(--ink); }
.bar nav { display: flex; flex-wrap: wrap; gap: 0 24px; }
.nav-btn { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
#nav-toggle:focus-visible + .nav-btn { outline: 2px solid var(--accent); }

/* ===== Hero ======================================================= */
.hero { display: flex; flex-wrap: wrap; gap: 32px 56px; align-items: flex-start; padding: 72px 0 48px; }
.portrait { flex: 0 0 200px; width: 200px; height: 250px; object-fit: cover; border: 1px solid var(--line); }
.portrait--empty { background: var(--sea); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 15px; }
.hero-text { flex: 999 1 420px; min-width: 0; }
.hero h1 { margin: 0 0 6px; font-weight: 600; font-size: 46px; line-height: 1.15; color: var(--ink); }
.hero-role { margin-bottom: 24px; }
.hero-intro { max-width: 640px; font-size: 20px; margin: 0 0 22px; }
.hero-intro p { display: inline; }
.hero-links { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 16px; }

/* ===== Home grid: sections left, Marginalia right ================ */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; column-gap: 56px; align-items: start; }
.home-grid > .row { grid-column: 1; }
.home-grid > .mg { grid-column: 2; grid-row: 1 / span 9; }

.row { display: flex; flex-wrap: wrap; gap: 12px 48px; padding: 36px 0; border-top: 1px solid var(--line); }
.row > .l { flex: 0 0 170px; }
.row > .r { flex: 999 1 380px; min-width: 0; }
.row .r > :last-child { margin-bottom: 0; }
.proj { margin: 0 0 14px; }
.more { font-size: 16px; margin-top: 18px; }
.item { display: flex; flex-wrap: wrap; gap: 2px 24px; margin: 0 0 14px; }
.item .d { flex: 0 0 84px; color: var(--muted); font-size: 16px; }
.item .t { flex: 1 1 300px; min-width: 0; }
.item .t:only-child { flex-basis: 100%; }
ol.pubs { margin: 0; padding-left: 1.6em; }
ol.pubs li { margin: 0 0 14px; padding-left: .3em; }

/* ===== Marginalia ================================================= */
.mg { padding-top: 36px; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.5; }
.mg > .lab { margin-bottom: 16px; }
.mg-item { margin: 0 0 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.mg-item p { margin: 0; }
.mg-meta { color: var(--muted); font-size: 14px; }
.mg-meta a { color: var(--muted); border-bottom: none; }
.mg-img { display: block; width: 100%; height: auto; margin: 6px 0 8px; }
.mg-quote .mg-body, .mg-body blockquote { font-style: italic; }
.mg-cite { color: var(--muted); font-size: 14px; font-style: normal; }
.mg-archive .mg-item { font-size: 18px; max-width: 620px; }

/* ===== Article / inner pages ===================================== */
.article { max-width: 660px; padding-top: 48px; font-size: 19px; line-height: 1.65; }
.article--wide { max-width: none; }
.back { font-size: 16px; margin: 0 0 20px; }
.eyebrow { margin-bottom: 6px; }
.article h1 { margin: 0 0 24px; font-weight: 600; font-size: 38px; line-height: 1.2; color: var(--ink); }
.article h2 { font-weight: 600; font-size: 24px; line-height: 1.3; margin: 40px 0 12px; color: var(--ink); }
.article h3 { font-weight: 600; font-size: 19px; margin: 28px 0 8px; color: var(--ink); }
.article img, .figure img { max-width: 100%; height: auto; }
.figure { margin: 0 0 22px; }
.dek { color: var(--muted); font-size: 16px; }
blockquote { margin: 0 0 22px; padding-left: 1.1rem; border-left: 2px solid var(--line2); font-style: italic; }
blockquote footer { font-style: normal; color: var(--muted); font-size: 15px; }
code { font-family: var(--mono); font-size: .82em; background: var(--sea); padding: 1px 5px; }
pre { font-family: var(--mono); font-size: 14.5px; line-height: 1.5; background: var(--sea); padding: 16px 18px; margin: 0 0 22px; overflow-x: auto; color: var(--ink); }
pre code { background: none; padding: 0; font-size: inherit; }
table { border-collapse: collapse; margin: 0 0 22px; font-size: 16px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 14px 6px 0; text-align: left; }
ul.entries { list-style: none; margin: 0 0 1.5rem; padding: 0; }
ul.entries li { margin-bottom: .8rem; }
ul.entries .d { color: var(--muted); font-size: 16px; margin-right: .6rem; }

/* Publications lists */
ol.entries { margin: 0 0 1.5rem; padding-left: 1.6rem; }
ol.entries li { margin-bottom: .85rem; padding-left: .3rem; }
ol.entries li::marker { color: var(--muted); font-size: .9em; }
.article h2.section-heading { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); font-size: 1.4rem; }
.biblio { list-style: none; margin: 0; padding: 0; font-size: 17px; }
.biblio li { margin: 0 0 12px; padding-left: 1.6rem; text-indent: -1.6rem; }

/* By-type / chronological toggle: hidden radio pair, no JS, no scroll jump.
   The inputs must precede .view-toggle and .pub-view in the DOM (~ combinator). */
.view-radio { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.pub-view { display: none; }
#view-by-type:checked ~ .pub-view--by-type { display: block; }
#view-chronological:checked ~ .pub-view--chronological { display: block; }
.view-toggle { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; margin: 0 0 1.6rem; font-size: 15px; }
.view-toggle label { padding: .35rem .9rem; color: var(--muted); cursor: pointer; user-select: none; }
.view-toggle label + label { border-left: 1px solid var(--line2); }
.view-toggle label:hover { color: var(--ink); }
#view-by-type:checked ~ .view-toggle label[for="view-by-type"],
#view-chronological:checked ~ .view-toggle label[for="view-chronological"] { background: var(--ink); color: var(--bg); }
.view-radio:focus-visible ~ .view-toggle { outline: 2px solid var(--accent); }

/* ===== Footer ====================================================== */
footer.site { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }

/* ===== Narrow screens ============================================== */
@media (max-width: 900px) {
  .home-grid { display: flex; flex-direction: column; }
  .home-grid > .s-approach { order: 1; }
  .home-grid > .s-recent { order: 2; }
  .home-grid > .mg { order: 3; }
  .home-grid > .s-rest { order: 4; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding: 0 20px 48px; }
  .nav-btn { display: flex; }
  .bar nav { display: none; flex-basis: 100%; flex-direction: column; padding-bottom: 8px; }
  #nav-toggle:checked ~ nav { display: flex; }
  .hero { padding: 28px 0 28px; gap: 20px; }
  .portrait { flex: 0 0 96px; width: 96px; height: 120px; }
  .hero h1 { font-size: 34px; }
  .hero-intro { font-size: 18px; }
  .row { padding: 26px 0; gap: 8px; }
  .row > .l { flex-basis: 100%; }
  .article { padding-top: 32px; font-size: 18px; }
  .article h1 { font-size: 30px; }
}
@media print {
  .bar, footer.site, .view-toggle { display: none; }
}

/* Teaching entries: wider date column, optional "Co-taught with" line */
.item--course .d { flex-basis: 10.5rem; }
.item .sub { display: block; color: var(--muted); font-size: 16px; margin-top: 2px; }
