/* ============================================================
   DBCN Lite — 前台样式（Olivero 风格）
   ============================================================ */

/* ── CSS 变量 ─────────────────────────────────────── */
:root {
  /* Olivero 配色 */
  --color-blue:       #1185ce;
  --color-blue-dark:  #1a6fa8;
  --color-blue-light: #d6eaf8;
  --color-blue-pale:  #eaf4fd;

  /* 中性色 */
  --color-text:       #1a1a1a;
  --color-text-muted: #595959;
  --color-text-light: #999;
  --color-border:     #d8d8d8;
  --color-bg:         #fff;
  --color-bg-alt:     #f3f4f6;
  --color-bg-dark:    #1c2a38;

  /* 字体 */
  --font-sans: 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-size-base: 0.9375rem;
  --line-height: 1.6;

  /* 间距 */
  --spacing-2xs:  0rem;
  --spacing-xs:  0.25rem;
  --spacing-sm:  0.5rem;
  --spacing-md:  1rem;
  --spacing-lg:  1.5rem;
  --spacing-xl:  2rem;
  --spacing-2xl: 3rem;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);

  /* 布局 */
  --max-width: 1200px;
  --header-height: 76px;
  --sidebar-width: 240px;
  --sidebar-gap: 40px;
}

/* ── 重置 ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--color-blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--color-blue-dark); }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── 工具类 ──────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}
.clearfix::after {
  content: '';
  display: table;
  clear: both;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; top: -100%; left: 0;
  background: var(--color-blue); color: #fff;
  padding: .4rem .8rem; z-index: 9999; font-size: .85rem;
  text-decoration: none; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0; }
.skip-link:hover { color: #fff; }

/* ── Page Wrapper ─────────────────────────────────── */
#page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header (Olivero Style) ─────────────────────── */
.header {
  background: var(--color-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header__inner {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  padding: var(--spacing-sm) 0;
  min-height: var(--header-height);
}

/* Site Branding */
.site-branding {
  flex-shrink: 0;
}
.site-branding__text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  display: block;
  line-height: 1.3;
  padding: 0 10px;
}
.site-branding__text:hover { color: #fff; text-decoration: none; }
.site-branding__slogan {
  font-size: .75rem;
  color: rgba(255,255,255,.8);
  letter-spacing: .05em;
  padding: 0 30px;
}

/* Header Search — Olivero pill style */
.header__search {
  display: flex;
  align-items: center;
}
.search-form-inline {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: .25rem .25rem .25rem .9rem;
  border: 1px solid rgba(255,255,255,.25);
  transition: background .2s;
}
.search-form-inline:focus-within {
  background: rgba(255,255,255,.25);
}
.search-form-inline__input {
  padding: .35rem .6rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: .85rem;
  width: 200px;
  outline: none;
}
.search-form-inline__input::placeholder { color: rgba(255,255,255,.65); }
.search-form-inline__button {
  padding: .2rem .4rem;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,.9);
  display: flex;
  align-items: center;
  transition: color .15s;
}
.search-form-inline__button:hover { color: #fff; }

/* Main Navigation */
.header__nav {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-left: auto;
}
.main-menu {
  display: flex;
  align-items: center;
  gap: 0;
}
.main-menu__item { position: relative; }
.main-menu__link {
  display: block;
  padding: .45rem .85rem;
  color: rgba(255,255,255,.92);
  font-size: .9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.main-menu__link:hover {
  background: rgba(255,255,255,.18);
  text-decoration: none;
  color: #fff;
}
.main-menu__item.is-active .main-menu__link {
  background: rgba(255,255,255,.18);
  color: #fff;
}

/* Mobile Toggle */
.mobile-nav-toggle {
  display: none;
  padding: .4rem;
  margin-left: auto;
}
.mobile-nav-toggle__icon {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  position: relative;
  transition: background .2s;
}
.mobile-nav-toggle__icon::before,
.mobile-nav-toggle__icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 1px;
  transition: transform .2s;
}
.mobile-nav-toggle__icon::before { top: -7px; }
.mobile-nav-toggle__icon::after  { top: 7px; }

/* ── Main Wrapper (Sidebar + Content) ─────────────── */
.main-wrapper {
  flex: 1;
  background: var(--color-bg);
}
.main {
  padding: var(--spacing-xl) 0;
  display: flex;
  gap: var(--sidebar-gap);
  align-items: flex-start;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar-first {
  width: var(--sidebar-width);
  flex-shrink: 0;
}
.block {
  margin-bottom: var(--spacing-lg);
}
.block__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  padding-bottom: .5rem;
  margin-bottom: .5rem;
  border-bottom: 2px solid var(--color-blue);
}
.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  padding-left: 0rem;
}
  /* 横线放在链接上，避免 li 嵌套导致多重边框 */
.sidebar-menu__link {
  display: block;
  padding: .5rem .4rem;
  margin-left: -.4rem;
  font-size: .85rem;
  color: var(--color-text);
  text-decoration: none;
  transition: background .1s, color .1s;
}
.sidebar-menu__link:hover {
  background: var(--color-bg-alt);
  text-decoration: none;
  color: var(--color-blue);
}
.sidebar-menu__parent {
  font-weight: 600;
  cursor: default;
}
/* 折叠行 */
.sidebar-menu__row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0;
}
/* 横线：用 ::after 画在行底部，并向左延展抵消子目录缩进 → 满宽、与父级上下对齐（任意层级通用） */
.sidebar-menu__row::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--sub-indent, 0rem));
  right: 0;
  bottom: 0;
  border-bottom: 1px solid var(--color-border);
  pointer-events: none;
}
.sidebar-menu__toggle {
  background: none;
  border: none;
  padding: .5rem 0.3rem .5rem 0.2rem;		/*小三角间距*/
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
  min-width: 0;
  text-align: left;
}
.sidebar-menu__toggle:hover {
  color: var(--color-blue);
}
.sidebar-menu__row .sidebar-menu__link {
  flex: 1;
  margin-left: -.2rem;
  padding-left: .3rem;		/*最外层目录文字间距*/
}
/* 叶子节点占位符，与展开按钮等宽对齐 */
.sidebar-menu__indent {
  display: inline-block;
  flex-shrink: 0;
  min-width: 0;
  text-align: left;
  padding: .5rem 0 .5rem 1.4rem;			/*没有小三角的文字间距*/
}
.sidebar-menu--sub {
  list-style: none;
  --sub-indent: .8rem;		/*本层行距侧边栏左缘的累计偏移，仅供 ::after 向左延展抵消用*/
  padding-left: .8rem;		/*文字每层固定缩进 .8rem（增量，保持层级感）*/
  margin: 0;
}
/* 更深层累积缩进（同时让 ::after 知道该向左延展多少，使横线始终满宽对齐） */
.sidebar-menu--sub .sidebar-menu--sub { --sub-indent: 1.6rem; }
.sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub { --sub-indent: 2.4rem; }
.sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub { --sub-indent: 3.2rem; }
.sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub { --sub-indent: 4.0rem; }
.sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub .sidebar-menu--sub { --sub-indent: 4.8rem; }
.sidebar-menu--sub .sidebar-menu__link {
  font-size: .8rem;
  padding: .35rem .3rem;		/*子目录文字间距*/
  color: var(--color-text-muted);
}
.sidebar-menu--sub .sidebar-menu--sub .sidebar-menu__link {
  font-size: .78rem;
  padding: .3rem .3rem;		/*三层子目录文字间距*/
}
/* 当前页面精确匹配项高亮 */
.sidebar-menu__item.is-active > .sidebar-menu__link,
.sidebar-menu__item.is-active > .sidebar-menu__row .sidebar-menu__link {
  background: var(--color-blue-light);
  color: var(--color-blue-dark);
  font-weight: 600;
}

