/* ============================================================
   魔方资料库 · 样式表
   设计变量与主站保持一致，纯手写 CSS，零第三方依赖。
   ============================================================ */

:root {
  --a1: #22d3ee;
  --a2: #818cf8;
  --a3: #c084fc;
  --grad: linear-gradient(115deg, var(--a1) 0%, var(--a2) 48%, var(--a3) 100%);
  --grad-soft: linear-gradient(115deg, rgba(34,211,238,.16), rgba(129,140,248,.16) 48%, rgba(192,132,252,.16));

  --wrap: 1080px;
  --pad: 24px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #07080c;
  --surface: rgba(255,255,255,.038);
  --surface-2: rgba(255,255,255,.062);
  --border: rgba(255,255,255,.09);
  --border-2: rgba(255,255,255,.17);
  --text: #e9edf5;
  --text-2: #a4aec0;
  --text-3: #6a7488;
  --shadow: 0 24px 60px -28px rgba(0,0,0,.9);
  --grid-line: rgba(255,255,255,.035);
  --orb: .5;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --border: rgba(15,23,42,.10);
  --border-2: rgba(15,23,42,.20);
  --text: #0d1526;
  --text-2: #4a5568;
  --text-3: #8b95a7;
  --shadow: 0 22px 48px -30px rgba(15,23,42,.45);
  --grid-line: rgba(15,23,42,.045);
  --orb: .28;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: -.01em; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 背景装饰 ---------- */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg__orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: var(--orb); }
.bg__orb--1 { width: 520px; height: 520px; background: var(--a1); top: -180px; left: -120px; }
.bg__orb--2 { width: 460px; height: 460px; background: var(--a2); top: 18%; right: -160px; }
.bg__orb--3 { width: 520px; height: 520px; background: var(--a3); bottom: -220px; left: 30%; }
.bg__grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}

main, .nav, .footer { position: relative; z-index: 1; }

/* ---------- 导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}
.nav__inner { display: flex; align-items: center; gap: 20px; height: 62px; }
.nav__brand { display: flex; align-items: center; gap: 9px; font-weight: 700; white-space: nowrap; }
.nav__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 12px rgba(129,140,248,.7);
}
.nav__links { display: flex; gap: 20px; font-size: 14px; color: var(--text-2); margin-left: auto; }
.nav__links a { transition: color .2s var(--ease); }
.nav__links a:hover { color: var(--text); }
.nav__actions { display: flex; align-items: center; gap: 10px; }
.nav__search input {
  width: 190px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
  outline: none; transition: border-color .2s var(--ease), width .25s var(--ease);
}
.nav__search input:focus { border-color: var(--border-2); width: 240px; }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-2); }
.ico { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .ico--sun { display: none; }
[data-theme="light"] .ico--moon { display: none; }

/* ---------- 首页 hero ---------- */
.hero { padding: 72px 24px 44px; text-align: center; }
.hero__eyebrow {
  margin: 0 0 14px; font-size: 12.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text-3);
}
.hero__title { font-size: clamp(34px, 6vw, 54px); margin-bottom: 18px; }
.hero__lead { max-width: 620px; margin: 0 auto 26px; color: var(--text-2); font-size: 16px; }
.hero__stats {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px;
  margin-bottom: 30px; font-size: 14px; color: var(--text-3);
}
.hero__stats b {
  font-size: 18px; font-weight: 700;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__search { display: flex; gap: 10px; max-width: 560px; margin: 0 auto; }
.hero__search input {
  flex: 1; height: 46px; padding: 0 18px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: inherit; outline: none;
  transition: border-color .2s var(--ease);
}
.hero__search input:focus { border-color: var(--a2); box-shadow: 0 0 0 4px rgba(129,140,248,.13); }
.hero__search button {
  padding: 0 26px; height: 46px; border: 0; border-radius: var(--r-md);
  background: var(--grad); color: #08090d; font: inherit; font-weight: 700; cursor: pointer;
  transition: transform .18s var(--ease), filter .2s var(--ease);
}
.hero__search button:hover { transform: translateY(-1px); filter: brightness(1.08); }

/* ---------- 分区标题 ---------- */
.sec__title { font-size: 20px; margin: 46px 0 18px; }

/* ---------- 分类卡片 ---------- */
.cats { padding-bottom: 10px; }
.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  padding: 18px 18px 16px; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  transition: transform .22s var(--ease), border-color .22s var(--ease), background .22s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: var(--grad); opacity: 0;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  transition: opacity .25s var(--ease); pointer-events: none;
}
.card:hover { transform: translateY(-3px); background: var(--surface-2); }
.card:hover::before { opacity: 1; }
.card__ico { font-size: 24px; line-height: 1; margin-bottom: 4px; }
.card__name { font-size: 16px; font-weight: 700; }
.card__desc { font-size: 13px; color: var(--text-3); line-height: 1.6; }
.card__meta { margin-top: 8px; font-size: 12.5px; color: var(--text-3); font-family: var(--mono); }
.card--tool { background: var(--grad-soft); }

