/**
 * 课程 · 合作机构 · 团队 · 平台介绍 (Content modules)
 *
 * 这几个模块都是「卡片网格 + 筛选条」的同一套骨架，样式放在一起。
 * 栅格、按钮、徽章仍然用 design-system.css 里的，这里只写各自独有的部分。
 *
 * 由 views/frontend/courses/* 与 views/frontend/platform/* 引入。
 */

/* ── 课程 (Courses) ── */

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 22px;
}
.course-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.10); }
.course-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #F5F0E6;
  display: block;
}
.course-thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; color: #C8BFA8;
}
.course-body { padding: 15px 16px 17px; flex: 1; display: flex; flex-direction: column; }
.course-title { font-size: 15.5px; font-weight: 600; margin: 0 0 5px; line-height: 1.45; }
.course-meta  { font-size: 13px; color: var(--c-muted); margin: 0 0 10px; }
.course-tags  { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* 课程详情 */
.course-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #140A06;
  border-radius: 12px;
  display: block;
}
.chapter-list { list-style: none; margin: 0; padding: 0; }
.chapter-list li {
  border: 1px solid var(--c-border);
  border-radius: 9px;
  padding: 11px 14px;
  margin-bottom: 9px;
  background: #fff;
}
.chapter-list li.is-active { border-color: var(--c-gold); background: #FFFBF2; }
.chapter-list button {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
}
.chapter-list .ch-no {
  display: inline-block; min-width: 22px;
  color: var(--c-red); font-weight: 700;
}
.chapter-list .ch-dur { float: right; font-size: 12px; color: var(--c-muted); }

/* =====================================================================
 * 合作机构 · 团队 · 平台介绍
 * ===================================================================== */

.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.partner-card {
  display: block;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.partner-card:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.09); border-color: var(--c-gold); }
.partner-logo {
  width: 54px; height: 54px; border-radius: 10px;
  object-fit: cover; background: #F5F0E6; margin-bottom: 12px;
}
.partner-name { font-size: 16px; font-weight: 600; margin: 0 0 4px; line-height: 1.4; }
.partner-loc  { font-size: 13px; color: var(--c-muted); margin: 0 0 10px; }
.partner-desc { font-size: 13.5px; color: var(--c-ink-light, #3D3D3D); margin: 0; line-height: 1.65; }

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 20px;
}
.team-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 22px 18px;
  text-align: center;
}
.team-photo {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; background: #F5F0E6; margin: 0 auto 12px; display: block;
}
.team-photo-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #C8BFA8;
}
.team-name { font-size: 16.5px; font-weight: 600; margin: 0 0 6px; }
.team-positions { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.team-pos {
  font-size: 12.5px;
  color: var(--c-muted);
  line-height: 1.5;
}
.team-pos.is-primary { color: var(--c-red); font-weight: 600; }
.team-intro { font-size: 13px; color: var(--c-muted); line-height: 1.65; margin: 0; }

.intro-section { margin-bottom: 44px; }
.intro-section > h2 {
  font-family: "Noto Serif SC", serif;
  font-size: 1.5rem;
  color: var(--c-red);
  border-bottom: 2px solid var(--c-gold);
  padding-bottom: 9px;
  margin: 0 0 22px;
}
.intro-block {
  background: #fff;
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-gold);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 16px;
}
.intro-block h3 { font-size: 17px; margin: 0 0 10px; color: var(--c-ink); }
.intro-block p  { margin: 0 0 10px; line-height: 1.85; }
.intro-block p:last-child { margin-bottom: 0; }
.intro-block img { max-width: 100%; border-radius: 8px; margin-top: 12px; }

/* =====================================================================
 * 赛事系统 (Competitions)
 * ===================================================================== */

