/* ===== Teaching page ===== */

.teaching-container {
  margin: 20px 0 60px;
}

/* Section title by year */
.teaching-year {
  font-size: 1.5em;
  margin: 30px 0 14px;
  color: #333;
  border-bottom: 2px solid #ddd;
  padding-bottom: 5px;
}

/* ---------- 瀑布流布局（回退方案：columns） ---------- */
.teaching-grid {
  column-count: 3;      /* 桌面端三列 */
  column-gap: 20px;     /* 列间距 */
}

/* 卡片：避免被 columns 切断 */
.teaching-card {
  display: inline-block;   /* 使其在多列中正确排布 */
  width: 100%;
  margin: 0 0 20px;
  break-inside: avoid;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  transition: transform .15s ease, box-shadow .15s ease;
}

.teaching-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}

/* 图片：统一比例更整齐；若想更“随性”的瀑布效果可去掉 aspect-ratio */
.teaching-card-image img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

/* 内容 */
.teaching-card-content {
  padding: 14px 16px;
}

.teaching-card-title {
  font-size: 1.1em;
  line-height: 1.3;
  margin: 0 0 8px;
}

.teaching-card-title a {
  color: inherit;
  text-decoration: none;
}

.teaching-card-title a:hover {
  text-decoration: underline;
}

.teaching-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  color: #666;
  font-size: 0.9em;
  margin: 0 0 10px;
}

.teaching-card-meta .meta-item i {
  margin-right: 6px;
  color: #9aa4ad;
}

.teaching-card-excerpt {
  font-size: 0.95em;
  color: #333;
  margin: 0;
}

/* 标签 */
.teaching-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  line-height: 1.6;
  border-radius: 999px;
  background: #eef2f6;
  color: #334155;
  border: 1px solid #dbe3ea;
}

.badge-role {
  font-weight: 600;
  border: none;
  color: #fff;
}

/* 不同职责高亮色 */
.badge-lecture { background: #2563eb; }  /* 蓝色 */
.badge-exercise { background: #059669; } /* 绿色 */
.badge-project { background: #d97706; }  /* 橙色 */

/* ---------- 响应式列数 ---------- */
@media (max-width: 1200px) {
  .teaching-grid { column-count: 2; }
}
@media (max-width: 700px) {
  .teaching-grid { column-count: 1; }
}

/* ---------- 渐进增强：原生 CSS Masonry（可选，支持则替换 columns） ---------- */
@supports (grid-template-rows: masonry) {
  .teaching-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: masonry;
    gap: 20px;
    /* 覆盖 columns 模式 */
    column-count: initial;
    column-gap: initial;
  }
  .teaching-card {
    display: block;
    margin: 0;             /* 间距交给 gap 控制 */
    break-inside: auto;    /* Masonry 下不需要 avoid */
  }
  @media (max-width: 1200px) {
    .teaching-grid { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 700px) {
    .teaching-grid { grid-template-columns: 1fr; }
  }
}

/* 暗色模式已移除 */

/* ===== Netflix-style Teaching Archive ===== */
.nf-teaching { margin: 24px 0 64px; }
.nf-header .nf-title { font-size: 2rem; margin: 0 0 10px; }

.nf-section + .nf-section { margin-top: 28px; }
.nf-year {
  font-size: 1.4rem; margin: 18px 0 12px;
  color: #e50914; font-weight: 700; letter-spacing: .2px;
}

.nf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 1100px) { .nf-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .nf-grid { grid-template-columns: 1fr; } }

.nf-card { display: flex; flex-direction: column; }
.nf-poster {
  position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: #0f0f0f; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.nf-poster.noimg { background: linear-gradient(135deg, #1f2937 0%, #0f172a 100%); }

.nf-poster img {
  width: 100%; height: 100%; object-fit: cover; transform: scale(1);
  transition: transform .25s ease, filter .25s ease; display: block;
}
.nf-card:hover .nf-poster img { transform: scale(1.05); filter: brightness(1.05); }

.nf-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.62) 0%, rgba(0,0,0,0) 60%);
  pointer-events: none;
}

.nf-badges {
  position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2;
}
.nf-badge {
  display: inline-block; padding: 2px 8px; font-size: 12px; line-height: 1.6;
  border-radius: 999px; background: rgba(255,255,255,.9); color: #111;
  border: 1px solid rgba(255,255,255,.6); backdrop-filter: blur(2px);
}
.nf-role { font-weight: 700; color: #fff; border: none; background: #475569; }
.nf-lecture { background: #2563eb; }
.nf-exercise { background: #059669; }
.nf-project { background: #d97706; }
.nf-seminar { background: #7c3aed; }
.nf-workshop { background: #db2777; }
.nf-teaching-assistant { background: #14b8a6; }

/* level badges: 本科 / 硕士 */
.nf-level { font-weight: 700; color: #fff; border: none; }
.nf-undergrad { background: #0ea5e9; } /* 天蓝：本科 */
.nf-graduate { background: #8b5cf6; }  /* 紫色：硕士 */

.nf-title {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.3;
  text-shadow: 0 2px 8px rgba(0,0,0,.6); z-index: 2;
}

.nf-meta {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center;
  color: #6b7280; font-size: .92rem; margin-top: 8px;
}
.nf-meta .meta-item i { margin-right: 6px; color: #9aa4ad; }

.nf-excerpt { margin: 6px 2px 0; font-size: .95rem; color: #374151; }



/* ===== Teaching Single Hero ===== */
.teaching-hero { position: relative; margin: 10px 0 18px; }
.teaching-hero__media { position: relative; border-radius: 14px; overflow: hidden; }
.teaching-hero__media img { width: 100%; height: 260px; object-fit: cover; display: block; }
.teaching-hero__overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.5), rgba(0,0,0,0)); }
.teaching-hero__content { position: absolute; left: 18px; right: 18px; bottom: 14px; color: #fff; }
.teaching-hero__title { margin: 0 0 6px; font-size: 1.6rem; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.teaching-hero__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.teaching-hero__meta { display: flex; gap: 10px 14px; flex-wrap: wrap; font-size: .95rem; color: #e5e7eb; }
.teaching-hero__meta .meta-item i { margin-right: 6px; color: #f3f4f6; }
@media (max-width: 700px) { .teaching-hero__media img { height: 200px; } }

