/* 材料学科课程站群：浅色、深靛蓝墨色、纸面材质，token 对齐 mse/teaching-site 与 portal 设计系统。
 * 每门课只用一个强调色 --accent（由 registry.json 注入），不引入新的圆角值与阴影层级。 */
:root {
  --sjtu-red: #a41e35;
  --blueprint: #1b3a6b;
  --ink-900: #14171c;
  --ink-700: #383f4a;
  --ink-500: #687181;
  --ink-300: #a8aeb9;
  --rule: #dde1e8;
  --rule-strong: #b9c0cc;
  --sheet: #fff;
  --ground: #f7f8fa;
  --ground-2: #eef1f5;
  --accent: #1b3a6b;
  --radius-sm: 3px;
  --radius-md: 6px;
  --shadow-1: 0 1px 2px rgba(20, 23, 28, 0.04);
  --shadow-2: 0 2px 4px rgba(20, 23, 28, 0.04), 0 12px 24px -16px rgba(20, 23, 28, 0.16);
  --font-display: "IBM Plex Serif", "Songti SC", "Noto Serif SC", "Source Han Serif SC", STSong, serif;
  --font-sans: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --container: 1200px;
  --header-h: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink-700); font-family: var(--font-sans); font-size: 15px; line-height: 1.75; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2 { color: var(--ink-900); font-family: var(--font-display); font-weight: 700; }
h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.18; }
h2 { font-size: clamp(22px, 2.4vw, 30px); line-height: 1.28; }
h3 { color: var(--ink-900); font-size: 17px; line-height: 1.45; font-weight: 600; }
h4 { color: var(--ink-900); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-mono); font-weight: 600; }
:focus-visible { outline: 3px solid rgba(27, 58, 107, 0.28); outline-offset: 3px; }
.wrap { width: min(var(--container), 100% - 2 * clamp(16px, 4vw, 40px)); margin-inline: auto; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 200; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink-900); color: #fff; }
.skip-link:focus { top: 12px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.lead { font-size: 17px; line-height: 1.7; color: var(--ink-700); max-width: 60ch; }
.prose { max-width: 72ch; line-height: 1.85; }
.prose .en { margin-top: 10px; color: var(--ink-500); font-size: 13.5px; }
.inline-link { color: var(--blueprint); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--rule-strong); word-break: break-all; }
.text-link { color: var(--blueprint); font-weight: 600; white-space: nowrap; }
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.footnote { margin-top: 16px; font-size: 12.5px; color: var(--ink-500); }

/* 顶栏 */
.site-header { position: fixed; inset: 0 0 auto; z-index: 40; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(16px, 3vw, 32px); background: rgba(247, 248, 250, .86); border-bottom: 1px solid var(--rule); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink-900); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-md); background: var(--accent); color: #fff; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy span { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.brand-copy small { font-size: 11px; color: var(--ink-500); letter-spacing: .04em; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { padding: 8px 12px; border-radius: var(--radius-md); font-size: 14px; color: var(--ink-700); }
.site-nav a:hover { background: var(--ground-2); color: var(--ink-900); }
.site-nav a.active { color: var(--ink-900); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.site-nav .nav-pill { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 6px 12px; }
.site-nav .nav-pill.active, .site-nav .nav-pill:hover { background: var(--accent); color: #fff; box-shadow: none; }
.site-nav .nav-portal { margin-left: 6px; font-size: 12.5px; color: var(--ink-500); border-left: 1px solid var(--rule); border-radius: 0; padding-left: 14px; }
.nav-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--radius-md); flex-direction: column; justify-content: center; gap: 5px; padding: 0 10px; cursor: pointer; }
.nav-toggle span { display: block; height: 2px; background: var(--ink-900); }
main { padding-top: var(--header-h); }

