@import url("../fonts/fonts.css");

/* ---------- tokens ---------- */
:root {
  --serif: "Source Serif 4", Charter, "Bitstream Charter", Cambria, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #ffffff;
  --bg-soft: #f7f7f5;
  --ink: #16181d;
  --body: #2c2f36;
  --muted: #6b7079;
  --faint: #9aa0a8;
  --rule: #e4e4e6;
  --rule-strong: #c9cace;

  --accent: #1f3a68;
  --accent-hover: #a31f34;

  --measure: 62ch;
  --sidebar: 214px;
  --gap: 62px;
  --pad: 40px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px; z-index: 50;
  font-size: 0.9rem; border-radius: 0 0 3px 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ---------- shell ---------- */
.wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- masthead ---------- */
.masthead {
  padding: 72px 0 26px;
  border-bottom: 1px solid var(--rule);
}
.masthead h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.15rem, 1.4rem + 2.4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0 0 10px;
}
.masthead .role {
  font-size: 0.98rem;
  color: var(--body);
  margin: 0;
}
.cv-link {
  margin: 13px 0 0;
  font-size: 0.95rem;
  font-weight: 500;
}
.cv-link a {
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color .15s ease;
}
.cv-link a:hover { text-decoration-color: var(--accent-hover); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  gap: var(--gap);
  align-items: start;
  padding: 44px 0 96px;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky;
  top: 36px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: 50% 18%;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--bg-soft);
}

.sidebar-block { margin-top: 26px; }
.sidebar-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 9px;
}
.contact {
  font-size: 0.845rem;
  line-height: 1.62;
  color: var(--muted);
  font-style: normal;
  margin: 0;
}
.contact a { color: var(--accent); }
.contact .addr { display: block; margin-top: 7px; }

/* section nav */
.tocnav { margin: 0; padding: 0; list-style: none; }
.tocnav li { margin: 0; }
.tocnav a {
  display: block;
  font-size: 0.885rem;
  line-height: 1.35;
  color: var(--muted);
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--rule);
  transition: color .15s ease, border-color .15s ease;
}
.tocnav a:hover { color: var(--ink); border-left-color: var(--rule-strong); }
.tocnav a.is-active {
  color: var(--ink);
  font-weight: 500;
  border-left-color: var(--accent);
}

.sidebar-rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 26px 0 0;
}

/* ---------- main ---------- */
.bio {
  max-width: var(--measure);
  margin: 0 0 12px;
}
.bio p {
  font-family: var(--serif);
  font-size: 1.09rem;
  line-height: 1.68;
  color: var(--body);
  margin: 0 0 1.05em;
}
.bio p:last-child { margin-bottom: 0; }

section { padding-top: 46px; scroll-margin-top: 24px; }

h2 {
  font-size: 0.93rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 9px;
}
.rule {
  border: 0;
  border-top: 1.5px solid var(--ink);
  margin: 0 0 24px;
}

/* ---------- papers ---------- */
.papers { margin: 0; padding: 0; list-style: none; }
.paper {
  padding: 0 0 15px;
  margin: 0 0 15px;
  border-bottom: 1px solid var(--rule);
}
.paper:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.paper-title {
  font-family: var(--serif);
  font-size: 1.075rem;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -0.003em;
  color: var(--accent);
  margin: 0;
  max-width: var(--measure);
}
.paper-title a { color: inherit; }
.paper-title a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.paper-title.plain { color: var(--ink); }

.paper-meta {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 5px 0 0;
  max-width: var(--measure);
}
.paper-meta .yr { color: var(--faint); }
.paper-meta .sep { color: var(--rule-strong); margin: 0 6px; }

.paper-venue {
  font-size: 0.875rem;
  color: #3d424b;
  margin: 3px 0 0;
}
.paper-venue em { font-style: italic; }
.paper-venue .status { color: var(--muted); }

/* Optional pill row (PDF / Journal / Slides). Not used at present — paper
   titles link straight to the document — but kept for future entries that
   need more than one link. */
.paper-links {
  margin: 11px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.paper-links a {
  font-size: 0.735rem;
  font-weight: 500;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 11px;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.paper-links a:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
  background: #fdf6f7;
}

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  padding: 22px 0 56px;
  font-size: 0.8rem;
  color: var(--faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.footer a { color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  :root { --gap: 44px; --sidebar: 192px; }
}

@media (max-width: 820px) {
  :root { --pad: 22px; }
  body { font-size: 16.5px; }

  .masthead { padding: 40px 0 22px; }

  .layout {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 0 72px;
  }
  .sidebar { position: static; }

  .sidebar-head {
    display: grid;
    grid-template-columns: 136px 1fr;
    gap: 22px;
    align-items: center;
  }
  .portrait { max-width: 136px; aspect-ratio: 1 / 1; }
  .sidebar-head .sidebar-block { margin-top: 0; }

  .tocnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .tocnav a {
    border-left: 0;
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 5px 13px;
    font-size: 0.82rem;
  }
  .tocnav a.is-active { border-color: var(--accent); }

  section { padding-top: 36px; }
}

@media (max-width: 480px) {
  .sidebar-head { grid-template-columns: 100px 1fr; gap: 16px; }
  .portrait { max-width: 100px; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .footer, .skip-link { display: none; }
  .layout { display: block; padding: 0; }
  body { font-size: 10.5pt; color: #000; }
  a { color: #000; }
  .paper { break-inside: avoid; }
}
