/* ============================================================
   HaluCatch — FAQ 独立页面样式
   ============================================================ */

/* ── Sticky Footer ── */
body.faq-page {
  display: flex; flex-direction: column; min-height: 100vh;
}
body.faq-page .faq-content {
  flex: 1 0 auto;
}
body.faq-page footer {
  flex-shrink: 0;
}

/* ── Body Glow ── */
:root { --glow-opacity: 0.5; }

/* ── Skip Link ── */
.skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.skip-link:focus { position: fixed; top: 0; left: 0; z-index: 999; padding: 8px 16px; background: var(--accent); color: #fff; text-decoration: none; border-radius: 0 0 8px 0; }

/* ── Nav Back Link ── */
.faq-page .nav-back-link {
  position: absolute; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  color: var(--accent); text-decoration: none; font-size: 0.85rem; font-weight: 600;
  padding: 4px 8px; border-radius: 8px; transition: background 0.2s;
  white-space: nowrap;

  /* 可动画属性：top/left/transform 控制位置平滑变化 */
  top: 50%; left: 8px; transform: translateY(-50%);
  transition: top 0.4s ease, left 0.4s ease, transform 0.4s ease, background 0.2s;
}
.faq-page .nav-back-link:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.faq-page .nav-back-link svg { flex-shrink: 0; display: block; transform: translateY(-0.5px); }

/* ── 文字标签切换动画（右擦除效果） ──
   全名从右向左 clip-path 擦除，短名同步从右侧滑入，
   制造"文字被向右擦短"的视觉效果 ── */
.faq-page .nav-back-link .back-label-full {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.4s ease;
}
.faq-page .nav-back-link .back-label-short {
  position: absolute; left: 30px; white-space: nowrap;
  opacity: 0; transform: translateX(6px); clip-path: inset(0 0 0 0);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, clip-path 0.35s ease;
}

/* A: ≥ 1260px — 图标 + 完整文字 */
@media (min-width: 1260px) {
  .faq-page .nav-back-link .back-label-full {
    clip-path: inset(0 0 0 0);
  }
  .faq-page .nav-back-link .back-label-short {
    opacity: 0; transform: translateX(6px); pointer-events: none;
  }
}

/* B: 1200–1260px — 图标 + 短文字（全名从右擦除，短名滑入） */
@media (max-width: 1259px) and (min-width: 1200px) {
  .faq-page .nav-back-link .back-label-full {
    clip-path: inset(0 100% 0 0);
  }
  .faq-page .nav-back-link .back-label-short {
    opacity: 1; transform: translateX(0); pointer-events: auto;
    transition: opacity 0.25s ease 0.18s, transform 0.3s ease 0.18s;
  }
}

/* C: 1140–1200px — 仅图标（短名向左缩回图标） */
@media (max-width: 1199px) and (min-width: 1140px) {
  .faq-page .nav-back-link .back-label-full {
    clip-path: inset(0 100% 0 0);
  }
  .faq-page .nav-back-link .back-label-short {
    clip-path: inset(0 100% 0 0);
    opacity: 0; transform: translateX(-4px); pointer-events: none;
    transition: opacity 0.2s ease, transform 0.3s ease, clip-path 0.35s ease;
  }
}

/* D: < 1140px — 下沉到 brand 下方，完整文字 */
@media (max-width: 1139px) {
  .faq-page .nav { height: 80px; align-items: flex-start; transition: height 0.4s ease; }
  .faq-page .nav-back-link {
    top: 52px; left: 12px; transform: none;
  }
  .faq-page .nav-back-link .back-label-full {
    clip-path: inset(0 0 0 0);
  }
  .faq-page .nav-back-link .back-label-short {
    clip-path: inset(0 0 0 0);
    opacity: 0; transform: translateX(6px); pointer-events: none;
  }
  .faq-page .nav-inner { height: 52px; }
}

/* 恢复默认 nav 样式（覆盖 D 状态） */
@media (min-width: 1140px) {
  .faq-page .nav { height: 52px; transition: height 0.4s ease; }
}

/* ── FAQ Hero ── */
.faq-hero {
  text-align: center; padding: 80px 20px 40px;
  max-width: 720px; margin: 0 auto;
  position: relative; z-index: 1;
}
.faq-hero h1 {
  font-size: 2.4rem; font-weight: 800; margin-bottom: 24px;
  background: linear-gradient(135deg, var(--h1-from), var(--h1-to));
  background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── Search ── */
.faq-search-wrap {
  position: relative; max-width: 480px; margin: 0 auto;
}
.faq-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text2); pointer-events: none;
}
.faq-search {
  width: 100%; padding: 12px 40px 12px 42px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border); color: var(--text); font-size: 0.9rem;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.faq-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.faq-search::placeholder { color: var(--text2); opacity: 0.6; }