/* 按钮 */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: var(--radius-md); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink-900); font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s, color .15s; }
.button:hover { border-color: var(--ink-900); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { filter: brightness(1.08); }
.button.quiet { border-color: transparent; background: transparent; color: var(--blueprint); }
.button.quiet:hover { background: var(--ground-2); }

/* 首页主视觉 */
.hero { position: relative; overflow: hidden; background: linear-gradient(180deg, #fff 0%, var(--ground) 100%); border-bottom: 1px solid var(--rule); }
.hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px); background-size: 48px 48px; opacity: .35; mask-image: radial-gradient(60% 80% at 70% 50%, #000, transparent); pointer-events: none; }
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(24px, 5vw, 72px); align-items: center; padding: clamp(40px, 7vw, 88px) 0 clamp(36px, 5vw, 64px); }
.hero-copy h1 { margin-top: 10px; }
.hero-copy .lead { margin-top: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.facts { display: grid; grid-template-columns: repeat(4, auto); gap: 24px; margin-top: 34px; padding-top: 22px; border-top: 1px solid var(--rule); width: fit-content; }
.facts dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; color: var(--ink-500); text-transform: uppercase; }
.facts dd { font-weight: 600; color: var(--ink-900); margin-top: 2px; }
.hero-art { position: relative; }
.hero-art img { width: 100%; height: auto; border-radius: var(--radius-md); box-shadow: var(--shadow-2); }
.hero-art figcaption { margin-top: 8px; font-size: 11.5px; color: var(--ink-500); text-align: right; }

/* 分区 */
.band { padding: clamp(40px, 6vw, 72px) 0; }
.band.tight { padding: clamp(20px, 3vw, 32px) 0; }
.band.contrast { background: var(--sheet); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.section-head { margin-bottom: 26px; }
.section-head h2 { margin-top: 8px; }
.section-head p:not(.eyebrow) { margin-top: 8px; color: var(--ink-500); max-width: 70ch; }
.section-head.split { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }

/* 图谱预览 */
.graph-preview { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.graph-preview-stage { display: block; position: relative; aspect-ratio: 16 / 10; background: radial-gradient(70% 70% at 50% 50%, #fff, var(--ground-2) 85%); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-1); }
.graph-preview-stage svg { width: 100%; height: 100%; }
.graph-preview-stage:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-2); }
.graph-noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--ink-500); text-align: center; }
.graph-preview-side { display: grid; gap: 14px; align-content: start; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat-grid div { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 10px 6px; text-align: center; }
.stat-grid b { display: block; font-family: var(--font-mono); font-size: 20px; color: var(--ink-900); }
.stat-grid span { font-size: 11px; color: var(--ink-500); }
.unit-list { display: grid; gap: 4px; }
.unit-list a { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-md); background: var(--sheet); border: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-900); }
.unit-list a:hover { border-color: var(--rule-strong); }
.unit-list i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: #fff; font-style: normal; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.unit-list small { font-family: var(--font-mono); font-size: 11px; color: var(--ink-500); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-500); }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* 章节卡 */
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.chapter-card { background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, box-shadow .15s; }
.chapter-card:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-2); }
.chapter-head { display: flex; justify-content: space-between; align-items: baseline; }
.chapter-index { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--accent); }
.chapter-hours { font-family: var(--font-mono); font-size: 11px; color: var(--ink-500); letter-spacing: .06em; }
.chapter-card h3 { font-family: var(--font-display); font-size: 19px; }
.chapter-en { font-size: 12px; color: var(--ink-500); font-family: var(--font-mono); }
.chapter-cluster { font-size: 13.5px; color: var(--ink-700); line-height: 1.65; margin-top: 4px; }
.chapter-lab { margin-top: auto; padding-top: 10px; font-size: 12.5px; color: var(--blueprint); font-weight: 600; }

