/* 材料学科 AI 教学资源站
 * Token、字体栈、列线与基础组件取自 portal/static/css/portal.css，
 * 以及 portal/docs/01-设计系统规范.md。本站不引入新的强调色、新的圆角值、
 * 新的阴影层级——两个站看上去必须是一家。 */

:root {
  --sjtu-red: #a41e35;
  --sjtu-red-ink: #78121f;
  --sjtu-red-wash: #fbf3f5;
  --blueprint: #1b3a6b;
  --ink-900: #14171c;
  --ink-700: #383f4a;
  --ink-500: #687181;
  --ink-300: #a8aeb9;
  --rule: #dde1e8;
  --rule-strong: #b9c0cc;
  --grid-line: rgba(20, 23, 28, 0.045);
  --sheet: #fff;
  --ground: #f7f8fa;
  --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: "MSE Serif", "IBM Plex Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --font-sans: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --container: 1280px;
  --header-h: 68px;
}

* { 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, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
h1, h2 { color: var(--ink-900); font-family: var(--font-display); }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.2; font-weight: 700; }
h2 { font-size: clamp(24px, 2.5vw, 34px); line-height: 1.28; font-weight: 700; }
h3 { color: var(--ink-900); font-size: 17px; line-height: 1.45; font-weight: 600; }
:focus-visible { outline: 3px solid rgba(27, 58, 107, 0.28); outline-offset: 3px; }
.tabular { font-variant-numeric: tabular-nums; }

.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; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 32px;
}

