/* ==========================================================================
   苍匣工具目录（tools/index.html）
   白底、细边框、深灰文字，与首页保持同一套简洁语言。
   ========================================================================== */

body.tools-index {
  --index-bg: #ffffff;
  --index-surface: #fafafa;
  --index-surface-2: #f5f6f7;
  --index-text: #17191d;
  --index-soft: #3f4652;
  --index-muted: #6b7280;
  --index-muted-2: #9aa1ab;
  --index-line: #e6e7ea;
  --index-line-strong: #d2d5da;
  --index-accent: #1d4ed8;
  --index-accent-dark: #1e40af;
  --index-accent-soft: #eff4ff;
  position: relative;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: var(--index-bg);
  color: var(--index-text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.tools-index *,
body.tools-index *::before,
body.tools-index *::after { box-sizing: border-box; }

body.tools-index ::selection {
  background: #dbe7ff;
  color: var(--index-text);
}

.index-container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 36px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* 头部：和首页同一块透明磨砂玻璃 ─────────────────────────────────────────── */

.index-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(23, 25, 29, 0.07);
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}
/* 没有 backdrop-filter 的浏览器退回接近实心的白，滚动时文字照样压得住 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .index-header { background: #ffffff; }
}
.index-header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  min-height: 72px;
}
body.tools-index .brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: inherit;
  text-decoration: none;
}
body.tools-index .brand-logo {
  width: auto;
  height: 34px;
}
.index-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}
/* 导航项跟首页一样：平时灰字，悬停时从下面长出一条电蓝细线 */
.index-nav a {
  position: relative;
  padding: 8px 0;
  color: var(--index-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.index-nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 2px;
  border-radius: 99px;
  background: var(--index-accent);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.index-nav a:hover { color: var(--index-text); }
.index-nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* 页头搜索：首页那颗磨砂小药丸的同款 ------------------------------------- */

.index-header .index-search {
  flex: 0 1 246px;
  min-width: 0;
  margin: 0 2px 0 0;
}
.index-header .index-search .search-icon {
  left: 13px;
  font-size: 14px;
}
body.tools-index .index-header .index-search input[type="search"] {
  height: 36px;
  padding: 0 14px 0 34px;
  border: 1px solid rgba(23, 25, 29, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 13.5px;
}
body.tools-index .index-header .index-search input[type="search"]:focus {
  border-color: var(--index-accent);
  background: #ffffff;
}

/* 介绍 */

.index-main { padding: 72px 0 84px; }
.index-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 56px;
  align-items: end;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--index-line);
}
.index-intro h1 {
  color: var(--index-text);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
}
.index-lead {
  max-width: 620px;
  margin-top: 14px;
  color: var(--index-soft);
  font-size: 16px;
  line-height: 1.8;
}
.index-note {
  padding: 4px 0 4px 24px;
  border-left: 1px solid var(--index-line);
}
.index-note strong {
  display: block;
  color: var(--index-text);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.index-note span {
  display: block;
  margin-top: 8px;
  color: var(--index-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* 搜索、筛选与列表 */

.tools-browser { padding-top: 28px; }
.index-toolbar {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--index-line);
}
.index-search {
  position: relative;
  flex: 1;
  min-width: 220px;
  display: block;
}
.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--index-muted-2);
  font-size: 16px;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}
body.tools-index .index-search input[type="search"] {
  width: 100%;
  height: 38px;
  padding: 0 13px 0 36px;
  border: 1px solid var(--index-line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--index-text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
body.tools-index .index-search input[type="search"]:focus {
  border-color: var(--index-accent);
}
body.tools-index .index-search input[type="search"]::placeholder {
  color: var(--index-muted-2);
}

.index-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.index-filter {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--index-line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--index-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.index-filter:hover {
  border-color: var(--index-line-strong);
  color: var(--index-text);
}
.index-filter.active {
  border-color: var(--index-text);
  background: var(--index-text);
  color: #ffffff;
}
.index-filter-count {
  color: var(--index-muted-2);
  font-size: 12px;
}
.index-filter.active .index-filter-count { color: rgba(255, 255, 255, 0.65); }

.tool-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.index-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 16px;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px 12px 12px;
  border: 1px solid var(--index-line);
  border-radius: 9px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
}
.index-card:hover {
  border-color: var(--index-line-strong);
  background: var(--index-surface);
}
.index-card.hidden { display: none; }

.index-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--index-line);
  border-radius: 7px;
  background: var(--index-surface-2);
  color: var(--index-soft);
  font-family: "Cascadia Mono", ui-monospace, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.index-body { min-width: 0; }
.index-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.index-name {
  overflow: hidden;
  color: var(--index-soft);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-card:hover .index-name { color: var(--index-text); }
.index-scene {
  flex: none;
  padding: 2px 9px;
  border: 1px solid var(--index-line);
  border-radius: 999px;
  color: var(--index-muted);
  font-size: 12px;
  white-space: nowrap;
}
.index-desc {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--index-muted);
  font-size: 12.5px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-arrow {
  color: var(--index-muted-2);
  font-size: 14px;
  line-height: 1;
}
.index-card:hover .index-arrow { color: var(--index-text); }

body.tools-index .empty {
  padding: 48px 18px;
  border: 1px dashed var(--index-line-strong);
  border-radius: 9px;
  color: var(--index-muted);
  text-align: center;
}
body.tools-index .empty[hidden] { display: none; }
body.tools-index .empty strong {
  display: block;
  margin-bottom: 5px;
  color: var(--index-text);
  font-size: 15px;
  font-weight: 600;
}
body.tools-index .empty span { font-size: 13px; }


/* 页脚 */

.index-footer {
  padding: 22px 0;
  border-top: 1px solid var(--index-line);
  background: #ffffff;
  color: var(--index-muted-2);
  font-size: 12px;
}
.index-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.index-footer p { margin: 0; }
.index-footer a {
  color: var(--index-soft);
  text-decoration: none;
}
.index-footer a:hover { color: var(--index-accent); }

/* 响应式 */

@media (max-width: 1024px) {
  .index-container { padding: 0 30px; }
  .index-intro { grid-template-columns: minmax(0, 1fr) 200px; gap: 36px; }
  .index-toolbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .index-search { min-width: 0; }
  .index-filters { padding: 0 1px; }
}

@media (max-width: 720px) {
  .index-container { padding: 0 20px; }
  .index-header-inner { min-height: 64px; gap: 16px; }
  .index-header .index-search { flex: 1 1 150px; }
  body.tools-index .brand-logo { height: 30px; }
  .index-main { padding: 52px 0 64px; }
  .index-intro {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 30px;
  }
  .index-intro h1 { font-size: clamp(28px, 4.4vw, 34px); }
  .index-note {
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid var(--index-line);
  }
  .index-note strong { font-size: 30px; }
  .tool-directory { grid-template-columns: minmax(0, 1fr); }
  .index-card { grid-template-columns: 42px minmax(0, 1fr) 16px; }
  .index-footer-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  .index-nav { display: none; }
  /* 导航项收起来以后，搜索接管页头剩下的位置 */
  .index-header .index-search { flex: 1 1 130px; margin-right: 0; }
  .index-intro h1 { font-size: clamp(26px, 7.4vw, 30px); }
  .index-lead { font-size: 15px; }
  .index-filter { padding: 6px 10px; font-size: 12.5px; }
  .index-card { grid-template-columns: 40px minmax(0, 1fr) 16px; gap: 11px; }
  .index-mark { width: 38px; height: 38px; }
  .index-scene { display: none; }
  .index-desc { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