/* ── Content Column ───────────────────────────────── */
.content-column {
  flex: 1;
  min-width: 0;
}

/* ── 面包屑 ──────────────────────────────────────── */
.breadcrumb {
  margin-bottom: var(--spacing-md);
  font-size: .8rem;
  color: var(--color-text-muted);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem;
}
.breadcrumb li::before { content: ' » '; color: var(--color-border); }
.breadcrumb li:first-child::before { content: none; }
.breadcrumb a { color: var(--color-blue); }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Page Title ───────────────────────────────────── */
.page-title {
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: .75rem;
  line-height: 1.3;
}
.page-description {
  color: var(--color-text-muted);
  font-size: .9rem;
  margin-bottom: var(--spacing-lg);
}

/* ── 分类页头部 ──────────────────────────────────── */
.category-header {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--color-bg-alt);
}

/* ── Node Teaser (文章摘要) ──────────────────────── */
.view-content { display: flex; flex-direction: column; gap: 0; }
.node-teaser {
  padding: var(--spacing-md) 0;
  border-bottom: 1px solid var(--color-border);
}
.node-teaser:last-child { border-bottom: none; }
.node-teaser__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: .4rem;
  line-height: 1.35;
}
.node-teaser__title a { color: var(--color-text); }
.node-teaser__title a:hover { color: var(--color-blue); text-decoration: none; }
.node-teaser__summary {
  color: var(--color-text-muted);
  font-size: .875rem;
  margin-bottom: .5rem;
  line-height: 1.6;
}
.node-meta {
  font-size: .88rem;
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem;
  margin-bottom: .4rem;
}
.node-meta__sep { color: var(--color-border); }
.node-category-badge {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.node-category-badge a { color: var(--color-blue); }
.sticky-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--color-blue);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
}
.read-more {
  font-size: .8rem;
  font-weight: 500;
  color: var(--color-blue);
}
.read-more:hover { color: var(--color-blue-dark); text-decoration: none; }