.faq-search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text2); cursor: pointer;
  padding: 4px; border-radius: 4px; display: none; opacity: 0.6;
}
.faq-search-clear:hover { opacity: 1; color: var(--text); }
.faq-search-clear.visible { display: block; }

/* ── Main Content ── */
.faq-content {
  max-width: 820px; margin: 0 auto; padding: 0 20px 60px;
  position: relative; z-index: 1;
}

/* ── Section Card ── */
.faq-section {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 24px 20px; margin-bottom: 20px;
  transition: opacity 0.3s ease;
}
.faq-section.hidden { display: none; }

.faq-section-title {
  font-size: 1.15rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.fs-icon { font-size: 1.3rem; line-height: 1; }

/* ── Q&A (reuse faq-item from style.css) ── */
.qa-section .faq-item {
  margin-bottom: 6px;
}

/* ── Table ── */
.faq-table-wrap { overflow-x: auto; }
.faq-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
}
.faq-table th {
  background: var(--surface2); color: var(--text);
  padding: 10px 12px; text-align: left; font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.faq-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text2); vertical-align: top;
}
.faq-table tbody tr:hover { background: color-mix(in srgb, var(--surface2) 50%, transparent); }
.faq-table code {
  background: var(--surface2); padding: 2px 6px; border-radius: 4px;
  font-size: 0.8rem; color: var(--accent2);
}
.faq-table tbody tr.hidden { display: none; }

/* ── Scenes Grid ── */
.scenes-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.scene-card {
  background: color-mix(in srgb, var(--surface2) 50%, transparent);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 16px;
}
.scene-card h4 {
  font-size: 0.95rem; font-weight: 600; color: var(--text);
  margin-bottom: 8px;
}
.scene-card p {
  font-size: 0.82rem; color: var(--text2); line-height: 1.6;
}
.scene-card pre {
  background: var(--surface2); border-radius: 6px;
  padding: 10px; font-size: 0.78rem; margin-top: 8px;
  overflow-x: auto;
}

/* ── Capabilities Grid ── */
.caps-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 600px) {
  .caps-grid { grid-template-columns: 1fr; }
}
.cap-card {
  border-radius: 10px; padding: 16px;
  border: 1px solid var(--border);
}
.cap-card.cap-green { background: color-mix(in srgb, var(--green) 8%, var(--surface)); }
.cap-card.cap-red { background: color-mix(in srgb, var(--red) 8%, var(--surface)); }
.cap-card.cap-orange { background: color-mix(in srgb, var(--orange) 8%, var(--surface)); }
.cap-icon { font-size: 1.4rem; margin-bottom: 8px; }
.cap-card h4 { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.cap-card ul { margin: 0; padding-left: 16px; }
.cap-card li {
  font-size: 0.82rem; color: var(--text2); line-height: 1.7;
  list-style-type: disc;
}

/* ── Antipattern ── */
.antipattern-sub {
  margin-bottom: 20px;
}
.antipattern-sub:last-child { margin-bottom: 0; }
.antipattern-sub h4 {
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.antipattern-sub .faq-table {
  font-size: 0.8rem;
}
.antipattern-sub .faq-table th:first-child,
.antipattern-sub .faq-table td:first-child { min-width: 120px; }
.antipattern-sub .faq-table th:nth-child(2),
.antipattern-sub .faq-table td:nth-child(2) { min-width: 140px; }
.antipattern-sub .faq-table th:last-child,
.antipattern-sub .faq-table td:last-child { min-width: 160px; }

/* ── Back to Top ── */
.back-to-top {
  position: fixed; bottom: 32px; right: 32px;
  width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  color: var(--text2); cursor: pointer; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s, border-color 0.3s, color 0.3s;
  pointer-events: none;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ── No Results ── */
.faq-no-results {
  display: none; text-align: center; padding: 40px 20px;
}
.faq-no-results.visible { display: block; }
.faq-no-results-msg {
  font-size: 1rem; color: var(--text); font-weight: 600; margin-bottom: 8px;
}
.faq-no-results-hint { font-size: 0.85rem; color: var(--text2); margin-bottom: 14px; }

/* ── Keyword Chips ── */
.faq-keyword-chips {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.keyword-chip {
  background: color-mix(in srgb, var(--surface2) 60%, transparent);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 16px; font-size: 0.82rem; color: var(--text2);
  cursor: pointer; transition: all 0.2s; font-family: inherit;
}
.keyword-chip:hover {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .faq-hero h1 { font-size: 1.6rem; }
  .faq-hero { padding: 60px 16px 24px; }
  .faq-content { padding: 0 12px 40px; }
  .faq-section { padding: 16px 14px; }
  .scenes-grid { grid-template-columns: 1fr; }
  .back-to-top { bottom: 20px; right: 20px; width: 38px; height: 38px; }
}