/* 签名一：列线。与内容共用同一套 container，所以一定对齐。 */
.grid-rules { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.grid-rules .container { height: 100%; }
.grid-rules-inner { height: 100%; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-rules-inner span { border-right: 1px solid var(--grid-line); }
.grid-rules-inner span:last-child { border-right: 0; }
.page-layer { position: relative; z-index: 1; }

/* ---------- 顶栏与页脚 ---------- */

.site-header {
  position: fixed;
  inset: 16px 20px auto;
  z-index: 100;
  pointer-events: none;
}
.header-inner {
  max-width: 1180px; min-height: 64px; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  pointer-events: auto; border: 1px solid rgba(255,255,255,.92); border-radius: 999px;
  background: rgba(244,248,255,.86);
  -webkit-backdrop-filter: blur(16px) saturate(125%); backdrop-filter: blur(16px) saturate(125%);
  box-shadow: 0 2px 6px rgba(38,54,98,.04), 0 10px 30px rgba(38,54,98,.09);
}
.site-header + .page-layer { padding-top: 96px; }
main, main [id] { scroll-margin-top: 104px; }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 11px; }
.brand img { width: 38px; height: 38px; flex: 0 0 auto; }
.brand-copy { min-width: 0; display: block; line-height: 1.2; }
.brand-university { color: var(--ink-500); font-size: 11px; font-weight: 600; }
.brand-title {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--ink-900);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-title-short { display: none; }
.site-nav { display: flex; align-items: center; gap: 2px; }
.nav-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 999px;
}
.nav-link:hover { color: #34348f; background: rgba(78,83,161,.07); }
.nav-link[aria-current="page"] { color: #34348f; background: #e8edfb; }

.site-footer { border-top: 1px solid var(--rule); background: var(--sheet); }
.footer-signature { margin: 0; padding: 20px 0 calc(20px + env(safe-area-inset-bottom,0px)); color: var(--ink-500); font-size: 13px; line-height: 1.6; text-align: center; }

/* ---------- 排版元件 ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-500);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before { content: "+"; color: var(--sjtu-red); font-size: 15px; letter-spacing: 0; }
.eyebrow + h1, .eyebrow + h2 { margin-top: 16px; }
/* 图标默认 display:block，落在正文链接里会掉行，这里改回内联并压回基线 */
a .icon, p .icon { display: inline-block; vertical-align: -0.16em; }
.clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.lede { max-width: 760px; color: var(--ink-500); font-size: 17px; line-height: 1.85; }
.meta { color: var(--ink-500); font-family: var(--font-mono); font-size: 12px; line-height: 1.5; }
.link {
  color: var(--blueprint);
  text-decoration: underline;
  text-decoration-color: rgba(27, 58, 107, 0.32);
  text-underline-offset: 4px;
}
.link:hover { color: var(--sjtu-red); text-decoration-color: currentColor; }

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn-primary { border-color: var(--sjtu-red); background: var(--sjtu-red); color: #fff; }
.btn-primary:hover { border-color: var(--sjtu-red-ink); background: var(--sjtu-red-ink); }
.btn-secondary { border-color: var(--rule-strong); background: #fff; color: var(--ink-900); }
.btn-secondary:hover { border-color: var(--sjtu-red); color: var(--sjtu-red); }

.section { padding: clamp(56px, 6.5vw, 96px) 0; border-top: 1px solid var(--rule); background: rgba(255, 255, 255, 0.66); }
.section-head { max-width: 820px; }
.section-head h2 { margin-top: 16px; }
.section-head .lede { margin-top: 16px; }
.section-stat { margin-top: 22px; color: var(--ink-500); font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; }
.section-stat b { color: var(--ink-900); font-weight: 500; }

/* ---------- 首页 hero ---------- */

.hero { display: flex; align-items: center; border-bottom: 1px solid var(--rule); background: rgba(255, 255, 255, 0.86); }
.hero-inner { padding: clamp(56px, 7vw, 104px) 0; }
.hero h1 { max-width: 15em; margin-top: 24px; font-size: clamp(32px, 4.4vw, 58px); line-height: 1.14; letter-spacing: -0.01em; }
.hero .lede { max-width: 640px; margin-top: 26px; color: #4f5969; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }

.figures { display: flex; flex-wrap: wrap; gap: 0; margin-top: 48px; border-top: 1px solid var(--rule-strong); }
.figure { flex: 1 1 160px; min-width: 0; padding: 22px 24px 4px 0; }
.figure + .figure { padding-left: 24px; border-left: 1px solid var(--rule); }
.figure b {
  display: block;
  color: var(--sjtu-red);
  font-family: var(--font-display);
  font-size: clamp(34px, 3.6vw, 48px);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.figure span { display: block; margin-top: 10px; color: var(--ink-900); font-size: 14px; font-weight: 600; }
.figure em { display: block; margin-top: 4px; color: var(--ink-500); font-size: 13px; font-style: normal; line-height: 1.6; }

/* ---------- 交互演示卡 ---------- */

.demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 44px; }
.demo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--sheet);
  box-shadow: var(--shadow-1);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
a.demo-card:hover { transform: translateY(-2px); border-color: var(--rule-strong); box-shadow: var(--shadow-2); }
a.demo-card::after {
  content: "+";
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: var(--sjtu-red);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 180ms ease;
}
a.demo-card:hover::after { opacity: 1; }
.demo-poster {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--rule);
  background: var(--ground);
}
.demo-poster img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.demo-poster-fallback {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--ink-300);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
}
.demo-body { flex: 1 1 auto; padding: 22px 24px 26px; }
.demo-body h3 { margin-top: 10px; font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.4; }
.demo-body p { margin-top: 12px; color: var(--ink-500); font-size: 13px; line-height: 1.75; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tag {
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink-500);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- 课程卡 ---------- */

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 44px; }
.course-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--sheet);
  box-shadow: var(--shadow-1);
}
/* 内边距落在 body 上，封面才能顶到卡片边框，没封面时视觉与之前完全一致 */
.course-card-body { display: flex; flex-direction: column; flex: 1 1 auto; padding: 22px 24px 24px; }
/* 封面放文件即生效：static/img/covers/<slug>.webp。没有文件就没有这一块，不留占位灰框。 */
.course-cover {
  aspect-ratio: 16 / 9;
  border-bottom: 1px solid var(--rule);
  background: #fff;
}
.course-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.course-card h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.45; }
.course-teachers { margin-top: 8px; color: var(--ink-500); font-size: 13px; }
.course-card-body > p { margin-top: 10px; color: var(--ink-500); font-size: 13px; line-height: 1.7; }
/* 入口贴卡片底部，同一行的卡片入口区就能横向对齐 */
.course-entries { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--rule); }
.entry {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}
.entry-label {
  flex: 0 0 62px;
  color: var(--ink-500);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.entry a { color: var(--blueprint); text-decoration: underline; text-decoration-color: rgba(27, 58, 107, 0.3); text-underline-offset: 4px; }
.entry a:hover { color: var(--sjtu-red); text-decoration-color: currentColor; }
.entry-none { color: var(--ink-500); }
.course-card-quiet { background: rgba(255, 255, 255, 0.55); }
.course-card-quiet h3 { color: var(--ink-700); font-weight: 600; }

/* ---------- 备选演示（给老师点选） ---------- */

.pick-list { margin-top: 40px; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.pick {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 0 18px;
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--rule);
}
/* 编号是老师报号用的，所以给它字号和分量，不是装饰性的小角标 */
.pick-num {
  color: var(--sjtu-red);
  font-family: var(--font-mono);
  font-size: 22px;
  line-height: 1.35;
}
.pick-main h3 { font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.45; }
.pick-sees { margin-top: 10px; max-width: 780px; color: var(--ink-700); line-height: 1.8; }
.pick-module { margin-top: 10px; color: var(--ink-500); font-size: 13px; }

/* ---------- 课程详情 ---------- */

.course-hero { padding-top: clamp(48px, 6vw, 82px); background: rgba(255, 255, 255, 0.86); }
.course-back-row { margin: 0; }
.course-back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.course-hero .eyebrow { margin-top: 34px; }
.course-hero h1 { max-width: 18em; margin-top: 16px; }
.course-byline { margin-top: 12px; color: var(--ink-500); font-size: 14px; }
.course-hero .lede { margin-top: 18px; }
.course-facts { display: flex; flex-wrap: wrap; gap: 0; margin-top: 34px; border-top: 1px solid var(--rule-strong); }
.course-facts div { min-width: 126px; padding: 14px 24px 0 0; }
.course-facts div + div { padding-left: 24px; border-left: 1px solid var(--rule); }
.course-facts dt { color: var(--ink-500); font-family: var(--font-mono); font-size: 11px; }
.course-facts dd { margin: 4px 0 0; color: var(--ink-900); font-size: 14px; font-weight: 600; }
.course-source { max-width: 860px; margin-top: 28px; color: var(--ink-500); font-size: 12px; line-height: 1.7; }
.course-source span { margin-right: 10px; color: var(--ink-700); font-family: var(--font-mono); font-size: 11px; }
.course-modules { background: rgba(255, 255, 255, 0.66); }
.module-list { margin-top: 44px; border-top: 1px solid var(--rule-strong); }
.module-card { padding: 28px 0 32px; border-bottom: 1px solid var(--rule); }
.module-main h3 { font-family: var(--font-display); font-size: 21px; }
.module-goal { max-width: 760px; margin-top: 12px; color: var(--ink-700); line-height: 1.8; }
.module-goal span, .hard-point > span, .resource-label { display: block; margin-bottom: 6px; color: var(--ink-500); font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; }
.hard-point { max-width: 820px; margin-top: 20px; padding: 14px 16px; border-left: 3px solid var(--sjtu-red); background: var(--sjtu-red-wash); }
.hard-point p { color: var(--sjtu-red-ink); line-height: 1.8; }
.module-resources { margin-top: 22px; }
.resource-list { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.resource { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--blueprint); font-size: 13px; text-decoration: underline; text-decoration-color: rgba(27, 58, 107, 0.3); text-underline-offset: 4px; }
.resource:hover { color: var(--sjtu-red); text-decoration-color: currentColor; }
.resource-pending { color: var(--ink-300); text-decoration: none; cursor: default; }
/* 与 .section 同底：站内只有 hero 一处用 0.86，其余一律 0.66，避免交替底色分段（禁则 3） */
.course-next-grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: 64px; align-items: start; }
.course-next-grid > div:last-child p { max-width: 620px; color: var(--ink-500); line-height: 1.85; }
.course-next-grid .btn { margin-top: 24px; }

