:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #1a2233;
  --muted: #64708a;
  --border: #e6e9f2;
  --accent: #4f46e5;
  --accent-dark: #3f37c9;
  --accent-soft: #eef0ff;
  --shadow: 0 12px 36px rgba(30, 41, 80, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
.container { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 248, 252, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; }
.brand small { display: block; font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 600; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent); color: #fff;
  font-family: Consolas, Monaco, monospace; font-size: 14px;
}
.site-nav { display: flex; gap: 34px; font-size: 14px; font-weight: 600; color: var(--muted); }
.site-nav a { transition: color .2s; }
.site-nav a:hover, .site-nav a.active { color: var(--accent); }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 22px; height: 2px; margin: 4px 0; background: var(--text); border-radius: 2px; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: 96px 0 88px; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(79, 70, 229, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, .045) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, #000 20%, transparent 100%);
  pointer-events: none;
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: center; }
.eyebrow {
  display: inline-block; color: var(--accent);
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(38px, 5vw, 60px); letter-spacing: -1.5px; }
.accent { color: var(--accent); }
.hero-desc { margin-top: 22px; max-width: 510px; color: var(--muted); font-size: 16px; }
.hero-actions { display: flex; gap: 14px; margin-top: 32px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: 10px;
  font-size: 14px; font-weight: 700; border: 1px solid transparent;
  cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.stats { display: flex; gap: 36px; margin-top: 48px; }
.stats strong { display: block; font-size: 26px; color: var(--text); }
.stats span { font-size: 12px; color: var(--muted); }

.hero-visual { position: relative; display: flex; justify-content: center; }
.code-card {
  width: 100%; max-width: 480px;
  background: #151a2d; border-radius: 18px; overflow: hidden;
  box-shadow: 0 28px 60px rgba(21, 26, 45, .25);
  transform: rotate(-1.5deg);
}
.code-card-head {
  display: flex; align-items: center; gap: 7px;
  padding: 14px 18px; background: #1e243b;
  font-family: Consolas, Monaco, monospace; font-size: 12px; color: #8f9bbd;
}
.code-card-head i { width: 9px; height: 9px; border-radius: 50%; background: #ff6b6b; }
.code-card-head i:nth-child(2) { background: #ffd166; }
.code-card-head i:nth-child(3) { background: #51cf66; }
.code-card-head span { margin-left: 10px; }
.code-card pre { margin: 0; padding: 26px 24px 30px; overflow-x: auto; }
.code-card code { font-family: Consolas, Monaco, monospace; font-size: 13px; line-height: 1.9; color: #dce3f7; }
.c-key { color: #c792ea; } .c-fn { color: #82aaff; }
.c-str { color: #c3e88d; } .c-comment { color: #6b7599; }
.floating-chip {
  position: absolute; padding: 9px 16px; border-radius: 9px;
  background: var(--surface); box-shadow: var(--shadow);
  font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: var(--accent);
}
.chip-a { top: -14px; right: 6%; transform: rotate(4deg); }
.chip-b { bottom: -16px; left: 2%; transform: rotate(-5deg); }

/* Sections */
.section { padding: 88px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { text-align: center; max-width: 600px; margin: 0 auto 48px; }
.section-head h2 { font-size: clamp(28px, 3.5vw, 38px); }
.section-head p { margin-top: 14px; color: var(--muted); }

.service-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.service-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 24px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.service-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: #c9c9ff; }
.service-icon {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 20px;
}
.service-icon svg { width: 22px; height: 22px; }
.service-card h3 { font-size: 18px; }
.service-card p { margin-top: 10px; font-size: 14px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags span { padding: 4px 9px; border-radius: 6px; background: var(--bg); font-size: 11px; color: var(--muted); }

.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.work-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: transform .25s, box-shadow .25s;
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.work-thumb {
  height: 190px; display: flex; align-items: flex-end; padding: 22px;
  color: rgba(255,255,255,.88); font-weight: 800; letter-spacing: 3px; font-size: 13px;
}
.thumb-1 { background: linear-gradient(135deg, #4338ca, #7c3aed 55%, #ec4899); }
.thumb-2 { background: linear-gradient(135deg, #0f766e, #0ea5e9 60%, #6366f1); }
.thumb-3 { background: linear-gradient(135deg, #b45309, #f97316 60%, #facc15); }
.thumb-4 { background: linear-gradient(135deg, #1e293b, #475569 60%, #94a3b8); }
.work-body { padding: 22px 24px 24px; }
.work-body h3 { font-size: 19px; }
.work-body p { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* Contact */
.contact-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 72px; align-items: start; }
.contact-info h2 { font-size: clamp(28px, 3.5vw, 38px); }
.contact-info > p { margin-top: 16px; color: var(--muted); }
.contact-list { margin-top: 32px; border-top: 1px solid var(--border); }
.contact-item { display: flex; flex-direction: column; gap: 2px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.contact-label { font-size: 12px; color: var(--muted); }
.contact-value { font-weight: 600; font-size: 15px; }
.contact-value.mail { color: var(--accent); }
.contact-value.mail:hover { text-decoration: underline; }
.contact-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
}
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.form-row input, .form-row textarea {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.form-row textarea { resize: vertical; }
.form-row input:focus, .form-row textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.btn-block { width: 100%; margin-top: 4px; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.form-status { min-height: 20px; margin-top: 12px; font-size: 13px; text-align: center; }
.form-status.success { color: #15803d; }
.form-status.error { color: #dc2626; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.footer-inner a:hover { color: var(--accent); }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { grid-template-columns: 1fr; gap: 56px; }
  .hero-visual { order: -1; }
  .contact-inner { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 640px) {
  .container { width: min(100% - 32px, 1120px); }
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 72px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 10px 16px 18px;
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 0; }
  .hero { padding: 56px 0 64px; }
  .section { padding: 64px 0; }
  .stats { gap: 24px; flex-wrap: wrap; }
  .service-grid, .work-grid { grid-template-columns: 1fr; }
  .contact-form { padding: 22px; }
  .floating-chip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
