/* ==========================================================================
   常见问题页专用样式
   仅由 pages/faq.html 引入，不影响其他页面。
   复用 main.css 的变量、.o-faq 手风琴、.page-hero、.o-hd 等组件。
   ========================================================================== */

/* ---- 屏幕阅读器专用（main.css 未定义） ---- */
.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;
}

/* ==========================================================================
   1. 整体布局
   ========================================================================== */
.faq-layout { display: grid; gap: 28px; }

@media (min-width: 1024px) {
  .faq-layout {
    grid-template-columns: 248px minmax(0, 1fr);
    gap: 44px;
    align-items: start;
  }
}

/* ==========================================================================
   2. 左侧分类目录
   ========================================================================== */
.faq-side { min-width: 0; }

.faq-side-in {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--sh-sm);
}

@media (min-width: 1024px) {
  .faq-side-in {
    position: sticky;
    top: 96px;
  }
}

.faq-side-t {
  margin: 0 0 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.faq-toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.faq-toc-a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-left: 3px solid transparent;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  transition: color .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}

.faq-toc-a:hover { color: var(--brand); background: var(--surface-2); }

.faq-toc-a.is-active {
  color: var(--brand);
  font-weight: 600;
  background: var(--gold-pale);
  border-left-color: var(--gold);
}

.faq-toc-a b {
  flex: none;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

.faq-toc-a.is-active b { background: var(--gold); color: #fff; }

/* 侧栏底部咨询小卡 */
.faq-side-tip {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--gold-pale);
  border: 1px solid var(--gold-light);
}

.faq-side-tip p {
  margin: 0 0 8px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.faq-side-tip .faq-side-tel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .01em;
}

.faq-side-tip .faq-side-tel:hover { color: var(--brand); }

.faq-side-tip > span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}

/* 手机 / 平板：侧栏变成横向滚动胶囊 */
@media (max-width: 1023px) {
  .faq-side-in { padding: 12px; }

  .faq-side-t { display: none; }

  .faq-toc {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .faq-toc::-webkit-scrollbar { display: none; }

  .faq-toc > li { flex: none; }

  .faq-toc-a {
    border-left: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: 7px 14px;
    white-space: nowrap;
    font-size: var(--fs-xs);
    background: var(--surface);
  }

  .faq-toc-a.is-active {
    border-color: var(--gold);
    background: var(--gold);
    color: #fff;
  }

  .faq-toc-a.is-active b { background: rgba(255, 255, 255, .28); color: #fff; }

  .faq-side-tip { display: none; }
}

/* ==========================================================================
   3. 工具栏（搜索 + 全部展开）
   ========================================================================== */
.faq-main { min-width: 0; }

.faq-tools {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 20px;
}

.faq-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.faq-search > .ic {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: var(--ink-3);
  pointer-events: none;
}

.faq-search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 38px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  font-size: var(--fs-sm);
  color: var(--ink);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.faq-search input::placeholder { color: var(--ink-3); }

.faq-search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27, 58, 92, .1);
}

.faq-search input::-webkit-search-cancel-button { display: none; }

.faq-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
}

.faq-search-clear:hover { background: var(--line-2); color: var(--ink); }

/* hidden 属性需要显式覆盖 display，否则会被上面的 display:inline-flex 覆盖掉 */
.faq-search-clear[hidden],
.faq-result[hidden],
.faq-empty[hidden] { display: none !important; }

.faq-toggle-all {
  flex: none;
  height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}

.faq-toggle-all:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-pale);
}

/* 搜索命中数提示 */
.faq-result {
  margin: 0 0 16px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.faq-result b { color: var(--gold); font-weight: 700; }

/* ==========================================================================
   4. 分类分组
   ========================================================================== */
.faq-group { scroll-margin-top: 96px; }

.faq-group + .faq-group { margin-top: 44px; }

.faq-group-hd {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.faq-group-bar {
  flex: none;
  width: 4px;
  height: 22px;
  margin-top: 4px;
  border-radius: var(--r-pill);
  background: linear-gradient(to bottom, var(--gold), var(--gold-bright));
}

.faq-group-hd h2 {
  margin: 0;
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -.01em;
}

.faq-group-hd p {
  margin: 5px 0 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--ink-3);
}

/* 搜索时被隐藏的问答项 / 分组 */
.faq-group[hidden],
.o-faq-i[hidden],
.o-faq[hidden] { display: none !important; }

/* 搜索关键词高亮 */
mark.faq-hl {
  background: rgba(228, 151, 92, .42);
  color: #7a3d13;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 3px;
}

/* ==========================================================================
   5. 空状态
   ========================================================================== */
.faq-empty {
  padding: 56px 24px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.faq-empty > .ic {
  font-size: 34px;
  color: var(--line-2);
  margin-bottom: 12px;
}

.faq-empty p {
  margin: 0 0 6px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--brand);
}

.faq-empty span {
  display: block;
  margin-bottom: 18px;
  font-size: var(--fs-sm);
  color: var(--ink-3);
}

.faq-empty .btn { display: inline-flex; }

/* ==========================================================================
   6. 移动端微调
   ========================================================================== */
@media (max-width: 640px) {
  .faq-tools { flex-wrap: wrap; }

  .faq-search { flex: 1 1 100%; }

  .faq-toggle-all { flex: 1 1 100%; height: 40px; }

  .faq-group + .faq-group { margin-top: 34px; }

  .faq-group-hd h2 { font-size: var(--fs-md); }

  .faq-empty { padding: 40px 16px; }
}

/* ==========================================================================
   8. 总览页：搜索区
   ========================================================================== */
.faq-searchsec { padding-bottom: 0; }

.faq-searchbig {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.faq-searchbig > .ic {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--ink-3);
  pointer-events: none;
}

.faq-searchbig input {
  width: 100%;
  height: 56px;
  padding: 0 52px 0 50px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: var(--fs-md);
  color: var(--ink);
  box-shadow: var(--sh-sm);
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.faq-searchbig input::placeholder { color: var(--ink-3); }

.faq-searchbig input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 154, 74, .14);
}

