/* Panda 主题样式：自写。
   设计令牌与版式数值 = 实测 Halo PandaPRO 站点样式表得到（reset.css:2-125 / style.css），
   未复制其文件；栅格与工具类由官方 Bootstrap 5.1.3（MIT，见 assets/vendor/）承担。 */
:root {
  /* 灰阶与主色（实测 --gray-1..8、--blue） */
  --gray-1: #f7f7fb; --gray-2: #f3f3f4; --gray-3: #e7e8eb; --gray-4: #dcdee0;
  --gray-5: #c8c9cc; --gray-6: #a2a6b1; --gray-7: #424a57; --gray-8: #20232b;
  --primary-color: #3858F6; --red: #ea1414; --green: #34968e; --orange: #ff8338;
  /* 语义令牌 */
  --bg-primary: var(--primary-color);
  --color-dark: var(--gray-8); --color-secondary: var(--gray-7);
  --color-muted: var(--gray-6); --border-color: var(--gray-2);
  --bg-body: var(--gray-1); --bg-card: #fff; --bg-light: var(--gray-2);
  --shadow: 0 0 10px rgb(0 0 0 / .04); --shadow-lg: 0 6px 18px rgb(0 0 0 / .08);
  /* 圆角阶梯（实测 5/7/9/15/999） */
  --border-radius-xs: 5px; --border-radius-sm: 7px; --border-radius-md: 9px;
  --border-radius-lg: 15px; --border-radius-max: 999px;
  --pd-max: 1180px; --pd-side: 300px; --pd-gap: 24px;
  --animation-duration-base: .3s; --animation-duration-fast: .2s;
}
html[data-theme="dark"] {
  --color-dark: var(--gray-2); --color-secondary: var(--gray-4);
  --border-color: #2b2c2d; --bg-body: #18191A; --bg-card: #242525; --bg-light: #3d3e3e;
  --shadow: 0 0 10px rgb(0 0 0 / .3); --shadow-lg: 0 6px 18px rgb(0 0 0 / .45);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg-body); color: var(--color-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "Segoe UI",
    Arial, Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 1rem; line-height: 1.6;
}
img { max-width: 100%; height: auto; vertical-align: middle; }
a { color: inherit; text-decoration: none; transition: color var(--animation-duration-fast) ease-in-out; }
a:hover { color: var(--primary-color); }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.35; font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.text-muted { color: var(--color-muted) !important; }
.text-secondary { color: var(--color-secondary) !important; }
.text-xs { font-size: .8125rem; }
.text-sm { font-size: .875rem; }
.text-md { font-size: 1.125rem; }
.font-number { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
/* 行锁（实测 h-1x / h-2x 用 -webkit-line-clamp） */
.h-1x, .h-2x { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.h-1x { -webkit-line-clamp: 1; line-clamp: 1; }
.h-2x { -webkit-line-clamp: 2; line-clamp: 2; }

/* 版式骨架：容器 + 主区两列 */
.pd-container { width: 100%; max-width: var(--pd-max); margin-inline: auto; padding-inline: var(--pd-gap); }
.pd-main { padding-block: var(--pd-gap); min-height: 60vh; }
.pd-layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--pd-side); gap: var(--pd-gap); align-items: start; }
.pd-col-main { min-width: 0; }
.pd-col-side.is-sticky { position: sticky; top: var(--pd-gap); }

/* 卡片容器（实测 .block） */
.block {
  position: relative; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm); transition: all var(--animation-duration-base) ease-in-out;
}

/* 页头（实测 .site-navbar） */
.pd-header.site-navbar { padding-block: .75rem; background: var(--bg-card); box-shadow: var(--shadow); }
.pd-header .header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.navbar-brand { display: inline-flex; align-items: center; margin: 0; padding: 0; flex: none; }
/* logo 尺寸照源站 .navbar-brand .logo：base max-height 55px，md 45px，sm max-width 135 / max-height 40 */
.navbar-brand .logo { display: block; width: auto; height: auto; max-width: 135px; max-height: 55px; }
.dark-logo { display: none; }
html[data-theme="dark"] .light-logo { display: none; }
html[data-theme="dark"] .dark-logo { display: block; }
.navbar-site { flex: 1 1 auto; min-width: 0; }
.nav-list { display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: center; }
.menu-item { position: relative; }
.menu-item > a { display: inline-block; padding: 6px 0; }
.menu-item > a[aria-current="page"] { color: var(--primary-color); font-weight: 600; }
.sub-menu {
  display: none; position: absolute; z-index: 30; top: 100%; left: 0; min-width: 160px;
  padding: 8px; margin: 0; background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm); box-shadow: var(--shadow-lg);
}
.menu-item-has-children:hover > .sub-menu, .menu-item-has-children:focus-within > .sub-menu { display: block; }
.header-tools { display: flex; flex: none; align-items: center; gap: 8px; }
/* 页头圆钮照源站 .btn-icon.btn-sm = 2.1875rem(35px)；.btn-link 形态＝无边框透明底、muted 色。
   用户按钮走源站 header.html:43 的 .btn-primary（实心主色圆钮）。 */
