:root {
  --paper:      #F5F4EF;
  --paper-deep: #ECE9E0;
  --ink:        #1C2541;
  --ink-soft:   #5C6478;
  --stamp:      #8A332F;
  --brass:      #8A6A2E;
  --line:       #D9D5C8;

  --font-display: 'Newsreader', Georgia, serif;
  --font-body:    'IBM Plex Sans', -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --maxw: 1000px;
}

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

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

section { scroll-margin-top: 84px; }

a { color: var(--ink); text-decoration: none; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 2px; }

::selection { background: var(--stamp); color: var(--paper); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 5vw, 28px); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(245, 244, 239, 0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav__mark {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.03em; flex-shrink: 0;
}

/* Hamburger button — hidden on desktop */
.nav__toggle {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 36px; height: 36px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.nav__toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--ink); border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__links { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft);
  padding-bottom: 4px; border-bottom: 1.5px solid transparent;
  transition: color .2s, border-color .2s;
}
.nav__links a:hover, .nav__links a.is-active {
  color: var(--ink); border-color: var(--stamp);
}

/* ====== Hero / title page ====== */
.hero { padding-top: 148px; padding-bottom: 64px; }
.hero__eyebrow { margin-bottom: 18px; }
.hero__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 5vw, 4rem);
  line-height: 1.05;
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.hero__role {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0 0 36px;
}
.abstract {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  margin-bottom: 30px;
}
.abstract__label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; font-weight: 500; color: var(--stamp);
  margin-bottom: 10px; display: block;
}
.abstract p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0;
}
.hero__links { display: flex; gap: 10px; flex-wrap: wrap; }
.tag-link {
  font-family: var(--font-mono); font-size: 0.78rem;
  border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 12px; color: var(--ink);
  transition: border-color .2s, background .2s;
  display: inline-block;
}
a.tag-link:hover { border-color: var(--brass); background: var(--paper-deep); }
span.tag-link { color: var(--ink-soft); }

/* ====== Generic section heading ====== */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section__head { margin-bottom: 36px; }
.section__num { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.1em; }
.section__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.9rem; margin: 6px 0 0;
}
.section__sub { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft); margin-top: 8px; }

/* ====== About ====== */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.about-grid p { margin: 0 0 16px; color: var(--ink); }
.about-grid p:last-child { margin-bottom: 0; }

.fact-sheet {
  border: 1px solid var(--line); border-radius: 4px;
  padding: 18px 20px; background: var(--paper-deep);
}
.fact-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-bottom: 1px dashed var(--line);
  font-size: 0.88rem;
}
.fact-row:last-child { border-bottom: none; }
.fact-row dt {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0;
}
.fact-row dd { margin: 0; text-align: right; font-weight: 500; }

.interests-label {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft); margin: 30px 0 12px;
  grid-column: 1 / -1;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; grid-column: 1 / -1; }

/* ====== Experience ====== */
.exp-item { padding: 20px 0; border-bottom: 1px solid var(--line); }
.exp-item:last-child { border-bottom: none; padding-bottom: 0; }
.exp-item__top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.exp-item__role { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; margin: 0 0 3px; }
.exp-item__org { color: var(--ink-soft); font-size: 0.92rem; }
.exp-item__years { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; }
.exp-item__desc { margin: 10px 0 0; font-size: 0.92rem; color: var(--ink); max-width: 560px; }

/* ====== Publications ====== */
.pub-card {
  position: relative;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 26px 24px 22px;
  margin-bottom: 22px;
  overflow: hidden;
}
.pub-card:last-child { margin-bottom: 0; }
.pub-number {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft);
  letter-spacing: 0.06em; margin-bottom: 10px; display: block;
}
.pub-stamps {
  position: absolute; top: 18px; right: 18px;
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
  max-width: 46%;
}
.stamp {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--stamp); border: 1.4px solid var(--stamp);
  border-radius: 2px; padding: 3px 7px;
  transform: rotate(var(--r, -4deg));
  background: rgba(138, 51, 47, 0.04);
}
.pub-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.22rem; line-height: 1.3; margin: 0 0 8px;
  padding-right: 120px;
}
.pub-authors { font-size: 0.92rem; color: var(--ink-soft); margin: 0 0 4px; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-note { font-size: 0.78rem; font-style: italic; color: var(--ink-soft); margin: 0 0 10px; }
.pub-venue {
  font-family: var(--font-mono); font-style: italic; font-size: 0.84rem;
  color: var(--ink-soft); margin: 0 0 16px;
}
.pub-links { display: flex; gap: 16px; flex-wrap: wrap; }
.pub-links button, .pub-links a {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink);
  border: none; background: none; cursor: pointer; padding: 0;
  border-bottom: 1px solid var(--ink-soft);
}
.pub-links button:hover, .pub-links a:hover { border-color: var(--stamp); color: var(--stamp); }
.cite-toast {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--stamp);
  opacity: 0; transition: opacity .25s; margin-left: 4px;
}
.cite-toast.show { opacity: 1; }

