/* =========================================================
   尚善堂 · 中医视觉强化层
   ========================================================= */

:root {
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Songti SC", serif;
}

/* 宣纸：噪点 + 纤维 */
body::before {
  opacity: 0.62;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(30, 42, 37, 0.02) 0 1px, transparent 1px 5px);
  background-size: 180px 180px, auto;
}

/* 首屏：醫字水印、竖排、印章 */
.hero { position: relative; }
.hero::before {
  content: "醫";
  position: absolute;
  left: -26px;
  top: 54px;
  font-family: var(--kai);
  font-size: clamp(200px, 24vw, 360px);
  line-height: 1;
  color: rgba(44, 74, 62, 0.04);
  pointer-events: none;
  user-select: none;
}
.hero .container { position: relative; z-index: 1; }
.hero-vertical,
.hero-vertical-left { font-family: var(--kai); letter-spacing: 0.28em; }
.hero-vertical-left {
  position: absolute;
  left: -34px;
  top: 34px;
  writing-mode: vertical-rl;
  font-size: 12.5px;
  color: var(--ink-3);
  opacity: 0.8;
}
.hero-seal {
  position: absolute;
  right: 22px;
  bottom: 24px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: var(--cinnabar);
  color: #f8f1e2;
  font-family: var(--kai);
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: 0.06em;
  writing-mode: vertical-rl;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(248, 241, 226, 0.35);
  transform: rotate(-4deg);
  z-index: 2;
  pointer-events: none;
}

/* 章节小标题：去掉竖线，改用朱砂菱形 + 楷体 */
.sec-title { padding-left: 0; }
.sec-title::before { display: none; }
.sec-title .cn {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--kai);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--cinnabar);
}
.sec-title .cn::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--cinnabar);
  transform: rotate(45deg);
}
.band .sec-title .cn { color: #d8b884; }
.band .sec-title .cn::before { background: var(--gold); }

/* 科室：朱砂印章编号 + 单字水印 */
.dept { position: relative; overflow: hidden; }
.dept .code {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: var(--cinnabar);
  color: #f8f1e2;
  font-family: var(--kai);
  font-size: 15px;
  line-height: 1;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(248, 241, 226, 0.32);
  transform: rotate(-2deg);
  letter-spacing: 0;
}
.dept-mark {
  position: absolute;
  right: 6px;
  bottom: -12px;
  font-family: var(--kai);
  font-size: 108px;
  line-height: 1;
  color: rgba(164, 67, 47, 0.055);
  pointer-events: none;
  user-select: none;
}
.dept:hover .dept-mark { color: rgba(164, 67, 47, 0.09); }
.dept h3 { position: relative; z-index: 1; }
.dept p, .dept .go, .dept .code { position: relative; z-index: 1; }

/* 医师：照片上的坐诊 / 特约印章 */
.doc-stamp {
  position: absolute;
  right: -8px;
  bottom: -3px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--cinnabar);
  color: #f8f1e2;
  font-family: var(--kai);
  font-size: 12px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  border-radius: 2px;
  box-shadow: inset 0 0 0 2px rgba(248, 241, 226, 0.4);
  transform: rotate(-7deg);
  z-index: 2;
  pointer-events: none;
}
.doc-hero .doc-stamp { width: 44px; height: 44px; font-size: 14px; right: 2px; bottom: 6px; }

/* 四诊 */
.diagnosis-section {
  background: linear-gradient(180deg, rgba(239, 229, 210, 0.6), rgba(246, 241, 230, 0) 78%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.diagnosis-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.diagnosis {
  position: relative;
  overflow: hidden;
  background: var(--card);
  padding: 28px 26px 30px;
}
.diagnosis .d-no {
  position: absolute;
  right: 18px;
  top: 14px;
  font-family: var(--kai);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--gold);
}
.diagnosis .d-char {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border: 1px solid rgba(164, 67, 47, 0.45);
  border-radius: 50%;
  font-family: var(--kai);
  font-size: 34px;
  color: var(--cinnabar);
  position: relative;
}
.diagnosis .d-char::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(164, 67, 47, 0.2);
  border-radius: 50%;
}
.diagnosis h3 { font-family: var(--serif); font-size: 20px; margin: 0 0 8px; }
.diagnosis p { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--ink-2); }
.diagnosis::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  opacity: 0.75;
}

