/* ============================================================
   XX市中医院 官网模板 — 全局样式
   说明：
   1) 所有颜色通过 CSS 变量定义，皮肤文件只覆盖变量；
   2) 深色模式 :root[data-mode="dark"]；
   3) 字号全部使用 rem，配合 html[data-font] 三档缩放
      （standard 16px / large 18px / xlarge 20px），
      并联动 :root 的 --f-* 变量，实现大字体模式。
   ============================================================ */

/* ---------- 设计令牌（默认青黛 + 深色兜底） ---------- */
:root {
  /* 固定浅色外观：告诉浏览器不要按系统深色渲染表单控件与滚动条 */
  color-scheme: light;
  --primary: #0f766e;
  --primary-600: #115e59;
  --primary-100: #ccfbf1;
  --primary-50: #f0fdfa;
  --accent: #f59e0b;
  --accent-600: #d97706;
  --grad: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
  /* 按钮/激活背景：明暗两模式都保持深色，保证白字对比 ≥4.5（深色模式 --primary 会变浅，不能直接做背景） */
  --btn: var(--primary);
  --btn-hover: var(--primary-600);

  --text-strong: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --bg: #f6f8f7;
  --card: #ffffff;
  --line: #e5e9e7;

  --topbar-bg: #0c4a46;
  --topbar-text: #d9f3ef;
  --header-bg: #ffffff;
  --header-text: #1e293b;
  --nav-active: #0f766e;
  --footer-bg: #0c2e2b;
  --footer-text: #cde0dd;
  --footer-muted: #8fb0ac;

  --shadow: 0 6px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 14px 40px rgba(15, 23, 42, 0.12);
  --radius: 10px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  /* 字号档位：1rem 随 html font-size 变化（整体上调一档，老人友好更清晰） */
  --f-xs: 0.8125rem;
  --f-sm: 0.875rem;
  --f-md: 0.9375rem;
  --f-base: 1.0625rem;
  --f-lg: 1.1875rem;
  --f-xl: 1.3125rem;
  --f-2xl: 1.4375rem;
  --f-3xl: 1.75rem;
  --f-hero: clamp(1.625rem, 4.4vw, 3rem);
  --f-h2: clamp(1.5rem, 3.2vw, 2.125rem);
}

:root[data-mode="dark"] {
  --primary: #2dd4bf;
  --primary-600: #14b8a6;
  --primary-100: #99f6e4;
  --primary-50: #f0fdfa;
  --accent: #fbbf24;
  --accent-600: #f59e0b;

  --text-strong: #f1f5f9;
  --text: #cbd5e1;
  --muted: #94a3b8;
  --bg: #0b1220;
  --card: #131c2e;
  --line: #243246;

  --topbar-bg: #060b16;
  --topbar-text: #a7f3d0;
  --header-bg: #0e1626;
  --header-text: #e2e8f0;
  --nav-active: #2dd4bf;
  --footer-bg: #060b16;
  --footer-text: #cbd5e1;
  --footer-muted: #64748b;

  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.5);
}