.btn-icon {
  display: inline-grid; place-items: center; width: 2.1875rem; height: 2.1875rem; padding: 0;
  color: var(--color-muted); font: inherit; background: none; border: 1px solid transparent;
  border-radius: var(--border-radius-max); cursor: pointer;
}
.btn-icon.is-primary { color: #fff; background: var(--primary-color); border-color: var(--primary-color); }
.btn-icon.is-primary:hover { color: #fff; background: var(--primary-color); filter: brightness(1.08); }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { border-color: var(--primary-color); color: var(--primary-color); }
html[data-theme="dark"] .btn-icon { color: var(--color-text); }
.aside-toggle { display: none; }
.site-cart-count { font-size: .7em; }

/* 列表卡片（实测 post-card.html 的 DOM） */
.block-list { display: flex; flex-direction: column; gap: 0; }
.block-list > .list-item { border-bottom: 1px solid var(--border-color); border-radius: 0; }
.block-list > .list-item:last-child { border-bottom: 0; }
.list-item { display: flex; flex-direction: row; gap: 16px; min-width: 0; word-wrap: break-word; }
/* 宽度对齐源站 post-card 的 col-5 / col-md-4 / col-lg-3（Bootstrap 栏宽即 flex 基准） */
.list-item .media {
  position: relative; display: block; flex: 0 0 25%; overflow: hidden; padding: 0;
  border-radius: var(--border-radius-xs); background: var(--bg-light);
}
.media-3x2::after { content: ""; display: block; padding-top: 66.66666%; }
.media .media-content { position: absolute; inset: 0; border: 0; border-radius: inherit; background-size: cover; background-position: center; }
.media .media-content img { width: 100%; height: 100%; object-fit: cover; }
.list-top-badge {
  position: absolute; top: 0; left: 0; padding: 2px 6px; color: #fff; background: var(--primary-color);
  font-size: 12px; font-weight: 600; border-radius: var(--border-radius-xs) 0 var(--border-radius-xs) 0;
}
/* 源站 .list-catname：left/top 贴角、12px/600、黑底 60%，只保留左上内直角 */
.list-catname {
  position: absolute; left: 0; top: 0; padding: 2px 6px; color: #fff; font-size: 12px; font-weight: 600;
  background: rgb(0 0 0 / .6); border-radius: inherit; border-top-right-radius: 0; border-bottom-left-radius: 0;
}
.list-content { display: flex; flex: 1 1 auto; flex-direction: column; justify-content: center; padding: 1rem 0; min-width: 0; }
.list-body { flex: 1 1 auto; word-break: break-all; word-wrap: break-word; }
.list-title { display: block; margin: 0; color: inherit; word-break: break-all; }
.list-desc { margin: .5rem 0 0; font-size: .9375rem; }
.list-footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: .75rem; color: var(--color-muted); }
.list-footer .flex-fill { flex: 1 1 auto; }
.flex-avatar {
  position: relative; display: flex; flex-shrink: 0; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; line-height: 1; white-space: nowrap; border-radius: var(--border-radius-max);
  background: var(--bg-light); overflow: hidden;
}
.flex-avatar img { width: 100%; height: 100%; object-fit: cover; }
.flex-avatar--text { color: var(--primary-color); font-size: .875rem; font-weight: 600; }

/* 文章页（实测 .post / .post-content） */
.post { padding: 2rem; }
.post-title { font-size: 1.5rem; }
/* 元信息行（源站 post.html:19-42）：左侧「32px 圆形头像 + 作者名/日期两行」，右侧统计项（本主题无数据，不输出） */
.post-meta { display: flex; align-items: center; font-size: .8125rem; color: var(--color-muted); }
.post-meta-author { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-meta-author .flex-avatar { width: 32px; height: 32px; }
.post-meta-info { display: flex; flex-direction: column; line-height: 1.3; }
.post-meta-info .h-1x { color: var(--color-dark); font-size: .875rem; }
/* 正文与元信息之间的分隔线（源站 `.border-top border-light mt-3 pt-3`） */
.post-sep { margin: 16px 0; border-top: 1px solid var(--border-color); }
.post-content { position: relative; font-size: 1rem; line-height: 1.85; word-break: normal; word-wrap: break-word; }
.post-content h2 { margin: 1.8em 0 .8em; padding-bottom: .3em; border-bottom: 1px solid var(--border-color); font-size: 1.25em; color: var(--color-dark); }
.post-content h3 { margin: 1.5em 0 .6em; font-size: 1.1em; }
.post-content p { margin: 0 0 1.5rem; }
.post-content img { border-radius: var(--border-radius-xs); }
.post-content pre { position: relative; padding: 14px 16px; margin: 0 0 1.5rem; overflow-x: auto; background: var(--bg-light); border-radius: var(--border-radius-sm); font-size: .875rem; }
.post-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.post-content blockquote { margin: 0 0 1.5rem; padding: 4px 0 4px 16px; border-left: 3px solid var(--primary-color); color: var(--color-muted); }
.post-content table { width: 100%; margin-bottom: 1.5rem; border-collapse: collapse; }
.post-content th, .post-content td { padding: 8px 10px; border: 1px solid var(--border-color); text-align: left; }
/* 标签行：度量照源站 .post-tags a（.8125rem / .25rem .75rem / 圆角 100px / 淡主色底） */
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.post-tags a {
  display: inline-block; padding: .25rem .75rem; font-size: .8125rem; border-radius: 100px;
  color: var(--primary-color); background: var(--bg-light); border: 1px solid var(--border-color);
}
.post-tags a:hover { color: #fff; background: var(--primary-color); border-color: var(--primary-color); }
/* 推荐阅读：源站 post.html 是 .post-related.card（独立卡片），标题在 card-header 里 */
.post-related {
  margin-top: 16px; padding: 16px; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--border-radius-sm);
}
.post-related-title { margin: 0 0 12px; font-size: 1.0625rem; color: var(--color-dark); }
.post-related .post-list { border: 0; }
.post-related .list-item:last-child { border-bottom: 0; }

/* 面包屑 / 小部件 / 分页 */
.site-breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; font-size: .875rem; color: var(--color-muted); }
.site-breadcrumbs li + li::before { content: "/"; padding-right: 6px; }
.widget { padding: 16px; margin-bottom: 16px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); }
.widget-title { margin: 0 0 10px; font-size: 1rem; }
.widget-list > li { padding: 4px 0; }
.widget-list > li.is-active > a { color: var(--primary-color); font-weight: 600; }
.widget-list .depth-2, .widget-sublist { padding-left: 16px; font-size: .9375rem; }
.pagination { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; width: 100%; margin-top: 20px; }
.pagination a, .pagination span { padding: 4px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); font-size: .875rem; }
.term-header { margin-bottom: 16px; }
/* 标签页头通栏（源站 tag.html:9 的 h1 在 row 之外，字号 text-xxl） */
.term-title { margin: 0 0 16px; font-size: 1.6rem; color: var(--color-dark); }
.term-title sup { margin-left: 4px; font-size: .875rem; font-weight: 400; color: var(--color-muted); }
.term-title .term-icon { width: 1.35rem; height: 1.35rem; margin-right: 6px; vertical-align: -.2em; color: var(--primary-color); }
.term-desc { margin: 4px 0 0; font-size: .875rem; }
.empty-hint { padding: 32px 0; text-align: center; color: var(--color-muted); }

