/* =========================================================
   Deelf - 工程向技术展示站
   设计灵感：klinecharts.com 的极简深色 + 工程感网格/代码块
   架构：CSS 变量驱动 + 深/浅双主题 + 组件化 utility
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root,
[data-theme="dark"] {
  --bg:           #0b1017;
  --bg-elev-1:    #111827;
  --bg-elev-2:    #151e2d;
  --surface:      #141b27;
  --surface-2:    #1a2332;
  --border:       #223044;
  --border-soft:  #1b2636;
  --text:         #e8edf4;
  --text-strong:  #ffffff;
  --muted:        #8b9cb3;
  --muted-2:      #6a7a93;
  --accent:       #2fa1ff;
  --accent-2:     #36e2b5;
  --accent-3:     #a78bfa;
  --warn:         #f59e0b;
  --danger:       #ef4444;

  --grad-primary: linear-gradient(135deg, #2fa1ff 0%, #36e2b5 100%);
  --grad-indigo:  linear-gradient(135deg, #5b8def 0%, #a78bfa 100%);
  --grad-cyan:    linear-gradient(135deg, #22d3ee 0%, #2fa1ff 100%);
  --grad-mint:    linear-gradient(135deg, #10b981 0%, #36e2b5 100%);

  --shadow-sm:    0 1px 2px rgba(0,0,0,.25);
  --shadow-md:    0 6px 18px rgba(0,0,0,.35);
  --shadow-lg:    0 20px 45px rgba(0,0,0,.45);
  --ring:         0 0 0 1px rgba(47,161,255,.35);

  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;

  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:
    "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular,
    Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg:           #ffffff;
  --bg-elev-1:    #f7f9fc;
  --bg-elev-2:    #f1f5fa;
  --surface:      #ffffff;
  --surface-2:    #f7f9fc;
  --border:       #e3e9f2;
  --border-soft:  #eef2f7;
  --text:         #1f2937;
  --text-strong:  #0b1220;
  --muted:        #5a6a82;
  --muted-2:      #8591a6;
  --accent:       #1d7fe6;
  --accent-2:     #0ea371;

  --shadow-sm:    0 1px 2px rgba(15,23,42,.06);
  --shadow-md:    0 6px 18px rgba(15,23,42,.08);
  --shadow-lg:    0 20px 45px rgba(15,23,42,.12);
  --ring:         0 0 0 1px rgba(29,127,230,.35);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  transition: background-color .3s ease, color .3s ease;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color .2s ease;
}
a:hover { color: var(--accent-2); }

img,
svg { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  color: var(--text-strong);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 .6em;
}

p { margin: 0 0 1em; }

code, pre, kbd { font-family: var(--font-mono); }

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  position: relative;
  padding: 5rem 0;
}
@media (max-width: 768px) {
  .section { padding: 3.5rem 0; }
}

.section-head {
  max-width: 680px;
  margin: 0 auto 3rem;
  text-align: center;
}
.section-head .eyebrow {
  display: inline-block;
  padding: .3rem .8rem;
  margin-bottom: .9rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 999px;
}
.section-head h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.15rem);
  font-weight: 700;
}
.section-head p {
  color: var(--muted);
  font-size: 1rem;
  margin: .5rem auto 0;
  max-width: 560px;
}

.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.muted { color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease, background-color .3s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--border-soft);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.site-header .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-strong);
  letter-spacing: .01em;
}
.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--grad-primary);
  color: #0b1017;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .9rem;
  box-shadow: 0 4px 14px rgba(47,161,255,.35);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav a {
  color: var(--muted);
  font-size: .92rem;
  padding: .3rem .1rem;
  border-bottom: 1px solid transparent;
}
.nav a:hover,
.nav a.active {
  color: var(--text-strong);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.icon-btn:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  transform: translateY(-1px);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.15rem;
  border-radius: 10px;
  font-size: .94rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease,
              background-color .2s ease, color .2s ease,
              border-color .2s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  color: #06131f;
  background: var(--grad-primary);
  box-shadow: 0 8px 22px rgba(47,161,255,.28);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(47,161,255,.38);
  color: #06131f;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.btn-lg { padding: .9rem 1.5rem; font-size: 1rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 6rem 0 4.5rem;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(47,161,255,.22), transparent 55%),
    radial-gradient(circle at 82% 8%, rgba(54,226,181,.18), transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(167,139,250,.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 0%, transparent 70%);
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
.hero .inner,
.hero .container {
  position: relative;
  z-index: 1;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3rem;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .8rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  margin-bottom: 1.2rem;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}
.hero .lead {
  font-size: 1.08rem;
  color: var(--muted);
  max-width: 560px;
  margin: 0 0 1.8rem;
}
.hero-cta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.hero-meta {
  margin-top: 2rem;
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .86rem;
}
.hero-meta .sep { opacity: .4; }

/* Hero visual (chart card) */
.hero-visual {
  position: relative;
}
.chart-card {
  position: relative;
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chart-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(160deg,
    rgba(47,161,255,.35), rgba(47,161,255,0) 35%,
    rgba(54,226,181,.25) 70%, rgba(54,226,181,0));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.chart-card .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.chart-card .toolbar .dots {
  display: inline-flex; gap: .35rem;
}
.chart-card .toolbar .dots span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border);
}
.chart-card .toolbar .dots span:nth-child(1) { background: #ef4444; }
.chart-card .toolbar .dots span:nth-child(2) { background: #f59e0b; }
.chart-card .toolbar .dots span:nth-child(3) { background: #10b981; }
.chart-card .toolbar .label {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
}

.chart-wrap {
  position: relative;
  height: 220px;
  background:
    linear-gradient(var(--border-soft) 1px, transparent 1px) 0 0/100% 44px,
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px) 0 0/25% 100%;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}
.chart-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-stats {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}
.chart-stats .stat {
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: .65rem .8rem;
}
.chart-stats .stat .val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-strong);
}
.chart-stats .stat .lbl {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  margin-top: .15rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ---------- Marquee tagline ---------- */
.tagline-bar {
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elev-1);
}
.tagline-bar .inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem 2.4rem;
  justify-content: center;
  color: var(--muted);
  font-size: .86rem;
}
.tagline-bar .item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.tagline-bar svg { color: var(--accent-2); }