/* 大字体模式：整体放大根字号，rem 字号随之放大 */
html { font-size: 16px; }
html[data-font="large"] { font-size: 18px; }
html[data-font="xlarge"] { font-size: 20px; }

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: var(--f-base);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background .3s ease, color .3s ease;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-600); }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5 { color: var(--text-strong); line-height: 1.4; }
::selection { background: var(--primary); color: #fff; }
[id] { scroll-margin-top: 84px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
/* ≥1500：全部容器统一按视口比例充满（97vw，上限 2800）——
   页头/院名横幅/首页目录/板块/页脚左右边缘完全对齐，上下模块不错位 */
@media (min-width: 1500px) {
  .container { max-width: min(97vw, 2800px); }
}
.section { padding: 3.5rem 0; }
.section--alt { background: var(--card); }

.section-head { text-align: center; margin-bottom: 2.125rem; }
.section-head .tag {
  display: inline-block; font-size: var(--f-xs); color: var(--primary);
  background: var(--primary-100); padding: 3px 14px; border-radius: 4px;
  margin-bottom: 10px; letter-spacing: 1px;
}
.section-head h2 { font-size: var(--f-h2); font-weight: 700; }
.section-head p { color: var(--muted); margin-top: 8px; font-size: var(--f-md); }

/* 分隔标题（左右结构） */
.sec-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.375rem; }
.sec-title h2 { font-size: var(--f-2xl); font-weight: 700; border-left: 4px solid var(--primary); padding-left: 12px; }
.sec-title .more { font-size: var(--f-md); color: var(--muted); }
.sec-title .more:hover { color: var(--primary); }

/* 通用行内小图标 */
.ico { width: 1em; height: 1em; vertical-align: -0.12em; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--btn); color: #fff; border: none; cursor: pointer;
  padding: 0.625rem 1.375rem; border-radius: 6px; font-size: var(--f-md); font-weight: 500;
  transition: background .2s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.btn:hover { box-shadow: 0 4px 12px rgba(0,0,0,.18); color: #fff; filter: brightness(1.08); background: var(--btn-hover); }
.btn--ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); box-shadow: none; }
.btn--ghost:hover { background: var(--primary-50); color: var(--primary); }
.btn--accent { background: linear-gradient(135deg, var(--accent), var(--accent-600)); }
/* 深色模式下强调按钮：accent 变浅，改用深琥珀底+白字保证可读 */
:root[data-mode="dark"] .btn--accent { background: linear-gradient(135deg, #b45309 0%, #92400e 100%); color: #fff; }
.btn--sm { padding: 0.4375rem 1rem; font-size: var(--f-sm); }
.btn--lg { padding: 0.8125rem 1.875rem; font-size: var(--f-lg); }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block; font-size: var(--f-xs); padding: 2px 10px; border-radius: 4px;
  background: var(--primary-100); color: var(--primary); white-space: nowrap;
}
.badge--accent { background: rgba(245,158,11,.15); color: var(--accent-600); }

/* ---------- 顶部条 ---------- */
.topbar { background: var(--topbar-bg); color: var(--topbar-text); font-size: var(--f-xs); }
.topbar .container { display: flex; justify-content: space-between; align-items: center; min-height: 38px; gap: 12px; }
.topbar a { color: inherit; opacity: .9; }
.topbar a:hover { opacity: 1; color: var(--accent); }
.topbar .tb-right { display: flex; align-items: center; gap: 16px; }

/* ---------- 头部 + 导航 ---------- */
.header {
  position: sticky; top: 0; z-index: 100; background: var(--header-bg);
  box-shadow: 0 1px 0 var(--line), 0 4px 18px rgba(15,23,42,.05);
  transition: background .3s ease;
}
.header-inner { display: flex; align-items: center; gap: 18px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .logo { width: 48px; height: 48px; flex: 0 0 auto; }
.brand .logo img { width: 100%; height: 100%; }
.brand-name { display: block; line-height: 1.2; min-width: 0; }
.brand-name .cn { display: block; font-size: var(--f-2xl); font-weight: 800; color: var(--header-text); letter-spacing: 1px; }
.brand-name .en {
  display: block; font-size: 0.75rem; color: var(--muted); letter-spacing: 2px; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a {
  padding: 9px 15px; border-radius: 6px; color: var(--header-text);
  font-size: var(--f-md); font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--primary); background: var(--primary-50); }
.nav a.active { color: #fff; background: var(--grad); box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.nav a.active:hover { color: #fff; }

/* 模式切换按钮 */
.mode-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; font-size: var(--f-lg);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s ease, background .2s ease;
}
.mode-toggle:hover { transform: rotate(20deg) scale(1.06); }
/* 头部按钮：导航 / 预约 */
.header-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 0.875rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.header-btn:hover { border-color: var(--primary); color: var(--primary); }
.header-btn .hb-ic { width: 15px; height: 15px; flex: 0 0 auto; }
/* 头部「导航」选择菜单（向下展开，右对齐）；特异性须高于后部的 .fmap-nav-menu 基础定位，否则 top/bottom 同时生效被压成 0 高 */
.header-nav-wrap { position: relative; }
.header-nav-wrap .fmap-nav-menu.header-nav-menu { position: absolute; top: calc(100% + 6px); right: 0; left: auto; bottom: auto; transform: none; }
.header-nav-wrap .fmap-nav-menu.header-nav-menu a { text-align: left; }
.header-btn-primary { background: var(--btn); color: #fff; border-color: transparent; }
.header-btn-primary:hover { color: #fff; filter: brightness(1.08); background: var(--btn-hover); }
/* 联系我们页「来院路线」内嵌地图 */
.route-map { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.route-map .fmap-view { height: 320px; }
.route-map .fmap-nav-btn { background: var(--btn); color: #fff; }

/* 大字体切换 */
.font-toggle { display: flex; gap: 4px; }
.font-toggle button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  transition: .2s;
}
.font-toggle button.f-sm { font-size: 0.75rem; }
.font-toggle button.f-md { font-size: 0.875rem; }
.font-toggle button.f-lg { font-size: 1rem; }
.font-toggle button.active { background: var(--grad); color: #fff; border-color: transparent; }
.font-toggle button:not(.active):hover { border-color: var(--primary); color: var(--primary); }

/* 汉堡菜单（移动端） */
.hamburger {
  display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; transition: .25s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 轮播 ---------- */
.hero { position: relative; overflow: hidden; background: var(--card); }
.hero-track { display: flex; transition: transform .6s cubic-bezier(.4,0,.2,1); }
.hero-slide { position: relative; min-width: 100%; }
/* 横幅自适应高度：桌面不过高、手机不过矮，用 cover 裁切避免拉伸变形 */
.hero-slide img { width: 100%; height: clamp(240px, 40vw, 580px); object-fit: cover; object-position: center; }
.hero-overlay {
  position: absolute; inset: 0; display: flex; align-items: center;
  background: linear-gradient(90deg, rgba(6,25,22,.55) 0%, rgba(6,25,22,.18) 55%, transparent 100%);
  color: #fff;
}
.hero-overlay .inner { max-width: 640px; padding: 0 40px; }
.hero-overlay h2 { color: #fff; font-size: var(--f-hero); font-weight: 800; margin-bottom: 12px; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.hero-overlay p { font-size: var(--f-lg); color: rgba(255,255,255,.95); margin-bottom: 22px; text-shadow: 0 1px 8px rgba(0,0,0,.3); }
.hero-overlay .btn { background: #fff; color: #0f172a; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.hero-overlay .btn:hover { background: #fff; color: #0f172a; }
.hero-dots { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
.hero-dots button {
  width: 10px; height: 10px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.5); transition: .3s; padding: 0;
}
.hero-dots button.active { width: 26px; border-radius: 999px; background: #fff; }
.hero-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.85); color: #1e293b; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s, background .3s;
}
.hero:hover .hero-arrow { opacity: 1; }
.hero-arrow:hover { background: #fff; }
.hero-arrow.prev { left: 18px; }
.hero-arrow.next { right: 18px; }

/* ---------- 快捷入口 ---------- */
.quick { margin-top: 26px; position: relative; z-index: 10; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.quick-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.375rem 1.125rem; text-align: center; box-shadow: var(--shadow);
  transition: box-shadow .25s ease, border-color .25s;
  display: block;
}
.quick-item:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); }
.quick-item .qi-icon {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 12px;
  background: var(--btn); display: flex; align-items: center; justify-content: center; color: #fff;
}
.quick-item .qi-icon svg { width: 28px; height: 28px; }
.quick-item h3 { font-size: var(--f-lg); margin-bottom: 4px; }
.quick-item p { font-size: var(--f-xs); color: var(--muted); }

/* ---------- 数据统计 ---------- */
.stats { background: var(--grad); padding: 2.125rem 0; color: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; text-align: center; }
.stat-item .num { font-size: clamp(1.875rem, 4vw, 2.75rem); font-weight: 800; }
.stat-item .label { font-size: var(--f-md); opacity: .92; margin-top: 2px; }

/* ---------- 首页：动态+公告 ---------- */
.home-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 26px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.news-list { padding: 6px 22px 20px; }
.news-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.news-item:last-child { border-bottom: none; }
.news-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); flex: 0 0 auto; }
.news-item a { color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--f-md); }
.news-item a:hover { color: var(--primary); }
.news-item time { font-size: var(--f-xs); color: var(--muted); flex: 0 0 auto; }

/* ---------- 列表折叠：内容多时默认收起，点「显示更多」展开 ---------- */
.fold-list .fold-item { display: none !important; }
.fold-list.expanded li.fold-item { display: list-item !important; }
.fold-list.expanded .news-item.fold-item { display: flex !important; }
.fold-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 6px; padding: 9px 0;
  background: none; border: none; border-top: 1px dashed var(--line);
  color: var(--primary); font-size: var(--f-sm); font-family: inherit; cursor: pointer;
  transition: background .2s;
}
.fold-toggle:hover { background: var(--primary-50); }
.fold-toggle .fold-arrow { display: inline-block; transition: transform .2s; }
.fold-toggle.expanded .fold-arrow { transform: rotate(180deg); }

/* ---------- 通用卡片网格 ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

/* 新闻卡片 */
.post-card { overflow: hidden; display: flex; flex-direction: column; }
.post-card .pc-img { aspect-ratio: 16 / 9; overflow: hidden; position: relative; }
.post-card .pc-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.post-card:hover .pc-img img { transform: scale(1.06); }
.post-card .pc-date {
  position: absolute; top: 12px; left: 12px; background: rgba(15,23,42,.72); color: #fff;
  border-radius: 8px; padding: 4px 10px; font-size: var(--f-xs); backdrop-filter: blur(4px);
}
.post-card .pc-body { padding: 1rem 1.125rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.post-card .pc-body h3 { font-size: var(--f-lg); margin-bottom: 8px; }
.post-card .pc-body h3 a { color: var(--text-strong); }
.post-card .pc-body h3 a:hover { color: var(--primary); }
.post-card .pc-body p { font-size: var(--f-md); color: var(--muted); flex: 1; }
.post-card .pc-meta { margin-top: 12px; display: flex; gap: 8px; align-items: center; }

/* 科室宫格 */
.dept-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.125rem; display: block; box-shadow: var(--shadow);
  transition: border-color .25s, box-shadow .25s;
}
.dept-item:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.dept-item h3 { font-size: var(--f-lg); margin-bottom: 4px; }
.dept-item p { font-size: var(--f-sm); color: var(--muted); margin: 0; }

/* 专家卡片 */
.doctor-card { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem 0.75rem 1rem; box-shadow: var(--shadow); transition: box-shadow .25s, border-color .25s; }
.doctor-card:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); }
.doctor-card .dc-avatar { display: block; width: 60px; height: 60px; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; border: 3px solid var(--primary-100); }
.doctor-card .dc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.doctor-card h3 { font-size: var(--f-md); }
.doctor-card .dc-title { font-size: var(--f-sm); color: var(--primary); margin: 4px 0 2px; }
.doctor-card .dc-dept { font-size: var(--f-xs); color: var(--muted); margin-bottom: 0; }

/* 专家跑马灯：横向滑动（手机手滑，桌面箭头），卡片紧凑 */
.expert-swiper { position: relative; }
.expert-swiper .track {
  display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 2px 12px; scrollbar-width: none;
}
.expert-swiper .track .doctor-card { flex: 0 0 180px; width: 180px; scroll-snap-align: start; margin: 0; }
.expert-swiper .track::-webkit-scrollbar { display: none; }
.expert-swiper .swipe-btn { display: none; }
@media (min-width: 768px) { .expert-swiper .swipe-btn { display: flex; } }
.swipe-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; box-shadow: var(--shadow); font-size: var(--f-lg); display: flex; align-items: center; justify-content: center; }
.swipe-btn:hover { color: var(--primary); }
.swipe-btn.prev { left: -14px; }
.swipe-btn.next { right: -14px; }

