/* Shared academic-portal shell — aligned with ai.ms1001.com homepage (CUHK / Tsinghua-like) */
:root {
  --cuhk-navy: #00205b;
  --cuhk-navy-soft: #0b3a7a;
  --cuhk-gold: #c9a227;
  --cuhk-muted: #5b6577;
  --cuhk-line: #e6ebf2;
  --cuhk-bg: #ffffff;
  --cuhk-soft: #f7f9fc;
}

body.portal-cuhk,
body.ms1001-cuhk {
  margin: 0;
  min-height: 100vh;
  color: #0f172a;
  background: #fff !important;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

html[data-ms1001-chrome="on"] body.portal-cuhk::before,
html[data-ms1001-chrome="on"] body.ms1001-cuhk::before {
  background: #fff !important;
}

body.portal-cuhk a,
body.ms1001-cuhk a {
  color: var(--cuhk-navy-soft);
}
/* Chrome auth CTAs keep their own button colors (not body link navy) */
body.portal-cuhk #ms1001-chrome a.ms1001-btn-login,
body.ms1001-cuhk #ms1001-chrome a.ms1001-btn-login,
body.portal-cuhk #ms1001-chrome a.ms1001-btn-account,
body.ms1001-cuhk #ms1001-chrome a.ms1001-btn-account {
  color: #fff;
}

.cuhk-wrap {
  width: calc(100% - clamp(16px, 2vw, 32px) * 2);
  max-width: none;
  margin: 0 auto;
  padding: 28px 0 56px;
}

.cuhk-page-hero {
  margin: 0 0 28px;
  padding: 0 0 20px;
  border-bottom: 2px solid var(--cuhk-navy);
}

.cuhk-page-hero .eyebrow {
  margin: 0 0 10px;
  color: var(--cuhk-gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.cuhk-page-hero h1 {
  margin: 0 0 12px;
  color: var(--cuhk-navy);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.cuhk-page-hero .lead {
  margin: 0;
  max-width: 72ch;
  color: var(--cuhk-muted);
  font-size: 15px;
  line-height: 1.8;
}

.cuhk-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 22px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--cuhk-navy);
}

.cuhk-section-head h2 {
  margin: 0;
  color: var(--cuhk-navy);
  font-size: 26px;
  font-weight: 800;
}

.cuhk-panel {
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid var(--cuhk-line);
  background: #fff;
}

.cuhk-panel h2,
.cuhk-panel h3 {
  margin: 0 0 12px;
  color: var(--cuhk-navy);
  font-weight: 800;
}

.cuhk-panel p,
.cuhk-panel li {
  color: var(--cuhk-muted);
  line-height: 1.8;
  font-size: 14px;
}

.cuhk-tag {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--cuhk-gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.cuhk-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  border: 0;
  background: var(--cuhk-navy);
  color: #fff !important;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.cuhk-btn.ghost {
  background: transparent;
  border: 1px solid var(--cuhk-line);
  color: var(--cuhk-navy) !important;
}

.cuhk-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0 0;
}

.cuhk-stats div {
  border: 1px solid var(--cuhk-line);
  background: var(--cuhk-soft);
  padding: 14px;
  text-align: center;
}

.cuhk-stats b {
  display: block;
  color: var(--cuhk-navy);
  font-size: 28px;
  font-weight: 800;
}

.cuhk-stats span {
  color: var(--cuhk-muted);
  font-size: 12px;
}

.cuhk-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.cuhk-card {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--cuhk-line);
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.cuhk-card:hover {
  border-color: #c9d4e5;
  box-shadow: 0 10px 28px rgba(0, 32, 91, 0.08);
}

.cuhk-card .day,
.cuhk-card .meta-tag {
  color: var(--cuhk-gold);
  font-size: 12px;
  font-weight: 800;
}

.cuhk-card h3 {
  margin: 6px 0;
  color: var(--cuhk-navy);
  font-size: 16px;
  line-height: 1.35;
}

.cuhk-card p {
  margin: 0;
  color: var(--cuhk-muted);
  font-size: 13px;
  line-height: 1.65;
}

.cuhk-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 18px 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--cuhk-line);
  background: var(--cuhk-soft);
}

.cuhk-toolbar input,
.cuhk-toolbar select {
  border: 1px solid var(--cuhk-line);
  background: #fff;
  padding: 10px 14px;
  min-width: 220px;
  font: inherit;
}

.cuhk-toolbar input { flex: 1; }

.cuhk-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--cuhk-line);
  color: var(--cuhk-muted);
  font-size: 12px;
  line-height: 1.8;
}