/* ---------- Works (big feature rows) ---------- */
.work {
  padding: 5rem 0;
  border-top: 1px solid var(--border-soft);
}
.work + .work { border-top: 1px solid var(--border-soft); }

.work-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.work-row.reverse { direction: rtl; }
.work-row.reverse > * { direction: ltr; }
@media (max-width: 900px) {
  .work-row,
  .work-row.reverse { grid-template-columns: 1fr; direction: ltr; gap: 2rem; }
}

.work-copy .tag {
  display: inline-block;
  padding: .3rem .7rem;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.work-copy h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  margin: 0 0 .8rem;
}
.work-copy .lead {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 1.5rem;
  max-width: 520px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  gap: .7rem;
}
.feature-list li {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  font-size: .95rem;
  color: var(--text);
}
.feature-list li svg {
  flex-shrink: 0;
  width: 18px; height: 18px;
  margin-top: 3px;
  color: var(--accent-2);
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.keywords .kw {
  padding: .25rem .6rem;
  font-size: .78rem;
  color: var(--muted);
  background: var(--bg-elev-1);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  font-family: var(--font-mono);
}

/* Work visual (code/diagram card) */
.work-visual {
  position: relative;
}
.code-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem 1.3rem;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.code-card .ccbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: .7rem;
  margin-bottom: .9rem;
  border-bottom: 1px solid var(--border-soft);
}
.code-card .ccbar .title {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--muted);
}
.code-card .ccbar .badge {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--accent-2);
  padding: .15rem .5rem;
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, transparent);
  border-radius: 999px;
}
.code-card pre {
  margin: 0;
  padding: 0;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}
.code-card .kw   { color: #a78bfa; }
.code-card .fn   { color: #2fa1ff; }
.code-card .str  { color: #36e2b5; }
.code-card .cmt  { color: var(--muted-2); font-style: italic; }
.code-card .num  { color: #f59e0b; }

/* Flow diagram */
.flow-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.2rem;
  box-shadow: var(--shadow-md);
}
.flow-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  align-items: stretch;
}
.flow-node {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: .65rem .7rem;
  text-align: center;
}
.flow-node .t {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-strong);
  font-family: var(--font-mono);
}
.flow-node .d {
  display: block;
  font-size: .7rem;
  color: var(--muted);
  margin-top: .15rem;
}
.flow-arrow {
  height: 1px;
  margin: .7rem 0;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  position: relative;
}
.flow-arrow::after {
  content: "";
  position: absolute;
  right: 50%;
  top: 50%;
  width: 8px; height: 8px;
  border-top: 1px solid var(--muted-2);
  border-right: 1px solid var(--muted-2);
  transform: translate(50%, -50%) rotate(135deg);
}

/* ---------- Principles grid ---------- */
.principles {
  background: var(--bg-elev-1);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) { .principle-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .principle-grid { grid-template-columns: 1fr; } }

.principle {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.2rem 1.3rem;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.principle:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: var(--shadow-md);
}
.principle .ico {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .9rem;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.principle .ico svg { width: 20px; height: 20px; }
.principle h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 .35rem;
}
.principle p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
}