/* ---------- 板块 Tab ---------- */
.tabs { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.tabs-nav { display: flex; border-bottom: 1px solid var(--line); background: var(--bg); }
.tabs-nav button {
  flex: 1; padding: 13px 10px; border: none; background: transparent; cursor: pointer;
  font-size: var(--f-md); font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent;
  transition: color .2s, border-color .2s;
}
.tabs-nav button.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--card); }
.tabs-panel { display: none; padding: 18px 22px; }
.tabs-panel.active { display: block; animation: fadeIn .35s ease; }

/* ---------- 首页：关于简介 ---------- */
.about-wrap { display: grid; grid-template-columns: 1fr 1.2fr; gap: 36px; align-items: center; }
.about-img { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); }
.about-wrap p { color: var(--text); margin-bottom: 14px; text-align: justify; }
.seal { border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- 页脚 ---------- */
.footer { background: var(--footer-bg); color: var(--footer-text); margin-top: 3.5rem; }
.footer-top { padding: 2.75rem 0 1.875rem; }
/* 品牌区整行 */
.footer-brand {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px 30px;
  padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-brand .f-about { flex: 1 1 300px; max-width: 680px; font-size: var(--f-md); color: var(--footer-muted); line-height: 1.9; margin: 0; }
/* 联系我们：联系方式 + 二维码 + 地图 分层 */
.footer-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px 32px; padding-top: 24px; min-width: 0; }
.f-contact-row { display: flex; align-items: center; gap: 20px 32px; flex-wrap: wrap; }
.f-contact { flex: 1 1 240px; min-width: 0; }
.f-qr { flex: 0 0 auto; text-align: center; }
.f-qr img { display: block; width: 120px; height: 120px; border-radius: 8px; background: #fff; padding: 6px; }
.f-qr b { display: block; margin-top: 6px; font-size: var(--f-sm); color: var(--footer-text); }
.f-qr em { display: block; font-style: normal; font-size: var(--f-xs); color: var(--footer-muted); margin-top: 2px; }
.footer-cols > * { min-width: 0; }
.footer h4 { color: #fff; font-size: var(--f-lg); margin-bottom: 16px; }
.footer ul li { margin-bottom: 10px; }
.footer ul li a { color: var(--footer-muted); font-size: var(--f-md); }
.footer ul li a:hover { color: var(--accent); }
.footer .f-contact li { display: flex; gap: 8px; color: var(--footer-text); font-size: var(--f-md); align-items: flex-start; }
.footer .f-contact li span { flex: 1; min-width: 0; overflow-wrap: break-word; word-break: break-word; }
.footer .f-contact li svg { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 4px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 18px 0; font-size: var(--f-xs); color: var(--footer-muted); }
.footer-bottom .container { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.footer-bottom .container span { overflow-wrap: break-word; word-break: break-word; }
/* 页脚底部链接：深色页脚上用页脚色而非主色，保证对比度 */
.footer-bottom a { color: var(--footer-muted); text-decoration: underline; text-underline-offset: 2px; }
.footer-bottom a:hover { color: var(--footer-text); }

/* 页脚「意见反馈」精简入口（小信箱按钮） */
.fb-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  padding: 6px 12px; border: 1px solid rgba(255,255,255,.28); border-radius: 8px;
  background: rgba(255,255,255,.06); color: var(--footer-text);
  font-size: var(--f-sm); font-family: inherit; cursor: pointer; transition: .2s;
}
.fb-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(255,255,255,.1); }
.fb-btn .ico { width: 15px; height: 15px; }
/* 反馈弹窗（一键打开） */
.fb-modal { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.5); padding: 18px; }
.fb-modal.show { display: flex; }
.fb-card { position: relative; background: var(--card); width: min(440px, 96vw); border-radius: 14px; padding: 24px; box-shadow: var(--shadow-lg); }
.fb-card h3 { font-size: var(--f-xl); margin-bottom: 4px; }
.fb-card .fb-sub { font-size: var(--f-sm); color: var(--muted); margin-bottom: 14px; }
.fb-card .fb-close { position: absolute; top: 14px; right: 16px; border: none; background: none; font-size: 1.25rem; line-height: 1; color: var(--muted); cursor: pointer; }
.fb-card .fb-close:hover { color: var(--text); }
.fb-card input, .fb-card textarea {
  width: 100%; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: var(--f-md); font-family: inherit; color: var(--text); background: var(--card);
}
.fb-card input:focus, .fb-card textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.fb-card .fb-actions { display: flex; gap: 10px; margin-top: 14px; }
.fb-card .fb-actions .btn { flex: 1; justify-content: center; }

/* 页脚内置地图（Leaflet+高德瓦片）+ 导航按钮（点开选 高德/百度/腾讯） */
.footer-map { margin-top: 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; overflow: hidden; }
.fmap-view-wrap { position: relative; z-index: 0; /* 建立独立层叠上下文，防止 Leaflet 高 z-index 图层(400-700)盖住导航菜单(z-index 30) */ }
.fmap-view { height: 220px; width: 100%; background: #dfe8ee; }
.fmap-calibrate {
  position: absolute; top: 8px; right: 8px; z-index: 1001; padding: 4px 10px;
  font-size: var(--f-xs); border-radius: 6px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.15); background: rgba(255,255,255,.94); color: #374151;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.fmap-calibrate:hover { background: #fff; }
.fmap-nav { position: relative; }
.fmap-nav-btn {
  display: block; width: 100%; padding: 10px 0; border: none; cursor: pointer;
  background: var(--btn); color: #fff; font-size: var(--f-md); font-weight: 600;
}
.fmap-nav-btn:hover { filter: brightness(1.1); }
.fmap-nav-menu {
  position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); min-width: 150px; overflow: hidden; z-index: 30; display: none;
}
.fmap-nav-menu.open { display: block; animation: fadeIn .2s ease; }
.fmap-nav-menu a { display: block; padding: 9px 18px; color: var(--text); font-size: var(--f-md); text-align: center; white-space: nowrap; }
.fmap-nav-menu a + a { border-top: 1px solid var(--line); }
.fmap-nav-menu a:hover { background: var(--primary-50); color: var(--primary); }

/* 主题切换器 */
.theme-switch { display: flex; align-items: center; gap: 8px; }
.theme-switch .sw-item {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s; padding: 0;
}
.theme-switch .sw-item:hover { transform: scale(1.15); }
.theme-switch .sw-item.active { border-color: var(--text-strong); box-shadow: 0 0 0 3px rgba(255,255,255,.15); }

/* 自媒体社交（预留：可二维码或链接，未启用时不显示） */
.footer-social { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.footer-social .fs-head { width: 100%; font-size: var(--f-md); color: var(--footer-text); margin-bottom: 2px; }
.fs-item {
  position: relative; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: var(--footer-text);
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, background .2s, color .2s;
}
.fs-item:hover { background: var(--btn); color: #fff; transform: translateY(-2px); }
.fs-item svg { width: 22px; height: 22px; }
.fs-qr {
  position: absolute; bottom: 50px; left: 50%; transform: translateX(-50%) scale(.6);
  transform-origin: bottom center; background: var(--card); border-radius: 10px;
  padding: 8px 8px 4px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden;
  transition: .25s; z-index: 60; width: 132px;
}
.fs-item:hover .fs-qr, .fs-item.show-qr .fs-qr { opacity: 1; visibility: visible; transform: translateX(-50%) scale(1); }
.fs-qr img { width: 116px; height: 116px; border-radius: 6px; }
.fs-qr em { display: block; font-style: normal; font-size: var(--f-xs); color: var(--text); text-align: center; margin-top: 4px; }

/* 移动端抽屉遮罩 */
.nav-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 110;
  opacity: 0; visibility: hidden; transition: .3s;
}
.nav-backdrop.show { opacity: 1; visibility: visible; }

/* 浮动回到顶部 */
.to-top {
  position: fixed; right: 22px; bottom: 26px; z-index: 90; width: 44px; height: 44px;
  border-radius: 50%; border: none; background: var(--grad); color: #fff; cursor: pointer;
  font-size: 1.25rem; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden;
  transform: translateY(12px); transition: .3s;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- 内页横幅 ---------- */
.page-hero { background: var(--grad); color: #fff; padding: 2.875rem 0; }
.page-hero h1 { color: #fff; font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 800; }
.page-hero p { color: rgba(255,255,255,.9); margin-top: 8px; font-size: var(--f-md); }
.breadcrumb { font-size: var(--f-xs); color: rgba(255,255,255,.85); margin-top: 10px; }
.breadcrumb a { color: #fff; }
.breadcrumb a:hover { text-decoration: underline; }

/* 列表页通用 */
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 1.375rem; flex-wrap: wrap; }
.list-toolbar .cats { display: flex; gap: 8px; flex-wrap: wrap; }
.list-toolbar .cats button { padding: 6px 16px; border-radius: 6px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-size: var(--f-md); transition: .2s; }
.list-toolbar .cats button.active { background: var(--grad); color: #fff; border-color: transparent; }
.list-toolbar .count { font-size: var(--f-md); color: var(--muted); }

/* 文章列表（行式） */
.article-row {
  display: flex; gap: 18px; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.article-row:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.article-row .ar-img { flex: 0 0 200px; aspect-ratio: 16/9; border-radius: var(--radius-sm); overflow: hidden; }
.article-row .ar-img img { width: 100%; height: 100%; object-fit: cover; }
.article-row .ar-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.article-row h3 { font-size: var(--f-lg); margin-bottom: 8px; }
.article-row h3 a { color: var(--text-strong); }
.article-row h3 a:hover { color: var(--primary); }
.article-row .ar-sum { font-size: var(--f-md); color: var(--muted); flex: 1; }
.article-row .ar-meta { margin-top: 10px; display: flex; gap: 10px; align-items: center; font-size: var(--f-xs); color: var(--muted); }

/* ---------- 文章详情 ---------- */
.article-detail { max-width: 820px; margin: 0 auto; }
.article-head { text-align: center; padding: 10px 0 24px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.article-head h1 { font-size: clamp(1.375rem, 3vw, 1.875rem); font-weight: 800; margin-bottom: 14px; }
.article-head .meta { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: var(--f-md); flex-wrap: wrap; }
.article-body { font-size: var(--f-lg); line-height: 2; color: var(--text); }
.article-body p { margin-bottom: 16px; text-align: justify; }
.article-body strong { color: var(--text-strong); }
.article-body img { border-radius: var(--radius-sm); margin: 8px 0; max-width: 100%; height: auto; }
.article-body h2, .article-body h3 { margin: 18px 0 8px; color: var(--text-strong); }
.article-body ul, .article-body ol { margin: 8px 0 8px 22px; }
.article-body blockquote { border-left: 4px solid var(--primary); background: var(--primary-50); padding: 8px 14px; margin: 12px 0; color: var(--text); }
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.article-body table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.article-body table td, .article-body table th { border: 1px solid var(--line); padding: 6px 10px; }
.article-body table th { background: var(--primary-50); }
.article-note { margin-top: 24px; padding: 12px 14px; background: var(--primary-50); border-left: 4px solid var(--primary); border-radius: var(--radius-sm); color: var(--text); font-size: var(--f-sm); }
.expert-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: var(--f-md); }

/* ---------- 医院概况 ---------- */
.about-page p { margin-bottom: 16px; text-align: justify; }
.about-page h3 { margin: 26px 0 14px; font-size: 1.25rem; border-left: 4px solid var(--primary); padding-left: 12px; }
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.feature-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; text-align: center; box-shadow: var(--shadow); }
.feature-item .fi-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--primary-100); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.feature-item .fi-icon svg { width: 30px; height: 30px; }
.feature-item h4 { font-size: var(--f-lg); margin-bottom: 8px; }
.feature-item p { font-size: var(--f-md); color: var(--muted); }

/* ---------- 科室详情 ---------- */
.keshi-detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 26px; }
.keshi-intro h2 { font-size: var(--f-2xl); margin-bottom: 14px; }
.keshi-intro p { margin-bottom: 12px; text-align: justify; }
.side-card { padding: 1.375rem; }
.side-card h3 { font-size: var(--f-lg); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.side-card ul li { padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: var(--f-md); }
.side-card ul li:last-child { border-bottom: none; }
.side-card ul li a { color: var(--text); }
.side-card ul li a:hover { color: var(--primary); }
.info-row { display: flex; gap: 10px; padding: 8px 0; font-size: var(--f-md); }
.info-row .k { color: var(--muted); flex: 0 0 76px; }

/* ---------- 就医指南 ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.step-item { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 18px; text-align: center; box-shadow: var(--shadow); }
.step-item .no { width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 50%; background: var(--btn); color: #fff; font-weight: 800; font-size: var(--f-lg); display: flex; align-items: center; justify-content: center; }
.step-item h4 { font-size: var(--f-lg); margin-bottom: 8px; }
.step-item p { font-size: var(--f-sm); color: var(--muted); }
.appoint-cta { text-align: center; padding: 10px 0; }
.appoint-cta h2 { font-size: var(--f-3xl); margin-bottom: 8px; }
.appoint-cta p { color: var(--muted); margin-bottom: 20px; }

/* ---------- 联系我们 ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 28px; }
.contact-item { display: flex; gap: 14px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow); }
.contact-item .ci-icon { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; background: var(--primary-100); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.contact-item .ci-icon svg { width: 24px; height: 24px; }
.contact-item h4 { font-size: var(--f-md); margin-bottom: 4px; }
.contact-item p { font-size: var(--f-md); color: var(--muted); }
.map-box { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--card); min-height: 360px; position: relative; }
.map-box .map-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 8px; text-align: center; padding: 20px; }
.map-box .map-placeholder svg { width: 60px; height: 60px; opacity: .5; }

/* 友情链接 */
.friend-links { display: flex; flex-wrap: wrap; gap: 12px; }
.friend-links a {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--muted); font-size: var(--f-sm);
  transition: .2s;
}
.friend-links a:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- 通用动效 ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.reveal { opacity: 0; transition: opacity .45s ease; }
.reveal.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .about-wrap { grid-template-columns: 1fr; }
  .home-cols, .keshi-detail, .contact-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .feature-list { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: fixed; top: 0; right: -300px; width: 280px; height: 100vh; z-index: 120;
    background: var(--card); flex-direction: column; align-items: stretch; padding: 70px 20px 20px;
    gap: 6px; box-shadow: -10px 0 40px rgba(0,0,0,.15); transition: right .3s ease; overflow-y: auto;
  }
  .nav.open { right: 0; }
  .nav a { font-size: var(--f-lg); padding: 12px 14px; border-radius: 10px; }
  .nav a.active { color: var(--primary); background: var(--primary-50); box-shadow: none; }
  .hamburger { display: flex; }
}

@media (min-width: 641px) and (max-width: 1024px) {
  /* 平板/150%缩放等中等宽度：头部按钮单独成行，避免与院名+汉堡挤压 */
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 0 8px; }
  .brand-name .en { display: none; }
  .brand-name .cn { font-size: 1.125rem; letter-spacing: 0; }
  .header-actions { order: 2; width: 100%; margin-left: 0; gap: 8px; }
  .header-actions .header-btn { flex: 1; justify-content: center; padding: 8px 6px; }
  .header-nav-wrap { flex: 1; }
  .header-nav-wrap .header-btn { width: 100%; }
  .hamburger { margin-left: auto; }
}

@media (max-width: 640px) {
  /* 手机端头部：第一行 院名+菜单；第二行 导航/预约 等分全宽 */
  .header-inner { flex-wrap: wrap; gap: 8px; padding: 10px 0 8px; }
  .brand-name .en { display: none; }
  .brand-name .cn { font-size: 1.0625rem; letter-spacing: 0; }
  .header-actions { order: 2; width: 100%; margin-left: 0; gap: 8px; }
  .header-actions .header-btn { flex: 1; justify-content: center; padding: 8px 6px; }
  .header-nav-wrap { flex: 1; }
  .header-nav-wrap .header-btn { width: 100%; }
  .hamburger { margin-left: auto; }
  .section { padding: 2.5rem 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .brand .logo { width: 40px; height: 40px; }
  .brand-name .cn { font-size: var(--f-lg); }
  .brand-name .en { max-width: 140px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .quick-item { padding: 1rem 0.625rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .article-row { flex-direction: column; }
  .article-row .ar-img { flex: none; }
  .steps { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  /* 页脚手机端：联系我们上下堆叠（联系方式→二维码居中→地图），版权条居中 */
  .footer-cols { grid-template-columns: 1fr; gap: 20px 24px; }
  .footer-cols > div:last-child { grid-column: auto; }
  .f-contact-row { flex-direction: column; align-items: flex-start; gap: 14px; }
  .f-contact { flex: none; width: 100%; }
  .f-qr { align-self: center; }
  .footer-bottom .container { flex-direction: column; align-items: center; text-align: center; gap: 4px; }
  .footer-brand .f-about { max-width: none; }
  .hero-overlay .inner { padding: 0 22px; }
  .hero-arrow { display: none; }
  .expert-swiper .track .doctor-card { flex: 0 0 150px; width: 150px; }
  .topbar .container { justify-content: center; }
  .topbar .tb-left { display: none; }
  .font-toggle { display: none; }
}

/* ============================================================
   统一响应式目录布局（手机/电脑同一套页面，<1024px 自动折叠单栏）
   ============================================================ */
.dir-wrap { padding: 26px 20px 6px; }
.dir-wrap { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(0, 2.3fr) minmax(200px, 1fr); gap: 18px; align-items: stretch; }
.dir-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 每栏最后一个盒子撑满栏高，消除矮栏下方的大片背景空白 */
.dir-col > .dbox:last-child { flex: 1 1 auto; display: flex; flex-direction: column; }
/* 被拉伸盒子的内容纵向分布：概况盒横幅图自动撑满，不留盒内空腔 */
.dir-col > .dbox:last-child .dbox-img { flex: 1 1 auto; min-height: 0; display: flex; }
.dir-col > .dbox:last-child .dbox-img img { width: 100%; height: 100%; object-fit: cover; }
/* 右栏「预约挂号」CTA 卡：按钮居中撑满剩余高度 */
.appt-cta .appt-note { padding: 0 14px; font-size: var(--f-sm); color: var(--muted); line-height: 1.8; }
.appt-cta .appt-btn { margin: auto 14px 16px; display: flex; justify-content: center; align-items: center; font-size: var(--f-md); padding: 12px 0; }

.dbox { border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.dbox-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; font-size: var(--f-xl); font-weight: 700; color: var(--text-strong);
  border-bottom: 1px solid var(--line); border-left: 4px solid var(--primary);
  background: var(--primary-50);
}
.dbox-title .dmore { font-weight: 400; }
.dbox-title .dmore a { font-size: var(--f-xs); color: var(--muted); }
.dbox-title .dmore a:hover { color: var(--primary); }

.dbox-img { display: block; padding: 12px 14px 0; }
.dbox-img img { width: 100%; border-radius: 4px; }
.dbox-text { padding: 8px 14px 6px; font-size: var(--f-md); color: var(--muted); line-height: 1.85; margin: 0; text-align: justify; }
.dlink { display: inline-block; padding: 0 14px 12px; font-size: var(--f-xs); }

.dcontact { padding: 8px 14px 4px; }
.dcontact li { font-size: var(--f-xs); color: var(--text); padding: 4px 0; line-height: 1.7; }

.dlist { padding: 6px 14px 12px; }
.dlist li { padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: var(--f-md); }
.dlist li:last-child { border-bottom: none; }
.dlist a { color: var(--text); }
.dlist a:hover { color: var(--primary); }
.dlist li em { display: block; font-style: normal; font-size: var(--f-xs); color: var(--muted); }

/* 医院动态：迷你轮播 + 标题列表 */
.dnews-flex { display: flex; gap: 14px; padding: 12px 14px; }
.mini-hero { position: relative; flex: 0 0 44%; width: 44%; overflow: hidden; border-radius: 6px; }
.mini-hero .hero-slide img { width: 100%; height: 210px; object-fit: cover; }
.mini-hero .hero-caption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); color: #fff;
  font-size: var(--f-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-hero .hero-dots { bottom: 6px; }
.mini-hero .hero-dots button { width: 7px; height: 7px; background: rgba(255,255,255,.55); }
.mini-hero .hero-dots button.active { width: 18px; background: #fff; }
.mini-hero .hero-arrow { width: 30px; height: 30px; font-size: var(--f-md); opacity: 0; }
.mini-hero:hover .hero-arrow { opacity: 1; }
.dnews-flex .dlist { flex: 1; min-width: 0; padding: 2px 0 6px; }

/* 目录式科室 */
.dir-section { margin: 22px auto; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.dir-depts { padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
/* 科室列表页（独立网格，自适应换列铺满） */
.dept-fluid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
/* 专家列表页：小头像网格，手机2个/稍宽3个/桌面自适应 */
.expert-fluid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.dir-depts .dept-item { padding: 12px; text-align: center; }
.dir-depts .dept-item h3 { font-size: var(--f-md); margin-bottom: 2px; }
.dir-depts .dept-item p { font-size: var(--f-xs); }
.dir-section > .expert-swiper { padding: 14px; }
.dir-section > .friend-links { padding: 12px 14px; }

/* 桌面端：顶部院名横幅（经典医院风格，配色随主题变量） */
.desktop-banner {
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-50) 55%, var(--primary-100) 100%);
  border-bottom: 3px solid var(--primary);
}
.db-inner { display: flex; align-items: center; gap: 22px; padding: 20px 0; }
.db-logo { width: 74px; height: 74px; flex: 0 0 auto; }
.db-name h1 { font-size: clamp(1.625rem, 3vw, 2.25rem); color: var(--primary-600); font-weight: 800; letter-spacing: 2px; }
.db-en { font-size: var(--f-xs); color: var(--muted); letter-spacing: 3px; margin-top: 3px; overflow-wrap: break-word; word-break: break-word; }
.db-slogan { font-size: 0.9375rem; color: var(--accent-600); font-weight: 700; margin-top: 4px; letter-spacing: 1px; }
.db-extra { margin-left: auto; text-align: right; font-size: var(--f-md); color: var(--text); line-height: 2; }
.db-extra span { display: block; }

/* 目录区跟随容器宽度（1280px/超宽屏1440px），三栏用弹性比例，减少两侧空白 */
@media (min-width: 900px) and (max-width: 1179px) {
  /* 中等宽度：概况+动态 两列，健康/就医指南 整行两栏（自动排布，避免列塌陷） */
  .dir-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; }
  .dir-col:nth-child(3) { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

/* ============================================================
   移动端排版优化：避免左右顶格，内容留白更智能
   ============================================================ */
body { overflow-x: hidden; }

/* ================= 演示版角标（临时，正式上线前移除整段） =================
   说明：此站当前为模板/演示展示，非最终结果。用固定左下角半透明角标提示。
   纯 CSS 伪元素实现，不进入 HTML 正文（不影响 SEO）；正式发布前删除本段即可。
-------------------------------------------------------------------------------- */
body::before {
  content: '演示版 · 内容待替换';
  position: fixed; left: 14px; bottom: 16px; z-index: 200;
  padding: 5px 14px; border-radius: 999px;
  background: rgba(15, 23, 42, .72); color: #fff;
  font-size: 12px; letter-spacing: 1px; line-height: 1; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
/* 网格/弹性容器与子项：允许收缩，避免长文本撑破页面（不改变列数定义） */
.quick-grid, .stats-grid, .grid, .dir-depts, .home-cols, .about-wrap, .dnews-flex,
.footer-cols, .steps, .feature-list { min-width: 0; }
.quick-grid > *, .stats-grid > *, .grid > *, .dir-depts > *, .home-cols > *,
.about-wrap > *, .dnews-flex > *, .footer-cols > *, .steps > *, .feature-list > * { min-width: 0; }
/* 科室卡 / 信息行 内层可收缩换行 */
.dept-item > * , .info-row > * { min-width: 0; }
.info-row > span:last-child { flex: 1; overflow-wrap: break-word; word-break: break-word; }
p, li, h1, h2, h3, h4, h5, a, .dbox-text, .article-body, .news-item a, .dlist a {
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 640px) {
  /* 更舒适的左右留白 + 刘海屏安全区 */
  .container, .topbar .container {
    padding-left: max(18px, env(safe-area-inset-left, 0px));
    padding-right: max(18px, env(safe-area-inset-right, 0px));
  }
  /* 轮播图内嵌圆角，不再满屏顶格 */
  .hero { margin: 10px 12px 0; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
  .hero-overlay { border-radius: 16px; }
  .hero-overlay .inner { padding: 0 18px; }
  .hero-overlay h2 { font-size: 1.375rem; }
  .hero-overlay p { font-size: var(--f-md); }
  .quick { margin-top: 0; }
  .quick-grid { padding: 0 2px; }
  /* 数据统计带内嵌圆角 */
  .stats { margin: 0 12px; border-radius: 14px; }
  /* 卡片留白与圆角统一 */
  .card { border-radius: 12px; }
  .news-list { padding: 6px 16px 16px; }
  .post-card .pc-body { padding: 14px 16px; }
  .dept-item { padding: 14px; }
  .doctor-card { padding: 18px 12px 16px; }
  .tabs-panel { padding: 14px 16px; }
  /* 页脚 */
  .footer-bottom { padding: 16px 0; }
  .footer-top { padding: 28px 0 22px; }
}

@media (min-width: 641px) and (max-width: 1023px) {
  /* 平板：保持舒适留白 */
  .container { padding-left: 24px; padding-right: 24px; }
}

/* ===== 统一布局响应式：三栏 → 单栏 ===== */
@media (max-width: 1023px) {
  .dir-wrap { grid-template-columns: 1fr; padding: 18px 20px 0; }
  .dir-col { gap: 12px; }
  .dnews-flex { align-items: stretch; }
}

@media (max-width: 640px) {
  /* 医院动态：轮播与列表上下堆叠 */
  .dnews-flex { flex-direction: column; gap: 10px; }
  .mini-hero { width: 100%; flex: none; }
  .mini-hero .hero-slide img { height: 180px; }
  /* 科室目录：自适应网格（auto-fill），无需固定列数 */
  /* 院名横幅：换行排列 */
  .db-inner { flex-wrap: wrap; gap: 14px; }
  .db-name { min-width: 0; flex: 1 1 60%; }
  .db-name h1 { font-size: 1.5rem; }
  .db-en { letter-spacing: 1px; }
  .db-extra { margin-left: 0; text-align: left; width: 100%; }
  .db-extra span { display: inline-block; margin-right: 14px; }
}