/* ── 文章详情 ─────────────────────────────────────── */
.node--full {
  /* no max-width, let content column handle it */
}
.node--full .node__body {
  font-size: var(--font-size-base);
  line-height: 1.75;
  color: var(--color-text);
  margin: var(--spacing-lg) 0;
}
.node--full .node__body p   { margin-bottom: var(--spacing-2xs); }
.node--full .node__body h2   { font-size: 1.4rem; font-weight: 700; margin: var(--spacing-xl) 0 var(--spacing-sm); }
.node--full .node__body h3   { font-size: 1.2rem; font-weight: 700; margin: var(--spacing-lg) 0 var(--spacing-sm); }
.node--full .node__body img  { margin: var(--spacing-sm) 0; border-radius: var(--radius-md); }
/* 图片链接：让 a 标签只包裹图片实际宽度，间距不可点击 */
.node--full .node__body a > img {
  display: block;
}
.node--full .node__body a:has(> img:only-child) {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  vertical-align: middle;
}
.node--full .node__body a:has(> img:only-child) > img {
  margin: 0;
  padding: var(--spacing-sm) 0;
  background: var(--color-bg);
  background-clip: padding-box;
  border-radius: var(--radius-md);
}
.node--full .node__body a    { color: var(--color-blue); word-break: break-all; word-wrap: break-word; }
.node--full .node__body a:hover { color: var(--color-blue-dark); }
.node--full .node__body blockquote {
  border-left: 4px solid var(--color-blue);
  margin: var(--spacing-md) 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-blue-pale);
  color: var(--color-text-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.node--full .node__body ul,
.node--full .node__body ol {
  padding-left: 1.5rem;
  margin-bottom: var(--spacing-md);
  list-style: disc;
}
.node--full .node__body ol { list-style: decimal; }
.node--full .node__body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--spacing-md);
  font-size: .85rem;
}
.node--full .node__body th,
.node--full .node__body td {
  border: 1px solid var(--color-border);
  padding: .5rem .75rem;
  text-align: left;
}
.node--full .node__body th { background: var(--color-bg-alt); font-weight: 600; }

/* 上一篇/下一篇 */
.node-navigation {
  display: flex;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}
.node-nav__prev,
.node-nav__next {
  font-size: .85rem;
  color: var(--color-text-muted);
  max-width: 45%;
}
.node-nav__prev:hover,
.node-nav__next:hover { color: var(--color-blue); text-decoration: none; }
.node-nav__label {
  display: block;
  font-size: .75rem;
  color: var(--color-text-light);
  margin-bottom: .2rem;
}
.node-nav__next { text-align: right; }

/* ── 评论 ─────────────────────────────────────────── */
.comments-section { }
.comments__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--color-bg-alt);
}
.comment {
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-bg-alt);
}
.comment:last-child { border-bottom: none; }

/* ── 分页 ─────────────────────────────────────────── */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-lg) 0;
}
.pager__item {
  display: inline-block;
  padding: .35rem .8rem;
  border: 1px solid var(--color-blue);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--color-blue);
  font-weight: 500;
  background: var(--color-bg);
  transition: background .15s, color .15s;
}
.pager__item:hover {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
  text-decoration: none;
}
.pager__info { font-size: .8rem; color: var(--color-text-light); }