/* ---------- Integration strip (how it fits) ---------- */
.integration {
  padding: 5rem 0;
}
.integration-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  position: relative;
}
@media (max-width: 900px) { .integration-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .integration-grid { grid-template-columns: 1fr; } }

.step {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.1rem;
}
.step .no {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--accent);
  margin-bottom: .5rem;
  letter-spacing: .1em;
}
.step h4 {
  font-size: 1rem;
  margin: 0 0 .35rem;
}
.step p {
  color: var(--muted);
  font-size: .88rem;
  margin: 0;
}

/* ---------- CTA ---------- */
.cta {
  padding: 5rem 0;
  text-align: center;
}
.cta-card {
  background:
    radial-gradient(circle at 20% 0%, rgba(47,161,255,.18), transparent 55%),
    radial-gradient(circle at 80% 100%, rgba(54,226,181,.14), transparent 55%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem 1.5rem;
}
.cta-card h2 {
  font-size: clamp(1.6rem, 3vw, 2rem);
  margin-bottom: .6rem;
}
.cta-card p {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 1.6rem;
}
.cta-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Prose page (about) ---------- */
.page.prose {
  max-width: 760px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5rem;
}
.page.prose h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 .8rem;
}
.page.prose .prose-lead {
  color: var(--muted);
  font-size: 1.08rem;
  margin-bottom: 2.4rem;
}
.page.prose h2 {
  font-size: 1.25rem;
  margin-top: 2.2rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border-soft);
}
.page.prose h3 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
}
.page.prose p {
  color: var(--text);
  line-height: 1.8;
}
.page.prose ul { padding-left: 1.2rem; }
.page.prose li { color: var(--text); margin: .3rem 0; }
.page.prose code {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  padding: .1rem .4rem;
  border-radius: 6px;
  font-size: .88em;
  color: var(--accent-2);
}
.page.prose blockquote {
  margin: 1.2rem 0;
  padding: .8rem 1rem;
  background: var(--bg-elev-1);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: var(--bg-elev-1);
  border-top: 1px solid var(--border-soft);
  padding: 2.5rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr .9fr .9fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
.footer-brand p {
  color: var(--muted);
  font-size: .9rem;
  max-width: 320px;
}
.footer-col h4 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 .8rem;
}
.footer-col ul {
  list-style: none;
  padding: 0; margin: 0;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.footer-col a {
  color: var(--text);
  font-size: .92rem;
}
.footer-col a:hover { color: var(--accent); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: .82rem;
}
.footer-bottom a { color: var(--muted); }
.footer-bottom a:hover { color: var(--accent); }
.footer-bottom .icp {
  font-family: var(--font-mono);
  letter-spacing: .02em;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up {
  opacity: 0;
  animation: fadeUp .7s ease forwards;
}
.delay-1 { animation-delay: .1s; }
.delay-2 { animation-delay: .2s; }
.delay-3 { animation-delay: .3s; }

@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-6px); }
}
.float { animation: float 5s ease-in-out infinite; }

/* ========================================================
   Works page (/works/)
   ======================================================== */

.works-hero-inner {
  max-width: 860px;
  margin: 0 auto;
  text-align: center;
  padding: 1rem 0 0;
}
.works-hero-inner .hero-eyebrow {
  display: inline-flex;
  margin-bottom: 1.2rem;
}
.works-hero-inner h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.works-hero-inner .lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 1.5rem;
}
.works-hero-inner .hero-cta {
  justify-content: center;
}
.works-hero-inner .hero-meta {
  justify-content: center;
  margin-top: 1.5rem;
}

.work-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem .8rem;
  margin-top: 1.4rem;
}

.work-meta-card {
  background: var(--bg-elev-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.3rem;
  box-shadow: var(--shadow-soft);
}
.work-meta-card + .work-meta-card { margin-top: 1rem; }
.work-meta-card h3 {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .9rem;
}

.meta-dl {
  margin: 0;
  display: grid;
  gap: .7rem;
}
.meta-dl .meta-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: .8rem;
  align-items: start;
  font-size: .9rem;
}
.meta-dl dt {
  color: var(--muted);
  font-size: .82rem;
  padding-top: 1px;
}
.meta-dl dd {
  margin: 0;
  color: var(--text);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: .45rem;
  transform: translateY(-1px);
  background: var(--muted);
}
.status-dot.ok {
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent-2) 30%, transparent);
}

