/* =========================================================================
   AX 无盘工具站 · 视觉增强层 v2
   -------------------------------------------------------------------------
   用法：页面只引本文件即可（内部已 @import 原始 style.css，顺序不会乱）
   原始文件 css/style.css 一行未改，删掉本文件 + 还原 index.html 即回滚
   ========================================================================= */
@import url("/css/style.css");

/* -------------------------------------------------------------------------
   0. 令牌扩展
   ------------------------------------------------------------------------- */
:root {
  --v2-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --v2-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  --v2-glow-cyan: rgba(40, 199, 255, 0.36);
  --v2-glow-violet: rgba(139, 124, 255, 0.32);
}

/* -------------------------------------------------------------------------
   1. 全局质感：噪点膜 + 滚动条 + 选中色
   ------------------------------------------------------------------------- */
#v2Grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: var(--v2-grain);
  background-size: 160px 160px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 124, 255, 0.5) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  border: 2px solid #05070d;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(40, 199, 255, 0.6), rgba(139, 124, 255, 0.6));
}

::selection {
  color: #fff;
  background: rgba(139, 124, 255, 0.45);
}

/* 兜底：任何元素越界都不再产生横向滚动条（clip 不创建滚动容器，不影响 sticky） */
html,
body {
  overflow-x: clip;
}

/* -------------------------------------------------------------------------
   2. 分类胶囊：磨砂 + 柔光滑块（滑块位置由 JS 测量，见 beautify-v2.js）
   ------------------------------------------------------------------------- */
.filters {
  position: relative;
  gap: 8px;
  margin-bottom: 26px;
}

.filter-glider {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
  width: 0;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(58% 74% at 50% 50%,
      rgba(40, 199, 255, 0.44),
      rgba(139, 124, 255, 0.24) 58%,
      transparent 76%);
  filter: blur(9px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.34s var(--v2-ease),
    width 0.34s var(--v2-ease),
    height 0.24s var(--v2-ease),
    opacity 0.28s ease;
}

.filter-button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: 0 17px;
  border-radius: 999px;
  color: #a9b9cc;
  font-size: 13px;
  letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.035);
  -webkit-backdrop-filter: blur(8px) saturate(1.15);
  backdrop-filter: blur(8px) saturate(1.15);
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    transform 0.22s var(--v2-ease),
    box-shadow 0.22s ease;
}

.filter-button:hover {
  color: #e6f4ff;
  border-color: rgba(63, 207, 255, 0.42);
  background: rgba(40, 199, 255, 0.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.filter-button:active {
  transform: translateY(0) scale(0.985);
}

.filter-button.active {
  color: #04111b;
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow:
    0 10px 24px rgba(88, 116, 255, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.filter-button.active::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), transparent 55%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* -------------------------------------------------------------------------
   3. 工具卡：指针光斑 + 图标浮起 + 标题微调
   ------------------------------------------------------------------------- */
.tool-card-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%),
      rgba(40, 199, 255, 0.18),
      rgba(139, 124, 255, 0.1) 42%,
      transparent 70%);
}

.tool-card:hover .tool-card-surface::after,
.tool-card.is-pointed .tool-card-surface::after {
  opacity: 1;
}

/* 卡片顶部霓虹强调线（.tool-card 原本只占用了 ::before，::after 是空的） */
.tool-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 22%;
  left: 14%;
  z-index: 4;
  height: 2px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.55;
  background: linear-gradient(90deg,
      transparent,
      rgba(40, 199, 255, 0.6) 30%,
      rgba(139, 124, 255, 0.6) 70%,
      transparent);
  transition:
    opacity 0.25s ease,
    left 0.25s var(--v2-ease),
    right 0.25s var(--v2-ease);
}

.tool-card:hover::after,
.tool-card.is-pointed::after {
  right: 15%;
  left: 8%;
  opacity: 1;
}

/* 卡片底：对角冷光 + 略提亮的一档主渐变，比原来纯黑更有层次 */
.tool-card-surface {
  background-image:
    linear-gradient(165deg,
      rgba(56, 189, 248, 0.085),
      rgba(139, 124, 255, 0.045) 38%,
      transparent 62%),
    linear-gradient(145deg, rgba(24, 37, 53, 0.99), rgba(13, 21, 33, 0.99));
}

.tool-icon {
  transition:
    transform 0.3s var(--v2-ease),
    box-shadow 0.3s ease,
    border-color 0.3s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    0 6px 14px rgba(0, 0, 0, 0.26),
    0 0 18px rgba(40, 199, 255, 0.1);
}

.tool-card:hover .tool-icon,
.tool-card.is-pointed .tool-icon {
  border-color: rgba(63, 207, 255, 0.62);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 10px 22px rgba(40, 199, 255, 0.26);
  transform: translateY(-2px) rotate(-5deg) scale(1.04);
}

.tool-card h3 {
  letter-spacing: -0.01em;
}

/* -------------------------------------------------------------------------
   4. 下载按钮：扫光 + 按压反馈 + 点击涟漪
   ------------------------------------------------------------------------- */
.download-link {
  position: relative;
  overflow: hidden;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition:
    transform 0.18s var(--v2-ease),
    box-shadow 0.22s ease;
}

.download-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(105deg,
      transparent 28%,
      rgba(255, 255, 255, 0.62) 48%,
      transparent 66%);
  transform: translateX(-130%);
}

.download-link:hover::after {
  animation: v2-sheen 1.05s var(--v2-ease) forwards;
}

.download-link:hover {
  transform: translateY(-1px);
}