/* ── 搜索页 ──────────────────────────────────────── */
.search-page { }
.search-page h1 { font-size: 1.5rem; margin-bottom: var(--spacing-md); }
.search-form-full {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xl);
}
.search-form-full input[type="search"] {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  outline: none;
}
.search-form-full input:focus { border-color: var(--color-blue); }
.search-form-full button {
  padding: .5rem 1rem;
  background: var(--color-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
}
.search-form-full button:hover { background: var(--color-blue-dark); }
.search-count { font-size: .8rem; color: var(--color-text-muted); margin-bottom: var(--spacing-md); }
.search-result__keyword { color: var(--color-blue); font-weight: 600; }

/* ── 404 ─────────────────────────────────────────── */
.page-404 {
  text-align: center;
  padding: var(--spacing-2xl) 0;
}
.page-404__code {
  font-size: 5rem;
  font-weight: 900;
  color: var(--color-blue-light);
  line-height: 1;
}
.page-404 h1 { font-size: 1.5rem; margin: var(--spacing-md) 0 var(--spacing-sm); font-weight: 400; }
.page-404 p  { color: var(--color-text-muted); margin-bottom: var(--spacing-xl); font-size: .9rem; }
.btn {
  display: inline-block;
  padding: .5rem 1.2rem;
  background: var(--color-blue);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
}
.btn:hover { background: var(--color-blue-dark); text-decoration: none; color: #fff; }

/* ── 空内容提示 ──────────────────────────────────── */
.empty-message {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--spacing-2xl);
  font-size: .9rem;
}

/* ── Footer (Olivero) ────────────────────────────── */
.footer {
  background: var(--color-bg-dark);
  color: rgba(255,255,255,.7);
  padding: var(--spacing-lg) 0;
}
.footer__inner {
  text-align: center;
}
.footer-menu {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm) var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
}
.footer-menu__item a {
  font-size: .8rem;
  color: rgba(255,255,255,.7);
  transition: color .15s;
}
.footer-menu__item a:hover { color: #fff; text-decoration: none; }
.footer__copy {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
}
.footer__copy a { color: rgba(255,255,255,.6); }
.footer__copy a:hover { color: rgba(255,255,255,.9); }
.footer__mobile-link {
  color: rgba(255,255,255,.6);
  text-decoration: underline;
  white-space: nowrap;
}
.footer__mobile-link:hover { color: rgba(255,255,255,.9); }

/* ── Back to top ─────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-blue);
  color: #fff;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  transition: opacity .2s, background .15s;
}
.back-to-top:hover { background: var(--color-blue-dark); }

/* ── 响应式 ──────────────────────────────────────── */
@media (max-width: 900px) {
  .mobile-nav-toggle { display: block; }

  .header__nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-dark);
    flex-direction: column;
    display: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
    z-index: 99;
  }
  .header__nav.is-open { display: flex; }
  .main-menu {
    flex-direction: column;
    width: 100%;
    padding: var(--spacing-sm) 0;
  }
  .main-menu__link {
    padding: .65rem var(--spacing-lg);
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
    color: rgba(255,255,255,.85);
  }
  .main-menu__item.is-active .main-menu__link {
    background: rgba(36,148,219,.35);
  }

  /* Sidebar stays in place — mobile users use mobile.php */
  .header__search { display: none; }
}

@media (max-width: 600px) {
  .site-branding__text { font-size: 1.05rem; }
  .page-title { font-size: 1.35rem; }
  .node-teaser__title { font-size: 1.05rem; }
  .node-navigation { flex-direction: column; }
  .node-nav__next { text-align: left; }
  .search-form-full { flex-direction: column; }
}

/* ── 系列导航（上一篇/下一篇） ───────────────────── */
.series-nav {
  margin: 2rem 0 1.5rem;
  padding: 1rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.series-nav__inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.series-nav__prev,
.series-nav__next {
  flex: 0 1 auto;
  max-width: 48%;
  min-width: 25%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.series-nav__prev {
  padding: .4rem 4.5rem .4rem .5rem;
}
.series-nav__prev:hover,
.series-nav__next:hover {
  background: var(--color-bg-alt);
  text-decoration: none;
}
.series-nav__next {
  text-align: right;
  margin-left: auto;
  padding: .4rem .5rem .4rem 4.5rem;
}
.series-nav__label {
  font-size: .75rem;
  color: var(--color-text-muted);
  margin-bottom: .2rem;
}
.series-nav__title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--color-blue);
}
.series-nav__disabled {
  flex: 0 1 auto;
  display: flex;
  flex-direction: column;
  color: var(--color-text-muted);
}
.series-nav__disabled .series-nav__label {
  color: var(--color-text-muted);
}
.series-nav__disabled .series-nav__title {
  color: var(--color-text-muted);
  font-weight: 400;
}
.series-nav__next.series-nav__disabled {
  text-align: right;
}
