/* 卡帕西中文站 · 与 jikejiao.com 主站同一套指挥中心视觉
   深空蓝黑 + 品牌金橙（重点）+ 电光青（遥测） */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Noto+Sans+SC:wght@400;500;700;900&family=Orbitron:wght@500;700;900&display=swap");

:root {
  --bg0: #04060d;
  --bg1: rgba(10, 16, 30, 0.72);
  --ink: #e9eef8;
  --mut: #8f9ab2;
  --gold: #f5b53f;
  --gold-hi: #ffd257;
  --gold-glow: rgba(245, 181, 63, 0.35);
  --cyan: #53d9ff;
  --cyan-dim: rgba(83, 217, 255, 0.55);
  --green: #7dffa8;
  --red: #ff5468;
  --line: rgba(126, 158, 214, 0.16);
  --line-hi: rgba(126, 158, 214, 0.32);
  --font-d: "Orbitron", "Noto Sans SC", sans-serif;
  --font-b: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font-b);
  line-height: 1.75;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--gold); color: #1a1204; }

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--gold-hi); text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 2; }

/* 背景层：由 karpathy-fx.js 注入 canvas，此处只铺扫描线与暗角 */
#fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
.fx-scan {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.022) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 120% 90% at 50% 0%, transparent 55%, rgba(2,4,9,0.55) 100%);
}

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(4, 6, 13, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  gap: 16px;
}
.brand {
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: 0.06em;
}
.brand a { color: inherit; }
.brand a:hover { color: var(--gold-hi); }
.brand small {
  font-family: var(--font-d);
  color: var(--cyan);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.24em;
  margin-left: 10px;
}
.site-nav { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--mut);
  font-size: 14px;
  white-space: nowrap;
  padding: 2px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--gold-hi); border-bottom-color: var(--gold); }

/* ---------- 首屏 ---------- */
.hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); position: relative; z-index: 2; }
.hero h1 {
  font-weight: 900;
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  line-height: 1.25;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
  background: linear-gradient(100deg, #fff 15%, var(--gold-hi) 60%, var(--gold) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 60px rgba(245, 181, 63, 0.22);
}
.hero p.lead { color: var(--mut); max-width: 780px; }
.hero p.lead strong { color: var(--ink); }
.hero .meta { color: var(--mut); font-size: 13px; margin-top: 16px; }
.hero .meta span {
  display: inline-block;
  margin-right: 10px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  color: var(--cyan);
  border: 1px solid rgba(83, 217, 255, 0.25);
  background: rgba(83, 217, 255, 0.05);
  padding: 1px 9px;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}

/* ---------- 区块 ---------- */
section { padding: 48px 0 8px; position: relative; z-index: 2; }
section > .wrap > h2 {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 6px;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
}
.sec-desc {
  color: var(--mut);
  font-size: 14px;
  margin-bottom: 22px;
  padding-left: 17px;
}
h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-hi);
  margin: 30px 0 12px;
}

/* ---------- 卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card {
  position: relative;
  background: var(--bg1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  padding: 18px 20px;
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
}
.card::before, .card::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--cyan-dim);
  transition: border-color 0.25s;
  pointer-events: none;
}
.card::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-hi);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.card:hover::before, .card:hover::after { border-color: var(--gold); }
.card h4 { font-size: 16px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.card h4 a { color: var(--ink); }
.card h4 a:hover { color: var(--gold-hi); }
.card p { color: var(--mut); font-size: 14px; }
.card .tag-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- 表格 ---------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--bg1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th {
  text-align: left;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--cyan);
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-hi);
  white-space: nowrap;
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(245, 181, 63, 0.045); }
td.num, td.date {
  font-family: var(--mono);
  color: var(--mut);
  white-space: nowrap;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
td .sub { color: var(--mut); font-size: 13px; display: block; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  padding: 1px 9px;
  border: 1px solid;
  white-space: nowrap;
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px);
}
.badge.mit { color: var(--green); border-color: rgba(125, 255, 168, 0.35); background: rgba(125, 255, 168, 0.05); }
.badge.arr { color: var(--red); border-color: rgba(255, 84, 104, 0.35); background: rgba(255, 84, 104, 0.05); }
.badge.gray { color: var(--mut); border-color: var(--line-hi); }
.badge.gold { color: var(--gold-hi); border-color: rgba(245, 181, 63, 0.4); background: rgba(245, 181, 63, 0.06); }
.star { color: var(--gold); }

/* ---------- 学习路线 ---------- */
.path { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 8px; }
.path .step {
  position: relative;
  background: var(--bg1);
  border: 1px solid var(--line);
  padding: 20px;
  transition: border-color 0.22s, transform 0.22s;
}
.path .step:hover { border-color: var(--line-hi); transform: translateY(-3px); }
.path .step .no {
  font-family: var(--font-d);
  font-weight: 700;
  color: var(--cyan);
  font-size: 12px;
  letter-spacing: 0.2em;
}
.path .step h4 { margin: 8px 0; color: var(--gold-hi); font-size: 16px; font-weight: 700; }
.path .step p { color: var(--mut); font-size: 14px; }

/* ---------- 提示框 ---------- */
.notice {
  background: linear-gradient(180deg, rgba(245, 181, 63, 0.06), var(--bg1) 60%);
  border: 1px solid rgba(245, 181, 63, 0.35);
  border-left: 2px solid var(--gold);
  padding: 16px 20px;
  font-size: 14px;
  color: var(--mut);
  margin: 22px 0;
}
.notice strong { color: var(--gold-hi); }

/* ---------- 文章页 ---------- */
.article { max-width: 780px; margin: 0 auto; padding: 52px 20px 20px; position: relative; z-index: 2; }
.article .crumb { font-family: var(--mono); font-size: 12px; color: var(--mut); letter-spacing: 0.08em; margin-bottom: 24px; }
.article h1 {
  font-weight: 900;
  font-size: clamp(1.5rem, 3.6vw, 1.9rem);
  line-height: 1.4;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  background: linear-gradient(100deg, #fff 20%, var(--gold-hi) 75%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.article .a-meta {
  color: var(--mut);
  font-size: 12px;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  margin-bottom: 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.article h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-hi);
  margin: 36px 0 12px;
  padding-left: 12px;
  border-left: 2px solid var(--gold);
}
.article p { margin-bottom: 14px; color: var(--mut); }
.article p strong { color: var(--ink); }
.article ul, .article ol { margin: 0 0 14px 22px; color: var(--mut); }
.article li { margin-bottom: 6px; }
.article li strong { color: var(--ink); }
.article .backlink { margin-top: 44px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }

blockquote {
  background: var(--bg1);
  border-left: 2px solid var(--gold);
  padding: 14px 18px;
  margin: 20px 0;
  color: var(--ink);
  font-style: italic;
}
blockquote .src {
  display: block;
  font-style: normal;
  font-size: 12px;
  color: var(--mut);
  margin-top: 8px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(83, 217, 255, 0.07);
  border: 1px solid rgba(83, 217, 255, 0.18);
  padding: 1px 6px;
  color: var(--cyan);
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 60px;
  padding: 30px 0 44px;
  background: rgba(3, 5, 10, 0.85);
  position: relative;
  z-index: 2;
}
.site-footer p { color: var(--mut); font-size: 13px; line-height: 1.9; opacity: 0.8; }
.site-footer a { color: var(--mut); }
.site-footer a:hover { color: var(--gold-hi); }

/* ---------- 滚动显现 ---------- */
.k-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1), transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.k-reveal.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 640px) {
  .site-header .wrap { height: auto; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .hero { padding: 40px 0 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .k-reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
