/*
 * 自定义样式增强
 * 在主样式文件基础上添加的额外样式
 */

/* ===========================
   首页自我介绍：Kling 工作线
   =========================== */
.about .content {
  font-size: 16px;
  line-height: 1.65;
}

.about-lead,
.about-history {
  margin-bottom: 16px;
}

.about-history {
  margin-top: 18px;
}

.kling-focus {
  margin: 16px 0 14px 18px;
  padding: 14px 10px;
  border: 1px solid #dbeadf;
  border-radius: 8px;
  background: #f1f8f2;
}

.kling-focus-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kling-focus-header .eyebrow {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  background: #3f9f3d;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kling-focus-header p {
  margin: 0;
  color: #4f5964;
  font-size: 15px;
  line-height: 1.5;
}

.kling-focus-item {
  margin-top: 8px;
}

.kling-focus-item:first-child {
  margin-top: 0;
}

.kling-focus-item h3 {
  margin: 0 0 3px;
  color: #3b454f;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.kling-focus-item p {
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.35;
}

.kling-focus-item > a {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
}

/* ===========================
   Experience logo layout
   =========================== */
.experience-logos .item {
  margin-bottom: 20px;
}

.experience-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.experience-text {
  min-width: 0;
}

.experience-logos .item .title {
  margin-bottom: 6px;
}

.experience-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 112px;
}

.experience-logo {
  display: block;
  width: 80px;
  max-width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
}

.experience-logo-kling {
  width: 80px;
  max-width: 80px;
}

.experience-logo-tencent {
  width: 80px;
  max-width: 80px;
}

/* ===========================
   Education logo layout
   =========================== */
.education-logos .item {
  margin-bottom: 20px;
}

.education-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.education-text {
  min-width: 0;
}

.education-logos .item .title {
  margin-bottom: 6px;
}

.education-logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 112px;
}

.education-logo {
  display: block;
  width: 80px;
  max-width: 80px;
  height: 80px;
  object-fit: contain;
}

.education-logo-cuhk {
  width: 80px;
  max-width: 80px;
}

.education-logo-zju {
  width: 80px;
  max-width: 80px;
}

/* ===========================
   项目卡片增强样式
   =========================== */
.cards-section .item {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cards-section .item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* ===========================
   论文列表样式优化
   =========================== */
.latest .item {
  margin-bottom: 30px;
  padding-bottom: 30px;
  border-bottom: 1px solid #e8e8e8;
}

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

.latest .item .project-image {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.latest .item .project-image:hover {
  transform: scale(1.05);
}

/* 视频元素优化 */
.latest .item video {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: block;
  max-width: 260px;
  width: 100%;
}

/* 图片容器优化 */
.latest .item .col-md-4 {
  margin-bottom: 20px;
}

/* 确保图片和视频不会溢出 */
.latest .item .project-image {
  max-width: 100%;
  height: auto;
}

/* 桌面端：确保左右列正确对齐 */
@media (min-width: 768px) {
  .latest .item .col-md-4 {
    margin-bottom: 0;
  }

  .latest .item video,
  .latest .item .project-image {
    max-width: 260px;
  }
}

/* 移动端：确保图片/视频和文字不重叠 */
@media (max-width: 767px) {
  .latest .item .col-md-4 {
    margin-bottom: 25px;
  }

  .latest .item video,
  .latest .item .project-image {
    max-width: 100%;
  }
}

/* ===========================
   链接样式优化
   =========================== */
.more-link {
  display: inline-block;
  margin: 0 5px;
  white-space: nowrap;
}

.more-link i {
  margin-right: 3px;
}

/* 确保论文信息段落有足够的行高 */
.latest .item .desc p {
  line-height: 1.8;
}

/* GitHub stars 图片对齐 */
.latest .item img[alt="GitHub stars"] {
  vertical-align: middle;
  margin-left: 5px;
}

/* ===========================
   新闻列表样式
   =========================== */
.resume-list li {
  margin-bottom: 4px;
  line-height: 1.3;
}

.resume-list details {
  margin-top: 18px;
  padding-left: 0;
  margin-left: 0;
}

.resume-list summary {
  cursor: pointer;
  font-weight: 600;
  color: #49ac43;
  padding: 0;
  transition: color 0.3s ease;
  list-style: none;
}

.resume-list summary::marker {
  content: '';
}

.resume-list summary:hover {
  color: #3a8a35;
}

.pub-note {
  color: #d0021b;
  font-weight: 600;
}

.latest .item .desc .pub-note {
  color: #d0021b;
  font-weight: 700;
}

.latest .heading {
  margin-bottom: 8px;
}

.pub-meta-note {
  margin-bottom: 10px;
}

/* ===========================
   响应式优化
   =========================== */
@media (max-width: 768px) {
  .sections-wrapper > .row > .primary {
    display: contents;
  }

  .sections-wrapper > .row > .primary > .section,
  .sections-wrapper > .row > .primary > .cards-section {
    flex: 0 0 auto;
    width: 100%;
    max-width: 100%;
    padding-right: calc(var(--bs-gutter-x) * 0.5);
    padding-left: calc(var(--bs-gutter-x) * 0.5);
  }

  .sections-wrapper > .row > .primary > .about {
    order: 1;
  }

  .sections-wrapper > .row > .primary > .hiring-section {
    order: 2;
  }

  .sections-wrapper > .row > .primary > .news-section {
    order: 3;
  }

  .sections-wrapper > .row > .secondary {
    order: 4;
  }

  .sections-wrapper > .row > .primary > .cards-section {
    order: 5;
  }

  .sections-wrapper > .row > .primary > .latest {
    order: 6;
  }

  .about .content {
    font-size: 16px;
  }

  .kling-focus {
    margin-left: 0;
    padding: 14px 10px;
  }

  .kling-focus-header {
    display: block;
  }

  .kling-focus-header .eyebrow {
    display: inline-block;
    margin-bottom: 10px;
  }

  .latest .item .col-md-4 {
    margin-bottom: 15px;
  }

  .more-link {
    font-size: 0.9em;
  }

  .cards-section .item {
    margin-bottom: 20px;
  }
}

/* ===========================
   暗色模式优化
   =========================== */
[data-theme="dark"] .latest .item {
  border-bottom-color: #333;
}

[data-theme="dark"] .kling-focus {
  border-color: #333;
  background: #202428;
}

[data-theme="dark"] .kling-focus-header p,
[data-theme="dark"] .kling-focus-item p {
  color: #b9c0c8;
}

[data-theme="dark"] .kling-focus-item h3 {
  color: #fff;
}

[data-theme="dark"] .latest .item .project-image {
  opacity: 0.9;
}

[data-theme="dark"] .latest .item .project-image:hover {
  opacity: 1;
}

/* ===========================
   加载动画（可选）
   =========================== */
.loading {
  text-align: center;
  padding: 50px;
  font-size: 1.2em;
  color: #999;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60% {
    content: '...';
  }
  80%, 100% {
    content: '';
  }
}

/* ===========================
   打印样式优化
   =========================== */
@media print {
  .header .dark-mode-switch,
  .header .btn-cta-primary {
    display: none;
  }

  .cards-section .item {
    page-break-inside: avoid;
  }

  .latest .item {
    page-break-inside: avoid;
  }
}
