/* Layout descends from the original Weebly theme; type is Newsreader (reading
   text) with Inter (menus, labels, small print). */
:root {
  --bg: #fff;
  --text: #1b1b1b;
  --muted: #5a5a5a;
  --rule: #e5e5e5;
  --accent: #24678d;
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Newsreader", Georgia, "Times New Roman", serif;
  --max: 64rem;      /* one content width for header, pages and footer */
  --gutter: 2.5rem;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 19px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.wrap {
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- site header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);  /* full-width line; the contents follow the page width */
}
.site-header .wrap {
  min-height: var(--header-h);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 0 2rem;
}
/* The Research page widens on large screens for the drawing; header and footer follow it. */
@media (min-width: 1280px) {
  body:has(main.research) .site-header .wrap,
  body:has(main.research) .site-footer .wrap { max-width: calc(74rem + 2 * var(--gutter)); }
}
.site-name {
  display: flex;
  align-items: center;
  padding: 0.75rem 0;
  text-decoration: none;
}
.site-title {
  font: 500 23px/1.1 var(--display);
  letter-spacing: -0.02em;
  color: var(--text);
}

/* Menu: grey links; the current page is dark with an accent rule on the bar's bottom edge. */
.site-nav, .site-nav ul, .site-nav li { display: flex; }
.site-nav ul { flex-wrap: wrap; column-gap: 28px; }
.site-nav a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 0;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font: 500 14px/1 var(--display);
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- content ---------- */
main.wrap { padding-top: 3rem; }

/* Keep running text to a comfortable line length (~70 characters). */
main p, details p { max-width: 70ch; }
.selected li { max-width: calc(70ch + 7.25rem); } /* text column stays ~70ch beside the year */
main.research, main.teaching, main.cv { max-width: calc(64rem + 2 * var(--gutter)); }

h1 { font: 600 30px/1.2 var(--display); letter-spacing: -0.02em; margin: 0 0 1rem; }

/* Research, Teaching and CV show no visible page title (the menu says where
   you are); keep it for screen readers. The 404 page's title stays visible. */
main.research > h1, main.teaching > h1, main.cv > h1 {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

h2 {
  font: 600 13px/1.2 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 1.5rem;
}
h3 { font: 600 18px/1.3 var(--display); letter-spacing: -0.01em; margin: 0 0 0.3rem; }

section + section { margin-top: 3.5rem; }

p { margin: 0 0 1.1rem; }
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; height: auto; }

.muted { color: var(--muted); }

figure { margin: 1.5rem 0; }
figcaption { font: 13px var(--display); color: var(--muted); margin-top: 0.4rem; text-align: center; }

/* ---------- home: profile sidebar + one main reading column ---------- */
main.home { max-width: calc(64rem + 2 * var(--gutter)); }
.profile { margin-bottom: 3rem; font: 14px/1.5 var(--display); }
.home-main { font-size: 17px; }
.portrait { display: block; width: 200px; margin: 0 0 1rem; }
.profile p { margin: 0 0 0.75rem; }
.profile-name { font: 600 17px/1.25 var(--display); letter-spacing: -0.01em; margin-bottom: 0.25rem !important; }

