/* 伴永远健康情报站 — 与官网 banyongyuan.com 品牌对齐 */
:root {
  --brand: #0f9f9a;
  --brand-dark: #087b77;
  --brand-soft: #e6f7f5;
  --accent: #f47c32;
  --accent-hover: #dc6721;
  --ink: #12323f;
  --muted: #5f7480;
  --line: #d8e8e6;
  --surface: #ffffff;
  --tint: #f4fbfa;
  --page-bg: #fbfefe;
  --card-shadow: 0 8px 28px rgba(18, 50, 63, 0.06);
  --header-bg: rgba(255, 255, 255, 0.92);
  --code-bg: #f0f7f6;
  --disclaimer-bg: #fff8f2;
  --disclaimer-ink: #b9561f;
  --radius: 14px;
  /* 内容区加宽、侧栏收窄：阅读区为主 */
  --max: 900px;
  --sidebar: 200px;
  --page-max: 1180px;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

html[data-theme="dark"] {
  --brand: #2ec4bc;
  --brand-dark: #5fd4ce;
  --brand-soft: #14353a;
  --accent: #f59a5a;
  --accent-hover: #f47c32;
  --ink: #e8f2f4;
  --muted: #9bb0b8;
  --line: #2a4248;
  --surface: #12262c;
  --tint: #0e1c21;
  --page-bg: #0b161a;
  --card-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(14, 28, 33, 0.92);
  --code-bg: #1a3036;
  --disclaimer-bg: #2a2218;
  --disclaimer-ink: #e0a878;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background: var(--page-bg);
  line-height: 1.75;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--brand-dark);
  text-decoration: none;
}
a:hover {
  color: var(--brand);
  text-decoration: underline;
}

/* —— 顶栏（对齐官网 navbar） —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(15, 159, 154, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
html[data-theme="dark"] .site-header {
  border-bottom-color: var(--line);
}

.site-header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.7rem 1.25rem 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  color: inherit;
  text-decoration: none !important;
}
.brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.sidebar-author img {
  object-fit: contain;
  background: transparent !important;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.brand-text strong {
  font-size: 1.08rem;
  color: var(--ink);
  font-weight: 700;
}
.brand-text small {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.icon-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
}
.icon-btn[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-pills {
  display: none;
  gap: 0.15rem;
  align-items: center;
}
.nav-pills a {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  text-decoration: none !important;
}
.nav-pills a:hover {
  color: var(--brand-dark);
  background: var(--brand-soft);
}
.btn-brand {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--accent);
  color: #fff !important;
  border: none;
  text-decoration: none !important;
  box-shadow: 0 8px 20px rgba(244, 124, 50, 0.22);
}
.btn-brand:hover {
  background: var(--accent-hover);
  color: #fff !important;
}

@media (min-width: 860px) {
  .nav-pills {
    display: flex;
  }
  #menu-toggle {
    display: none;
  }
}

/* —— 搜索面板 —— */
.search-panel {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.85rem 1.1rem 1rem;
}
.search-panel.open {
  display: block;
}
.search-panel-inner {
  max-width: var(--page-max);
  margin: 0 auto;
}
.search-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.search-input-wrap input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--tint);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.98rem;
  outline: none;
}
.search-input-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 159, 154, 0.15);
}
.search-input-wrap input::placeholder {
  color: var(--muted);
}
.search-hint {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.search-results {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}
.search-result {
  display: block;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.search-result:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.search-result strong {
  display: block;
  color: var(--brand-dark);
  margin-bottom: 0.2rem;
}
.search-result span {
  font-size: 0.88rem;
  color: var(--muted);
}
.search-empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 0.5rem 0;
}

/* —— 主体布局：侧栏偏左、正文占大头 —— */
.layout {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem 0.85rem;
  display: grid;
  gap: 1rem;
}
@media (min-width: 960px) {
  .layout {
    /* 侧栏固定窄宽，其余全给正文 */
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    align-items: start;
    gap: 1.35rem;
    padding-left: 0.75rem;
    padding-right: 1.5rem;
  }
}
@media (min-width: 1200px) {
  .layout {
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 1.75rem;
  }
}

/* 侧栏 */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem 0.75rem;
  box-shadow: var(--card-shadow);
  font-size: 0.92rem;
}
@media (min-width: 960px) {
  .sidebar {
    position: sticky;
    top: 5.2rem;
  }
}
.sidebar-author {
  text-align: center;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.9rem;
}
.sidebar-author img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: contain;
  background: var(--tint);
  border: 1px solid var(--line);
}
.sidebar-author h2 {
  margin: 0.55rem 0 0.25rem;
  font-size: 1.05rem;
  color: var(--brand-dark);
}
.sidebar-author p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  text-align: center;
  margin-bottom: 0.9rem;
}
.stats a,
.stats div {
  text-decoration: none !important;
  color: inherit;
  padding: 0.4rem 0.2rem;
  border-radius: 10px;
}
.stats a:hover {
  background: var(--brand-soft);
}
.stats .n {
  display: block;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--brand-dark);
}
.stats .l {
  font-size: 0.75rem;
  color: var(--muted);
}
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.side-nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none !important;
}
.side-nav a:hover,
.side-nav a.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

