/* ============================================================
   Hao Li — personal site
   Accent color matches the LaTeX CV: rgb(31, 73, 125)
   ============================================================ */

:root {
  --accent: rgb(31, 73, 125);
  --accent-hover: rgb(20, 55, 100);
  --bg: #fafafa;
  --text: #171717;
  --text-muted: #6b7280;
  --text-gray: #404040;
  --border: #e5e5e5;
  --max-width: 64rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ───────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.site-name:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav a {
  font-size: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

.nav a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nav a.current {
  color: var(--text);
  cursor: default;
}

.nav a.current:hover {
  text-decoration: none;
}

.nav .cv-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.nav .icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

/* mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .nav {
    display: none;
    position: absolute;
    top: 3.5rem;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 0.5rem 0;
    width: 100%;
  }

  .menu-toggle {
    display: block;
  }
}

/* ─── Main layout ──────────────────────────────────────────── */

main {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 2rem;
  flex: 1;
}

@media (min-width: 640px) {
  main {
    padding: 3rem 2rem 3rem;
  }
  .header-inner {
    padding: 0 2rem;
  }
}

/* ─── Typography ───────────────────────────────────────────── */

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

@media (min-width: 640px) {
  .page-title {
    font-size: 2.25rem;
  }
}

.subtitle {
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.subtitle + .subtitle {
  margin-top: 0.125rem;
}

.section-heading {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 1.25rem;
}

p {
  color: var(--text-gray);
  font-size: 0.9375rem;
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.link {
  font-size: 0.875rem;
}

em {
  font-style: italic;
}

strong {
  font-weight: 600;
}

/* ─── Hero (home page) ─────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: flex-start;
}

@media (min-width: 640px) {
  .hero {
    flex-direction: row;
  }
}

.hero-photo {
  flex-shrink: 0;
  width: 210px;
  border-radius: 0.5rem;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  background: #e5e5e5;
}

@media (min-width: 640px) {
  .hero-photo {
    width: 270px;
  }
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.875rem;
  text-align: center;
  padding: 1rem;
}

.hero-content {
  flex: 1;
  min-width: 0;
}

.hero-bio {
  margin-top: 2.5rem;
}

.hero-bio p + p {
  margin-top: 1rem;
}

/* ─── Two-column section (home page) ───────────────────────── */

.two-col {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

@media (min-width: 768px) {
  .two-col {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 3rem;
  }
}

.two-col .col {
  display: flex;
  flex-direction: column;
}

/* ─── Lists ────────────────────────────────────────────────── */

ul.entry-list {
  list-style: none;
  padding: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

ul.entry-list li {
  font-size: 0.875rem;
}

.entry-title {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.entry-title:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.entry-meta {
  margin-top: 0.125rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.see-all {
  margin-top: 1rem;
  padding-top: 1rem;
  font-size: 0.875rem;
}

/* ─── Sub-page content ─────────────────────────────────────── */

.page-section {
  margin-top: 2rem;
}

.page-section:first-of-type {
  margin-top: 1.5rem;
}

.page-section h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.entry {
  margin-bottom: 1.5rem;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}

.entry-role {
  font-weight: 600;
  font-size: 0.9375rem;
}

.entry-place {
  color: var(--text-gray);
  font-weight: 400;
}

.entry-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-style: italic;
  white-space: nowrap;
}

.entry ul {
  margin-top: 0.5rem;
  padding-left: 1.25rem;
}

.entry ul li {
  font-size: 0.9375rem;
  color: var(--text-gray);
  line-height: 1.65;
  margin-bottom: 0.25rem;
}

/* ─── Contact page ─────────────────────────────────────────── */

.contact-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
  font-size: 0.9375rem;
}

.contact-grid dt {
  color: var(--text-muted);
  font-weight: 500;
}

.contact-grid dd {
  color: var(--text-gray);
}

/* ─── Footer ───────────────────────────────────────────────── */

.site-footer {
  margin-top: auto;
  height: 3.5rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-links svg {
  width: 1.25rem;
  height: 1.25rem;
}
