/* ==========================================================================
   蓝魔鬼科普网 · components.css
   三页共用：基础排版、容器、页头导航、按钮、区块标题、标签、声明条、页脚，
   以及内页新增的组件（面包屑、筛选条、正文排版、目录、相关推荐）。
   页面专属样式在 style.css（首页）/ inner.css（内页）。
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--white);
  color: var(--text);
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.25; }
p { margin: 0; }
button { font: inherit; }

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: var(--fs-lg);
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ------------------------------------------------------------ site header */
.site-header {
  background: var(--navy);
  color: var(--ink-invert);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 65px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-invert);
  flex: none;
}
.brand-mark { width: 26px; height: 26px; color: #6ea8ff; flex: none; }
.brand-text { font-size: 20px; font-weight: 800; letter-spacing: .01em; }
.brand-sub {
  font-size: var(--fs-base);
  color: var(--muted-on-navy);
  padding-left: 12px;
  margin-left: 3px;
  border-left: 1px solid rgba(255, 255, 255, .22);
  font-weight: 400;
}

.site-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
  min-width: 0;
  font-size: var(--fs-xl);
}
.site-nav > ul { display: flex; align-items: center; gap: 22px; }
.site-nav li { position: relative; }
.site-nav .nav-drop {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 176px;
  max-height: 360px;
  overflow-y: auto;
  padding: 6px;
  background: var(--navy);
  border: 1px solid var(--line-navy);
  border-radius: 10px;
  box-shadow: 0 18px 38px -18px rgba(0, 0, 0, .7);
  z-index: 60;
  white-space: normal;
}
.site-nav li:hover > .nav-drop { display: block; }
.site-nav .nav-drop a { display: block; padding: 6px 10px; border-radius: 6px; font-size: var(--fs-lg); color: #cfdcf0; white-space: normal; }
.site-nav .nav-drop a::after { display: none; }
.site-nav .nav-drop a:hover { background: rgba(110, 168, 255, .18); color: var(--ink-invert); }
.site-nav .nav-all > a { color: var(--ink-invert); font-weight: 600; }
.site-nav a {
  color: #cfdcf0;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
  transition: color .18s;
}
.site-nav a:hover { color: var(--ink-invert); }
.site-nav a.is-current { color: var(--ink-invert); font-weight: 600; }
.site-nav a.is-current::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: #6ea8ff;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 40px; height: 40px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 9px;
  background: none;
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--ink-invert);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 10px;
  border: 0;
  font-size: var(--fs-2xl);
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s, transform .18s;
}
.btn-primary { background: var(--blue); color: var(--ink-invert); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { border: 1px solid rgba(255, 255, 255, .34); color: #e6eefb; }
.btn-ghost:hover { border-color: rgba(255, 255, 255, .7); background: rgba(255, 255, 255, .06); }
.btn-outline { border: 1px solid var(--line); color: var(--blue-deep); background: var(--white); }
.btn-outline:hover { border-color: #cfe0f8; background: var(--blue-pale); }
.btn-sm { padding: 8px 16px; font-size: var(--fs-base); border-radius: 9px; }

/* --------------------------------------------------------- section heads */
.section { padding: 20px 0 26px; }

.section-head h2,
.faq h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: var(--fs-5xl);
  font-weight: 800;
  letter-spacing: -.008em;
}

.head-icon {
  color: var(--blue);
  font-size: 18px;
  line-height: 1;
  flex: none;
}

.section-sub {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--muted);
  margin-top: 8px;
  max-width: 1080px;
}

.section-head--row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.section-head--row .section-sub { flex: 1 1 620px; margin-top: 0; }

.section-more {
  font-size: var(--fs-base);
  color: var(--blue-deep);
  white-space: nowrap;
  border-bottom: 1px solid rgba(11, 78, 162, .3);
  padding-bottom: 1px;
}
.section-more:hover { color: var(--blue); }

/* ------------------------------------------------------------------- tag */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: var(--ink-invert);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- notice */
.notice-section { padding: 13px 0; }

.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
  border-radius: var(--radius);
  background: var(--blue-tint);
  color: var(--ink-alt);
  font-size: var(--fs-md);
  line-height: 1.65;
}
.notice-icon {
  flex: none;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: var(--ink-invert);
  font-size: var(--fs-base);
  font-weight: 800;
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
}