/* 内容区：加宽阅读面 */
.content {
  min-width: 0;
  max-width: none;
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}
.category-chips a {
  display: inline-block;
  padding: 0.28rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  text-decoration: none !important;
}
.category-chips a:hover,
.category-chips a.active {
  border-color: var(--brand);
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem 1.05rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.15s, transform 0.15s;
}
.post-card:hover {
  border-color: rgba(15, 159, 154, 0.35);
}
.post-card h2 {
  margin: 0.15rem 0 0.45rem;
  font-size: 1.18rem;
  line-height: 1.4;
}
.post-card h2 a {
  color: var(--ink);
  text-decoration: none !important;
}
.post-card h2 a:hover {
  color: var(--brand-dark);
}
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.post-meta a {
  color: var(--brand-dark);
  font-weight: 600;
  text-decoration: none !important;
}
.post-excerpt {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.read-more {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--brand-dark);
  text-decoration: none !important;
}
.read-more:hover {
  color: var(--brand);
}

/* 正文页 */
.article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem;
  box-shadow: var(--card-shadow);
  max-width: none;
}
.article h1 {
  margin: 0.2rem 0 0.65rem;
  font-size: 1.55rem;
  line-height: 1.35;
  color: var(--ink);
}
.article-body {
  margin-top: 1rem;
  font-size: 1.05rem;
  max-width: 48rem;
  line-height: 1.85;
}
.article-body h2 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.15rem;
  color: var(--brand-dark);
}
.article-body p {
  margin: 0.7rem 0;
}
.article-body ul,
.article-body ol {
  padding-left: 1.25rem;
}
.article-body li {
  margin: 0.3rem 0;
}
.article-body code {
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.92em;
}
.article-body a {
  color: var(--brand-dark);
  font-weight: 600;
}
.health-disclaimer {
  margin-top: 1.5rem;
  padding: 0.9rem 1rem;
  background: var(--disclaimer-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: var(--disclaimer-ink);
  font-size: 0.9rem;
  line-height: 1.7;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--muted);
  text-align: center;
}

/* 页脚 */
.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, var(--tint));
  padding: 1.5rem 1.1rem 2rem;
  text-align: center;
  font-size: 0.86rem;
  color: var(--muted);
}
.site-footer a {
  color: var(--brand-dark);
  font-weight: 600;
}
.site-footer .copy {
  margin-bottom: 0.35rem;
  color: var(--ink);
  font-weight: 600;
}

/* 移动端菜单 */
.mobile-nav {
  display: none;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 0.5rem 1rem 0.75rem;
}
.mobile-nav.open {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.mobile-nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--tint);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none !important;
}
@media (min-width: 860px) {
  .mobile-nav,
  #menu-toggle {
    /* menu toggle only useful on small screens for nav pills */
  }
}
