﻿/* ============================================================
   数字运河 — 全站样式
   纯手写，无外部依赖（不引 CDN / 字体 / 图标库）
   ============================================================ */

:root {
  --c-bg:        #f6f8fa;
  --c-surface:   #ffffff;
  --c-border:    #e3e7ed;
  --c-text:      #1e2733;
  --c-text-2:    #58636f;
  --c-text-3:    #8792a0;
  --c-brand:     #0d6b8a;      /* 水利蓝 */
  --c-brand-dk:  #0a5470;
  --c-brand-lt:  #e8f3f7;
  --c-accent:    #1a8f9c;      /* 青绿 */
  --c-deep:      #0b3c52;      /* 深水色 */
  --c-warn-bg:   #fff8e6;
  --c-warn-bd:   #f0d69a;

  --radius:      10px;
  --radius-sm:   6px;
  --shadow:      0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg:   0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --wrap:        1120px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC",
          "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
          "Cascadia Mono", "Courier New", monospace;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--c-brand); text-decoration: none; }
a:hover { color: var(--c-brand-dk); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 600; }
h1 { font-size: 2rem; letter-spacing: -.01em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p  { margin: 0 0 1em; }

code, kbd, pre { font-family: var(--mono); font-size: .9em; }

/* ---------- 布局 ---------- */

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

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--c-brand); color: #fff;
  padding: 10px 16px; z-index: 999; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- 顶栏 ---------- */

.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; z-index: 50;
}

.site-header .wrap {
  display: flex; align-items: center; gap: 28px;
  min-height: 62px;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.18rem; font-weight: 700;
  color: var(--c-text); letter-spacing: .01em;
  text-decoration: none; flex-shrink: 0;
}
.brand:hover { text-decoration: none; color: var(--c-brand); }

.brand-mark {
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--c-brand), var(--c-accent));
  display: grid; place-items: center;
  color: #fff; font-size: .82rem; font-weight: 700;
  letter-spacing: -.02em;
}

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }

.nav a {
  padding: 7px 13px; border-radius: var(--radius-sm);
  color: var(--c-text-2); font-size: .93rem; font-weight: 500;
  text-decoration: none; white-space: nowrap;
}
.nav a:hover { background: var(--c-brand-lt); color: var(--c-brand-dk); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--c-brand); background: var(--c-brand-lt); }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); padding: 7px 11px;
  font-size: 1rem; cursor: pointer; color: var(--c-text-2);
}

/* ---------- 主体 ---------- */

main { display: block; padding: 40px 0 64px; }

.section { margin-bottom: 52px; }
.section:last-child { margin-bottom: 0; }

.section-head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.section-head h2 { margin: 0; }
.section-head .more { margin-left: auto; font-size: .9rem; }

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

.hero {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 44px 40px;
  margin-bottom: 44px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 2.15rem; margin-bottom: .45em; }
.hero .lead {
  font-size: 1.05rem; color: var(--c-text-2);
  max-width: 62ch; margin-bottom: 1.4em;
}
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  display: inline-block;
  padding: 3px 11px; border-radius: 999px;
  background: var(--c-brand-lt); color: var(--c-brand-dk);
  font-size: .82rem; font-weight: 500;
}

/* ---------- 卡片网格 ---------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: box-shadow .16s ease, transform .16s ease, border-color .16s ease;
}
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: #cfd8e6;
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
.card .desc { color: var(--c-text-2); font-size: .92rem; }

.card-icon {
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--c-brand-lt); color: var(--c-brand);
  display: grid; place-items: center;
  font-size: 1.05rem; font-weight: 700;
  margin-bottom: 14px;
}

/* ---------- 条目列表（技术分享 / 案例等） ---------- */

.news-list { display: flex; flex-direction: column; gap: 0; }

