/* =========================================================
   Erdong Xu — Personal Academic Website
   Original visual style, updated home-page structure
   ========================================================= */

@font-face {
  font-family: "Lato";
  src: url("fonts/lato-300.ttf") format("truetype");
  font-style: normal;
  font-weight: 300;
  font-display: optional;
}

@font-face {
  font-family: "Lato";
  src: url("fonts/lato-400.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: optional;
}

@font-face {
  font-family: "Lato";
  src: url("fonts/lato-700.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: optional;
}

@font-face {
  font-family: "Lato";
  src: url("fonts/lato-italic-400.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: optional;
}

:root {
  --bg: #fcfbf8;
  --text: #1d1d1b;
  --muted: #6f6d68;
  --rule: #e4e1da;
  --max-width: 1200px;
  --home-width: 780px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

/* ---------------- Header ---------------- */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: rgba(251, 250, 247, 0.96);
}

.nav-wrap {
  width: min(calc(100% - 64px), var(--max-width));
  margin: 0 auto;
}

.site-nav {
  display: flex;
  gap: 42px;
  align-items: center;
  height: 72px;
}

.site-nav a {
  position: relative;
  padding: 25px 0 23px;
  color: #2e2e2e;
  font-size: 0.9rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.site-nav a:hover {
  color: #000;
}

.site-nav a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #222;
}

/* =========================================================
   HOME PAGE
   ========================================================= */

.home-page {
  width: min(calc(100% - 64px), var(--home-width));
  margin: 0 auto;
  padding: 68px 0 92px;
}

.home-content h1 {
  margin: 0;
  font-size: clamp(2.75rem, 5vw, 3.8rem);
  line-height: 1.04;
  font-weight: 300;
  letter-spacing: -0.035em;
}

.bio {
  margin-top: 32px;
  max-width: 700px;
}

.bio p {
  margin: 0 0 24px;
  font-size: 0.98rem;
  line-height: 1.72;
  letter-spacing: 0.002em;
}

.email-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.email-link:hover {
  opacity: 0.65;
}

.home-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.home-links a,
.home-links .document-label {
  font-size: 0.98rem;
  line-height: 1.5;
}

.home-links a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.home-links .document-label {
  color: var(--muted);
}

.home-links a:hover {
  opacity: 0.65;
}

/* =========================================================
   RESEARCH PAGE
   ========================================================= */

.research-page {
  width: min(calc(100% - 64px), var(--max-width));
  margin: 0 auto;
  padding: 56px 0 90px;
}

.research-section > h1 {
  margin: 0 0 34px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.12;
  font-weight: 300;
  letter-spacing: -0.02em;
}

.paper-card {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 38px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--rule);
}

.paper-card:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.paper-image {
  width: 100%;
}

.paper-card--center-image .paper-image {
  align-self: center;
}

.paper-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid #d4d0c7;
  border-radius: 3px;
  background: #f2f0eb;
}

.paper-content {
  padding-top: 1px;
}

.paper-content h2 {
  margin: 0;
  max-width: 800px;
  font-size: 1.27rem;
  line-height: 1.42;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.abstract {
  margin: 16px 0 0;
  max-width: 790px;
  font-size: 0.94rem;
  line-height: 1.66;
  color: #34322f;
}

.presented {
  margin: 18px 0 0;
  max-width: 790px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--muted);
}

.presented span {
  color: #55524d;
  font-weight: 600;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .paper-card {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 30px;
  }

  .paper-content h2 {
    font-size: 1.22rem;
  }
}

@media (max-width: 700px) {
  .nav-wrap,
  .home-page,
  .research-page {
    width: min(calc(100% - 34px), var(--max-width));
  }

  .site-nav {
    height: 64px;
    gap: 28px;
  }

  .site-nav a {
    padding: 22px 0 18px;
    font-size: 0.95rem;
  }

  .home-page {
    padding-top: 44px;
    padding-bottom: 72px;
  }

  .home-content h1 {
    font-size: clamp(2.45rem, 11vw, 3.15rem);
  }

  .bio {
    margin-top: 32px;
  }

  .bio p {
    margin-bottom: 24px;
    font-size: 0.97rem;
    line-height: 1.68;
  }

  .home-links {
    gap: 18px;
    margin-top: 34px;
    padding-top: 20px;
  }

  .home-links a,
  .home-links .document-label {
    font-size: 0.98rem;
  }

  .research-page {
    padding-top: 42px;
    padding-bottom: 70px;
  }

  .research-section > h1 {
    margin-bottom: 28px;
    font-size: 1.8rem;
  }

  .paper-card {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 30px 0 34px;
  }

  .paper-image {
    max-width: 520px;
  }

  .paper-content h2 {
    font-size: 1.18rem;
  }

  .abstract {
    font-size: 0.94rem;
    line-height: 1.64;
  }

  .presented {
    margin-top: 18px;
    font-size: 0.92rem;
  }
}

/* US Political Tracker nav item: keep three header links on one line on very narrow phones */
@media (max-width: 400px) {
  .site-nav {
    gap: 18px;
  }

  .site-nav a {
    font-size: 0.8rem;
  }
}

/* ---------------- Work in Progress ---------------- */

.wip-section {
  margin-top: 64px;
}

.inline-link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.inline-link:hover {
  opacity: 0.65;
}

@media (max-width: 700px) {
  .wip-section {
    margin-top: 48px;
  }
}

/* keep nav position stable across short/tall pages */
html { scrollbar-gutter: stable; }