/* ----------------------------------------------------------------- footer */
.site-footer {
  background: var(--navy);
  color: var(--muted-on-navy);
  padding: 14px 0 0;
  margin-top: 6px;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  padding-bottom: 8px;
}
.footer-col { flex: 1 1 180px; min-width: 160px; }
.footer-brand { flex: 1 1 240px; }
.footer-icp { color: var(--muted-on-navy); font-size: var(--fs-s); }

.footer-brandname {
  font-size: var(--fs-3xl);
  font-weight: 800;
  color: var(--ink-invert);
  margin-bottom: 7px;
}
.footer-brand p { font-size: var(--fs-sm); line-height: 1.55; max-width: 330px; }

.site-footer h2 {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--ink-invert);
  margin-bottom: 8px;
}

.footer-cols { columns: 2; column-gap: 24px; }
.footer-cols li { margin-bottom: 3px; line-height: 1.5; break-inside: avoid; }
.footer-note li { font-size: var(--fs-sm); line-height: 1.5; margin-bottom: 2px; }

.site-footer a { color: var(--muted-on-navy); }
.site-footer a:hover { color: var(--ink-invert); }
.footer-links a,
.footer-cols a { font-size: var(--fs-base); line-height: 1.5; display: inline-block; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 7px 24px 8px;
  border-top: 1px solid var(--line-navy);
  font-size: var(--fs-s);
  color: var(--faint-on-navy);
}
.to-top { color: var(--faint-on-navy); }
.to-top:hover { color: var(--ink-invert); }

/* ======================================================== 内页公共组件 ==== */

/* 面包屑 */
.crumb {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-base);
  color: var(--muted);
}
.crumb a { color: var(--blue-deep); }
.crumb a:hover { color: var(--blue); }
.crumb li { display: flex; align-items: center; }
.crumb .sep { color: #b8c8da; }

/* 内页页头 */
.page-hero {
  background: linear-gradient(112deg, var(--navy-deep) 0%, var(--navy) 55%, var(--navy-lift) 100%);
  color: var(--ink-invert);
  padding: 26px 0 34px;
}
.page-hero .crumb { color: var(--muted-on-navy); }
.page-hero .crumb a { color: #9dc2ff; }
.page-hero .crumb .sep { color: rgba(255, 255, 255, .35); }
.page-hero .eyebrow {
  font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif;
  font-size: var(--fs-base);
  letter-spacing: .16em;
  color: #7fb2ff;
  margin: 18px 0 10px;
}
.page-hero h1 {
  color: var(--ink-invert);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.012em;
}
.page-hero p {
  margin-top: 12px;
  max-width: 860px;
  font-size: var(--fs-xl);
  line-height: 1.7;
  color: var(--ink-on-navy);
}

/* 筛选 + 排序条 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}
.filter-group { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.filter-btn:hover { border-color: #cfe0f8; color: var(--blue-deep); }
.filter-btn[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--ink-invert);
  font-weight: 600;
}
.filter-count {
  margin-left: auto;
  font-size: var(--fs-base);
  color: var(--muted);
}
.sort-label { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); color: var(--muted); cursor: pointer; }
.sort-select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--white);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
}

/* 空状态 */
.empty-state {
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-md);
}

/* 长文正文 */
.article {
  max-width: 800px;
  font-size: 16px;
  line-height: 1.9;
  color: var(--text);
}
.article h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 34px 0 12px;
  padding-top: 6px;
  scroll-margin-top: 90px;
}
.article h3 { font-size: 18px; margin: 22px 0 8px; }
.article p { margin: 0 0 14px; }
.article strong { color: var(--ink); font-weight: 700; }
.article ul { list-style: disc; padding-left: 22px; margin: 0 0 16px; }
.article li { margin-bottom: 6px; }
.article ul li::marker { color: var(--blue); }
.article .lead {
  font-size: 17px;
  line-height: 1.8;
  color: var(--ink);
  font-weight: 600;
  padding-left: 14px;
  border-left: 3px solid var(--blue);
  margin-bottom: 22px;
}

