/* ============================================
   Modern Academic Site - Fluid-inspired Theme
   ============================================ */

/* CSS Variables */
:root {
  --primary: #2c3e50;
  --primary-light: #3498db;
  --accent: #29d;
  --text: #333;
  --text-light: #666;
  --text-muted: #999;
  --bg: #f5f5f5;
  --bg-white: #fff;
  --border: #eee;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12);
  --radius: 8px;
  --transition: all 0.3s ease;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
  --max-width: 1200px;
  --nav-height: 60px;
}

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

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

body {
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}

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

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

/* ============================================
   Progress Bar (top of page)
   ============================================ */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary-light));
  z-index: 9999;
  transition: width 0.1s ease;
}

/* ============================================
   Navigation
   ============================================ */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  transition: var(--transition);
}

.site-nav.transparent {
  background: transparent;
}

.site-nav.scrolled {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

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

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  transition: var(--transition);
}

.site-nav.transparent .nav-brand {
  color: #fff;
}

.site-nav.scrolled .nav-brand {
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
}

.nav-links a {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.site-nav.transparent .nav-links a {
  color: rgba(255, 255, 255, 0.9);
}

.site-nav.transparent .nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.site-nav.scrolled .nav-links a {
  color: var(--text);
}

.site-nav.scrolled .nav-links a:hover {
  color: var(--primary-light);
  background: rgba(41, 221, 221, 0.08);
}

/* Mobile Nav Toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 5px 0;
  transition: var(--transition);
}

.site-nav.transparent .nav-toggle span {
  background: #fff;
}

.site-nav.scrolled .nav-toggle span {
  background: var(--text);
}

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

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    padding: 16px;
    gap: 4px;
    box-shadow: var(--shadow);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .nav-links a {
    color: var(--text) !important;
    padding: 12px 20px;
    border-radius: var(--radius);
  }

  .nav-links a:hover {
    background: var(--bg) !important;
  }
}

/* ============================================
   Hero Banner
   ============================================ */
.hero {
  position: relative;
  height: 70vh;
  min-height: 400px;
  max-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(44, 62, 80, 0.7), rgba(52, 152, 219, 0.5));
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  padding: 0 24px;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
  font-size: 1.15rem;
  font-weight: 300;
  opacity: 0.9;
  line-height: 1.6;
}

.hero-subtitle .typing-cursor {
  animation: blink 1s infinite;
  font-weight: 100;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Page Hero (smaller, for sub-pages) */
.hero.hero-page {
  height: 45vh;
  min-height: 280px;
  max-height: 400px;
}

.hero.hero-page .hero-title {
  font-size: 2.2rem;
}

@media (max-width: 768px) {
  .hero {
    height: 55vh;
    min-height: 320px;
    background-attachment: scroll;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .hero.hero-page {
    height: 40vh;
    min-height: 240px;
  }

  .hero.hero-page .hero-title {
    font-size: 1.8rem;
  }
}

/* ============================================
   Main Content Container
   ============================================ */
.main-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
}

/* ============================================
   Card Grid (Posts)
   ============================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 992px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

/* Post Card */
.post-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.post-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: var(--transition);
}

.post-card:hover .post-card-img {
  transform: scale(1.03);
}

.post-card-img-wrapper {
  overflow: hidden;
  height: 180px;
}

.post-card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-title:hover {
  color: var(--primary-light);
}

.post-card-excerpt {
  font-size: 0.88rem;
  color: var(--text-light);
  line-height: 1.7;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

.post-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.post-card-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(41, 170, 221, 0.08);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 48px;
  padding: 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.pagination a {
  color: var(--text);
  background: var(--bg-white);
  box-shadow: var(--shadow);
}

.pagination a:hover {
  background: var(--accent);
  color: #fff;
}

.pagination .current {
  background: var(--accent);
  color: #fff;
}

/* ============================================
   Page Content (About, Publications)
   ============================================ */
.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

.page-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 40px 0 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.page-content p {
  margin-bottom: 16px;
  color: var(--text);
}

.page-content ol,
.page-content ul {
  padding-left: 20px;
  margin-bottom: 24px;
}

.page-content li {
  margin-bottom: 16px;
  line-height: 1.8;
}

.page-content a {
  color: var(--primary-light);
  border-bottom: 1px dashed var(--primary-light);
}

.page-content a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.page-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 40px 0;
}

/* About Page Profile */
.about-profile {
  text-align: center;
  margin-bottom: 48px;
}

