/* 小问号博物馆 · 样式
   风格：白纸 + 细线 + 大量留白；颜色只用来说明学科，不用来装饰 */

:root {
  --ink: #1C1F26;
  --ink-2: #5A616E;
  --muted: #8A9099;
  --hair: #E8E6E1;
  --paper: #FCFCFA;
  --card: #FFFFFF;
  --accent: #B45309;
  --r-card: 12px;
  --r-sm: 8px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 头部 ---------- */
.hero { padding: 64px 0 26px; }

.hero h1 {
  margin: 0 0 10px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
}

.hero .sub {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink-2);
  max-width: 30em;
}

.stats {
  margin-top: 18px;
  font-size: 14px;
  color: var(--muted);
}

.stats span + span::before { content: "·"; margin: 0 8px; }

/* ---------- 语言切换 ---------- */
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

.lang-toggle {
  flex: 0 0 auto;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  padding: 6px 11px;
  margin-top: 6px;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s ease, border-color .12s ease;
}
.lang-toggle:hover { color: var(--ink); border-color: #D6D2C9; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.topbar .back { margin-bottom: 0; }
.topbar .lang-toggle { margin-top: 0; }

/* ---------- 筛选 ---------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(252, 252, 250, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
  padding: 12px 0 10px;
}

.search-row { display: flex; gap: 10px; align-items: center; }

#search {
  flex: 1 1 auto;
  width: 100%;
  font: inherit;
  font-size: 14.5px;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease;
  -webkit-appearance: none;
  appearance: none;
}
#search::placeholder { color: #B3B8BF; }
#search:focus { border-color: #C9C6BE; }

.view-toggle {
  flex: 0 0 auto;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.2;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: color .12s ease, border-color .12s ease;
}
.view-toggle:hover { color: var(--ink); border-color: #D6D2C9; }

.chips { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 8px; }

.chip {
  font: inherit;
  font-size: 13.5px;
  line-height: 1.2;
  padding: 5px 10px;
  white-space: nowrap;
  border-radius: var(--r-sm);
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.chip:hover { background: #F2F1EC; color: var(--ink); }
.chip.on { background: #EDECE7; color: var(--ink); font-weight: 600; }

/* ---------- 学科分组 ---------- */
main { padding: 40px 0 72px; }

.subject {
  margin-bottom: 52px;
  scroll-margin-top: 140px;
}

.subject-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 20px;
}

.subject-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.subject-head .count {
  font-size: 13px;
  color: var(--muted);
}

.subject-head .about {
  font-size: 13px;
  color: var(--muted);
  margin-left: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
  gap: 18px;
}

/* ---------- 卡片 ---------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: border-color .15s ease;
}
.card:hover { border-color: #D6D2C9; }

.card-fig {
  position: relative;
  background: #FFFDF7;
  border-bottom: 1px solid var(--hair);
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.card-fig img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 还没有图解时：一块安静的空位 */
.card-fig-soon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FAF8F2;
}
.card-fig-soon span { font-size: 28px; opacity: .3; }

.card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body .q {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.55;
}