/* 移动侧栏抽屉（实测 .mobile-aside：fixed / 20rem / .2s） */
.mobile-aside {
  position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; width: 20rem; max-width: 85vw;
  padding: 20px; overflow-y: auto; background: var(--bg-card); border-right: 1px solid var(--border-color);
  transform: translateX(-100%); transition: all var(--animation-duration-fast) ease-in-out;
}
.mobile-aside.is-open { transform: none; }
.mobile-aside[hidden] { display: none; }
.aside-body { flex: 1 1 auto; }
.aside-menu > li { padding: 6px 0; }
.aside-menu .sub-menu { position: static; display: block; padding: 0 0 0 14px; border: 0; background: none; box-shadow: none; }
.aside-menu .sub-menu .menu-item a { font-size: .9375rem; color: var(--color-muted); }

/* 页脚 */
.pd-footer { margin-top: 40px; padding-block: 24px; background: var(--bg-card); border-top: 1px solid var(--border-color); }
.footer-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--pd-gap); align-items: start; }
.footer-name { font-weight: 600; }
.footer-desc { margin: 6px 0 0; font-size: .875rem; color: var(--color-muted); }
.footer-links ul { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9375rem; }
.footer-locale button { padding: 2px 10px; margin-right: 6px; font: inherit; font-size: .8125rem; color: inherit; background: none; border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); cursor: pointer; }
.footer-locale button[aria-current="true"] { border-color: var(--primary-color); color: var(--primary-color); }