/* 目标与面板 */
.objective-list { display: grid; gap: 10px; margin-top: 18px; }
.objective-list li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.objective-list .num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-family: var(--font-mono); font-size: 12.5px; font-weight: 700; }
.objective-list div { padding-top: 2px; line-height: 1.7; }
.objective-list small { display: block; color: var(--ink-500); font-size: 12.5px; margin-top: 2px; }
.objective-list.wide { max-width: 80ch; }
.panel-stack { display: grid; gap: 14px; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-1); }
.panel-eyebrow { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-500); margin-bottom: 8px; }
.panel h3 { margin-bottom: 6px; }
.panel-note { font-size: 13.5px; color: var(--ink-500); margin: 0 0 12px; line-height: 1.7; }
.plain-list li { padding: 6px 0; border-top: 1px solid var(--rule); font-size: 13.5px; line-height: 1.6; }
.plain-list li:first-child { border-top: 0; }
.plain-list b { display: block; color: var(--ink-900); font-size: 12.5px; }
.goal-list { counter-reset: g; display: grid; gap: 8px; }
.goal-list li { counter-increment: g; display: grid; grid-template-columns: 22px 1fr; gap: 8px; font-size: 13.5px; line-height: 1.65; }
.goal-list li::before { content: counter(g); font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.bar-row:first-of-type { border-top: 0; }
.bar-row span small { display: block; color: var(--ink-500); font-size: 11.5px; }
.bar-row strong { font-family: var(--font-mono); color: var(--ink-900); }
.bar-row i { grid-column: 1 / -1; display: block; height: 6px; border-radius: 3px; background: var(--ground-2); position: relative; overflow: hidden; }
.bar-row i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--value); background: var(--accent); border-radius: 3px; }
.assess-group { margin-top: 18px; }
.assess-group h4 { margin-bottom: 6px; }

/* 知识库 */
.knowledge-workbench { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
.knowledge-copy { background: var(--ground); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: 22px; display: grid; gap: 10px; align-content: start; }
.knowledge-copy h3 { font-family: var(--font-display); font-size: 20px; }
.knowledge-copy p:not(.eyebrow) { font-size: 13.5px; color: var(--ink-500); }
.knowledge-frame { width: 100%; height: 620px; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--sheet); }
.ai-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; align-items: start; }
.ai-side { display: grid; gap: 14px; }
.ai-frame { border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; background: var(--sheet); box-shadow: var(--shadow-1); }
.ai-frame iframe { display: block; width: 100%; height: calc(100vh - var(--header-h) - 150px); min-height: 560px; border: 0; }

/* 页头 */
.page-head { padding: clamp(36px, 5vw, 60px) 0 clamp(20px, 3vw, 32px); background: var(--sheet); border-bottom: 1px solid var(--rule); }
.page-head.compact { padding-bottom: 20px; }
.page-head h1 { margin-top: 8px; }
.page-head .sub { margin-top: 10px; color: var(--ink-500); }
.page-head .split { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }

