/* ==========================================================================
   Tokens
   ========================================================================== */
:root{
  --paper:      #F7F5EF;
  --paper-dim:  #EFEBE0;
  --ink:        #1C2127;
  --ink-soft:   #4B5158;
  --rule:       #DCD5C2;
  --accent:     #1F6F63;      /* deep teal — primary actions, links */
  --accent-ink: #ffffff;
  --tag-preprint: #B5772E;    /* warm ochre — used only for status tags */
  --tag-published: #1F6F63;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  "IBM Plex Sans", -apple-system, Segoe UI, Roboto, sans-serif;
  --mono:  "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --max-w: 760px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a{ color: var(--accent); text-decoration: none; }
a:hover{ text-decoration: underline; }
a:focus-visible, button:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link{
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: 8px 14px; z-index: 200;
}
.skip-link:focus{ left: 8px; top: 8px; }

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

/* ==========================================================================
   Top bar
   ========================================================================== */
.topbar{
  position: sticky; top: 0; z-index: 100;
  background: rgba(247,245,239,0.92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner{
  max-width: 980px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
}
.topbar__name{
  font-family: var(--serif); font-weight: 600; font-size: 1.05rem;
  color: var(--ink);
}
.topbar__name:hover{ text-decoration: none; color: var(--accent); }
.topbar__nav{ display: flex; gap: 28px; }
.topbar__nav a{
  color: var(--ink-soft); font-size: 0.94rem; font-weight: 500;
}
.topbar__nav a:hover{ color: var(--accent); text-decoration: none; }

.topbar__toggle{
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 34px; height: 34px; background: none; border: none; cursor: pointer;
}
.topbar__toggle span{ display:block; height: 2px; background: var(--ink); border-radius: 1px; }

.topbar__nav-mobile{
  display: none; flex-direction: column;
  padding: 4px 24px 16px;
  border-top: 1px solid var(--rule);
}
.topbar__nav-mobile a{
  padding: 10px 0; color: var(--ink-soft); font-size: 0.98rem;
  border-bottom: 1px solid var(--paper-dim);
}

@media (max-width: 720px){
  .topbar__nav{ display: none; }
  .topbar__toggle{ display: flex; }
  .topbar__nav-mobile.is-open{ display: flex; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero{
  max-width: 980px; margin: 0 auto;
  padding: 64px 24px 40px;
  display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center;
}
.hero__portrait img{
  width: 132px; height: 132px; border-radius: 6px; object-fit: cover;
  border: 1px solid var(--rule);
}
.hero__eyebrow{
  margin: 0 0 6px; font-size: 0.86rem; letter-spacing: 0.02em;
  color: var(--tag-preprint); font-weight: 600;
}
h1{
  font-family: var(--serif); font-weight: 700; font-size: 2.6rem;
  margin: 0 0 6px; line-height: 1.1; color: var(--ink);
}
.hero__role{ margin: 0 0 10px; font-size: 1.08rem; color: var(--ink-soft); }
.hero__affil{ margin: 0 0 18px; color: var(--ink-soft); font-size: 0.96rem; }
.hero__links{ display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px){
  .hero{ grid-template-columns: 1fr; text-align: left; padding-top: 40px; }
  .hero__portrait img{ width: 96px; height: 96px; }
  h1{ font-size: 2.1rem; }
}

.hero--simple{ display: block; padding-bottom: 12px; }
.hero--simple h1{ margin-top: 4px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn{
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 0.88rem; font-weight: 600;
  padding: 8px 14px; border-radius: 4px; border: 1px solid transparent;
  cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover{ text-decoration: none; }
.btn--primary{ background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover{ background: #185a50; }
.btn--ghost{ background: transparent; border-color: var(--rule); color: var(--ink); }
.btn--ghost:hover{ border-color: var(--accent); color: var(--accent); }
.btn--sm{ padding: 6px 11px; font-size: 0.82rem; }
.btn[disabled]{ opacity: 0.45; cursor: not-allowed; }

/* ==========================================================================
   Section layout
   ========================================================================== */
.section{
  max-width: var(--max-w); margin: 0 auto;
  padding: 52px 24px;
  border-top: 1px solid var(--rule);
}
.section__title{
  font-family: var(--serif); font-size: 1.6rem; font-weight: 600;
  margin: 0 0 20px;
}
.section__subtitle{
  font-family: var(--serif); font-size: 1.15rem; font-weight: 600;
  margin: 40px 0 16px;
}
.section__hint{ color: var(--ink-soft); font-size: 0.9rem; margin: -8px 0 24px; }
.prose p{ margin: 0 0 14px; }
.prose a{ text-decoration: underline; text-decoration-color: var(--rule); }

/* Timeline */
.timeline{ list-style: none; margin: 0; padding: 0; }
.timeline__item{
  display: grid; grid-template-columns: 150px 1fr; gap: 18px;
  padding: 14px 0; border-top: 1px solid var(--paper-dim);
}
.timeline__item:first-child{ border-top: none; }
.timeline__when{
  font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); padding-top: 2px;
}
.timeline__what strong{ display: block; font-size: 0.98rem; }
.timeline__what span{ display: block; color: var(--ink-soft); font-size: 0.9rem; margin-top: 2px; }

@media (max-width: 560px){
  .timeline__item{ grid-template-columns: 1fr; gap: 4px; }
}

/* Epigraph */
.epigraph{
  margin: 44px 0 0; padding: 18px 0 0 20px;
  border-left: 3px solid var(--rule);
  font-family: var(--serif); font-style: italic; color: var(--ink-soft);
  font-size: 1.02rem; line-height: 1.55;
}
.epigraph cite{ display: block; margin-top: 10px; font-style: normal; font-size: 0.82rem; }

/* Interests */
.interest-list{ margin: 0; padding-left: 20px; }
.interest-list li{ margin-bottom: 8px; }

/* ==========================================================================
   Publications
   ========================================================================== */
.pub-list{ list-style: none; margin: 0; padding: 0; counter-reset: pub; }
.pub{
  padding: 22px 0; border-top: 1px solid var(--paper-dim);
}
.pub:first-child{ border-top: none; padding-top: 0; }

.pub__tag{
  display: inline-block; font-family: var(--mono); font-size: 0.72rem;
  padding: 2px 7px; border-radius: 3px; margin-bottom: 8px;
  color: #fff;
}
.pub__tag--preprint{ background: var(--tag-preprint); }
.pub__tag--published{ background: var(--tag-published); }

.pub__title{
  font-family: var(--serif); font-weight: 600; font-size: 1.08rem;
  margin: 0 0 4px; line-height: 1.35;
}
.pub__authors{ font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 3px; }
.pub__venue{ font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 12px; }
.pub__venue strong{ color: var(--ink); font-weight: 600; }

.pub__actions{ display: flex; gap: 8px; flex-wrap: wrap; }

/* Theses */
.thesis-list{ list-style: none; margin: 0; padding: 0; }
.thesis-list li{
  padding: 16px 0; border-top: 1px solid var(--paper-dim);
}
.thesis-list li:first-child{ border-top: none; padding-top: 0; }
.thesis-list__meta{ display: block; color: var(--ink-soft); font-size: 0.88rem; margin-top: 3px; }

/* ==========================================================================
   Footer
   ========================================================================== */
.footer{
  max-width: var(--max-w); margin: 0 auto;
  padding: 32px 24px 64px;
  color: var(--ink-soft); font-size: 0.88rem;
}
.footer p{ margin: 0 0 4px; }
.footer__updated{ color: #8a8578; }

/* ==========================================================================
   Modal (Abstract / BibTeX pop-up)
   ========================================================================== */
.modal-overlay{
  position: fixed; inset: 0; background: rgba(20,22,20,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 300;
}
.modal-overlay[hidden]{ display: none; }
.modal{
  position: relative; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 6px;
  max-width: 640px; width: 100%; max-height: 82vh; overflow-y: auto;
  padding: 28px 28px 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}
.modal__close{
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1.6rem; line-height: 1;
  color: var(--ink-soft); cursor: pointer;
}
.modal__close:hover{ color: var(--ink); }
.modal__kicker{
  font-family: var(--mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--tag-preprint); margin: 0 0 6px;
}
.modal__title{
  font-family: var(--serif); font-size: 1.15rem; margin: 0 0 14px; padding-right: 20px;
}
.modal__body{ font-size: 0.95rem; color: var(--ink-soft); line-height: 1.6; }
.modal__body pre{
  background: var(--paper-dim); border: 1px solid var(--rule); border-radius: 4px;
  padding: 14px; font-family: var(--mono); font-size: 0.82rem; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
.modal__copy{ margin-top: 14px; }
