/* ============================================================
   码禾数字 · 手绘赛博朋克（handraw FG-001 × C-20/C-01/C-28）
   tokens 见 design.md v2
   ============================================================ */

:root {
  --void: #0B0E16;
  --panel: rgba(18, 23, 34, 0.55);
  --line: #26304A;
  --text: #E9EDF5;
  --muted: #8B93A7;
  --magenta: #FF2E7E;
  --cyan: #00E0FF;
  --gold: #F5D90A;
  --klein: #2E4BFF;
  --display: "ZCOOL QingKe HuangYou", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  /* 手绘歪斜圆角（马克笔勾框感） */
  --sk1: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --sk2: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --sk-btn: 10px 5px 12px 6px / 6px 12px 5px 10px;
  --wave-u: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='12' viewBox='0 0 160 12'%3E%3Cpath d='M3 8 C 30 3 55 11 82 6 S 132 4 157 8' fill='none' stroke='%23FF2E7E' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
  --wave-sep: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='8' viewBox='0 0 140 8'%3E%3Cpath d='M2 5 C 24 2 44 6 70 4 S 116 3 138 5' fill='none' stroke='%2326304A' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); }

::selection { background: var(--magenta); color: var(--void); }

a { color: var(--cyan); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

img { max-width: 100%; }

/* ---------------- 扫描线与电路涂鸦背景 ---------------- */

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px);
}

.circuit {
  position: fixed;
  width: 300px;
  z-index: 0;
  pointer-events: none;
}

.circuit path, .circuit circle, .circuit rect {
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.c-1 { top: 9vh; right: -46px; color: rgba(0, 224, 255, 0.13); }
.c-2 { top: 58vh; left: -56px; color: rgba(255, 46, 126, 0.11); }

@media (max-width: 1100px) { .circuit { display: none; } }

/* ---------------- 顶部导航 ---------------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 14, 22, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}

.topnav-inner {
  max-width: 1120px;
  margin-inline: auto;
  padding: 12px clamp(20px, 5vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark { width: 26px; height: 26px; color: var(--magenta); }

.topnav nav { display: flex; gap: clamp(14px, 2.6vw, 28px); flex-wrap: wrap; }

.topnav nav a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 3px 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.topnav nav a:hover { color: var(--cyan); }

.topnav nav a.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

/* ---------------- glitch（仅允许动效时抖动） ---------------- */

.glitch { position: relative; display: inline-block; }

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  clip-path: inset(0 0 0 0);
}

.glitch::before { color: var(--cyan); transform: translate(-2px, 0); z-index: -1; }
.glitch::after { color: var(--magenta); transform: translate(2px, 1px); z-index: -2; }

@media (prefers-reduced-motion: no-preference) {
  .glitch::before { animation: glitch-a 3.4s steps(1) infinite; }
  .glitch::after { animation: glitch-b 2.9s steps(1) infinite; }

  @keyframes glitch-a {
    0%, 91%, 100% { transform: translate(-2px, 0); clip-path: inset(0 0 0 0); }
    92% { transform: translate(-5px, -2px); clip-path: inset(12% 0 58% 0); }
    94% { transform: translate(3px, 1px); clip-path: inset(62% 0 8% 0); }
    96% { transform: translate(-4px, 2px); clip-path: inset(38% 0 42% 0); }
    98% { transform: translate(-2px, 0); clip-path: inset(0 0 0 0); }
  }

  @keyframes glitch-b {
    0%, 88%, 100% { transform: translate(2px, 1px); clip-path: inset(0 0 0 0); }
    89% { transform: translate(6px, 2px); clip-path: inset(55% 0 22% 0); }
    91% { transform: translate(-3px, -1px); clip-path: inset(8% 0 74% 0); }
    93% { transform: translate(4px, 0); clip-path: inset(72% 0 5% 0); }
    95% { transform: translate(2px, 1px); clip-path: inset(0 0 0 0); }
  }
}

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(48px, 9vh, 96px) clamp(20px, 5vw, 48px) 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
}

.hero-kicker {
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--cyan);
  opacity: 0.9;
}

.hero-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(68px, 10.5vw, 128px);
  line-height: 1.08;
  margin: 0;
  letter-spacing: 0.03em;
}