/* 响应式：与 pandapro 的 Bootstrap 断点一致（xl=1200 收侧栏，md=768 改列宽） */
@media (max-width: 1199.98px) {
  .pd-layout { grid-template-columns: minmax(0, 1fr); }
  .pd-col-side { position: static; order: 2; }
}
@media (max-width: 991.98px) {
  .navbar-brand .logo { max-height: 45px; }
  .list-item .media { flex: 0 0 33.3333%; }   /* col-md-4 */
  .aside-toggle { display: inline-grid; }
  .navbar-site { display: none; flex-basis: 100%; }
  .navbar-site.is-open { display: block; }
  .nav-list { flex-direction: column; align-items: flex-start; }
  .sub-menu { position: static; display: block; border: 0; background: none; box-shadow: none; padding-left: 14px; }
}
@media (max-width: 767.98px) {
  :root { --pd-gap: 14px; }
  .navbar-brand .logo { max-height: 40px; max-width: 135px; }
  .list-item { gap: 12px; }
  .list-item .media { flex: 0 0 41.6667%; }   /* col-5 */
  .list-content { padding: .75rem 0; }
  .post { padding: 1.25rem; }
  .post-title { font-size: 1.25rem; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .d-desktop-none { display: inline-grid; }
}
@media (min-width: 992px) { .d-desktop-none { display: inline-grid; } }
@media (max-width: 991.98px) { .d-mobile-none { display: none !important; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 搜索页 / 404 */
.search-form { display: flex; gap: 8px; margin-bottom: 20px; }
.search-form input[type="search"] {
  flex: 1 1 auto; min-width: 0; padding: 8px 12px; font: inherit; color: var(--color-dark);
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm);
}
.search-form input[type="search"]:focus { outline: 2px solid var(--primary-color); outline-offset: 1px; }
.term-section { margin-bottom: 28px; }
.term-section h2 { margin: 0 0 12px; font-size: 1.125rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.product-card { padding: 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--border-radius-sm); }
/* 404 对齐源站 error/404.html：在 75vh 里垂直居中，大号警示图标 + h1 + 说明 */
.error-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 75vh; padding: 40px 24px; text-align: center;
}
.error-icon { width: 64px; height: 64px; color: var(--primary-color); }
.error-title { margin: 14px 0 6px; font-size: 1.35rem; color: var(--color-dark); }
.error-detail { margin: 0 0 16px; font-size: .9375rem; }
.error-back a { color: var(--primary-color); }

/* 首屏大图（pandapro index 顶部 hero） */
.hero { overflow: hidden; margin-bottom: var(--pd-gap); border-radius: var(--border-radius-md); }
.hero-link { position: relative; display: block; }
.hero-image { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }

/* 侧栏资料卡（pandapro widgets/profile） */
/* 资料卡对齐源站 widgets/profile.html：cover 是 media-2x1（50% 高）的封面带，
   头像绝对定位在 meta 容器顶边中线上（translate(-50%,-50%)），meta 顶部留 44px 避开头像。 */
.widget-profile { padding: 0 0 20px; text-align: center; overflow: hidden; }
.profile-cover {
  position: relative; padding-top: 50%; background-size: cover; background-position: center;
  background-image: linear-gradient(135deg, var(--primary-color) 0%, #6b8cff 55%, #a9b8ff 100%);
}
.profile-meta { position: relative; padding: 44px 20px 0; }
.profile-avatar {
  position: absolute; left: 50%; top: 0; width: 72px; height: 72px; transform: translate(-50%, -50%);
  object-fit: cover; background: var(--bg-card); border: 3px solid var(--bg-card);
  border-radius: var(--border-radius-max); box-shadow: var(--shadow);
}
.profile-avatar--text { display: grid; place-items: center; font-size: 1.4rem; font-weight: 600; color: var(--primary-color); }
.profile-name { margin: 10px 0 4px; font-size: 1.0625rem; }
.profile-desc { margin: 0; font-size: .8125rem; color: var(--color-muted); }

/* 分类目录 chips（pandapro widgets/categories 的观感） */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip a {
  display: inline-block; padding: 3px 12px; font-size: .8125rem;
  background: var(--bg-body); border: 1px solid var(--border-color); border-radius: var(--border-radius-max);
}
.chip a:hover { color: #fff; background: var(--primary-color); border-color: var(--primary-color); }

/* 圆形分页（pandapro modules/pagination） */
.pagination a, .pagination span {
  display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px;
  border-radius: var(--border-radius-max); font-size: .875rem;
}
.pagination a:hover { color: #fff; background: var(--primary-color); border-color: var(--primary-color); }

/* 目录（pandapro widgets/toc 观感：左侧竖线 + 层级缩进） */
.widget-toc[hidden] { display: none; }
.toc-list { max-height: 60vh; overflow-y: auto; border-left: 2px solid var(--border-color); }
.toc-list li { padding: 3px 0 3px 14px; font-size: .875rem; line-height: 1.5; }
.toc-list .toc-h3 { padding-left: 28px; font-size: .8125rem; }
.toc-list a { color: var(--color-muted); }
.toc-list a:hover { color: var(--primary-color); }

/* 无封面时（站内媒体库尚无封面，见上游 #4042）分类信息改用标题前的小 chip，保证信息不丢 */
.list-catname-inline {
  display: inline-block; margin-bottom: 6px; padding: 1px 8px; font-size: .75rem;
  color: var(--primary-color); background: var(--bg-light);
  border-radius: var(--border-radius-max);
}

/* ── 对齐 pandapro 的交互细节（实测取自其 style.css）────────────────────
   .block:hover { border-color: var(--border-light); box-shadow: 0 10px 30px rgba(62 61 80/.03) }
   .site-navbar.navbar-sticky { position: fixed; ... }  ← 这里用 position: sticky 实现同等观感，
       不引入滚动监听脚本（原站靠加类名切换，观感差异只在滚动瞬间的高度收缩）
   .navbar-site li ul.sub-menu { top:115%; min-width:220px; padding:.5rem }
   .navbar-site li ul.sub-menu li a { display:block; padding:.75rem; color: var(--color-muted) }
   .dark .site-navbar { background-color: var(--dark-bg-white) /* #000 */ }                      */
.pd-header.site-navbar { position: sticky; top: 0; z-index: 50; }
html[data-theme="dark"] .pd-header.site-navbar { background-color: #000; }

.block { transition: border-color var(--animation-duration-base) ease-in-out, box-shadow var(--animation-duration-base) ease-in-out; }
.block:hover { border-color: var(--gray-3); box-shadow: 0 10px 30px rgba(62, 61, 80, .03); }
html[data-theme="dark"] .block:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }

.pd-header .sub-menu { top: 115%; min-width: 220px; padding: .5rem; }
.pd-header .sub-menu .menu-item a { display: block; padding: .75rem; color: var(--color-muted); }
.pd-header .sub-menu .menu-item a:hover { color: var(--primary-color); }
.pd-header .sub-menu .sub-menu { top: 100%; left: -10px; }

/* 吸顶后不遮挡锚点跳转的标题 */
.post-content h2, .post-content h3 { scroll-margin-top: 84px; }

/* 栏目页头（对齐 pandapro .archive-poster / .media-3x1 / .heading-content） */
.archive-poster { position: relative; margin-bottom: 16px; overflow: hidden; }
.archive-poster .media-3x1 { padding-top: 33%; min-height: 96px;
  background: linear-gradient(135deg, var(--primary-color) 0%, #6b8cff 55%, var(--bg-light) 100%); }
.archive-poster .heading-content { position: absolute; left: 20px; right: 20px; bottom: 14px; }
.poster-title { margin: 0; color: #fff; font-size: 1.5rem; text-shadow: 0 1px 6px rgba(0,0,0,.35); }
.poster-title sup { margin-left: 4px; font-size: .875rem; font-weight: 400; opacity: .85; }
.poster-desc { margin: 4px 0 0; color: rgba(255,255,255,.85); font-size: .875rem; }