/* ---------- 运行页 ---------- */

.runner-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}
.runner-bar .container { display: flex; align-items: center; gap: 16px; }
.runner-back { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--ink-700); font-size: 13px; font-weight: 600; }
.runner-back:hover { color: var(--sjtu-red); }
.runner-title { min-width: 0; flex: 1 1 auto; overflow: hidden; color: var(--ink-900); font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.runner-title span { color: var(--ink-500); font-weight: 400; }
.runner-open { flex: 0 0 auto; color: var(--blueprint); font-size: 13px; font-weight: 600; white-space: nowrap; }
.runner-open:hover { color: var(--sjtu-red); }

.runner-stage { padding: 20px 0 0; }
.runner-frame {
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-md);
  background: var(--sheet);
  box-shadow: var(--shadow-1);
}
.runner-frame iframe { width: 100%; height: clamp(520px, calc(100svh - 96px), 980px); border: 0; }
.runner-notes { padding: clamp(48px, 5vw, 76px) 0 clamp(56px, 6vw, 88px); }
.runner-notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 48px; margin-top: 32px; }
.note h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.note p { margin-top: 12px; color: var(--ink-700); line-height: 1.85; }
.note-review { margin-top: 32px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--sjtu-red-wash); color: var(--sjtu-red-ink); font-size: 13px; line-height: 1.7; }

