/* =============================================================================
   Dr. Haodi Zhang — Academic Homepage Stylesheet
   ============================================================================= */

/* 1. Font Face
   ============================================================================= */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-latin-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-latin-600.woff2') format('woff2');
}

/* 2. CSS Custom Properties
   ============================================================================= */
:root {
  --bg:           #FAFAF8;
  --surface:      #FFFFFF;
  --text:         #1A1A1A;
  --text-muted:   #6B7280;
  --accent:       #E08A2C;
  --accent-light: #FDF0E0;
  --ccf-a:        #DC2626;
  --ccf-b:        #E08A2C;
  --journal:      #2563EB;
  --tag-other:    #9CA3AF;
}

/* 3. Reset & Base
   ============================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  padding: 0;
}

/* 4. Typography
   ============================================================================= */
h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--text);
  text-decoration: underline;
  transition: color 0.15s ease;
}

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

/* 5. Layout
   ============================================================================= */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 3rem 0;
}

/* 6. Navigation
   ============================================================================= */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #eee;
  padding: 0.75rem 1.5rem;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.nav-brand {
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.nav-brand:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding-bottom: 2px;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}

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

.nav-links a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.2s ease;
}

/* Mobile: nav-links open state */
.nav-links.open {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* 7. Hero
   ============================================================================= */
.hero {
  display: flex;
  gap: 3rem;
  align-items: center;
  padding-top: 5rem;
}

.hero-photo-wrapper {
  position: relative;
  width: 240px;
  height: 300px;
  flex-shrink: 0;
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 90% 85% at 50% 38%, black 50%, transparent 85%);
  mask-image: radial-gradient(ellipse 90% 85% at 50% 38%, black 50%, transparent 85%);
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.hero-info h1 {
  margin-bottom: 0.25rem;
}

.hero-titles {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 0.5rem;
}

.hero-icons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.hero-icons a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
  font-size: 0.9rem;
}

.hero-icons a:hover {
  color: var(--accent);
}

.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.research-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* 8. Metrics Bar
   ============================================================================= */
.metrics {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2rem;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  flex-wrap: wrap;
}

.metric-item {
  text-align: center;
}

.metric-number {
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  display: block;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
  display: block;
}

/* 9. Cards
   ============================================================================= */
.card {
  background: var(--surface);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-left: 3px solid var(--accent);
}

/* 10. Venue Tags
   ============================================================================= */
.venue-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.venue-tag.ccf-a {
  background: var(--ccf-a);
}

.venue-tag.ccf-b {
  background: var(--ccf-b);
}

.venue-tag.journal {
  background: var(--journal);
}

.venue-tag.other {
  background: var(--tag-other);
}

/* 11. News List
   ============================================================================= */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-item {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
  align-items: flex-start;
}

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

.news-date {
  min-width: 5rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.news-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

.news-text {
  flex: 1;
  font-size: 0.95rem;
}

/* 12. Publication List
   ============================================================================= */
.pub-year-header {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
}

.pub-entry {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f5f5f5;
}

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

.pub-authors {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.1rem;
}

.pub-title {
  font-weight: 600;
  margin: 0.25rem 0;
}

.pub-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.pub-links a {
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.pub-links a:hover {
  opacity: 0.75;
}

.pub-note {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
}

.pub-if {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* 13. Filter Bar
   ============================================================================= */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  align-items: center;
}

.filter-bar input {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  flex: 1;
  min-width: 200px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.filter-bar input:focus {
  border-color: var(--accent);
}

.year-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 1rem;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.year-btn:hover,
.year-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* 14. Tables
   ============================================================================= */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: var(--accent-light);
  text-align: left;
  padding: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

tr:hover {
  background: #fafafa;
}

/* 15. Timeline
   ============================================================================= */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent-light);
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 1rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.75rem;
  top: 0.5rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline-period {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.15rem;
}

.timeline-title {
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.timeline-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 16. Collapsible (details/summary)
   ============================================================================= */
details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  padding: 0.5rem 0;
  list-style: none;
  user-select: none;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: '▶ ';
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  content: '▼ ';
}

details summary:hover {
  opacity: 0.8;
}

details[open] summary {
  margin-bottom: 0.5rem;
}

/* 17. Footer
   ============================================================================= */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid #eee;
  margin-top: 3rem;
}

.footer a {
  color: var(--text-muted);
}

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

/* 18. Responsive
   ============================================================================= */

/* Tablet / moderate screens */
@media (max-width: 1024px) {
  .hero {
    gap: 2rem;
  }

  .metrics {
    gap: 2rem;
    padding: 1.5rem;
  }

  .nav-links {
    gap: 1.5rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    gap: 0.75rem;
  }

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

  .nav-toggle {
    display: flex;
  }

  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: 4.5rem;
    gap: 1.5rem;
  }

  .hero-photo-wrapper {
    width: 180px;
    height: 220px;
  }

  .hero-icons {
    justify-content: center;
  }

  .research-tags {
    justify-content: center;
  }

  .metrics {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
  }

  .metric-number {
    font-size: 2rem;
  }

  .container {
    padding: 0 1rem;
  }

  .filter-bar input {
    min-width: 0;
    width: 100%;
    flex: none;
  }

  .pub-links {
    gap: 0.5rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  h2 {
    font-size: 1.3rem;
  }
}

/* 19. Utilities
   ============================================================================= */
.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent);
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.hidden {
  display: none;
}

/* 20. Epigraph
   ============================================================================= */
.epigraph {
    font-style: italic;
    color: var(--text-muted);
    border-left: 3px solid var(--accent-light);
    padding: 0.5rem 1rem;
    margin: 1rem 0 2rem;
    font-size: 0.9rem;
}
.epigraph cite {
    display: block;
    text-align: right;
    margin-top: 0.25rem;
    font-style: normal;
    font-size: 0.85rem;
}