.card-body .ans {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
  font-weight: 400;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.meta .pill { margin: 0; }
.meta .pill + .pill::before { content: "·"; margin: 0 7px; color: #C9CDD3; }

.pill { color: inherit; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 64px 20px;
  font-size: 15px;
  line-height: 2;
}

/* ---------- 详情页 ---------- */
.article {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.back {
  display: inline-block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}
.back:hover { color: var(--ink); }

.quote-label {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .04em;
}

.q-title {
  margin: 0 0 14px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0;
}

.byline {
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}
.byline .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, #B3B8BF);
  display: inline-block;
  margin-right: 2px;
}
.byline .sep { color: #C9CDD3; }

.figure {
  margin: 0 0 6px;
  background: #FFFDF7;
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  overflow: hidden;
}
.figure img { width: 100%; display: block; }
.figure figcaption {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 10px 14px 12px;
  border-top: 1px solid #F1EFE9;
}

.oneline {
  margin: 32px 0 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--accent);
}
.oneline .label {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: .04em;
}
.oneline p {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.85;
  font-weight: 500;
}

.block-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  margin: 40px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}

.points { list-style: none; padding: 0; margin: 0; counter-reset: p; }
.points li {
  counter-increment: p;
  position: relative;
  padding: 15px 0 15px 30px;
  margin: 0;
  font-size: 15.5px;
  line-height: 1.8;
  border-bottom: 1px solid #F1EFE9;
}
.points li:last-child { border-bottom: 0; }
.points li::before {
  content: counter(p);
  position: absolute;
  left: 0;
  top: 15px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.followup {
  margin-top: 26px;
  padding: 16px 0 0;
  border-top: 1px solid var(--hair);
  font-size: 15px;
  color: var(--ink-2);
  line-height: 1.8;
}
.followup b { color: var(--ink); font-weight: 600; }

.related { margin-top: 40px; }
.related h3 {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .08em;
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}
.related-list a {
  display: block;
  padding: 11px 0;
  font-size: 15px;
  border-bottom: 1px solid #F1EFE9;
  transition: color .12s ease;
}
.related-list a:hover { color: var(--accent); }
.related-list a:last-child { border-bottom: 0; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  font-size: 14px;
  color: var(--ink-2);
}
.pager a:hover { color: var(--accent); }
.pager > span { max-width: 46%; }

.waiting {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.waiting .chips { display: inline-flex; gap: 4px; margin: 0 0 0 6px; vertical-align: middle; }
.waiting .chip { font-size: 12.5px; padding: 2px 8px; cursor: default; background: #F5F4EF; }

footer {
  border-top: 1px solid var(--hair);
  padding: 28px 0 44px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
}

/* ---------- 图片全屏查看 ---------- */
.figure.zoomable { position: relative; }
.figure.zoomable img { cursor: zoom-in; }
.zoom-hint {
  position: absolute;
  right: 14px;
  bottom: 44px;
  background: rgba(28, 31, 38, 0.62);
  color: #fff;
  font-size: 12px;
  letter-spacing: .02em;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
}

.card-zoom {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: zoom-in;
  opacity: 0;
  transition: opacity .15s ease;
}
.card:hover .card-zoom { opacity: .95; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vmin;
  background: rgba(18, 20, 26, 0.94);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox img {
  width: 94vw;
  height: 88vh;
  object-fit: contain;
  border-radius: 10px;
  background: #FFFDF7;
  cursor: zoom-in;
}
.lightbox.zoomed { display: block; overflow: auto; padding: 2vmin; }
.lightbox.zoomed img {
  width: 180%;
  height: auto;
  max-width: none;
  max-height: none;
  object-fit: fill;
  margin: 0 auto;
  border-radius: 6px;
  cursor: zoom-out;
}
.lb-close {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-close:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- 窄屏 ---------- */
@media (max-width: 620px) {
  body { font-size: 15.5px; }

  .wrap { padding: 0 18px; }
  .hero { padding: 36px 0 18px; }
  .hero h1 { font-size: 25px; }
  .hero .sub { font-size: 14.5px; }
  .stats { margin-top: 12px; font-size: 13px; }
  .lang-toggle { font-size: 12px; padding: 5px 10px; margin-top: 2px; }

  .filters { padding: 8px 0 6px; }
  #search { font-size: 14px; padding: 8px 12px; }
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 2px;
    margin-top: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; font-size: 13px; padding: 4px 9px; }

  main { padding: 28px 0 56px; }
  .subject { margin-bottom: 40px; }
  .subject-head { padding-bottom: 8px; margin-bottom: 16px; }
  .subject-head h2 { font-size: 16px; }
  .subject-head .about { display: none; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card-body .q { font-size: 16px; }
  .card-body .ans { -webkit-line-clamp: 2; }

  .article { padding: 24px 18px 64px; }
  .q-title { font-size: 22px; }
  .byline { font-size: 13px; margin-bottom: 22px; }
  .oneline p { font-size: 16.5px; }
  .points li { font-size: 15px; }
  .block-title { margin-top: 32px; }

  .lightbox { padding: 52px 8px 16px; }
  .lightbox img { width: 100%; height: 74vh; border-radius: 8px; }
  .lightbox.zoomed { padding: 48px 6px 12px; }
  .lightbox.zoomed img { width: 200%; height: auto; }
  .zoom-hint { right: 10px; bottom: 42px; font-size: 11.5px; padding: 3px 9px; }
  .card-zoom { opacity: .9; }
}