/* ---------- 说明页 ---------- */

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-top: 48px; border-top: 1px solid var(--rule-strong); }
.step { padding: 28px 28px 32px 0; }
.step + .step { padding-left: 28px; border-left: 1px solid var(--rule); }
.step-mark { color: var(--sjtu-red); font-family: var(--font-mono); font-size: 13px; letter-spacing: .1em; }
.step h3 { margin-top: 14px; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.step p { margin-top: 12px; color: var(--ink-500); font-size: 14px; line-height: 1.85; }

.invite { margin-top: clamp(48px, 5vw, 72px); padding: clamp(32px, 4vw, 48px); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); background: var(--sheet); }
.invite h2 { font-size: clamp(21px, 2vw, 26px); }
.invite p { max-width: 640px; margin-top: 14px; color: var(--ink-500); line-height: 1.85; }
.invite-action { margin-top: 24px; }
.steps + .invite { margin-top: clamp(40px, 4vw, 64px); }

.empty-state { padding: 56px 0; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); }
.empty-state h1 { font-size: clamp(24px, 2.4vw, 32px); }
.empty-state p { max-width: 620px; margin-top: 12px; color: var(--ink-500); }
.empty-state .btn { margin-top: 26px; }

/* ---------- 响应式 ---------- */

@media (max-width: 1023px) {
  .container { padding-inline: 24px; }
  .grid-rules { display: none; }
  .demo-grid { grid-template-columns: minmax(0, 1fr); }
  .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runner-notes-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { padding: 24px 0 26px; border-top: 1px solid var(--rule); }
  .step:first-child { border-top: 0; }
  .step + .step { padding-left: 0; border-left: 0; }
}