.v2-ripple {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 70%);
  transform: scale(0);
  animation: v2-ripple 0.6s ease-out forwards;
}

@keyframes v2-sheen {
  0% { transform: translateX(-130%); opacity: 0; }
  18% { opacity: 0.9; }
  100% { transform: translateX(130%); opacity: 0; }
}

@keyframes v2-ripple {
  to { transform: scale(1); opacity: 0; }
}

/* -------------------------------------------------------------------------
   5. 骨架屏（API 未返回时占位，数据到达后由 JS 移除）
   ------------------------------------------------------------------------- */
.v2-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.skeleton-card {
  min-height: 182px;
  border: 1px solid rgba(115, 166, 205, 0.14);
  border-radius: 11px;
  background: linear-gradient(100deg,
      rgba(18, 27, 40, 0.92) 28%,
      rgba(34, 50, 70, 0.96) 48%,
      rgba(18, 27, 40, 0.92) 68%);
  background-size: 240% 100%;
  animation: v2-skeleton 1.4s ease-in-out infinite;
}

@keyframes v2-skeleton {
  from { background-position: 140% 0; }
  to { background-position: -40% 0; }
}

/* -------------------------------------------------------------------------
   6. 进场动画（只挂 animation，不写死 transform，避免压掉 :hover 位移）
   ------------------------------------------------------------------------- */
@keyframes v2-card-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.v2-motion .tool-card.is-in {
  animation: v2-card-in 0.55s var(--v2-ease) backwards;
  animation-delay: calc(var(--i, 0) * 46ms);
}

/* 分区光晕（isolation 让负 z-index 停在分区内部，不会掉到 body 背景之下） */
.tools-section {
  position: relative;
  isolation: isolate;
}

.tools-section::before {
  content: "";
  position: absolute;
  top: -80px;
  right: 0;
  left: 0;
  z-index: -1;
  height: 420px;
  pointer-events: none;
  opacity: 0.85;
  background:
    radial-gradient(58% 100% at 16% 0%, rgba(40, 199, 255, 0.1), transparent 70%),
    radial-gradient(52% 100% at 84% 0%, rgba(139, 124, 255, 0.13), transparent 72%);
}

/* 分类之间的渐隐分隔线 */
.category-block + .category-block {
  position: relative;
  padding-top: 10px;
}

.category-block + .category-block::before {
  content: "";
  position: absolute;
  top: -18px;
  right: 6%;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg,
      rgba(40, 199, 255, 0.22),
      rgba(139, 124, 255, 0.22) 40%,
      transparent 85%);
}

/* -------------------------------------------------------------------------
   7. Hero / 标题 / 状态灯 / 搜索框细节
   ------------------------------------------------------------------------- */
.shiny-title-card {
  filter: drop-shadow(0 10px 30px rgba(139, 124, 255, 0.3));
}

.status-pill {
  box-shadow:
    0 0 0 1px rgba(53, 232, 149, 0.18),
    0 0 22px rgba(53, 232, 149, 0.22);
}

.status-pill span {
  animation: v2-pulse 2.4s ease-in-out infinite;
}

@keyframes v2-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.kicker {
  letter-spacing: 0.22em;
}

.category-block > h3 {
  letter-spacing: -0.01em;
}

.category-block > h3::before {
  box-shadow: 0 0 18px rgba(40, 199, 255, 0.45);
}

.search-box {
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.search-box:focus-within {
  border-color: rgba(63, 207, 255, 0.6);
  box-shadow:
    0 0 0 3px rgba(40, 199, 255, 0.12),
    0 10px 26px rgba(0, 0, 0, 0.3);
}

/* 时钟与气温用等宽数字，避免每秒跳动 */
.visitor-time,
.visitor-weather,
.visitor-location {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* -------------------------------------------------------------------------
   8. 响应式
   ------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .v2-skeleton-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .v2-skeleton-grid {
    grid-template-columns: 1fr;
  }

  .tool-icon {
    width: 42px;
    height: 42px;
  }

  .tool-icon svg {
    width: 22px;
    height: 22px;
  }

  /* 修既有移动端横向溢出：hero 与分区标题在窄屏必须堆叠 */
  .hero-layout {
    display: block;
  }

  .hero-contact {
    width: 100%;
    max-width: 360px;
    margin-top: 24px;
  }

  .split-head {
    display: block;
  }

  .split-head .search-panel {
    width: 100%;
    margin-top: 16px;
  }

  .split-head .search-box {
    width: 100%;
  }

  .tools-section::before {
    height: 300px;
  }
}

@media (max-width: 640px) {
  .filters {
    flex-wrap: nowrap;
    padding-bottom: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }

  .filter-button {
    flex: 0 0 auto;
  }

  .tool-card-surface {
    padding: 14px;
  }
}

/* 小屏顶栏：只留定位 + 时间，天气行收起，避免整条导航被挤出屏幕 */
@media (max-width: 440px) {
  .topbar {
    gap: 8px;
  }

  .visitor-widget {
    gap: 8px;
    padding: 6px 9px;
  }

  .visitor-weather-line {
    display: none;
  }

  .visitor-location {
    font-size: 12px;
  }

  .visitor-time {
    font-size: 12px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------------------
   9. 降级：尊重系统的「减少动态效果」
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .skeleton-card,
  .status-pill span,
  .v2-ripple {
    animation: none !important;
  }

  .download-link:hover::after {
    animation: none !important;
    opacity: 0;
  }

  .filter-glider {
    transition: none;
  }

  body.v2-motion .tool-card.is-in {
    animation: none;
  }
}