.news-item {
  display: block; padding: 18px 4px;
  border-bottom: 1px solid var(--c-border);
  color: inherit; text-decoration: none;
}
.news-item:first-child { border-top: 1px solid var(--c-border); }
.news-item:hover { text-decoration: none; color: inherit; }
.news-item:hover .news-title { color: var(--c-brand); }

.news-title {
  font-size: 1.03rem; font-weight: 600;
  margin-bottom: 5px; transition: color .14s ease;
}
.news-meta {
  font-size: .84rem; color: var(--c-text-3);
  display: flex; gap: 12px; flex-wrap: wrap;
}
.news-sum {
  color: var(--c-text-2); font-size: .92rem;
  margin: 7px 0 0; max-width: 78ch;
}

/* ---------- 文章正文 ---------- */

.article {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  max-width: 860px;
  margin: 0 auto;
}
.article header { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--c-border); }
.article h1 { font-size: 1.75rem; margin-bottom: .35em; }
.article h2 { margin-top: 1.9em; font-size: 1.25rem; }
.article h3 { margin-top: 1.5em; }
.article ul, .article ol { padding-left: 1.5em; margin: 0 0 1em; }
.article li { margin-bottom: .4em; }
.article blockquote {
  margin: 1.2em 0; padding: 2px 18px;
  border-left: 3px solid var(--c-brand);
  color: var(--c-text-2);
  background: #fafbfd;
}
.article pre {
  background: #1f2733; color: #e6edf3;
  padding: 15px 18px; border-radius: var(--radius-sm);
  overflow-x: auto; line-height: 1.55;
}
.article :not(pre) > code {
  background: #eef1f6; color: #b03060;
  padding: 1px 6px; border-radius: 4px;
}
.article table {
  width: 100%; border-collapse: collapse; margin: 1.2em 0;
  font-size: .92rem;
}
.article th, .article td {
  border: 1px solid var(--c-border);
  padding: 8px 12px; text-align: left;
}
.article th { background: #f2f5f9; font-weight: 600; }

.breadcrumb {
  font-size: .88rem; color: var(--c-text-3);
  max-width: 860px; margin: 0 auto 16px;
}
.breadcrumb a { color: var(--c-text-2); }

.article-meta {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: .87rem; color: var(--c-text-3);
}

/* ---------- 提示条 ---------- */

.notice {
  background: var(--c-warn-bg);
  border: 1px solid var(--c-warn-bd);
  border-radius: var(--radius-sm);
  padding: 13px 17px;
  font-size: .9rem;
  color: #7a5b12;
  margin-bottom: 24px;
}
.notice strong { color: #5d450d; }

/* ---------- 工具页 ---------- */

.tool-panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: .9rem; font-weight: 500;
  margin-bottom: 6px; color: var(--c-text-2);
}
.field .hint { font-size: .82rem; color: var(--c-text-3); margin-top: 5px; }

input[type="text"], input[type="number"], select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: .95rem;
  color: var(--c-text); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(13, 107, 138, .13);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.btn {
  display: inline-block; padding: 9px 20px;
  border: 1px solid var(--c-brand);
  border-radius: var(--radius-sm);
  background: var(--c-brand); color: #fff;
  font-family: inherit; font-size: .93rem; font-weight: 500;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--c-brand-dk); border-color: var(--c-brand-dk); color: #fff; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--c-text-2); border-color: var(--c-border); }
.btn-ghost:hover { background: #f2f5f9; color: var(--c-text); }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.result {
  margin-top: 22px; padding: 20px;
  background: #f8fafc; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
}
.result:empty { display: none; }
.result dl {
  margin: 0; display: grid;
  grid-template-columns: auto 1fr; gap: 8px 20px;
  font-size: .94rem;
}
.result dt { color: var(--c-text-2); }
.result dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.result .big { font-size: 1.35rem; color: var(--c-brand); }
.result .err { color: #b42318; }

/* ---------- 空状态 ---------- */

.empty {
  text-align: center; padding: 56px 20px;
  color: var(--c-text-3);
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--radius);
}
.empty h3 { color: var(--c-text-2); }
.empty .btn { margin-top: 12px; }

/* ---------- 页脚 ---------- */

.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  padding: 34px 0 28px;
  font-size: .89rem; color: var(--c-text-3);
}
.footer-cols {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr;
  gap: 30px; margin-bottom: 26px;
}
.footer-cols h4 {
  font-size: .88rem; color: var(--c-text-2);
  margin-bottom: .8em; font-weight: 600;
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin-bottom: .45em; }
.footer-cols a { color: var(--c-text-3); }
.footer-cols a:hover { color: var(--c-brand); }