@media (max-width: 767px) {
  .container { padding-inline: 20px; }
  .site-header { inset: 10px 10px auto; }
  .header-inner { min-height: 56px; padding: 7px 10px; gap: 6px; }
  .site-header + .page-layer { padding-top: 82px; }
  main, main [id] { scroll-margin-top: 90px; }
  /* 手机使用短站名，为三个常用入口保留可读字号与触摸空间。 */
  .brand { gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  .brand-university { display: none; }
  .brand-title { display: none; }
  .brand-title-short { display: block; margin-top: 0; font-size: 14px; }
  .site-nav { gap: 0; }
  .nav-link { padding: 0 6px; min-height: 40px; font-size: 14px; }
  .nav-link-wide { display: none; }
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure { padding: 18px 16px 12px 0; }
  .figure + .figure { padding-left: 16px; }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
  .runner-frame iframe { height: clamp(460px, calc(100svh - 84px), 760px); }
  .course-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-facts div + div { padding-left: 0; border-left: 0; }
  .module-main h3 { font-size: 19px; }
  .pick { grid-template-columns: 30px minmax(0, 1fr); gap: 0 12px; }
  .pick-num { font-size: 18px; line-height: 1.5; }
  .pick-main h3 { font-size: 17px; }
  .course-next-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Language and identity share the floating bar; small screens use a compact menu. */
.header-inner { gap: 14px; }
.site-nav { margin-left: auto; }
.header-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.language-toggle { font-family: var(--font-sans); font-size: 12px; letter-spacing: .02em; }
.login-link, .account-menu > summary { color: #45429c; background: #e8eafb; }
.nav-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #45476c; background: transparent; cursor: pointer; }
.account-menu { position: relative; }
.account-menu > summary { gap: 6px; cursor: pointer; list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-dot { width: 6px; height: 6px; border-radius: 50%; background: #5a8d73; }
.account-panel { position: absolute; top: calc(100% + 14px); right: 0; min-width: 190px; padding: 10px; border: 1px solid #e5e7f0; border-radius: 16px; background: #fff; box-shadow: 0 10px 28px #34375d1c; }
.account-panel p { padding: 8px 10px; color: #66708a; font-size: 13px; overflow-wrap: anywhere; }
.account-panel a { display: block; padding: 10px; border-radius: 8px; font-size: 14px; }
.account-panel a:hover { background: #f0f2fa; }
.header-actions [hidden] { display: none; }
html[lang="en"] .brand-title { font-size: 14px; }
html[lang="en"] .brand-university { font-size: 10px; }
@media (max-width: 1100px) { .nav-link-wide { display: none; } }
@media (max-width: 900px) {
  .header-inner { position: relative; gap: 4px; }
  .site-nav { display: none; position: absolute; top: calc(100% + 10px); right: 0; left: 0; margin: 0; padding: 10px; border: 1px solid #e7eaf6; border-radius: 20px; background: rgba(248,250,255,.98); box-shadow: 0 12px 30px #34375d1c; }
  .site-nav .nav-link, .site-nav .nav-link-wide { display: flex; min-height: 44px; padding-inline: 14px; }
  .nav-open .site-nav { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .nav-toggle { display: flex; margin-left: auto; flex: 0 0 40px; }
  .brand-university, .brand-title { display: none; }
  .brand-title-short { display: block; margin: 0; font-size: 15px; }
  .header-actions .nav-link { min-height: 40px; padding: 0 9px; font-size: 13px; }
  html[lang="en"] .brand-title-short { font-size: 16px; }
}

/* One quiet school signature is enough on a phone. */
@media (max-width: 767px) {
  .page-layer { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; min-height: 100dvh; }
  .page-layer > main { flex: 1 0 auto; }
  .site-footer { flex: 0 0 auto; }
  .footer-signature { display: block; margin: 0; padding: 18px 0 calc(18px + env(safe-area-inset-bottom, 0px)); color: var(--ink-500); font-size: 12px; line-height: 1.6; text-align: center; white-space: nowrap; }
  html[lang="en"] .footer-signature { font-size: clamp(10px, 2.8vw, 12px); }
}