/* Surface dark: one navy shell (#00205b); content boxes stay light (like matrix cards) */
html[data-surface-theme="dark"] body.portal-cuhk,
html[data-surface-theme="dark"] body.ms1001-cuhk {
  --cuhk-bg: #00205b;
  --cuhk-soft: #00205b;
  --cuhk-navy-soft: #00205b;
  --cuhk-line: rgba(255, 255, 255, 0.22);
  --cuhk-muted: #5b6577;
  color: #fff;
  background: #00205b !important;
}
html[data-ms1001-chrome="on"][data-surface-theme="dark"] body.portal-cuhk::before,
html[data-ms1001-chrome="on"][data-surface-theme="dark"] body.ms1001-cuhk::before {
  background: #00205b !important;
}
html[data-surface-theme="dark"] body.portal-cuhk a,
html[data-surface-theme="dark"] body.ms1001-cuhk a {
  color: #1d4ed8;
}
html[data-surface-theme="dark"] body.portal-cuhk #ms1001-chrome a.ms1001-btn-login,
html[data-surface-theme="dark"] body.ms1001-cuhk #ms1001-chrome a.ms1001-btn-login,
html[data-surface-theme="dark"] body.portal-cuhk #ms1001-chrome a.ms1001-btn-account,
html[data-surface-theme="dark"] body.ms1001-cuhk #ms1001-chrome a.ms1001-btn-account {
  color: #00205b !important;
}
html[data-surface-theme="dark"] body.portal-cuhk .footer,
html[data-surface-theme="dark"] body.ms1001-cuhk .cuhk-foot {
  color: rgba(255, 255, 255, 0.88) !important;
}
html[data-surface-theme="dark"] body.portal-cuhk .footer a,
html[data-surface-theme="dark"] body.ms1001-cuhk .cuhk-foot a,
html[data-surface-theme="dark"] body.portal-cuhk .cuhk-section-head a,
html[data-surface-theme="dark"] body.ms1001-cuhk .cuhk-section-head a {
  color: #e2c878 !important;
}
html[data-surface-theme="dark"] .cuhk-page-hero {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 2px solid var(--cuhk-gold, #c9a227);
  padding: 22px 24px;
  margin-bottom: 22px;
}
html[data-surface-theme="dark"] .cuhk-page-hero h1,
html[data-surface-theme="dark"] .cuhk-section-head h2,
html[data-surface-theme="dark"] .cuhk-panel h2,
html[data-surface-theme="dark"] .cuhk-panel h3,
html[data-surface-theme="dark"] .cuhk-card h3,
html[data-surface-theme="dark"] .cuhk-stats b {
  color: #00205b;
}
html[data-surface-theme="dark"] .cuhk-page-hero .lead,
html[data-surface-theme="dark"] .cuhk-panel p,
html[data-surface-theme="dark"] .cuhk-panel li,
html[data-surface-theme="dark"] .cuhk-card p,
html[data-surface-theme="dark"] .cuhk-stats span {
  color: #5b6577;
}
html[data-surface-theme="dark"] .cuhk-section-head,
html[data-surface-theme="dark"] .cuhk-foot {
  border-color: rgba(255, 255, 255, 0.22);
}
html[data-surface-theme="dark"] .cuhk-section-head h2 {
  color: #fff;
}
html[data-surface-theme="dark"] .cuhk-section-desc {
  color: rgba(255, 255, 255, 0.72);
}
html[data-surface-theme="dark"] .cuhk-panel,
html[data-surface-theme="dark"] .cuhk-card,
html[data-surface-theme="dark"] .cuhk-stats div,
html[data-surface-theme="dark"] .cuhk-toolbar,
html[data-surface-theme="dark"] .visual-full figure,
html[data-surface-theme="dark"] .grid3 article {
  background: #fff !important;
  border-color: #e6ebf2;
  color: #0f172a;
}
html[data-surface-theme="dark"] .cuhk-toolbar input,
html[data-surface-theme="dark"] .cuhk-toolbar select {
  background: #fff;
  border-color: #e6ebf2;
  color: #0f172a;
}
html[data-surface-theme="dark"] .cuhk-btn.ghost {
  border-color: #00205b;
  color: #00205b !important;
  background: #fff !important;
}
html[data-surface-theme="dark"] .cuhk-btn {
  background: #00205b;
  color: #fff !important;
}
/* Surface theme lives in chrome — hide legacy hero-only Dark/Light pill */
html[data-ms1001-chrome="on"] .ms1001-hero-theme-toggle {
  display: none !important;
}
html[data-surface-theme="dark"] .cuhk-foot {
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 900px) {
  .cuhk-stats,
  .cuhk-card-grid { grid-template-columns: 1fr; }
  .cuhk-toolbar input { min-width: 0; width: 100%; }
  .cuhk-wrap { width: calc(100% - 24px); max-width: none; }
}
