/* ============================================
   CAPEST · 中体能体科院门户 · 设计系统
   ============================================ */

:root {
  /* 主色：院徽蓝（取自 capest-emblem.png · 校准） */
  --capest-blue: oklch(0.42 0.13 255);
  --capest-blue-deep: oklch(0.32 0.11 255);
  --brand-deep: oklch(0.30 0.11 255);
  --brand: oklch(0.42 0.13 255);
  --brand-light: oklch(0.56 0.13 252);
  --brand-wash: oklch(0.97 0.018 252);
  --accent: oklch(0.5 0.18 25);    /* 印章红，点缀 */
  --gold: oklch(0.72 0.12 80);

  /* 中性 */
  --fg: oklch(0.18 0.005 250);
  --fg-muted: oklch(0.42 0.01 250);
  --fg-sub: oklch(0.58 0.008 250);
  --line: oklch(0.9 0.005 250);
  --line-strong: oklch(0.82 0.006 250);
  --bg: oklch(0.995 0.002 250);
  --bg-alt: oklch(0.975 0.004 250);
  --bg-card: #ffffff;

  /* 字体 */
  --f-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --f-sans: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --f-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* 密度 */
  --gap: 20px;
  --pad-section: 48px;
  --radius: 2px;
  --radius-lg: 6px;

  /* 版心 */
  --wrap: 1280px;
}

/* 主题：党政红 */
[data-tone="red"] {
  --brand-deep: oklch(0.35 0.15 25);
  --brand: oklch(0.45 0.17 25);
  --brand-light: oklch(0.58 0.18 25);
  --brand-wash: oklch(0.97 0.02 25);
  --accent: oklch(0.55 0.14 260);
}

/* 主题：墨绿文人 */
[data-tone="green"] {
  --brand-deep: oklch(0.32 0.06 160);
  --brand: oklch(0.42 0.08 160);
  --brand-light: oklch(0.55 0.09 160);
  --brand-wash: oklch(0.97 0.015 160);
  --accent: oklch(0.55 0.14 30);
}

/* 密度：紧凑 */
[data-density="dense"] {
  --gap: 14px;
  --pad-section: 32px;
}
[data-density="loose"] {
  --gap: 28px;
  --pad-section: 72px;
}

/* 字体：黑体为主 */
[data-type="sans"] {
  --f-title: var(--f-sans);
}
[data-type="serif"] {
  --f-title: var(--f-serif);
}

/* 暗色模式 */
[data-mode="dark"] {
  --fg: oklch(0.95 0.005 250);
  --fg-muted: oklch(0.75 0.008 250);
  --fg-sub: oklch(0.6 0.008 250);
  --line: oklch(0.28 0.008 250);
  --line-strong: oklch(0.38 0.008 250);
  --bg: oklch(0.15 0.01 250);
  --bg-alt: oklch(0.19 0.012 250);
  --bg-card: oklch(0.22 0.012 250);
  --brand-wash: oklch(0.22 0.02 250);
}

/* ============================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-sans);
  color: var(--fg);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt" 1;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
ul, ol { list-style: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.serif { font-family: var(--f-serif); }

/* ---------- 顶部公告条 ---------- */
.topbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--fg-muted);
}
.topbar .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 34px;
}
.topbar-left { display: flex; gap: 18px; align-items: center; }
.topbar-left .date { color: var(--fg-sub); }
.topbar-left .weather { display: flex; align-items: center; gap: 6px; }
.topbar-right { display: flex; gap: 14px; align-items: center; }
.topbar-right a:hover { color: var(--brand); }
.topbar-right .divider { color: var(--line-strong); }

/* ---------- 头部 LOGO 区 ---------- */
.masthead {
  background: var(--bg-card);
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 85% 50%, color-mix(in oklch, var(--brand) 10%, transparent), transparent 60%);
  pointer-events: none;
}
.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  position: relative;
}
.logo-mark {
  width: 76px; height: 76px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--brand-deep);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--f-serif);
  position: relative;
  box-shadow: 0 0 0 4px var(--bg-card), 0 0 0 5px var(--brand-deep);
}
.logo-mark::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
}
.logo-mark .cn { font-size: 26px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.logo-mark .en { position: absolute; bottom: -2px; font-size: 7px; opacity: 0.7; letter-spacing: 1px; }

.masthead-text .cn-name {
  font-family: var(--f-title, var(--f-serif));
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--fg);
  line-height: 1.2;
}
.masthead-text .en-name {
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 1.5px;
  margin-top: 6px;
  text-transform: uppercase;
}
.masthead-text .tag {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--f-serif);
  font-size: 13px;
  color: var(--brand);
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}

.masthead-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.search-box {
  display: flex;
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  width: 260px;
  background: var(--bg-card);
}
.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--fg);
  font-family: inherit;
}
.search-box button {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
}
.quick-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--fg-muted);
  text-align: right;
}
.quick-links .cluster { display: flex; gap: 8px; justify-content: flex-end; }
.quick-links a { padding: 2px 0; }