/* 文章目录 */
.toc {
  background: var(--blue-card);
  border: 1px solid #dbe8fb;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.toc h2 {
  font-size: var(--fs-lg);
  font-weight: 800;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc ol {
  margin: 0;
  padding-left: 18px;
  font-size: var(--fs-base);
  line-height: 1.85;
  color: var(--text);
  list-style: decimal;
}
.toc li::marker { color: var(--blue); font-family:'PingFang SC','Microsoft YaHei','Noto Sans SC',-apple-system,BlinkMacSystemFont,'Segoe UI',Arial,sans-serif; }
.toc a:hover { color: var(--blue-deep); text-decoration: underline; }

/* 相关阅读 */
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 14px;
}
.related-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
  transition: transform .2s, border-color .2s;
}
.related-card:hover { transform: translateY(-2px); border-color: #cfe0f8; }
.related-card img {
  width: 96px; height: 72px;
  object-fit: cover;
  border-radius: 8px;
}
.related-card h3 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.45; }
.related-card p { margin-top: 5px; font-size: var(--fs-sm); color: var(--muted); }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1240px) {
  .brand-sub { display: none; }
  .site-nav { gap: 16px; font-size: var(--fs-lg); }
}

@media (max-width: 1024px) {
  .header-inner { gap: 14px; }
  .site-nav { margin-left: 0; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav > ul { gap: 14px; padding-right: 10px; }
  .site-nav a { font-size: var(--fs-lg); padding: 6px 0; }
  .site-nav a.is-current::after { display: none; }
  .site-nav .nav-drop { display: none !important; }
  .nav-toggle { display: none; }

  .footer-grid { flex-direction: column; gap: 22px; }
  .footer-brand, .footer-col { flex: 0 0 auto; width: 100%; min-width: 0; }
  .page-hero h1 { font-size: 32px; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  /* 触控目标：窄屏下把纯文字链接的行高和按钮内边距放大到 ≥ 32px */
  .footer-cols li { margin-bottom: 0; }
  .footer-cols a,
  .footer-note li,
  .to-top,
  .site-footer a { display: inline-block; padding: 6px 0; min-height: 32px; }
  .filter-btn { padding: 7px 14px; }
  .toc ol { line-height: 2; }
  .toc a { display: inline-block; padding: 3px 0; }
  .crumb a { display: inline-block; padding: 4px 0; }
  .page-hero h1 { font-size: 26px; }
  .page-hero p { font-size: 15px; }
  .related-grid { grid-template-columns: 1fr; }
  .filter-count { margin-left: 0; }
}

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

/* ---------------------------------------------------- 首页分类内容模块 */
.home-modules { padding: 26px 0 8px; }
.module-block { margin-bottom: 30px; }
.module-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.module-head h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--ink); }
.module-head-meta { display: flex; align-items: baseline; gap: 14px; font-size: var(--fs-base); color: var(--muted); }
.module-head-meta .more { color: var(--blue-deep); text-decoration: none; }
.module-head-meta .more:hover { text-decoration: underline; text-underline-offset: 3px; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.module-grid .note-body h3 { font-size: var(--fs-3xl); }

/* ------------------------------------------------------------ 缩略图占位 */
.entry-emoji { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 38px; background: var(--blue-pale, #e8f1fb); }

/* ------------------------------------------------------------ 正文配图 */
.article-body .article-figure { margin: 18px 0 8px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--blue-pale, #e8f1fb); }
.article-body .article-figure img { display: block; width: 100%; height: auto; }

/* ---------------------------------------------------------------- 分页 */
.pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 7px; margin: 26px 0 8px; }
.pager a, .pager .pager-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; font-size: var(--fs-base); color: var(--text); text-decoration: none; }
.pager a:hover { border-color: var(--blue); color: var(--blue-deep); }
.pager a.is-active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.pager .pager-gap { border-color: transparent; }

@media (max-width: 1240px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .module-grid { grid-template-columns: 1fr; }
  .module-head h2 { font-size: 20px; }
}