.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}
.note-list li {
  position: relative;
  padding-left: 1.1rem;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text);
}
.note-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .85;
}

@media (max-width: 640px) {
  .works-hero-inner { text-align: left; }
  .works-hero-inner .hero-cta,
  .works-hero-inner .hero-meta { justify-content: flex-start; }
  .works-hero-inner .lead { margin-left: 0; margin-right: 0; }
  .work-meta-card { padding: 1rem 1.05rem; }
  .meta-dl .meta-row { grid-template-columns: 72px 1fr; gap: .6rem; font-size: .85rem; }
  .meta-dl dt { font-size: .78rem; }
  .note-list li { font-size: .85rem; }
  .work-actions { gap: .5rem; }
}

/* ========================================================
   Mobile hardening
   - 防止子网格项被 <pre> / canvas / 长内容撑爆视口
   - 让长字符串安全换行
   - 收紧移动端内边距与字号
   ======================================================== */

/* 1. 所有可能承载溢出子内容的网格项都收回最小宽度 */
.hero-grid > *,
.work-row > *,
.footer-grid > *,
.principle-grid > *,
.integration-grid > *,
.flow-row > *,
.chart-stats > *,
.cta-actions > *,
.keywords > *,
.hero-cta > *,
.tagline-bar .inner > *,
.hero-meta > * {
  min-width: 0;
}

/* 2. 图片 / 画布 / 代码块不能撑宽父容器 */
.chart-card,
.chart-wrap,
.code-card,
.flow-card,
.cta-card,
.principle {
  max-width: 100%;
}
.chart-wrap canvas {
  max-width: 100%;
  height: 100%;
}
.code-card pre {
  max-width: 100%;
  overflow-x: auto;
  word-break: normal;
  -webkit-overflow-scrolling: touch;
}

/* 3. 长单词 / 英文串自动换行，避免横向溢出 */
h1, h2, h3, h4, p, li, span, a {
  overflow-wrap: anywhere;
}
.code-card pre {
  overflow-wrap: normal; /* 代码保留原样滚动 */
}

/* 4. 平板及以下 */
@media (max-width: 900px) {
  .container { padding: 0 1.25rem; }
  .site-header .inner { padding: 0 1.25rem; }
  .hero { padding: 4.5rem 0 3.5rem; }
  .section,
  .work,
  .integration,
  .cta { padding: 3.5rem 0; }
  .section-head { margin-bottom: 2.2rem; }

  .hero-grid { gap: 2rem; }
  .work-row { gap: 2rem; }
}