/* ---------- 主导航 ---------- */
.mainnav {
  background: var(--brand-deep);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.mainnav .wrap {
  display: flex;
  align-items: stretch;
}
.mainnav ul {
  display: flex;
  flex: 1;
}
.mainnav li { position: relative; }
.mainnav li > a {
  display: block;
  padding: 0 22px;
  line-height: 46px;
  font-size: 15px;
  letter-spacing: 1px;
  color: #fff;
  font-family: var(--f-title, var(--f-sans));
  font-weight: 500;
  transition: background 0.15s;
}
.mainnav li > a:hover,
.mainnav li.active > a {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.mainnav li.active > a {
  box-shadow: inset 0 -3px 0 var(--gold);
}
.mainnav .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brand);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: 0.15s;
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
  z-index: 10;
}
.mainnav li:hover .dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.mainnav .dropdown a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--fg);
  border-bottom: 1px dashed var(--line);
}
.mainnav .dropdown a:last-child { border-bottom: 0; }
.mainnav .dropdown a:hover { background: var(--brand-wash); color: var(--brand); }

/* ---------- 面包屑/小栏目标题 ---------- */
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 10px;
}
.section-title h2 {
  font-family: var(--f-title, var(--f-serif));
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 2px;
  position: relative;
  padding-bottom: 10px;
  margin-bottom: -11px;
  border-bottom: 2px solid var(--brand);
}
.section-title h2 .en {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-sub);
  letter-spacing: 2px;
  margin-left: 10px;
  font-weight: 400;
  text-transform: uppercase;
}
.section-title .more {
  font-size: 12px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.section-title .more:hover { color: var(--brand); }

/* ---------- Section 容器 ---------- */
.block { padding: var(--pad-section) 0; }
.block-alt { background: var(--bg-alt); }

/* ---------- 通用新闻列表 ---------- */
.news-list li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.news-list li:last-child { border-bottom: 0; }
.news-list .dot {
  width: 4px; height: 4px;
  background: var(--brand-light);
  border-radius: 50%;
  flex-shrink: 0;
}
.news-list .title {
  flex: 1;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.news-list li:hover .title { color: var(--brand); }
.news-list .date {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--fg-sub);
  flex-shrink: 0;
}
.news-list .tag {
  font-size: 10px;
  padding: 1px 6px;
  background: var(--brand-wash);
  color: var(--brand);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.news-list .tag.hot {
  background: var(--accent);
  color: #fff;
}

/* ---------- 占位图 ---------- */
.placeholder {
  background:
    repeating-linear-gradient(135deg,
      color-mix(in oklch, var(--brand) 6%, var(--bg-card)) 0 12px,
      color-mix(in oklch, var(--brand) 10%, var(--bg-card)) 12px 24px);
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
  letter-spacing: 0.5px;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, color-mix(in oklch, var(--brand) 8%, transparent), transparent 60%);
  pointer-events: none;
}
.placeholder span { position: relative; padding: 4px 10px; background: color-mix(in oklch, var(--bg-card) 75%, transparent); border: 1px dashed var(--line-strong); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: 0.15s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-deep); color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--brand);
  border-color: var(--brand);
}
.btn-ghost:hover { background: var(--brand); color: #fff; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: 0.2s;
}
.card:hover {
  border-color: var(--brand-light);
  box-shadow: 0 6px 20px -8px rgba(0,0,0,0.12);
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-sub); }