.hero-name {
  margin: 2px 0 0;
  font-size: 15px;
  color: var(--magenta);
  letter-spacing: 0.14em;
}

.hero-tag {
  margin: 20px 0 0;
  font-size: 17.5px;
  color: var(--text);
}

.hero-cta {
  display: flex;
  gap: 16px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-stat {
  margin: 26px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* hero 右侧：大插画 + 叠加终端 */

.hero-visual { position: relative; }

.hero-art {
  display: block;
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
}

.hero-term {
  position: absolute;
  left: -34px;
  bottom: -6px;
  width: min(430px, 92%);
  background: rgba(11, 14, 22, 0.92);
  border: 2px solid var(--cyan);
  border-radius: var(--sk1);
  box-shadow: 0 0 26px rgba(0, 224, 255, 0.14), 0 14px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.term-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-bottom: 2px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}

.term-chrome i {
  width: 10px;
  height: 10px;
  border-radius: 46% 54% 52% 48% / 55% 48% 52% 45%;
}

.d-r { background: var(--magenta); }
.d-y { background: var(--gold); }
.d-g { background: var(--cyan); }

.term-title { margin-left: 6px; }

.term-body {
  margin: 0;
  padding: 14px 16px 16px;
  font-size: 13.5px;
  line-height: 1.8;
  min-height: 190px;
  white-space: pre-wrap;
  word-break: break-all;
}

.t-kw { color: var(--magenta); }
.t-fn { color: var(--cyan); }
.t-str { color: var(--gold); }
.t-cm { color: var(--muted); font-style: italic; }
.t-key { color: var(--cyan); }
.t-val { color: var(--magenta); }
.t-id { color: var(--text); }
.t-op { color: var(--muted); }

.cursor {
  display: inline-block;
  color: var(--gold);
  margin-left: 1px;
}

@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: blink 1.05s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
}

/* ---------------- 按钮（手绘描边） ---------------- */

.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  padding: 9px 22px;
  text-decoration: none;
  border: 2px solid;
  border-radius: var(--sk-btn);
  transition: transform 0.12s, box-shadow 0.15s, background-color 0.15s, color 0.15s;
}

.btn:active { transform: translateY(2px); }

.btn-solid {
  color: var(--void);
  background: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 3px 3px 0 rgba(255, 46, 126, 0.35);
}

.btn-solid:hover { box-shadow: 4px 4px 0 rgba(255, 46, 126, 0.55), 0 0 18px rgba(255, 46, 126, 0.35); }

.btn-ghost {
  color: var(--cyan);
  border-color: var(--cyan);
  background: transparent;
}

.btn-ghost:hover {
  background: rgba(0, 224, 255, 0.12);
  box-shadow: 0 0 16px rgba(0, 224, 255, 0.25);
}

/* ---------------- 通用区块 ---------------- */

.section {
  position: relative;
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(48px, 8vh, 88px) clamp(20px, 5vw, 48px) 24px;
  scroll-margin-top: 76px;
  overflow: hidden;
}

.watermark {
  position: absolute;
  top: 8px;
  right: -10px;
  font-weight: 700;
  font-size: clamp(54px, 8.5vw, 118px);
  line-height: 1;
  letter-spacing: 0.04em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(139, 147, 167, 0.14);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}

.sec-head {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 18px;
}

.sec-head h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(34px, 4.5vw, 46px);
  margin: 0;
  position: relative;
  padding-bottom: 12px;
}

/* 手绘波浪下划线 */
.sec-head h2::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 150px;
  height: 12px;
  background: var(--wave-u) no-repeat left bottom / 150px 12px;
}

.sec-tag {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.spot {
  width: 74px;
  height: auto;
  align-self: flex-end;
  margin-right: 2px;
  filter: drop-shadow(0 0 8px rgba(0, 224, 255, 0.08));
}

/* ---------------- 能力三卡 ---------------- */

.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
  margin-top: 26px;
}

.cap {
  border: 2.5px solid;
  border-radius: var(--sk2);
  background: var(--panel);
  padding: 0 0 20px;
  position: relative;
  transition: transform 0.15s;
}

.cap:hover { transform: translateY(-4px); }