.pub-footnote {
  margin-top: 22px; padding: 14px 18px;
  border-left: 2px solid var(--line);
  font-size: 0.86rem; color: var(--ink-soft);
}
.pub-footnote a { color: var(--ink); border-bottom: 1px solid var(--ink-soft); }
.pub-footnote a:hover { color: var(--stamp); border-color: var(--stamp); }

/* ====== Projects ====== */
.project-card {
  background: var(--paper-deep); border: 1px solid var(--line); border-radius: 4px;
  padding: 20px 22px; margin-bottom: 16px;
}
.project-card:last-child { margin-bottom: 0; }
.project-card h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; margin: 0 0 6px; }
.project-card p { font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 12px; }
.project-card a {
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink);
  border-bottom: 1px solid var(--ink-soft);
}
.project-card a:hover { border-color: var(--stamp); color: var(--stamp); }

/* ====== Contact / footer ====== */
.contact .section__title { margin-bottom: 14px; }
.contact p { max-width: 480px; color: var(--ink-soft); margin: 0 0 28px; }
.contact__email {
  font-family: var(--font-display); font-size: 1.4rem; font-weight: 600;
  display: inline-block; margin-bottom: 26px; border-bottom: 2px solid var(--stamp);
}
.contact__row { display: flex; gap: 18px; flex-wrap: wrap; }
.contact__row a { font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft); }
.contact__row a:hover { color: var(--ink); }

.colophon {
  border-top: 1px solid var(--line); padding: 22px 0 40px;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-soft);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

/* ====== Reveal-on-scroll ====== */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ====== Responsive — Tablet (≤ 860px) ====== */
@media (max-width: 860px) {
  :root { --maxw: 100%; }
  .container { padding: 0 32px; }
  .nav__inner { padding: 0 32px; }
  .about-grid { grid-template-columns: 1fr 1fr; gap: 28px; }
  .exp-item__desc { max-width: 100%; }
}

/* ====== Responsive — Mobile (≤ 640px) ====== */
@media (max-width: 640px) {

  /* Base container + nav padding */
  .container { padding: 0 20px !important; }
  .nav__inner { padding: 0 20px; }

  /* Nav: hamburger */
  .nav__toggle { display: flex; }
  .nav__links {
    display: none;
    position: absolute; top: 60px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }
  .nav__links.is-open { display: flex; }
  .nav__links li { width: 100%; }
  .nav__links a {
    display: block;
    padding: 14px 20px;
    font-size: 0.82rem;
    border-bottom: 1px solid var(--line);
  }
  .nav__links li:last-child a { border-bottom: none; }
  .nav__links a.is-active { color: var(--stamp); }

  /* Hero */
  .hero {
    padding-top: 84px !important;
    padding-bottom: 40px !important;
  }
  .hero__name {
    font-size: 1.6rem !important;
    line-height: 1.15;
    margin-bottom: 8px;
    word-break: break-word;
  }
  .hero__role {
    font-size: 0.85rem !important;
    line-height: 1.55;
    margin-bottom: 18px;
  }

  /* Abstract */
  .abstract { padding: 14px 0; margin-bottom: 18px; }
  .abstract__label { font-size: 0.65rem; margin-bottom: 6px; }
  .abstract p {
    font-size: 0.85rem !important;
    line-height: 1.65;
  }

  /* Hero link buttons — 2-col grid */
  .hero__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 0;
  }
  a.tag-link {
    font-size: 0.7rem !important;
    padding: 10px 6px !important;
    text-align: center;
    border-radius: 4px;
    display: block;
  }
  span.tag-link { display: none; }

  /* Sections */
  .section { padding: 40px 0; }
  .section__title { font-size: 1.4rem; }
  .section__head { margin-bottom: 20px; }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
  .interests-label { margin-top: 20px; }

  /* Publications */
  .pub-title { padding-right: 0; font-size: 1rem; }
  .pub-stamps { position: static; max-width: 100%; margin-bottom: 12px; justify-content: flex-start; }
  .pub-card { padding: 18px 14px 16px; }

  /* Experience */
  .exp-item__top { flex-direction: column; gap: 2px; }
  .exp-item__desc { max-width: 100%; font-size: 0.88rem; }

  /* Contact */
  .contact__email { font-size: 1rem; word-break: break-all; }
  .contact p { max-width: 100%; }

  /* Colophon */
  .colophon { flex-direction: column; gap: 4px; }
}