/* ---------- 页脚 ---------- */
.footer {
  background: var(--brand-deep);
  color: rgba(255,255,255,0.75);
  padding: 48px 0 0;
  font-size: 13px;
}
.footer a { color: rgba(255,255,255,0.75); }
.footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.footer-brand .cn {
  font-family: var(--f-serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}
.footer-brand .en {
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 1px;
  opacity: 0.7;
}
.footer-brand p { margin-top: 14px; line-height: 1.8; font-size: 12px; }
.footer-col h4 {
  font-size: 14px;
  color: #fff;
  margin-bottom: 14px;
  font-family: var(--f-title, var(--f-sans));
  letter-spacing: 1px;
}
.footer-col li { padding: 4px 0; font-size: 12px; }
.footer-bottom {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom .icp { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.footer-bottom .icp a { color: rgba(255,255,255,0.55); text-decoration: none; transition: 0.15s; cursor: pointer; }
.footer-bottom .icp a:hover { color: var(--gold); text-decoration: underline; }
.footer-bottom .icp a::after { content: " ↗"; font-size: 10px; opacity: 0.6; }

/* ---------- Tweaks 面板 ---------- */
.tweaks-panel {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.2);
  z-index: 500;
  font-size: 12px;
  transform: translateY(8px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
}
.tweaks-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.tweaks-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--fg);
  font-family: var(--f-title, var(--f-sans));
  letter-spacing: 2px;
}
.tweaks-body { padding: 8px 16px 16px; }
.tweak-row {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.tweak-row:last-child { border-bottom: 0; }
.tweak-row .label {
  font-size: 11px;
  color: var(--fg-muted);
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-family: var(--f-mono);
}
.tweak-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.tweak-opts button {
  flex: 1;
  padding: 6px 8px;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  background: var(--bg-alt);
  color: var(--fg-muted);
  border-radius: var(--radius);
  transition: 0.1s;
  min-width: 40px;
}
.tweak-opts button:hover { border-color: var(--brand); color: var(--brand); }
.tweak-opts button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}


/* ================================================
   无障碍浏览 · A11y Panel + Global Modes
   ================================================ */
#a11y-panel {
  position: fixed !important;
  top: 50% !important;
  right: -400px;
  width: 340px;
  background: var(--bg-card);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 60px -10px rgba(0,0,0,0.25);
  z-index: 9999;
  font-family: var(--f-sans);
  transform: translateY(-50%) !important;
  transition: right 0.3s cubic-bezier(.2,.8,.2,1);
  max-height: 85vh;
  overflow-y: auto;
}
#a11y-panel.open { right: 24px; }
#a11y-panel .a11y-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  background: var(--brand-deep);
  color: #fff;
}
#a11y-panel .a11y-title { font-family: var(--f-serif); font-size: 17px; font-weight: 600; }
#a11y-panel .a11y-close {
  width: 28px; height: 28px;
  color: #fff; font-size: 22px; line-height: 1;
  border-radius: 50%;
}
#a11y-panel .a11y-close:hover { background: rgba(255,255,255,0.15); }
#a11y-panel .a11y-body { padding: 18px 18px 20px; }
#a11y-panel .a11y-row { margin-bottom: 16px; }
#a11y-panel .a11y-label {
  font-size: 12px; color: var(--fg-muted);
  font-family: var(--f-mono); letter-spacing: 1.5px;
  margin-bottom: 8px;
}
#a11y-panel .a11y-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
#a11y-panel .a11y-btns[data-group="ct"] { grid-template-columns: repeat(2, 1fr); }
#a11y-panel .a11y-btns[data-group="ul"],
#a11y-panel .a11y-btns[data-group="am"],
#a11y-panel .a11y-btns[data-group="tts"] { grid-template-columns: repeat(2, 1fr); }
#a11y-panel .a11y-btns button {
  padding: 9px 6px;
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--fg);
  background: var(--bg);
  transition: 0.15s;
}
#a11y-panel .a11y-btns button:hover { border-color: var(--brand); color: var(--brand); }
#a11y-panel .a11y-btns button.on {
  background: var(--brand-deep);
  color: #fff;
  border-color: var(--brand-deep);
  font-weight: 600;
}
#a11y-panel .a11y-reset {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  font-size: 13px;
  color: var(--fg-muted);
}
#a11y-panel .a11y-reset:hover { color: var(--brand); border-color: var(--brand); }
#a11y-panel .a11y-note {
  font-size: 11px;
  color: var(--fg-sub);
  line-height: 1.6;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

/* —— 字号放大档位（通过 zoom 全局缩放，兼容所有固定 px 字号）—— */
html[data-a11y-fs="1"] body { zoom: 1.12; }
html[data-a11y-fs="2"] body { zoom: 1.25; }
html[data-a11y-fs="3"] body { zoom: 1.4; }

/* —— 高对比度 —— */
html[data-a11y-ct="high"] {
  --brand-deep: #000;
  --brand: #000;
  --brand-light: #000;
  --brand-wash: #fff;
  --fg: #000;
  --fg-muted: #000;
  --fg-sub: #111;
  --bg: #fff;
  --bg-alt: #fff;
  --bg-card: #fff;
  --line: #000;
  --line-strong: #000;
  --accent: #000;
}
html[data-a11y-ct="high"] body,
html[data-a11y-ct="high"] .mainnav,
html[data-a11y-ct="high"] .footer { background: #fff !important; color: #000 !important; }
html[data-a11y-ct="high"] .mainnav a,
html[data-a11y-ct="high"] .footer a,
html[data-a11y-ct="high"] .footer h4 { color: #000 !important; }
html[data-a11y-ct="high"] .mainnav { border-bottom: 3px solid #000; }
html[data-a11y-ct="high"] * { text-shadow: none !important; box-shadow: none !important; }
html[data-a11y-ct="high"] a:focus,
html[data-a11y-ct="high"] button:focus { outline: 3px solid #000 !important; outline-offset: 2px; }

/* —— 反色/灰度已移除 —— */

/* —— 强制下划线 —— */
html[data-a11y-ul="on"] a { text-decoration: underline !important; text-underline-offset: 3px; }
html[data-a11y-ul="on"] #a11y-panel a { text-decoration: none !important; }

/* —— 减少动画 —— */
html[data-a11y-am="off"] *,
html[data-a11y-am="off"] *::before,
html[data-a11y-am="off"] *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
}

/* —— 入口按钮可聚焦高亮 —— */
#a11y-toggle:focus { outline: 2px solid var(--brand); outline-offset: 2px; }

/* responsive.css 由 HTML 页面单独 link 加载（必须放在所有 CSS 之后） */
