/* ============================================
   Zengfu Hou - Academic Website
   Modern academic style, no framework dependency
   ============================================ */

/* --- CSS Variables --- */
:root {
  --color-primary: #1a3a5c;
  --color-primary-light: #2c5f8a;
  --color-accent: #c0392b;
  --color-accent-hover: #e74c3c;
  --color-bg: #fafafa;
  --color-bg-white: #ffffff;
  --color-bg-card: #ffffff;
  --color-text: #2c3e50;
  --color-text-light: #6c757d;
  --color-text-muted: #95a5a6;
  --color-border: #e8ecf1;
  --color-link: #2c5f8a;
  --color-link-hover: #1a3a5c;
  --font-heading: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Consolas', monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 8px;
  --max-width: 1140px;
  --nav-height: 64px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h4 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; }

ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.35rem; }

/* --- Navigation --- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--color-primary);
  z-index: 1000;
  transition: background 0.3s, box-shadow 0.3s;
}

.navbar.scrolled {
  background: rgba(26, 58, 92, 0.97);
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.nav-brand:hover {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* Mobile nav */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--color-primary);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.75rem 1rem;
  }
}

/* --- Hero Section --- */
.hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, #1a4a6c 100%);
  color: #fff;
  text-align: center;
  padding: calc(var(--nav-height) + 3rem) 2rem 4rem;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="30" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="60" cy="70" r="1.5" fill="rgba(255,255,255,0.02)"/><circle cx="80" cy="20" r="0.8" fill="rgba(255,255,255,0.03)"/></svg>');
  background-size: 200px 200px;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.hero .subtitle {
  font-size: 1.25rem;
  font-weight: 300;
  color: rgba(255,255,255,0.85);
  margin-bottom: 0.75rem;
}

.hero .affiliation {
  font-size: 1rem;
  color: rgba(255,255,255,0.65);
  margin-bottom: 2rem;
}

.hero-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.hero-links .btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.hero-links .btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.hero-links .btn-outline {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5);
}

.hero-links .btn-outline:hover {
  background: rgba(255,255,255,0.1);
  border-color: #fff;
  color: #fff;
  text-decoration: none;
}

@media (max-width: 768px) {
  .hero { min-height: 420px; padding: calc(var(--nav-height) + 2rem) 1.5rem 3rem; }
  .hero h1 { font-size: 2.25rem; }
  .hero .subtitle { font-size: 1.05rem; }
}

/* --- Page Header (sub-pages) --- */
.page-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
  color: #fff;
  padding: calc(var(--nav-height) + 3rem) 2rem 3rem;
  text-align: center;
}

.page-header h1 {
  color: #fff;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.page-header .subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.7);
  font-weight: 300;
}

/* --- Main Content Container --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 4rem 0;
}

.section:first-of-type {
  padding-top: 3rem;
}

.section-title {
  font-size: 1.75rem;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 3px solid var(--color-accent);
  display: inline-block;
}

/* --- Research Interests Grid --- */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.research-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
}

.research-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.research-card .icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.research-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.research-card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0;
}

/* --- Publication List --- */
.pub-list {
  list-style: none;
  padding: 0;
}

.pub-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.6;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item .pub-title {
  font-weight: 600;
  color: var(--color-text);
}

.pub-item .pub-authors {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

.pub-item .pub-venue {
  font-style: italic;
  color: var(--color-primary-light);
}

.pub-item .pub-links {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pub-item .pub-links a {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: #eef2f7;
  color: var(--color-link);
  text-decoration: none;
  transition: background 0.2s;
}

.pub-item .pub-links a:hover {
  background: #dde5ef;
  text-decoration: none;
}

.pub-item .pub-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--color-accent);
  color: #fff;
  vertical-align: middle;
  margin-left: 0.25rem;
}

/* --- Quick Links (Home) --- */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.quick-link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s;
}

.quick-link-card:hover {
  border-color: var(--color-primary-light);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--color-text);
}

.quick-link-card .ql-icon {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #eef2f7;
  flex-shrink: 0;
}

.quick-link-card .ql-text h4 {
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.quick-link-card .ql-text p {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin: 0;
}

/* --- Source/Code Cards --- */
.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.source-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.source-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.source-card .sc-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.source-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.source-card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.source-card .sc-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.source-card .sc-links a {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  color: var(--color-link);
  text-decoration: none;
  transition: all 0.2s;
}

.source-card .sc-links a:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
  text-decoration: none;
}

/* --- About / CV Section --- */
.cv-section {
  margin-bottom: 2.5rem;
}

.cv-section h3 {
  font-size: 1.3rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1rem;
}

.cv-bio {
  font-size: 1.05rem;
  line-height: 1.8;
}

/* --- Software Gallery --- */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.software-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.software-card img {
  width: 100%;
  height: 240px;
  object-fit: contain;
  background: #f8f9fa;
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem;
}

.software-card .sw-info {
  padding: 1.25rem;
}

.software-card h4 {
  margin-bottom: 0.25rem;
}

.software-card p {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin: 0;
}

/* --- Reviewer List --- */
.reviewer-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.5rem;
}

.reviewer-list li {
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-card);
  border-radius: 4px;
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
}

/* --- Contact Section --- */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.contact-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: 2rem;
  border: 1px solid var(--color-border);
  text-align: center;
}

.contact-card .cc-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: block;
}

.contact-card h3 {
  margin-bottom: 0.5rem;
}

.contact-card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* --- Footer --- */
.site-footer {
  background: var(--color-primary);
  color: rgba(255,255,255,0.6);
  padding: 2.5rem 0;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a {
  color: rgba(255,255,255,0.8);
}

.site-footer a:hover {
  color: #fff;
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* --- Featured Publications (Home) --- */
.featured-pubs .pub-item {
  background: var(--color-bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.featured-pubs .pub-item:last-child {
  margin-bottom: 0;
}

/* --- Dataset Section --- */
.dataset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.dataset-card {
  background: var(--color-bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.dataset-card .dc-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: var(--color-primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.75rem;
}

.dataset-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.dataset-card p {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 0.75rem;
}

.dataset-card .dc-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-link);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  :root { --nav-height: 56px; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.6rem; }

  .container { padding: 0 1.25rem; }
  .section { padding: 2.5rem 0; }

  .page-header { padding: calc(var(--nav-height) + 2rem) 1.5rem 2rem; }
  .page-header h1 { font-size: 2rem; }

  .research-grid { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .software-grid { grid-template-columns: 1fr; }
  .dataset-grid { grid-template-columns: 1fr; }

  .hero-links { flex-direction: column; align-items: center; }
  .hero-links a { width: 100%; max-width: 240px; justify-content: center; }
}