.footer-bottom {
  border-top: 1px solid var(--c-border);
  padding-top: 18px;
  display: flex; gap: 16px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  font-size: .84rem;
}
.footer-bottom .icp { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-bottom a { color: var(--c-text-3); }
.footer-bottom a:hover { color: var(--c-brand); }

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

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .wrap { padding: 0 16px; }
  main { padding: 26px 0 44px; }
  .hero { padding: 28px 22px; }
  .hero h1 { font-size: 1.6rem; }
  .article { padding: 26px 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; gap: 22px; }
  .section { margin-bottom: 38px; }

  .nav-toggle { display: block; }
  .nav {
    display: none; width: 100%;
    flex-direction: column; gap: 2px;
    margin: 0 0 14px;
  }
  .nav.is-open { display: flex; }
  .site-header .wrap { flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .nav a { padding: 10px 12px; }
}

/* ---------- 成果展示 / 案例 ---------- */

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.figure-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.figure-canvas {
  background: linear-gradient(160deg, #eef5f8 0%, #dce9ef 100%);
  border-bottom: 1px solid var(--c-border);
  padding: 0;
  line-height: 0;
}
.figure-canvas svg { width: 100%; height: auto; display: block; }

.figure-body { padding: 18px 20px 20px; }
.figure-body h3 { margin-bottom: .35em; font-size: 1.03rem; }
.figure-body p { margin: 0; color: var(--c-text-2); font-size: .91rem; }

.figure-tag {
  display: inline-block; margin-bottom: 9px;
  padding: 2px 9px; border-radius: 4px;
  background: var(--c-brand-lt); color: var(--c-brand-dk);
  font-size: .76rem; font-weight: 600; letter-spacing: .03em;
}

/* 案例列表 */
.case-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.case-item:last-child { margin-bottom: 0; }
.case-item h3 { margin-bottom: .3em; }
.case-meta {
  font-size: .85rem; color: var(--c-text-3);
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
}
.case-item dl {
  margin: 12px 0 0; display: grid;
  grid-template-columns: auto 1fr; gap: 6px 18px;
  font-size: .92rem;
}
.case-item dt { color: var(--c-text-2); white-space: nowrap; }
.case-item dd { margin: 0; }

/* 数据条（成果页的指标展示） */
.stat-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 34px;
}
.stat {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat .num {
  font-size: 1.6rem; font-weight: 700; color: var(--c-brand);
  font-variant-numeric: tabular-nums; line-height: 1.2;
}
.stat .lbl { font-size: .85rem; color: var(--c-text-2); margin-top: 4px; }

/* SVG 通用 */
.svg-label {
  font-family: var(--sans);
  font-size: 11px;
  fill: #4a5a66;
}
.svg-title {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  fill: #1e2733;
}

@media (max-width: 900px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .figure-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat .num { font-size: 1.3rem; }
  .case-item { padding: 20px 18px; }
  .case-item dl { grid-template-columns: 1fr; gap: 2px 0; }
  .case-item dt { margin-top: 8px; font-size: .84rem; }
}

@media print {
  .site-header, .site-footer, .nav-toggle, .btn-row { display: none; }
  body { background: #fff; }
  .article, .tool-panel { border: none; box-shadow: none; padding: 0; }
}