/* 五愿 */
.quote-section {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.quote-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  max-width: 940px;
}
.quote-seal {
  flex: none;
  width: 62px;
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cinnabar);
  color: #f8f1e2;
  font-family: var(--kai);
  font-size: 22px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(248, 241, 226, 0.35);
  transform: rotate(-2deg);
}
.quote-text {
  margin: 0;
  font-family: var(--kai);
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.quote-source {
  display: block;
  margin-top: 10px;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  text-align: right;
}

/* 君臣佐使 / 四气五味 */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.formula { background: var(--card); padding: 24px 22px; }
.f-seal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  background: var(--cinnabar);
  color: #f8f1e2;
  font-family: var(--kai);
  font-size: 22px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(248, 241, 226, 0.35);
  transform: rotate(-3deg);
}
.formula h3 { font-family: var(--serif); font-size: 19px; margin: 0 0 8px; }
.formula p { margin: 0; font-size: 13px; line-height: 1.85; color: var(--ink-2); }
.qiwei {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 20px;
}
.qiwei div {
  display: flex;
  align-items: baseline;
  gap: 14px;
  background: var(--card);
  padding: 16px 20px;
}
.qiwei b {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--cinnabar);
  font-weight: 500;
}
.qiwei span {
  font-family: var(--kai);
  font-size: 16px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}
.formula-note { margin: 16px 0 0; font-size: 13px; line-height: 1.9; color: var(--ink-3); }

/* 深色带：药柜格纹 */
.band::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"),
    linear-gradient(rgba(242, 234, 217, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 234, 217, 0.045) 1px, transparent 1px);
  background-size: 180px 180px, 64px 64px, 64px 64px;
}

/* 页脚：尚善堂水印 + 五愿 */
.foot { position: relative; overflow: hidden; }
.foot::before {
  content: "尚善堂";
  position: absolute;
  right: -18px;
  bottom: 30px;
  font-family: var(--kai);
  font-size: 180px;
  line-height: 1;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
  color: rgba(242, 234, 217, 0.035);
  pointer-events: none;
  user-select: none;
}
.foot .container { position: relative; z-index: 1; }
.foot-wish {
  font-family: var(--kai);
  font-size: 12.5px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: rgba(242, 234, 217, 0.62);
}

/* 品牌副标（中文） */
.brand-sub { letter-spacing: 0.18em; }

/* 404：中文数字 */
.err .code { font-family: var(--kai); font-size: 82px; letter-spacing: 0.08em; }

@media (max-width: 1100px) {
  .hero-vertical-left { display: none; }
  .hero-seal { width: 56px; height: 56px; font-size: 16px; right: 16px; bottom: 16px; }
}

@media (max-width: 960px) {
  .diagnosis-grid { grid-template-columns: 1fr 1fr; }
  .formula-grid { grid-template-columns: 1fr 1fr; }
  .dept-mark { font-size: 88px; }
}

@media (max-width: 720px) {
  .diagnosis-grid { grid-template-columns: 1fr; }
  .formula-grid { grid-template-columns: 1fr; }
  .qiwei { grid-template-columns: 1fr; }
  .quote-wrap { flex-direction: column; gap: 20px; text-align: center; }
  .quote-seal { width: 54px; height: 80px; font-size: 19px; }
  .quote-source { text-align: center; }
  .hero-seal { width: 48px; height: 48px; font-size: 14px; }
  .dept-mark { font-size: 76px; }
  .err .code { font-size: 64px; }
}

/* 科室页单字水印 */
.page-hero { position: relative; overflow: hidden; }
.page-mark {
  position: absolute;
  right: 4%;
  top: 6px;
  font-family: var(--kai);
  font-size: clamp(110px, 13vw, 200px);
  line-height: 1;
  color: rgba(164, 67, 47, 0.05);
  pointer-events: none;
  user-select: none;
}
@media (max-width: 720px) {
  .page-mark { font-size: 96px; right: 2%; top: 12px; opacity: 0.8; }
}