/* 大纲页 */
.info-table { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; font-size: 14px; }
.info-table th, .info-table td { text-align: left; vertical-align: top; padding: 12px 16px; border-top: 1px solid var(--rule); }
.info-table tr:first-child th, .info-table tr:first-child td { border-top: 0; }
.info-table th { width: 120px; background: var(--ground); color: var(--ink-900); font-weight: 600; white-space: nowrap; }
.info-table td small { color: var(--ink-500); font-size: 12.5px; }
.info-table td.prose { max-width: none; }
.chapter-list { display: grid; gap: 14px; }
.chapter-row { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); overflow: hidden; }
.chapter-row-head { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 16px 20px; background: var(--ground); border-bottom: 1px solid var(--rule); }
.chapter-row-head h3 { font-family: var(--font-display); font-size: 20px; }
.chapter-meta { display: flex; gap: 22px; }
.chapter-meta dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-500); }
.chapter-meta dd { font-weight: 600; color: var(--ink-900); font-family: var(--font-mono); }
.chapter-row-body { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 20px; padding: 18px 20px 20px; font-size: 13.5px; }
.chapter-row-body h4 { margin-bottom: 8px; }
.chapter-row-body p { line-height: 1.7; }
.content-list li { padding: 4px 0 4px 14px; position: relative; line-height: 1.55; }
.content-list li::before { content: ""; position: absolute; left: 0; top: 12px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chapter-extras p { padding: 6px 0; border-top: 1px solid var(--rule); line-height: 1.6; }
.chapter-extras p:first-child { border-top: 0; padding-top: 0; }
.chapter-extras b { display: block; font-size: 11px; font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); }
.schedule-table { width: 100%; border-collapse: collapse; background: var(--ground); border: 1px solid var(--rule); font-size: 14px; }
.schedule-table th, .schedule-table td { padding: 10px 16px; border-top: 1px solid var(--rule); text-align: left; }
.schedule-table th { background: var(--sheet); font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; color: var(--ink-500); text-transform: uppercase; }
.schedule-table td:first-child, .schedule-table td:nth-child(2) { font-family: var(--font-mono); width: 80px; }
.ref-list { counter-reset: r; display: grid; gap: 8px; margin-top: 14px; }
.ref-list li { counter-increment: r; display: grid; grid-template-columns: 26px 1fr; gap: 8px; font-size: 13.5px; line-height: 1.55; padding: 8px 0; border-top: 1px solid var(--rule); }
.ref-list li::before { content: counter(r, decimal-leading-zero); font-family: var(--font-mono); color: var(--ink-500); font-size: 12px; padding-top: 2px; }
.ref-list b { display: block; color: var(--ink-900); }
.ref-list span { color: var(--ink-500); font-size: 12.5px; }

/* 页脚 */
.site-footer { border-top: 1px solid var(--rule); background: var(--sheet); padding: 28px 0; margin-top: 20px; font-size: 13px; color: var(--ink-500); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; gap: 12px; align-items: center; }
.footer-brand strong { display: block; color: var(--ink-900); }
.footer-meta { display: grid; gap: 2px; text-align: right; }
.footer-meta a { color: var(--blueprint); }

/* 根页 */
.root-list { display: grid; gap: 10px; margin-top: 24px; max-width: 560px; }
.root-list a { display: grid; gap: 2px; padding: 14px 18px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-md); }
.root-list b { color: var(--ink-900); font-family: var(--font-display); font-size: 18px; }
.root-list span { font-family: var(--font-mono); font-size: 12px; color: var(--ink-500); }

/* 响应式 */
@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 320px; }
  .graph-preview, .knowledge-workbench, .ai-page, .two-col { grid-template-columns: 1fr; }
  .chapter-row-body { grid-template-columns: 1fr; }
  .chapter-row-head { grid-template-columns: 48px 1fr; }
  .chapter-meta { grid-column: 1 / -1; }
  .facts { grid-template-columns: repeat(2, auto); }
}
@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .site-nav { position: fixed; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; padding: 10px 16px 16px; background: var(--sheet); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-2); display: none; }
  .site-nav.open { display: flex; }
  .site-nav .nav-pill, .site-nav .nav-portal { margin-left: 0; border-left: 0; padding-left: 12px; }
  .brand-copy small { display: none; }
  .section-head.split, .page-head .split { flex-direction: column; align-items: flex-start; }
  .info-table th { width: 90px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .footer-meta { text-align: left; }
}

/* 打印：大纲与首页可直接打印或存 PDF 交申报材料 */
@media print {
  :root { --ground: #fff; --ground-2: #fff; }
  body { font-size: 12px; color: #000; }
  .site-header, .site-footer, .hero-actions, .text-link, .knowledge-band, .nav-toggle, .graph-noscript, .button { display: none !important; }
  main { padding-top: 0; }
  .hero::before { display: none; }
  .band { padding: 16px 0; break-inside: avoid; }
  .band.contrast, .chapter-row, .panel, .info-table, .chapter-card { border-color: #bbb; box-shadow: none; }
  .chapter-row, .chapter-card, .objective-list li { break-inside: avoid; }
  .graph-preview { grid-template-columns: 1fr; }
  .graph-preview-stage { aspect-ratio: 16 / 9; border-color: #bbb; }
  a[href]::after { content: none; }
}
