/**
 * Legacy Compatibility & Publication Styles
 * 兼容旧代码和project_renderer.js动态渲染的样式
 */

/* ============================================
   PUBLICATION TABLE COMPATIBILITY
   兼容publication动态渲染使用的table结构
   ============================================ */

#pubs table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;  /* Override cellspacing="17" in HTML */
  margin: 0;
}

#pubs tbody {
  display: block;
}

#pubs tr {
  display: flex;
  gap: 1rem;  /* Vincent: 1rem gap */
  padding: 0.5rem 0;  /* Compact: reduced from 1rem */
  border-bottom: 1px solid var(--color-border-light);  /* Separator line */
  transition: none;  /* No hover effect */
  align-items: flex-start;
  margin-bottom: 0;  /* Remove margin, use border instead */
}

#pubs tr:hover {
  background-color: transparent;  /* No hover background */
}

#pubs tr:last-child {
  border-bottom: none;  /* No border after last item */
}

/* 图片列 */
#pubs td:first-child {
  flex-shrink: 0;
  width: 180px;  /* Vincent: 180px */
  text-align: center;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#pubs td:first-child img,
#pubs td:first-child video {
  width: 180px;  /* Vincent: 180px */
  height: 101px;  /* Vincent: 101px (16:9 ratio) */
  border-radius: 4px;  /* Vincent: 4px */
  object-fit: cover;
}

/* 文字内容列 */
#pubs td:last-child {
  flex: 1;
  min-width: 0;
  padding: 0;
  vertical-align: top;
}

/* 标题样式 - Vincent: 1rem, 600 weight */
#pubs .title,
#pubs div.title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  color: var(--color-text-primary);
}

#pubs .title a,
#pubs div.title a {
  color: var(--color-text-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

#pubs .title a:hover,
#pubs div.title a:hover {
  color: var(--color-link-default);
  text-decoration: underline;
}

/* 作者样式 - Vincent: .9rem, muted color */
#pubs .author,
#pubs div.author {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 0.2rem;
  font-weight: var(--font-weight-normal);
}

#pubs .author a,
#pubs div.author a {
  color: var(--color-text-muted);
  text-decoration: none;
}

#pubs .author a:hover,
#pubs div.author a:hover {
  color: var(--color-link-default);
  text-decoration: none;
}

/* 高亮作者名(通常是自己) */
#pubs span.me {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* Venue样式 - Vincent: .9rem, separate line */
#pubs .venue-line {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

#pubs .venue-line .venue {
  font-weight: normal;
}

#pubs .venue-line .venue b {
  font-weight: 600;
}

/* Award标签 - Vincent: amber color #d97706, inline with venue */
#pubs .venue-line .award {
  color: #d97706;
  font-weight: 500;
}

/* Legacy: Keep old em/i styles for backward compatibility */
#pubs em,
#pubs i {
  font-size: 0.9rem;
  color: var(--color-text-primary);
  font-style: normal;
  font-weight: normal;
  line-height: 1.5;
  display: block;
  margin-bottom: 0.5rem;
}

/* Award标签 - Standalone (legacy fallback) */
#pubs > div.award {
  font-size: 0.875rem;
  color: #d97706;
  font-weight: var(--font-weight-medium);
  margin-top: 0.25rem;
  display: inline-block;
}

/* Material链接 - Vincent: .875rem, .75rem gap */
#pubs .material,
#pubs div.material {
  margin-top: 0;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

#pubs .material a,
#pubs div.material a {
  color: var(--color-link-default);
  text-decoration: none;
}

#pubs .material a:hover,
#pubs div.material a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* Year/Topic section headers */
#pubs h4 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  margin-top: var(--spacing-subsection);
  margin-bottom: var(--spacing-element);
  padding-bottom: var(--spacing-tight);
  border-bottom: var(--border-width-thin) solid var(--color-border-light);
}

#pubs h4:first-child {
  margin-top: 0;
}

/* Anchor spacers */
#pubs .text.anchor {
  display: block;
  height: auto;  /* allow headings to take up space so content below doesn't overlap */
  margin: 0;
  padding: 0;
}


/* ============================================
   LEGACY CLASSES COMPATIBILITY
   兼容旧CSS中的类名
   ============================================ */

/* 高亮文本 */
span.highlight {
  background-color: #ffffd0;
  padding: 0.1em 0.2em;
}

/* list-year右对齐(用于Teaching/Awards) */
.list-year {
  float: right;
  margin-left: var(--spacing-item);
  color: var(--color-text-muted);
  font-weight: var(--font-weight-medium);
  text-align: right;
  font-size: var(--font-size-tiny);
}


/* ============================================
   RESPONSIVE - Publications移动端
   ============================================ */

@media (max-width: 768px) {
  /* Publications - 移动端纵向排列 */
  #pubs tr {
    flex-direction: column;
    gap: var(--spacing-item);
    padding: var(--spacing-compact);
    align-items: center;
  }

  #pubs td:first-child {
    width: 100%;
    max-width: 200px;
  }

  #pubs td:first-child img {
    max-width: 180px;
  }

  #pubs td:last-child {
    width: 100%;
  }

  /* 移动端字号调整 */
  #pubs .title,
  #pubs div.title {
    font-size: var(--font-size-base);
    text-align: left;
  }

  #pubs .author,
  #pubs div.author {
    font-size: var(--font-size-tiny);
  }

  #pubs h4 {
    font-size: var(--font-size-h2);
  }
}
