:root {
  --ink: #14202b;
  --slate: #5a6b78;
  --paper: #fbfcfb;
  --line: #e2e8e4;
  --blue: #1f5673;      /* deep teal-blue, primary */
  --green: #3f7d5c;     /* field green, secondary */
  --green-soft: #eef4ef;
  --blue-soft: #eaf1f4;
  --maxw: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  font-size: 18px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ---- nav ---- */
header.site {
  border-bottom: 1px solid var(--line);
  background: rgba(251,252,251,0.92);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 0.9rem 1.5rem;
}
.brand {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.brand .dot { color: var(--green); }
.nav nav a {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem; font-weight: 500;
  color: var(--slate); text-decoration: none;
  margin-left: 1.4rem;
}
.nav nav a:hover { color: var(--blue); }

/* ---- hero ---- */
.hero { padding: 3.5rem 0 2.5rem; display: flex; gap: 2.2rem; align-items: flex-start; }
.hero img {
  width: 200px; height: 200px; border-radius: 12px; object-fit: cover;
  border: 1px solid var(--line); flex-shrink: 0;
}
.hero h1 {
  font-family: "Inter", system-ui, sans-serif;
  font-size: 2rem; line-height: 1.15; margin: 0 0 0.4rem;
  letter-spacing: -0.02em;
}
.hero .role { color: var(--green); font-weight: 600; font-family: "Inter", sans-serif; font-size: 1rem; }
.hero p.bio { margin: 0.8rem 0 0; color: var(--slate); }
.links { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.links a {
  font-family: "Inter", sans-serif; font-size: 0.85rem; font-weight: 500;
  text-decoration: none; color: var(--blue);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.3rem 0.85rem; background: #fff;
}
.links a:hover { border-color: var(--blue); background: var(--blue-soft); }

/* ---- sections ---- */
section { padding: 2.2rem 0; border-top: 1px solid var(--line); }
.eyebrow {
  font-family: "Inter", sans-serif; text-transform: uppercase;
  letter-spacing: 0.12em; font-size: 0.72rem; font-weight: 600;
  color: var(--green); margin: 0 0 0.4rem;
}
section h2 {
  font-family: "Inter", sans-serif; font-size: 1.4rem; margin: 0 0 1.2rem;
  letter-spacing: -0.01em;
}

/* ---- publications: grouped by year with a connecting rail ---- */
.pubgroup { display: flex; gap: 1.4rem; }
.pubgroup .year {
  font-family: "Inter", sans-serif; font-weight: 700; color: var(--blue);
  font-size: 0.95rem; width: 5rem; min-width: 5rem; flex-shrink: 0; text-align: right;
  position: relative; padding-top: 1rem;
}
/* the vertical rail sits just right of the year column */
.pubgroup .railcol {
  position: relative; width: 1px; background: var(--line); flex-shrink: 0;
}
.pubgroup .railcol::before {
  content: ""; position: absolute; left: -4px; top: 1.15rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); border: 2px solid var(--paper);
}
.pubgroup .items { flex: 1; }

/* working-papers status label (shown once per group, like a year) */
.wp-label {
  font-size: 0.72rem !important; letter-spacing: 0.04em; text-transform: uppercase;
  line-height: 1.3; text-align: right;
}
.pubgroup .year.wp-status {
  font-size: 0.7rem; line-height: 1.25; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pub { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.pub:last-child { border-bottom: none; }
.pub .title { font-weight: 600; }
.pub .authors { font-size: 0.95rem; }
.pub .venue { color: var(--slate); font-style: italic; font-size: 0.95rem; }
.pub .pub-links { margin-top: 0.2rem; }
.pub .pub-links a {
  font-family: "Inter", sans-serif; font-size: 0.78rem; font-weight: 600;
  text-decoration: none; color: var(--green); margin-right: 0.8rem;
}
.pub .pub-links a:hover { text-decoration: underline; }
.pub .pub-links a.data { color: var(--blue); }

/* ---- expandable abstract ---- */
.pub .abstract-toggle {
  font-family: "Inter", sans-serif; font-size: 0.78rem; font-weight: 600;
  color: var(--slate); cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: none; border: none; padding: 0; margin-top: 0.1rem;
}
.pub .abstract-toggle:hover { color: var(--blue); }
.pub .abstract-toggle .chev {
  display: inline-block; transition: transform 0.25s ease;
  width: 0; height: 0; margin-right: 0.1rem;
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
}
.pub .abstract-wrap {
  display: grid; grid-template-rows: 0fr; width: 100%;
  transition: grid-template-rows 0.35s ease;
}
.pub .abstract-wrap > div { overflow: hidden; width: 100%; }
.pub .abstract {
  font-size: 0.92rem; color: var(--slate); line-height: 1.6;
  padding-top: 0.6rem; width: 100%; max-width: none;
  opacity: 0; transition: opacity 0.3s ease 0.05s;
}
/* open state — toggled by hover on desktop and by .is-open (tap) anywhere */
.pub.is-open .abstract-wrap { grid-template-rows: 1fr; }
.pub.is-open .abstract { opacity: 1; }
.pub.is-open .abstract-toggle .chev { transform: rotate(90deg); }

@media (hover: hover) and (pointer: fine) {
  .pub.has-abstract:not(.js-controlled):hover .abstract-wrap { grid-template-rows: 1fr; }
  .pub.has-abstract:not(.js-controlled):hover .abstract { opacity: 1; }
  .pub.has-abstract:not(.js-controlled):hover .abstract-toggle .chev { transform: rotate(90deg); }
}

/* ---- expandable abstracts ---- */
.abstract-toggle {
  font-family: "Inter", sans-serif; font-size: 0.78rem; font-weight: 600;
  color: var(--green); cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 0.3rem; margin-top: 0.2rem;
}
.abstract-toggle::after { content: "\25BE"; font-size: 0.7rem; transition: transform 0.2s; }
.pub-abstract {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
  color: var(--slate); font-size: 0.92rem; line-height: 1.55;
  border-left: 2px solid var(--green-soft);
}
.pub-abstract p { margin: 0; }
/* open state: toggled by hover on desktop, or .is-open (tap) anywhere */
.has-abstract:hover .pub-abstract,
.has-abstract.is-open .pub-abstract {
  max-height: 600px; margin-top: 0.6rem; padding: 0.1rem 0 0.1rem 0.9rem;
}
.has-abstract:hover .abstract-toggle::after,
.has-abstract.is-open .abstract-toggle::after { transform: rotate(180deg); }
/* on touch devices, hover is unreliable; rely on tap (.is-open) only */
@media (hover: none) {
  .has-abstract:hover .pub-abstract { max-height: 0; margin-top: 0; padding: 0; }
  .has-abstract.is-open .pub-abstract { max-height: 600px; margin-top: 0.6rem; padding: 0.1rem 0 0.1rem 0.9rem; }
}

/* ---- projects ---- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 1.2rem;
  background: #fff;
}
.card h3 { font-family: "Inter", sans-serif; font-size: 1.05rem; margin: 0 0 0.4rem; }
.card p { margin: 0 0 0.7rem; color: var(--slate); font-size: 0.95rem; }
.card .tag {
  display: inline-block; font-family: "Inter", sans-serif; font-size: 0.72rem;
  background: var(--green-soft); color: var(--green); border-radius: 4px;
  padding: 0.1rem 0.5rem; margin-right: 0.3rem; font-weight: 600;
}
.card a.more {
  font-family: "Inter", sans-serif; font-size: 0.82rem; font-weight: 600;
  color: var(--blue); text-decoration: none;
}

/* ---- footer ---- */
footer.site {
  border-top: 1px solid var(--line); padding: 2rem 0 3rem;
  font-family: "Inter", sans-serif; font-size: 0.82rem; color: var(--slate);
  text-align: center;
}

@media (max-width: 640px) {
  .hero { flex-direction: column; gap: 1.2rem; }
  .grid { grid-template-columns: 1fr; }
  .nav nav a { margin-left: 1rem; }
  body { font-size: 17px; }
}

/* ---- Affiliations logo strip ---- */
.affiliations .logo-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 3rem);
}
.affiliations .logo-strip li { margin: 0; }
.affiliations .logo-strip img {
  height: clamp(38px, 7vw, 64px);
  width: auto;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.7;
  transition: filter 0.2s ease, opacity 0.2s ease;
}
.affiliations .logo-strip img:hover {
  filter: grayscale(0%);
  opacity: 1;
}