/* home: selected papers - year column, title, venue underneath */
.selected { display: flex; flex-direction: column; gap: 1.1rem; }
.selected li { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.25rem 1.25rem; }
.sel-year { font: 13px/1.2 var(--display); color: var(--muted); padding-top: 0.4rem; font-variant-numeric: tabular-nums; }
.sel-title { color: var(--text); }
.sel-with, .sel-venue { color: var(--muted); }
/* Small outlined "PDF" tag after the journal; the title links to the paper's page. */
.pdf-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 2px 6px 1px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  font: 600 11px/1.2 var(--display);
  letter-spacing: 0.05em;
  color: var(--accent);
  text-decoration: none;
  vertical-align: 2px;
}
.pdf-tag:hover { background: var(--accent); color: var(--bg); }
@media (max-width: 480px) {
  .selected li { grid-template-columns: 1fr; }
  .sel-year { padding-top: 0; }
}
.profile-role { color: var(--muted); }
.profile-label {
  margin: 1.25rem 0 0.35rem !important;
  font: 600 11px/1.2 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.affiliations { display: flex; flex-direction: column; gap: 0.3rem; margin: 0 0 1.25rem; font-size: 13px; line-height: 1.35; }
/* Quiet list: dark text, no underline until hover, small arrow = another site. */
.affiliations a { color: var(--text); text-decoration: none; }
.affiliations a::after {
  content: "";
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  margin-left: 0.3em;
  background: currentColor;
  opacity: 0.45;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 2h6v6M10 2 3 9'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 2h6v6M10 2 3 9'/%3E%3C/svg%3E") center / contain no-repeat;
}
.affiliations a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.affiliations a:hover::after { opacity: 1; }
/* Email / X / Instagram as icons in a row under the photo; 36px tap targets. */
.contact-icons { display: flex; justify-content: center; gap: 4px; width: 200px; margin: -0.5rem 0 0.75rem; }
.contact-icons a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: var(--muted);
}
.contact-icons a:hover { color: var(--accent); background: #f2f6f8; }
.contact-icons a:focus-visible { outline-offset: 0; }
/* Hovering the email icon drops down the address with a Copy button. The
   padding-top bridges the gap so the cursor can move down into the box. */
.contact-icons .email { position: relative; }
.email-pop {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  padding-top: 4px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.12s, visibility 0s 0.25s;
}
.email:hover .email-pop,
.email:has(:focus-visible) .email-pop { visibility: visible; opacity: 1; transition: opacity 0.12s; }
.email-pop::before { content: ""; position: absolute; inset: 4px 0 0; z-index: -1; background: #fff; border: 1px solid #dcdcdc; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.email-pop { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; font: 13px var(--display); }
.email-addr { padding: 0.45rem 0 0.45rem 0.65rem; color: var(--text); user-select: all; }
.email-copy {
  margin-right: 0.35rem;
  padding: 0.2rem 0.5rem;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 1px solid #c9d9e2;
  border-radius: 4px;
  cursor: pointer;
}
.email-copy:hover { background: #f2f6f8; }
.pron { color: var(--muted); }
.pron a { white-space: nowrap; }

@media (min-width: 800px) {
  main.home {
    display: grid;
    grid-template-columns: 14rem 1fr;
    column-gap: 4rem;
    align-items: start;
  }
  /* The sidebar is pinned: it never moves while the page scrolls. It sits
     exactly where the page's left column starts (below the header and the
     page's top padding, at the left edge of the centred content width); the
     main text stays in the second grid column. On a window too short for the
     whole sidebar, the sidebar scrolls on its own. */
  .profile {
    position: fixed;
    top: calc(var(--header-h) + 1px + 3rem);
    left: calc(max(0px, (100% - var(--max) - 2 * var(--gutter)) / 2) + var(--gutter));
    width: 14rem;
    max-height: calc(100vh - var(--header-h) - 1px - 3rem);
    overflow-y: auto;
    padding-bottom: 1rem;
    margin-bottom: 0;
  }
  .home-main { grid-column: 2; }
  /* The pinned sidebar runs the full height of the page, so the home page's
     footer starts in the main column instead of running underneath it. */
  .profile { z-index: 5; background: var(--bg); }
  body:has(main.home) .site-footer .wrap { padding-left: calc(var(--gutter) + 18rem); }
  .portrait { width: 100%; }
  .contact-icons { width: 100%; }
}

/* Narrow screens (one column): photo, icons, name and title first, then the
   main text, with affiliations and pronunciation moved to the end. The
   sidebar's children join the page's own column so they can be reordered. */
@media (max-width: 799px) {
  main.home { display: flex; flex-direction: column; }
  .home .profile { display: contents; }
  .home-main { order: 1; margin: 1rem 0 0; }
  .home .profile-label,
  .home .affiliations,
  .home .pron { order: 2; }
  .home .profile-label {
    margin: 3rem 0 0.5rem !important;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
  }
}

/* ---------- research: same year-column list as the home page ---------- */
.research-drawing { width: fit-content; max-width: min(100%, 420px); margin: 3.5rem 0 0 calc(6rem + 1.25rem); }
@media (max-width: 480px) { .research-drawing { margin-left: 0; } }
/* Wide screens: widen the page a little and pin the drawing in the top-right
   corner, beside the paper list (it stays at the end of the page elsewhere). */
@media (min-width: 1280px) {
  main.research { position: relative; max-width: calc(74rem + 2 * var(--gutter)); }
  .research-drawing { position: absolute; top: 3rem; right: var(--gutter); width: 250px; margin: 0; }
}
.research .selected { gap: 1.6rem; }
.research .sel-body > span { display: block; }
.sel-authors { color: var(--muted); font: 14px/1.6 var(--display); }

details { margin-top: 0.35rem; }
summary {
  cursor: pointer;
  font: 600 12px var(--display);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  width: max-content;
}
summary:hover { color: var(--text); }
details p { margin: 0.6rem 0 0; max-width: 60rem; }
details figure { margin: 0.75rem 0 0; }

/* ---------- teaching: title | description | syllabus button ---------- */
.courses > li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
}
.courses > li:first-child { padding-top: 0; }
.term {
  font: 700 12px/1.3 var(--display);
  color: var(--accent);
  margin: 0;
}
.courses p:not(.term) { margin: 0; }
.courses a { justify-self: start; align-self: start; }
.courses .pdf-tag { margin-left: 0; margin-top: 0.15rem; vertical-align: baseline; }
.button {
  display: inline-block;
  justify-self: start;
  padding: 12px 22px;
  border: 1px solid var(--text);
  font: 500 11px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text);
  text-decoration: none;
}
.button:hover { background: var(--text); color: var(--bg); }

@media (min-width: 800px) {
  .courses > li {
    grid-template-columns: 16rem 1fr;
    column-gap: 2.5rem;
    row-gap: 0.4rem;
    align-items: start;
  }
  .courses h3 { grid-column: 1; grid-row: 1; }
  .term { grid-column: 1; grid-row: 2 / span 2; }
  .courses p:not(.term) { grid-column: 2; grid-row: 1 / span 2; }
  .courses a { grid-column: 2; grid-row: 3; }
}

/* ---------- cv ---------- */
.cv > p:first-of-type { margin-bottom: 2.5rem; }
.cv-drawing { margin: 0 0 2rem; }
@media (min-width: 800px) {
  .cv-drawing { float: right; width: 42%; margin: 0 0 2rem 3rem; }
}
.cv dl { margin: 0; display: grid; grid-template-columns: 5rem 1fr; gap: 0.2rem 0.75rem; font-size: 17px; }
.cv dt { font: 14px/1.9 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.cv dd { margin: 0; }
.cv .org { margin: 1.25rem 0 0.3rem; font: 600 15px/1.4 var(--display); color: var(--accent); }
.cv .org:first-of-type { margin-top: 0; }
.cv ul.affil { margin: 0.2rem 0 0 5.75rem; font: 14px/1.7 var(--display); color: var(--muted); }
.cv ul.affil li::before { content: "- "; }
.cv .muted { color: var(--accent); font: 14px/1.7 var(--display); }

/* ---------- footer ---------- */
.site-footer { margin-top: 6rem; padding: 1.5rem 0 2.5rem; border-top: 1px solid var(--rule); }
.site-footer p { margin: 0; font: 13px/1.6 var(--display); color: var(--muted); }
.site-footer a { color: inherit; }

@media (max-width: 600px) {
  :root { --gutter: 1rem; --header-h: auto; }
  .site-header { position: static; }
  .site-name { padding-bottom: 0.25rem; }
  .site-nav ul { column-gap: 20px; }
}