.comp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
.comp-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.comp-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.10); }
.comp-cover {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: #F5F0E6; display: block;
}
.comp-cover-fallback { display:flex; align-items:center; justify-content:center; font-size:38px; color:#C8BFA8; }
.comp-body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
.comp-title { font-size: 16.5px; font-weight: 600; margin: 0 0 8px; line-height: 1.45; }
.comp-dates { font-size: 13px; color: var(--c-muted); margin: 0 0 12px; line-height: 1.7; }
.comp-card .comp-phase { margin-top: auto; }

/* 阶段徽章 */
.comp-phase {
  display: inline-block; padding: 3px 12px; border-radius: 12px;
  font-size: 12px; font-weight: 600;
}
.comp-phase.upcoming { background:#F0EEE9; color:#77716A; }
.comp-phase.signup   { background:#E4F5E9; color:#1E6B39; }
.comp-phase.review   { background:#E4F1FA; color:#1B5E86; }
.comp-phase.vote     { background:#FBE9E9; color:#8B1F1F; }
.comp-phase.judging  { background:#FFF4E0; color:#9A6B00; }
.comp-phase.contest  { background:#FFF4E0; color:#9A6B00; }
.comp-phase.result   { background:#E9E7FA; color:#40348C; }

/* 赛程时间轴 */
.comp-timeline { list-style: none; margin: 0; padding: 0; }
.comp-timeline li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px dashed var(--c-border);
}
.comp-timeline li:last-child { border-bottom: 0; }
.comp-timeline li.is-now { color: var(--c-red); font-weight: 600; }
.comp-timeline .tl-date { font-size: 13px; color: var(--c-muted); }
.comp-timeline li.is-now .tl-date { color: var(--c-red); }

/* 作品公示 */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 20px;
}
.work-card {
  background: #fff; border: 1px solid var(--c-border);
  border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.work-card video { width: 100%; aspect-ratio: 16/9; background: #140A06; display: block; }
.work-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.work-name { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.work-meta { font-size: 13px; color: var(--c-muted); margin: 0 0 12px; }
.work-foot {
  margin-top: auto; display: flex; align-items: center;
  justify-content: space-between; gap: 10px;
}
.work-votes {
  font-family: "Noto Serif SC", serif;
  font-size: 19px; font-weight: 700; color: var(--c-red);
}
.work-votes small { font-size: 12px; font-weight: 400; color: var(--c-muted); }

/* 成绩榜 */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  font-size: 12.5px; font-weight: 700;
  background: #F0EEE9; color: #77716A;
}
.rank-badge.r1 { background: linear-gradient(135deg,#E3C58F,#C9A063); color:#4A3410; }
.rank-badge.r2 { background: #DCDCDC; color:#4A4A4A; }
.rank-badge.r3 { background: #E8CDB2; color:#5A3A1E; }

/* =====================================================================
   课程页（参照 new_system_v2 的 courses.html）
   筛选卡片 + 横向条目
   ===================================================================== */

.course-filters { padding: 18px 20px; }
.cf-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  align-items: end;
}
.cf-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cf-field label { font-size: .82rem; color: var(--c-muted); }
.cf-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: #fff;
  color: var(--c-ink);
  font-size: .9rem;
}
.cf-actions { flex-direction: row; gap: 8px; }
.cf-actions .btn { flex: 1 1 auto; white-space: nowrap; }

/* ── 横向条目 ── */
.course-rows { display: flex; flex-direction: column; gap: 12px; }

.course-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px;
  background: var(--c-paper-2, #fff);
  border: 1px solid var(--c-border);
  border-radius: var(--radius, 10px);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}
a.course-row:hover {
  border-color: var(--c-red);
  box-shadow: 0 6px 20px rgba(139, 26, 26, .12);
  transform: translateY(-1px);
}
.course-row.is-static { cursor: default; }

.cr-cover {
  flex: none;
  width: 160px;
  height: 100px;
  border-radius: 6px;
  background: #f5efe6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  overflow: hidden;
}
.cr-cover img { width: 100%; height: 100%; object-fit: cover; }

.cr-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.cr-title { font-weight: 700; font-size: 1.02rem; color: var(--c-ink); }
.cr-title .badge { margin-left: 6px; vertical-align: middle; }
.cr-meta { font-size: .82rem; color: var(--c-muted); }
.cr-desc { font-size: .84rem; color: var(--c-ink-light, #6b6259); line-height: 1.7; }

.cr-go {
  flex: none;
  align-self: center;
  font-size: .85rem;
  color: var(--c-red);
  white-space: nowrap;
  text-decoration: none;
}

@media (max-width: 640px) {
  .course-row { flex-wrap: wrap; }
  .cr-cover { width: 100%; height: 150px; }
  .cr-go { align-self: flex-start; }
}

/* =====================================================================
   赛事系统（参照 new_system_v2 的 events.html）
   线上/线下分栏 + 大卡片 + 四格时间节点
   ===================================================================== */

.ev-subnav { background: #fff; border-bottom: 1px solid var(--c-border); }
.ev-subnav-inner { display: flex; gap: 6px; padding-top: 10px; padding-bottom: 0; }
.ev-tab {
  padding: 11px 20px;
  font-size: .92rem;
  color: var(--c-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: var(--transition);
}
.ev-tab:hover { color: var(--c-red); }
.ev-tab.active { color: var(--c-red); border-bottom-color: var(--c-red); font-weight: 600; }

.ev-list { display: flex; flex-direction: column; gap: 18px; }

.ev-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 18px;
  padding: 28px 30px 24px;
  box-shadow: var(--shadow-sm);
}
.ev-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ev-card h3 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #6b1410;
  line-height: 1.35;
}
.ev-intro { color: #555; font-size: .92rem; line-height: 1.9; margin: 0 0 20px; }

.ev-nodes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 16px;
}
.ev-node {
  background: #faf5f0;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 13px 8px;
  text-align: center;
}
.ev-node .k { font-size: .78rem; color: var(--c-muted); margin-bottom: 4px; }
.ev-node .v {
  font-size: .92rem;
  color: #6b1410;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ev-countdown {
  margin: 0 0 16px;
  font-size: .86rem;
  color: var(--c-muted);
}
.ev-countdown strong { color: var(--c-red); font-size: 1.05rem; }
/* 已结束／待定：不再用醒目的红色，避免和进行中的赛事抢注意力 */
.ev-countdown-over { color: var(--c-muted, #8A7F6E); }

.ev-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.ev-empty-cat { text-align: center; color: #888; padding: 60px 0; font-size: .95rem; }

@media (max-width: 640px) {
  .ev-card { padding: 22px 18px 20px; border-radius: 14px; }
  .ev-card h3 { font-size: 1.15rem; }
  .ev-nodes { grid-template-columns: repeat(2, 1fr); }
  .ev-actions .btn { width: 100%; text-align: center; }
}

/* =====================================================================
   赛事详情的文档式版头（参照 new_system_v2 的 events-rules.html）
   参考站的赛事详情本质是一份《竞赛规程》，我们内容更全，
   缺的是「读起来像一份正式文件」。
   ===================================================================== */

.comp-doc-head { padding-top: 0; overflow: hidden; }

.comp-doc-cover {
  display: block;
  width: calc(100% + 2px);
  margin: -1px -1px 18px;
  max-height: 260px;
  object-fit: cover;
}

.comp-doc-eyebrow {
  font-family: "Noto Serif SC", serif;
  font-size: .78rem;
  letter-spacing: .3em;
  color: var(--c-muted);
  margin: 0 0 6px;
}

.comp-doc-title {
  font-family: "Noto Serif SC", "STKaiti", serif;
  font-size: 1.55rem !important;
  line-height: 1.4;
  letter-spacing: 1px;
}

.comp-doc-meta {
  color: var(--c-muted);
  font-size: .85rem;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}

.comp-doc-lead { margin-bottom: 16px; }

/* 目录 */
.comp-doc-toc {
  background: #faf5f0;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  align-items: baseline;
}
.comp-doc-toc-label {
  font-family: "Noto Serif SC", serif;
  font-size: .8rem;
  color: var(--c-muted);
  letter-spacing: .2em;
  margin-right: 4px;
}
.comp-doc-toc a {
  font-size: .86rem;
  color: var(--c-red);
  text-decoration: none;
  white-space: nowrap;
}
.comp-doc-toc a:hover { text-decoration: underline; }

/* 锚点跳转时不要被吸顶的导航挡住标题 */
[id^="sec-"] { scroll-margin-top: 90px; }

/* ── 赛程倒计时（我们自己加的，参考站只摆日期不倒数）── */
.comp-countdown {
  text-align: center;
  background: linear-gradient(135deg, #fffdf8, #fdf3e8);
  border-color: #e8d9bf;
}
.cd-label {
  margin: 0 0 10px;
  font-size: .86rem;
  color: var(--c-muted);
  letter-spacing: .12em;
}
.cd-clock { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.cd-unit {
  min-width: 62px;
  padding: 8px 6px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
}
.cd-unit b {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
  color: #8b1a1a;
  font-variant-numeric: tabular-nums;
}
.cd-unit i { font-style: normal; font-size: .72rem; color: var(--c-muted); }
.cd-target { margin: 10px 0 0; font-size: .8rem; color: var(--c-muted); }
.comp-countdown.is-done .cd-unit b { color: var(--c-muted); }

/* ── 奖项卡片（参照 new_system_v2 的 events-scores.html）── */
.award-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.award-card {
  border: 1px solid #d9b45c;
  background: linear-gradient(135deg, #fffdf8, #fff);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
}
.award-card .medal { font-size: 30px; line-height: 1; }
.award-card .an {
  font-weight: 700;
  color: #6b1410;
  font-size: 1rem;
  margin: 8px 0 2px;
}
.award-card .rn { font-size: .78rem; color: #b49147; }
.award-card .pn { font-size: .92rem; color: var(--c-ink); margin-top: 6px; }
.award-card .un { font-size: .78rem; color: var(--c-muted); margin-top: 2px; }
.award-card .cn {
  font-size: .72rem;
  color: var(--c-muted);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

/* ── 参赛公示：证件照回退与人气排行榜 ───────────────────────── */
.work-photo { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #F3EFE7; }

.rank-board {
  border: 1px solid var(--c-border, #E6DFD3);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.rank-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border, #E6DFD3);
}
.rank-item:last-child { border-bottom: 0; }
.rank-item:nth-child(odd) { background: #FCF8F1; }
.rank-n {
  flex: 0 0 28px; height: 28px; line-height: 28px; text-align: center;
  border-radius: 6px; font-weight: 700; font-size: 13px;
  background: #EFE9DE; color: #6B5B44;
  font-variant-numeric: tabular-nums;
}
.rank-n.top { background: linear-gradient(135deg,#E3C58F,#C9A063); color: #4A3410; }
.rank-body { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rank-votes { color: #9E1F1F; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