/* ---------- 面包屑 / 分类头 ---------- */
.crumb { padding: 22px 24px 4px; font-size: 13.5px; color: var(--text-3); }
.crumb a { color: var(--text-2); border-bottom: 1px dashed var(--border-2); }
.crumb a:hover { color: var(--text); }
.crumb span { margin: 0 8px; opacity: .5; }
.crumb b { color: var(--text); font-weight: 600; }

.cathead { padding: 18px 24px 8px; }
.cathead h1 { font-size: clamp(24px, 4vw, 32px); display: flex; align-items: center; gap: 12px; }
.cathead__ico { font-size: .9em; }
.cathead__desc { margin: 10px 0 6px; color: var(--text-2); }
.cathead__stat { margin: 0; font-size: 13px; color: var(--text-3); font-family: var(--mono); }

/* ---------- 分组与文件行 ---------- */
.group { margin-top: 34px; }
.group__title {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  font-size: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.group__n { font-size: 12.5px; font-weight: 400; color: var(--text-3); font-family: var(--mono); }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 10px; border-bottom: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: background .16s var(--ease);
}
.row:hover { background: var(--surface); }
.row__ico { flex: none; width: 22px; text-align: center; font-size: 16px; opacity: .85; }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row__name {
  font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row__meta { font-size: 12px; color: var(--text-3); }
.row__meta b { font-family: var(--mono); font-weight: 600; color: var(--text-3); letter-spacing: .04em; }
.row__note { color: #f0a67a; margin-left: 8px; }
.row__act { flex: none; display: flex; gap: 8px; }

.act {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12.5px;
  border: 1px solid var(--border); color: var(--text-2); white-space: nowrap;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.act:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.act--view { border-color: rgba(34,211,238,.4); color: var(--a1); }
.act--view:hover { background: rgba(34,211,238,.1); border-color: var(--a1); color: var(--a1); }
.act--dl:hover { border-color: var(--a2); color: var(--a2); }

/* ---------- 搜索结果 ---------- */
.search { margin-top: 40px; }
.search__title { font-size: 17px; margin-bottom: 14px; }
.search__title span { font-size: 13px; font-weight: 400; color: var(--text-3); font-family: var(--mono); }
.search__empty { color: var(--text-3); padding: 20px 0; }
mark { background: rgba(129,140,248,.28); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---------- 免责声明 ---------- */
.notice {
  margin: 52px auto 40px; padding: 22px 24px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); font-size: 13.5px; color: var(--text-2);
}
.notice__title { font-size: 15px; margin-bottom: 10px; color: var(--text); }
.notice p { margin: 0 0 8px; }
.notice__sub { color: var(--text-3); font-size: 13px; margin-bottom: 0 !important; }
.notice a { color: var(--a1); border-bottom: 1px dashed currentColor; }

/* ---------- 页脚 ---------- */
.footer { margin-top: 20px; padding-top: 26px; padding-bottom: 46px; border-top: 1px solid var(--border); }
.footer__note { margin: 0 0 10px; font-size: 12.5px; color: var(--text-3); line-height: 1.7; }
.footer__copy { margin: 0; font-size: 12.5px; color: var(--text-3); }
.footer__copy a { color: var(--text-2); border-bottom: 1px dashed var(--border-2); }
.footer__beian { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
.footer__beian a { color: var(--text-3); transition: color .2s var(--ease); }
.footer__beian a:hover { color: var(--text-2); }
.footer__beian .sep { margin-inline: 8px; opacity: .5; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__search input { width: 128px; }
  .nav__search input:focus { width: 150px; }
  .hero { padding-top: 46px; }
  .grid { grid-template-columns: 1fr 1fr; }
  .row { flex-wrap: wrap; gap: 9px; padding: 12px 6px; }
  .row__name { white-space: normal; }
  .row__act { width: 100%; padding-left: 35px; }
  .notice { margin-left: 16px; margin-right: 16px; }
}
@media (max-width: 460px) {
  .grid { grid-template-columns: 1fr; }
  .hero__search { flex-direction: column; }
  .hero__search button { height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