.faq-searchbig input::-webkit-search-cancel-button { display: none; }

.faq-searchbig .faq-search-clear {
  right: 14px;
  width: 30px;
  height: 30px;
}

/* 热门搜索词 */
.faq-hints {
  max-width: 760px;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.faq-hints > span { margin-right: 2px; }

.faq-hints button {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  padding: 4px 12px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .18s var(--ease), color .18s var(--ease), background .18s var(--ease);
}

.faq-hints button:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-pale);
}

/* 搜索结果列表 */
.faq-sr {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  max-height: 520px;
  overflow-y: auto;
}

.faq-sr-i + .faq-sr-i { border-top: 1px solid var(--line); }

.faq-sr-i a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  color: var(--ink);
  transition: background .16s var(--ease);
}

.faq-sr-i a:hover { background: var(--gold-pale); }

.faq-sr-c {
  flex: none;
  min-width: 68px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
}

.faq-sr-q {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.faq-sr-i a > .ic {
  flex: none;
  font-size: 14px;
  color: var(--ink-3);
  transition: color .16s var(--ease), transform .16s var(--ease);
}

.faq-sr-i a:hover > .ic { color: var(--gold); transform: translateX(2px); }

/* ==========================================================================
   9. 总览页：分类卡片
   ========================================================================== */
.faq-cats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .faq-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .faq-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.faq-cat { display: flex; }

.faq-cat-in {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-sm);
  color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}

.faq-cat-in:hover {
  border-color: var(--gold-light);
  box-shadow: 0 10px 28px rgba(27, 58, 92, .1);
  transform: translateY(-2px);
}

.faq-cat-ic {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  background: var(--gold-pale);
  color: var(--gold);
  font-size: 20px;
}

.faq-cat-hd {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.faq-cat-hd b {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -.01em;
}

.faq-cat-hd em {
  font-style: normal;
  font-size: var(--fs-xs);
  color: var(--ink-3);
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}

.faq-cat-d {
  font-size: var(--fs-xs);
  line-height: 1.65;
  color: var(--ink-2);
}

.faq-cat-eg {
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  /* 两行截断 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.faq-cat-more {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--gold);
}

.faq-cat-more .ic { font-size: 12px; transition: transform .18s var(--ease); }
.faq-cat-in:hover .faq-cat-more .ic { transform: translateX(3px); }

/* 城市入口 */
.faq-cities { margin-top: 4px; }

@media (max-width: 640px) {
  .faq-cat-in { padding: 18px; }
  .faq-searchbig input { height: 50px; font-size: var(--fs-sm); }
}

/* ==========================================================================
   10. 总览页：热门问题
   ========================================================================== */
.faq-hot {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  counter-reset: hot;
}

@media (min-width: 900px) {
  .faq-hot { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
}

.faq-hot li { counter-increment: hot; }

.faq-hot a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.faq-hot a::before {
  content: counter(hot, decimal-leading-zero);
  flex: none;
  font-family: var(--font-num, inherit);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: .04em;
}

.faq-hot a:hover {
  border-color: var(--gold-light);
  background: var(--gold-pale);
}

.faq-hot-q {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.faq-hot a > .ic {
  flex: none;
  font-size: 14px;
  color: var(--ink-3);
  transition: color .16s var(--ease), transform .16s var(--ease);
}

.faq-hot a:hover > .ic { color: var(--gold); transform: translateX(2px); }

/* ==========================================================================
   11. 分类页：返回总览 + 继续看其他分类
   ========================================================================== */
.faq-toc-back {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.faq-toc-back a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  border-radius: var(--r-sm);
  transition: color .18s var(--ease), background .18s var(--ease);
}

.faq-toc-back a:hover { color: var(--gold); background: var(--gold-pale); }

.faq-toc-back .ic { font-size: 12px; }

@media (max-width: 1023px) {
  .faq-toc-back {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    order: 9;
  }
  .faq-toc-back a {
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    padding: 7px 14px;
    white-space: nowrap;
  }
}

.faq-next {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.faq-next-t {
  margin: 0 0 14px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.faq-next-ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .faq-next-ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.faq-next-ul a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--brand);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.faq-next-ul a:hover {
  border-color: var(--gold-light);
  background: var(--gold-pale);
}

.faq-next-ul b {
  flex: none;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

/* ==========================================================================
   12. 打印
   ========================================================================== */
@media print {
  .faq-side,
  .faq-tools,
  .faq-empty { display: none !important; }

  .faq-layout { display: block; }

  /* 打印时展开全部答案，避免内容缺失 */
  .o-faq-a { grid-template-rows: 1fr !important; opacity: 1 !important; }

  .faq-group { break-inside: avoid; }
  .o-faq-i { break-inside: avoid; }
}
