/* ============================================
   MODERN ACADEMIC WEBSITE - CSS STYLESHEET
   ============================================ */

/* Root Variables */
:root {
  --primary-color: #d00000;
  --secondary-color: #f5f1e7;
  --accent-color: #c7c8ca;
  --text-color: #001226;
  --light-bg: #f5f1e7;
  --border-color: #c7c8ca;
  --font-sans: 'Lato', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-serif: Georgia, serif;
  --spacing-unit: 1rem;
  --transition: all 0.3s ease;
  --max-width: 1000px;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */

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

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

body {
  font-family: var(--font-sans);
  color: var(--text-color);
  line-height: 1.6;
  background-color: #fefdfa;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--primary-color);
  margin: var(--spacing-unit) 0 0.5rem 0;
  font-weight: 600;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

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

h1 a:hover {
  /* color: var(--secondary-color); */
  text-decoration: underline;
}

h2 {
  font-size: 2rem;
  border-bottom: 3px solid var(--primary-color);
  padding-bottom: 0.5rem;
  margin: 2rem 0 1rem 0;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.2rem;
}

p {
  margin-bottom: var(--spacing-unit);
  text-align: justify;
}

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

a:hover {
  /* color: var(--secondary-color); */
  text-decoration: underline;
}

strong, b {
  font-weight: 700;
  color: var(--text-color);
}

em, i {
  font-style: italic;
}

hr {
  border: none;
  border-top: 2px solid var(--border-color);
  margin: 2rem 0;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header, .header {
  /* background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%); */
  background: var(--primary-color);
  color: #f5f1e7;
  padding: 0.75rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

nav, .site-navigation {
  max-width: var(--max-width);
  margin: 0 auto;
  /* padding: 0 var(--spacing-unit); */
}

nav ul, .site-navigation ul {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 0; 
  padding: 0;
}

nav li, .site-navigation li {
  position: relative;
}

nav a, .site-navigation a {
  position: relative;
  color: #f5f1e7;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.5rem 0.5rem;
  transition: var(--transition);
}

nav a:hover, .site-navigation a:hover {
background-color: transparent; 
  color: white;
}

nav a.active, .site-navigation a.active {
background-color: transparent; 
  color: white;
}

/* 添加现代感的底边框动效 */
nav a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 50%;
  background-color: white;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

nav a:hover::after, nav a.active::after {
  width: 80%; /* 悬停或激活时展开 */
}

/* Remove H3 styling inside nav */
nav h3, .site-navigation h3 {
  display: none;
}

/* ============================================
   LAYOUT
   ============================================ */

.content, main {
  min-height: calc(100vh - 400px);
  padding: 2rem 0;
  background-color: #fefdfa;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-unit);
}

/* Profile Section */
.profile-section {
  display: grid;
  grid-template-columns: 1fr 250px;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}

#left, .profile-content {
  order: 1;
}

#right-float, .profile-image {
  order: 2;
  text-align: center;
}

#right-float img, .profile-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px; 
  box-shadow: 0 10px 20px rgba(0,0,0,0.1); 
  border: 1px solid var(--border-color);
}

/* ============================================
   CONTACT INFORMATION
   ============================================ */

.contact-info {
  background-color: var(--light-bg);
  line-height: 1.4;
  padding: 0.75rem;
  border-left: 4px solid var(--primary-color);
  border-radius: 4px;
  margin: 1.5rem 0;
}

.contact-info p {
  margin: 0.5rem 0;
  text-align: left;
}

/* ============================================
   LISTS
   ============================================ */

ul, ol {
  margin-left: 2rem;
  margin-bottom: var(--spacing-unit);
}

ul ul, ol ol {
  margin-top: 0.5rem;
  margin-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
  line-height: 1.8;
}

/* Remove nested list indentation issues */
ul ul {
  list-style-type: circle;
}

ul ul ul {
  list-style-type: square;
}

/* Publication Lists */
.publications-list {
  list-style: none;
  margin-left: 0;
}

.publications-list li {
  padding: 1rem;
  margin-bottom: 1rem;
  background-color: var(--light-bg);
  border-left: 4px solid var(--primary-color);
  border-radius: 4px;
  transition: var(--transition);
}

/*
.publications-list li:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateX(4px);
}
*/

.publication-year {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  margin-right: 0.5rem;
  font-weight: 600;
}

/* ============================================
   IMAGES
   ============================================ */

img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

figure {
  margin: 1.5rem 0;
  text-align: center;
}

figcaption {
  font-style: italic;
  color: #666;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
  background-color: var(--primary-color);
  color: #fefdfa;
  padding: 1.0rem 0;
  margin-top: 1rem;
  text-align: center;
  font-size: 0.95rem;
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer p {
  margin: 0.5rem 0;
  text-align: center;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: var(--transition);
  border: 2px solid var(--primary-color);
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary-color);
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: white;
}

/* ============================================
   COURSE LISTING
   ============================================ */

.course-list {
  list-style: none;
  margin-left: 0;
}

.course-list li {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.course-list li:last-child {
  border-bottom: none;
}

.course-term {
  background-color: var(--light-bg);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-color);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  :root {
    font-size: 14px;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .profile-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  #right-float, .profile-image {
    order: -1;
    max-width: 300px;
    margin: 0 auto;
  }

  nav ul, .site-navigation ul {
    gap: 1rem;
    justify-content: flex-start;
    padding: 0 var(--spacing-unit);
  }

  nav a, .site-navigation a {
    font-size: 1rem;
    padding: 0.4rem 0.8rem;
  }

  p {
    text-align: left;
  }

  .publications-list li {
    padding: 0.75rem;
  }

  .course-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  :root {
    --spacing-unit: 0.75rem;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  nav ul, .site-navigation ul {
    flex-direction: column;
    gap: 0.5rem;
  }

  nav a, .site-navigation a {
    display: block;
    padding: 0.75rem;
    text-align: center;
  }

  .contact-info {
    padding: 1rem;
  }

  ul, ol {
    margin-left: 1.5rem;
  }

  #right-float img, .profile-image img {
    max-width: 200px;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

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

.text-muted {
  color: #999;
}

.mt-1 { margin-top: var(--spacing-unit); }
.mt-2 { margin-top: calc(var(--spacing-unit) * 2); }
.mb-1 { margin-bottom: var(--spacing-unit); }
.mb-2 { margin-bottom: calc(var(--spacing-unit) * 2); }
.p-1 { padding: var(--spacing-unit); }
.p-2 { padding: calc(var(--spacing-unit) * 2); }

.section-divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  margin: 1rem auto;
}

/* ============================================
   EXTERNAL LINK INDICATOR
   ============================================ */

/* 匹配所有以 http 开头的链接，但排除掉指向你自己网站（huijingdu.github.io）的链接 */
a[href^="http"]:not([href*="huijingdu.github.io"])::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 5px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c7c8ca' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'%3E%3C/path%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cline x1='10' y1='14' x2='21' y2='3'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: middle;
}

/* 悬停时图标变色 */
a[href^="http"]:not([href*="huijingdu.github.io"]):hover::after {
  color: var(--primary-color);
  transform: translate(2px, -2px); /* 悬停时有一个向右上方的微动效 */
}

/* 针对页脚链接的特殊处理（如果页脚链接背景是红色，图标应为白色或浅色） */
footer a[href^="http"]::after {
  color: rgba(255, 255, 255, 0.7);
}