/* 5. 常规手机 */
@media (max-width: 640px) {
  :root { --radius-xl: 16px; --radius-lg: 12px; }

  .container,
  .site-header .inner { padding: 0 1rem; }
  .site-header .inner { height: 56px; gap: .5rem; }

  /* nav 收缩，保留品牌和主题按钮 */
  .brand { font-size: 1rem; }
  .brand-mark { width: 26px; height: 26px; font-size: .85rem; border-radius: 7px; }
  .nav { gap: .9rem; }
  .nav a { font-size: .84rem; padding: .2rem .1rem; }

  /* Hero */
  .hero { padding: 3rem 0 2.5rem; }
  .hero h1 { font-size: 1.85rem; line-height: 1.2; }
  .hero .lead { font-size: .95rem; margin-bottom: 1.3rem; }
  .hero-eyebrow { font-size: .7rem; padding: .25rem .65rem; margin-bottom: .9rem; }
  .hero-cta { gap: .55rem; }
  .hero-cta .btn,
  .btn-lg { padding: .7rem 1.05rem; font-size: .9rem; }
  .hero-meta { gap: .5rem .9rem; font-size: .78rem; margin-top: 1.3rem; }
  .hero-meta .sep { display: none; }

  /* Chart card */
  .chart-card { padding: .9rem; border-radius: 14px; }
  .chart-wrap { height: 170px; }
  .chart-stats { gap: .45rem; }
  .chart-stats .stat { padding: .5rem .55rem; border-radius: 8px; }
  .chart-stats .stat .val { font-size: .88rem; }
  .chart-stats .stat .lbl { font-size: .62rem; letter-spacing: .02em; }

  /* Tagline bar */
  .tagline-bar { padding: .85rem 0; }
  .tagline-bar .inner { gap: .55rem 1.2rem; font-size: .78rem; justify-content: flex-start; }
  .tagline-bar svg { width: 13px; height: 13px; }

  /* Works */
  .work { padding: 3rem 0; }
  .work-copy .tag { font-size: .7rem; padding: .22rem .6rem; margin-bottom: .8rem; }
  .work-copy h2 { font-size: 1.5rem; }
  .work-copy .lead { font-size: .95rem; margin-bottom: 1.1rem; }
  .feature-list { gap: .55rem; margin-bottom: 1.1rem; }
  .feature-list li { font-size: .9rem; gap: .55rem; }
  .feature-list li svg { width: 16px; height: 16px; margin-top: 2px; }
  .keywords .kw { font-size: .72rem; padding: .2rem .5rem; }

  /* Code card */
  .code-card { padding: .85rem .9rem 1rem; border-radius: 12px; }
  .code-card .ccbar { padding-bottom: .5rem; margin-bottom: .7rem; }
  .code-card .ccbar .title { font-size: .74rem; }
  .code-card .ccbar .badge { font-size: .62rem; padding: .1rem .4rem; }
  .code-card pre { font-size: .72rem; line-height: 1.55; }

  /* Flow diagram */
  .flow-card { padding: 1.1rem .95rem; border-radius: 12px; }
  .flow-row { gap: .45rem; }
  .flow-node { padding: .5rem .45rem; border-radius: 8px; }
  .flow-node .t { font-size: .72rem; }
  .flow-node .d { font-size: .62rem; line-height: 1.35; }
  .flow-arrow { margin: .55rem 0; }

  /* Section heads */
  .section,
  .integration,
  .principles,
  .cta { padding: 3rem 0; }
  .section-head { margin-bottom: 1.7rem; }
  .section-head .eyebrow { font-size: .68rem; padding: .25rem .65rem; }
  .section-head h2 { font-size: 1.45rem; }
  .section-head p { font-size: .92rem; }

  /* Principle */
  .principle { padding: 1.05rem .95rem 1.1rem; }
  .principle .ico { width: 36px; height: 36px; margin-bottom: .7rem; }
  .principle h3 { font-size: .95rem; }
  .principle p { font-size: .85rem; }

  /* Integration steps */
  .step { padding: 1rem .9rem; }
  .step h4 { font-size: .92rem; }
  .step p { font-size: .82rem; }
  .step .no { font-size: .72rem; }

  /* CTA */
  .cta-card { padding: 2.2rem 1.1rem; border-radius: 16px; }
  .cta-card h2 { font-size: 1.4rem; }
  .cta-card p { font-size: .92rem; margin-bottom: 1.2rem; }
  .cta-actions { gap: .55rem; }

  /* Footer */
  .site-footer { padding: 2rem 0 1.1rem; }
  .footer-brand p { font-size: .85rem; }
  .footer-col h4 { font-size: .78rem; margin-bottom: .6rem; }
  .footer-col a { font-size: .88rem; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: .4rem;
    font-size: .76rem;
  }

  /* Prose (about page) */
  .page.prose { padding: 2.5rem 1rem 3rem; }
  .page.prose h1 { font-size: 1.7rem; }
  .page.prose .prose-lead { font-size: .98rem; margin-bottom: 1.6rem; }
  .page.prose h2 { font-size: 1.1rem; margin-top: 1.6rem; }
  .page.prose h3 { font-size: 1rem; }
  .page.prose p,
  .page.prose li { font-size: .93rem; line-height: 1.75; }
}

/* 6. 超窄屏：减项 */
@media (max-width: 420px) {
  .hero h1 { font-size: 1.6rem; }
  .hero .lead { font-size: .9rem; }
  .work-copy h2 { font-size: 1.35rem; }
  .section-head h2 { font-size: 1.3rem; }
  /* 导航第 3 项（原则/锚点）在极窄屏隐藏，避免挤压 */
  .nav a:nth-child(3) { display: none; }
  /* chart 三格 → 两格 + 一格两行 */
  .chart-stats { grid-template-columns: 1fr 1fr; }
  .chart-stats .stat:nth-child(3) { grid-column: span 2; }
  /* flow 的 3 列改 1 列堆叠 */
  .flow-row { grid-template-columns: 1fr; }
  .flow-row .flow-node[style*="span 3"] { grid-column: auto !important; }
  .flow-arrow { display: none; }
}

/* ---------- Print/a11y ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
