/* ============================================================
   benson27.cn 前台样式
   变量由 layout_header.php 内联注入
   ============================================================ */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text, #1f2937);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent, #4f46e5); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: min(1080px, 100% - 40px); margin-inline: auto; }

.skip-link {
  position: absolute; left: -9999px; top: 0; padding: 8px 14px;
  background: #fff; border-radius: 0 0 8px 0; z-index: 999;
}
.skip-link:focus { left: 0; }

#main { flex: 1 0 auto; padding: 40px 0 56px; }

/* ---------------- 首页 ---------------- */
.home-hero { text-align: center; padding: 26px 0 40px; }

.avatar-frame {
  width: calc(var(--avatar-size, 132px) + 16px);
  height: calc(var(--avatar-size, 132px) + 16px);
  margin: 0 auto 20px;
  padding: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(255,255,255,.45));
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12), inset 0 0 0 1px rgba(255,255,255,.6);
}

.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

.avatar-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent, #4f46e5); color: #fff;
  font-size: calc(var(--avatar-size, 132px) / 2.6);
  font-weight: 600; user-select: none;
}

.home-title {
  margin: 0 0 12px;
  font-size: clamp(24px, 3.4vw, 34px);
  line-height: 1.3;
  letter-spacing: .5px;
}

.home-intro {
  margin: 0 auto; max-width: 640px;
  color: var(--muted, #6b7280);
  font-size: 16px; line-height: 1.9;
}

/* ---------------- 卡片 ---------------- */
.card-grid {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--card-gap, 20px);
  margin-top: 34px;
}

.func-card {
  position: relative;
  width: var(--card-w, 230px);
  min-height: 140px;
  padding: 22px 20px 20px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  border-radius: var(--card-radius, 18px);
  background: var(--card-bg, rgba(255,255,255,.86));
  color: var(--card-text, var(--text, #1f2937));
  box-shadow: 0 6px 22px rgba(15, 23, 42, .08);
  border: 1px solid rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  overflow: hidden;
}

.func-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.5), transparent 55%);
  opacity: .55; pointer-events: none;
}

.func-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .16);
  text-decoration: none;
}

.card-icon { font-size: 26px; line-height: 1; }
img.card-icon { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }

.func-card-title { font-size: 18px; font-weight: 600; margin-top: 6px; }
.func-card-sub { font-size: 13.5px; color: var(--muted, #6b7280); line-height: 1.6; }

.func-card-arrow {
  margin-top: auto; font-size: 18px; opacity: .45;
  transition: transform .18s ease, opacity .18s ease;
}
.func-card:hover .func-card-arrow { transform: translateX(4px); opacity: .9; }

.badge {
  align-self: flex-start; margin-top: 4px; padding: 2px 9px;
  font-size: 12px; border-radius: 999px;
  background: rgba(79, 70, 229, .1); color: var(--accent, #4f46e5);
}

/* ---------------- 内页通用 ---------------- */
.breadcrumb { font-size: 13.5px; color: var(--muted, #6b7280); margin-bottom: 22px; }
.breadcrumb .sep { margin: 0 7px; opacity: .55; }
.breadcrumb .current { color: var(--text, #1f2937); }

.page-head { text-align: center; margin-bottom: 30px; }
.page-icon { font-size: 34px; }
.page-title { margin: 8px 0 6px; font-size: clamp(22px, 3vw, 30px); }
.page-sub { margin: 0; color: var(--muted, #6b7280); }

.empty-hint {
  text-align: center; padding: 34px 20px;
  color: var(--muted, #6b7280);
  background: var(--card-bg, rgba(255,255,255,.86));
  border-radius: var(--card-radius, 18px);
}

.list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 16px;
  color: var(--muted, #6b7280); font-size: 14px;
}

/* ---------------- 文章列表 ---------------- */
.article-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.article-item {
  background: var(--card-bg, rgba(255,255,255,.86));
  border-radius: var(--card-radius, 18px);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
  transition: transform .16s ease, box-shadow .16s ease;
}
.article-item:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(15,23,42,.12); }

.article-link { display: block; padding: 20px 22px; color: inherit; text-decoration: none; }
.article-link:hover { text-decoration: none; }

.article-title { margin: 0 0 6px; font-size: 18.5px; line-height: 1.5; }
.article-summary { margin: 0 0 8px; color: var(--muted, #6b7280); font-size: 14.5px; }
.article-meta { font-size: 13px; color: var(--muted, #6b7280); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.article-meta .dot, .dot { opacity: .5; margin: 0 2px; }

.tag-pin {
  display: inline-block; margin-right: 8px; padding: 1px 8px;
  font-size: 12px; border-radius: 6px; vertical-align: 2px;
  background: rgba(79,70,229,.12); color: var(--accent, #4f46e5);
}

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 26px; }
.pager-btn {
  padding: 7px 16px; border-radius: 10px; font-size: 14px;
  background: var(--card-bg, #fff); color: inherit;
  box-shadow: 0 3px 10px rgba(15,23,42,.08);
}
.pager-info { font-size: 13.5px; color: var(--muted, #6b7280); }

/* ---------------- 文章详情 ---------------- */
.article-wrap { width: min(1120px, 100% - 40px); }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 30px; align-items: start; }

@media (min-width: 1080px) {
  .article-layout:has(.article-toc) {
    grid-template-columns: minmax(0, var(--content-w, 820px)) 220px;
    justify-content: center;
  }
}

.article-main {
  background: var(--card-bg, rgba(255,255,255,.92));
  border-radius: var(--card-radius, 18px);
  padding: 34px 38px 40px;
  box-shadow: 0 8px 28px rgba(15,23,42,.08);
  border: 1px solid rgba(255,255,255,.7);
  min-width: 0;
}

.article-head { border-bottom: 1px solid rgba(15,23,42,.08); padding-bottom: 18px; margin-bottom: 24px; }
.article-h1 { margin: 0 0 10px; font-size: clamp(23px, 3vw, 31px); line-height: 1.35; }
.article-lead { margin: 0 0 12px; color: var(--muted, #6b7280); font-size: 15.5px; }

.article-toc {
  position: sticky; top: 24px;
  background: var(--card-bg, rgba(255,255,255,.86));
  border-radius: 14px; padding: 18px 18px 14px;
  box-shadow: 0 6px 20px rgba(15,23,42,.07);
  max-height: calc(100vh - 60px); overflow: auto;
  font-size: 14px;
}
.toc-title { font-weight: 600; margin-bottom: 10px; font-size: 14px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 3px 0; }
.toc-list a { color: var(--muted, #6b7280); display: block; padding: 3px 0 3px 10px; border-left: 2px solid transparent; }
.toc-list a:hover { color: var(--accent, #4f46e5); border-left-color: var(--accent, #4f46e5); text-decoration: none; }
.toc-lv2 { padding-left: 12px; }
.toc-lv3 { padding-left: 24px; font-size: 13px; }

.related { margin-top: 40px; border-top: 1px solid rgba(15,23,42,.08); padding-top: 22px; }
.related-title { font-size: 16px; margin: 0 0 12px; }
.related-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.related-list li { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; }
.related-date { color: var(--muted, #6b7280); font-size: 13px; white-space: nowrap; }

/* ---------------- 关于我：附加区块 ---------------- */
.about-section {
  max-width: var(--content-w, 820px);
  margin: 26px auto 0;
}
.about-section-title {
  font-size: 17px;
  margin: 0 0 14px;
  padding-left: 10px;
  border-left: 3px solid var(--accent, #4f46e5);
  line-height: 1.3;
}
.card-grid-left { justify-content: flex-start; margin-top: 0; }
.card-grid-left .func-card { min-height: 118px; }

.about-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.about-list-item {
  background: var(--card-bg, rgba(255,255,255,.86));
  border-radius: var(--card-radius, 18px);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 4px 16px rgba(15,23,42,.06);
  transition: transform .16s ease, box-shadow .16s ease;
}
.about-list-item:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(15,23,42,.12); }
.about-list-link {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 16px 20px; color: inherit; text-decoration: none;
}
.about-list-link:hover { text-decoration: none; }
.about-list-title { font-size: 16.5px; font-weight: 600; }
.about-list-sum { font-size: 13.5px; color: var(--muted, #6b7280); }
.about-list-date { margin-left: auto; font-size: 13px; color: var(--muted, #6b7280); white-space: nowrap; }

/* ---------------- 关于我 ---------------- */
.about-card {
  max-width: var(--content-w, 820px);
  margin: 0 auto;
  background: var(--card-bg, rgba(255,255,255,.92));
  border-radius: var(--card-radius, 18px);
  padding: 36px 40px 42px;
  box-shadow: 0 8px 28px rgba(15,23,42,.08);
  border: 1px solid rgba(255,255,255,.7);
}
.about-head { text-align: center; border-bottom: 1px solid rgba(15,23,42,.08); padding-bottom: 20px; margin-bottom: 24px; }
.about-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 12px; }
.about-title { margin: 0 0 6px; font-size: clamp(21px, 2.6vw, 27px); }
.about-sub { margin: 0; color: var(--muted, #6b7280); }

/* ---------------- 正文块 ---------------- */
.blk { margin: 0 0 16px; }
.blk-h1 { font-size: 27px; line-height: 1.4; margin: 30px 0 14px; }
.blk-h2 { font-size: 22px; line-height: 1.45; margin: 26px 0 12px; }
.blk-h3 { font-size: 18.5px; line-height: 1.5; margin: 22px 0 10px; }
.blk-h1:first-child, .blk-h2:first-child, .blk-h3:first-child { margin-top: 0; }
.blk-p, .blk-text { line-height: 1.95; }

.blk-quote {
  margin: 18px 0; padding: 12px 18px;
  border-left: 3px solid var(--accent, #4f46e5);
  background: rgba(79,70,229,.06);
  border-radius: 0 10px 10px 0;
  color: var(--muted, #4b5563);
}

.blk-code { margin: 18px 0; border-radius: 12px; overflow: hidden; background: #0f172a; color: #e2e8f0; }
.blk-code-lang { padding: 6px 14px; font-size: 12px; color: #94a3b8; background: rgba(255,255,255,.05); }
.blk-code pre { margin: 0; padding: 14px 16px; overflow: auto; }
.blk-code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; line-height: 1.7; color: inherit; background: none; }

.blk-list { margin: 12px 0 16px; padding-left: 24px; }
.blk-list li { margin: 5px 0; line-height: 1.85; }
.blk-divider { border: 0; border-top: 1px solid rgba(15,23,42,.12); margin: 26px 0; }

.blk-figure { margin: 22px 0; }
.blk-img-link { display: inline-block; max-width: 100%; }
.blk-img {
  display: block; margin-inline: auto;
  max-width: 100%; height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15,23,42,.1);
}
.blk-figure[style*="text-align:left"] .blk-img { margin-left: 0; margin-right: auto; }
.blk-figure[style*="text-align:right"] .blk-img { margin-left: auto; margin-right: 0; }
.blk-img-cap { margin-top: 8px; font-size: 13.5px; color: var(--muted, #6b7280); text-align: center; }

code { background: rgba(15,23,42,.06); padding: 2px 6px; border-radius: 5px; font-size: .92em; }
.blk-code code { background: none; padding: 0; }
mark { background: #fef08a; padding: 0 2px; }

/* ---------------- 404 ---------------- */
.notfound { text-align: center; padding: 60px 0; }
.nf-code { font-size: 76px; font-weight: 700; line-height: 1; color: var(--accent, #4f46e5); opacity: .25; }
.nf-title { margin: 10px 0 6px; }
.nf-desc { color: var(--muted, #6b7280); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 10px;
  background: #fff; color: var(--text, #1f2937);
  font-size: 14px; font-family: inherit; line-height: 1.4;
  cursor: pointer; text-decoration: none;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:hover { background: #f8fafc; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--accent, #4f46e5); border-color: var(--accent, #4f46e5); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent, #4f46e5); }
.btn-ghost { background: transparent; }
.btn-danger { color: #dc2626; border-color: rgba(220,38,38,.3); }
.btn-danger:hover { background: rgba(220,38,38,.08); }
.btn-block { width: 100%; }

/* ---------------- 页脚 ---------------- */
.site-footer {
  flex: 0 0 auto; padding: 26px 0 34px;
  text-align: center; color: var(--muted, #6b7280); font-size: 13.5px;
}
.footer-text { margin: 0 0 6px; }
.footer-meta { margin: 0; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.site-footer a { color: inherit; opacity: .8; }
.site-footer a:hover { opacity: 1; }

/* 备案信息（首页底部居中） */
.footer-filing {
  margin: 8px 0 0; display: flex; justify-content: center;
  align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted, #6b7280);
}
.footer-filing .dot { opacity: .5; }
.footer-icp, .footer-gongan {
  color: inherit; text-decoration: none; opacity: .9;
  display: inline-flex; align-items: center; gap: 4px;
}
.site-footer .footer-icp:hover, .site-footer .footer-gongan:hover { opacity: 1; text-decoration: underline; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .article-main, .about-card { padding: 26px 22px 30px; }
  .article-toc { display: none; }
}

@media (max-width: 620px) {
  .wrap { width: min(1080px, 100% - 28px); }
  #main { padding: 26px 0 40px; }
  .card-grid { gap: 14px; }
  .func-card { width: calc(50% - 7px); min-height: 128px; padding: 18px 15px 16px; }
  .func-card-title { font-size: 16px; }
  .home-intro { font-size: 15px; }
  .blk-h1 { font-size: 23px; }
  .blk-h2 { font-size: 19.5px; }
  .article-main, .about-card { border-radius: 14px; padding: 22px 17px 26px; }
}

@media (max-width: 420px) {
  .func-card { width: 100%; }
}

/* ---------------- 可折叠标题 ---------------- */
.article-body h1.blk,
.article-body h2.blk,
.article-body h3.blk { position: relative; }

.fold-toggle {
  position: absolute;
  left: -26px; top: .16em;
  width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: #9aa6b8;
  border-radius: 6px; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.fold-toggle:hover { background: #eef2ff; color: #4f46e5; }
.fold-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(79, 70, 229, .3); }
.fold-ico {
  display: block; font-size: 11px; line-height: 1;
  transition: transform .18s ease;
}
.fold-toggle.is-collapsed .fold-ico { transform: rotate(-90deg); }

.fold-body { transition: opacity .16s ease; }
.fold-body.is-collapsed { display: none; }

@media (max-width: 640px) {
  .fold-toggle { position: static; margin-right: 6px; vertical-align: middle; }
}