.cap-magenta { border-color: var(--magenta); box-shadow: 0 0 24px rgba(255, 46, 126, 0.12), inset 0 0 40px rgba(255, 46, 126, 0.04); }
.cap-cyan    { border-color: var(--cyan);    box-shadow: 0 0 24px rgba(0, 224, 255, 0.10), inset 0 0 40px rgba(0, 224, 255, 0.04); }
.cap-gold    { border-color: var(--gold);    box-shadow: 0 0 24px rgba(245, 217, 10, 0.10), inset 0 0 40px rgba(245, 217, 10, 0.04); }

.cap-art { padding: 12px 12px 0; }

.cap-art img {
  display: block;
  width: 100%;
  border-bottom: 2px dashed var(--line);
  padding-bottom: 10px;
}

.cap h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 27px;
  margin: 14px 22px 0;
  display: inline-block;
}

.cap-magenta h3 { color: var(--magenta); }
.cap-cyan h3 { color: var(--cyan); }
.cap-gold h3 { color: var(--gold); }

.cap-en {
  margin: 0 22px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.cap ul {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 22px;
}

.cap li {
  font-size: 14.5px;
  color: var(--text);
  padding: 5px 0;
}

.cap li::before {
  content: "> ";
  font-family: var(--mono);
  font-weight: 700;
}

.cap-magenta li::before { color: var(--magenta); }
.cap-cyan li::before { color: var(--cyan); }
.cap-gold li::before { color: var(--gold); }

/* ---------------- 方式四步 ---------------- */

.flow {
  list-style: none;
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 26px 0 0;
  padding: 0;
}

.step {
  flex: 1;
  border: 2px solid var(--line);
  border-radius: var(--sk1);
  background: var(--panel);
  padding: 18px 18px 16px;
  position: relative;
}

.step-no {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--magenta);
}

.step:nth-child(5) .step-no { color: var(--cyan); }
.step:nth-child(9) .step-no { color: var(--gold); }
.step:nth-child(13) .step-no { color: var(--magenta); }

.step h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 22px;
  margin: 6px 0 4px;
}

.step p { margin: 0; font-size: 13.5px; color: var(--muted); }

.flow-arrow {
  align-self: center;
  width: 64px;
  flex: 0 0 auto;
}

.flow-arrow svg { width: 100%; display: block; }

.flow-arrow path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

/* ---------------- 产品行 ---------------- */

.field .crops { margin-top: 18px; }

.crop {
  display: grid;
  grid-template-columns: 265px minmax(0, 1fr) auto;
  gap: 6px 30px;
  align-items: center;
  padding: 20px 12px 24px;
  background-image: var(--wave-sep);
  background-repeat: repeat-x;
  background-position: left bottom;
  transition: background-color 0.15s;
  border-radius: 8px;
}

.crop:hover { background-color: rgba(46, 75, 255, 0.06); }

.crop-name h3 {
  font-family: var(--display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.3;
  margin: 0;
}

.crop-name .status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 5px 0 0;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 47% 53% 58% 42% / 52% 46% 54% 48%;
  background: currentColor;
}

.s-oss  { color: var(--cyan); }
.s-live { color: var(--gold); }
.s-wip  { color: var(--magenta); }
.s-self, .s-int { color: var(--muted); }
.s-done { color: var(--cyan); }

.crop-desc { margin: 0; font-size: 15px; color: var(--text); }

.crop-tags { margin: 6px 0 0; font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }

.crop-links { display: flex; gap: 10px; }

.crop-links .btn { padding: 6px 16px; font-size: 13px; }

/* ---------------- Footer ---------------- */

.footer {
  position: relative;
  margin-top: 72px;
  border-top: 2px solid var(--line);
  background: linear-gradient(rgba(11, 14, 22, 0), rgba(46, 75, 255, 0.05));
  overflow: hidden;
}

.footer-inner {
  max-width: 1120px;
  margin-inline: auto;
  padding: 44px clamp(20px, 5vw, 48px) 48px;
}

.footer .sec-head { margin-bottom: 6px; }

.footer-line { margin: 0; font-size: 16px; }

.footer-line a { color: var(--gold); text-decoration-color: rgba(245, 217, 10, 0.4); text-underline-offset: 4px; }

.footer-meta { margin: 22px 0 0; font-size: 12.5px; color: var(--muted); }

.footer-meta a { color: var(--muted); }