.about-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-white);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.about-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.about-tagline {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.about-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}

.about-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
  border: none;
  transition: var(--transition);
}

.about-links a:hover {
  background: var(--accent);
  color: #fff;
}

/* About Info Cards */
.info-card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.info-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-card p {
  margin-bottom: 8px;
  color: var(--text-light);
}

/* ============================================
   Publication Page
   ============================================ */
.pub-section {
  margin-bottom: 40px;
}

.pub-section h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.pub-item {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.pub-item:hover {
  border-left-color: var(--accent);
  transform: translateX(4px);
}

.pub-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.6;
}

.pub-journal {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pub-links {
  display: flex;
  gap: 12px;
}

.pub-links a {
  font-size: 0.82rem;
  padding: 3px 12px;
  border-radius: 12px;
  background: rgba(41, 170, 221, 0.08);
  color: var(--accent);
  font-weight: 500;
  border: none;
}

.pub-links a:hover {
  background: var(--accent);
  color: #fff;
}

.pub-status {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(255, 193, 7, 0.12);
  color: #e67e22;
  font-weight: 500;
}

.pub-note {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Tags Page
   ============================================ */
.tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
  justify-content: center;
}

.tags-cloud a {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 20px;
  background: var(--bg-white);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: none;
}

.tags-cloud a:hover {
  background: var(--accent);
  color: #fff;
}

.tag-section {
  margin-bottom: 32px;
}

.tag-section-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  padding: 8px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-section-title::before {
  content: '#';
  color: var(--accent);
  font-weight: 700;
}

.tag-post-item {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  align-items: baseline;
  gap: 16px;
}

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

.tag-post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 100px;
}

.tag-post-title {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

.tag-post-title:hover {
  color: var(--primary-light);
}

/* ============================================
   Post (Article) Page
   ============================================ */
.post-article {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
}

.post-article-header {
  margin-bottom: 32px;
}

.post-article-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.post-article-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.4;
  margin-bottom: 8px;
}

.post-article-subtitle {
  font-size: 1.2rem;
  color: var(--text-light);
  font-weight: 400;
  margin-bottom: 12px;
}

.post-article-meta {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.post-article-content {
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text);
}

.post-article-content h1,
.post-article-content h2,
.post-article-content h3,
.post-article-content h4 {
  color: var(--primary);
  margin-top: 32px;
  margin-bottom: 16px;
  font-weight: 700;
}

.post-article-content h2 {
  font-size: 1.5rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.post-article-content h3 {
  font-size: 1.25rem;
}

.post-article-content p {
  margin-bottom: 20px;
}

.post-article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(41, 170, 221, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-light);
}

.post-article-content code {
  font-family: var(--font-mono);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.post-article-content pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
}

.post-article-content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.post-article-content img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 20px 0;
}

/* Post Navigation */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.post-nav-item {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.post-nav-item:hover {
  box-shadow: var(--shadow-hover);
}

.post-nav-item.next {
  text-align: right;
}

.post-nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.post-nav-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 576px) {
  .post-nav {
    flex-direction: column;
  }
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  background: var(--primary);
  color: rgba(255, 255, 255, 0.7);
  padding: 40px 24px;
  text-align: center;
  margin-top: 60px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  transition: var(--transition);
}

.footer-social a:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

.footer-copyright {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* ============================================
   Scroll to Top
   ============================================ */
.scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 900;
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 40px; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

.post-card {
  opacity: 0;
  animation: fadeInUp 0.5s ease forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }
.post-card:nth-child(6) { animation-delay: 0.6s; }
.post-card:nth-child(7) { animation-delay: 0.7s; }
.post-card:nth-child(8) { animation-delay: 0.8s; }
.post-card:nth-child(9) { animation-delay: 0.9s; }

/* ============================================
   Side Catalog (for post pages)
   ============================================ */
.side-catalog {
  position: sticky;
  top: 80px;
}

.side-catalog h5 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.catalog-body {
  list-style: none;
  padding: 0;
}

.catalog-body li {
  margin-bottom: 4px;
}

.catalog-body a {
  display: block;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--text-light);
  border-left: 2px solid transparent;
  border-radius: 0;
  transition: var(--transition);
}

.catalog-body a:hover,
.catalog-body .active a {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(41, 170, 221, 0.04);
}

.h2_nav a { padding-left: 12px; }
.h3_nav a { padding-left: 24px; font-size: 0.82rem; }
.h4_nav a { padding-left: 36px; font-size: 0.8rem; }