/* ---------------- 响应式 ---------------- */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 40px;
  }

  .hero-visual { margin-top: 12px; }

  .hero-term {
    position: static;
    width: 100%;
    margin-top: 10px;
  }

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

  .flow { flex-direction: column; }

  .flow-arrow {
    width: 40px;
    align-self: center;
    transform: rotate(90deg);
    margin: 4px 0;
  }

  .crop {
    grid-template-columns: 1fr;
    gap: 4px 0;
    padding: 18px 8px 22px;
  }

  .crop-links { margin-top: 6px; }
}

@media (max-width: 400px) {
  .hero-term { border-radius: 12px; }
  .term-body { font-size: 12.5px; }
}

/* ---------------- 动效偏好 ---------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------- 产品详情页 ---------------- */

.crop-title {
  color: inherit;
  text-decoration: none;
  border-bottom: 2px dashed transparent;
  transition: color 0.15s, border-color 0.15s;
}

.crop-title:hover { color: var(--cyan); border-bottom-color: var(--cyan); }

.detail {
  max-width: 880px;
  margin-inline: auto;
  padding: 40px clamp(20px, 5vw, 48px) 24px;
}

.back {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 26px;
}

.back:hover { color: var(--cyan); }

.detail-hero {
  display: flex;
  gap: clamp(20px, 4vw, 40px);
  align-items: center;
  flex-wrap: wrap;
}

.spot-big { width: 170px; flex-shrink: 0; }

.detail-head h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.15;
  margin: 4px 0 0;
}

.detail-family { font-size: 13px; letter-spacing: 0.08em; margin: 0; }

.c-cyan { color: var(--cyan); }
.c-magenta { color: var(--magenta); }
.c-gold { color: var(--gold); }

.detail-tagline {
  font-size: 18px;
  margin: 10px 0 8px;
  color: var(--text);
}

.detail-head .status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 0;
}

.detail-lead {
  font-size: 16.5px;
  color: var(--muted);
  border-left: 3px solid var(--magenta);
  padding: 6px 0 6px 18px;
  margin: 30px 0 8px;
}

.detail-block { margin-top: 44px; }

.detail-block h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, 3.4vw, 30px);
  margin: 0 0 16px;
  position: relative;
  padding-bottom: 10px;
}

.detail-block h2::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 0;
  width: 120px;
  height: 12px;
  background: var(--wave-u) no-repeat left bottom / 120px 12px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px 22px;
}

.fact {
  border: 2px solid var(--line);
  border-radius: var(--sk-btn);
  padding: 12px 16px;
  background: var(--panel);
}

.fact-k { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: 0.08em; }

.fact-v { display: block; font-size: 14.5px; margin-top: 3px; }

.features {
  list-style: none;
  margin: 0;
  padding: 0;
}

.features li {
  padding: 10px 0 12px;
  font-size: 15.5px;
  background-image: var(--wave-sep);
  background-repeat: repeat-x;
  background-position: left bottom;
}

.features li::before {
  content: "> ";
  font-family: var(--mono);
  font-weight: 700;
  color: var(--magenta);
}

.detail-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.dim { color: var(--muted); font-size: 13.5px; }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

.rel-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 2px solid var(--line);
  border-radius: var(--sk-btn);
  background: var(--panel);
  padding: 14px 16px;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.rel-card:hover { border-color: var(--cyan); transform: translateY(-3px); }

.rel-name { font-family: var(--display); font-size: 19px; color: var(--text); }

.rel-s { font-size: 11px; color: var(--muted); }

.rel-tag { font-size: 12.5px; color: var(--muted); }

@media (max-width: 640px) {
  .spot-big { width: 120px; }
  .detail-hero { align-items: flex-start; }
}

/* ---------------- 语言切换 ---------------- */

.nav-right { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.lang-switch { display: flex; gap: 8px; align-items: center; }

.lang-switch a,
.lang-switch span {
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  text-decoration: none;
  border: 1.5px solid var(--line);
  border-radius: var(--sk-btn);
  padding: 4px 10px;
  transition: color 0.15s, border-color 0.15s;
}

.lang-switch span { color: var(--cyan); border-color: var(--cyan); }

.lang-switch a:hover { color: var(--cyan); border-color: var(--cyan); }
