/* ============================================================
   JSONts — "Precision Workspace" 精密工作台 / 蓝图坐标系
   设计隐喻：把 JSON→TS 转换器设计成一间精密的 IDE 工作台。
   浅蓝灰底 + 细网格纹理，纯白面板，靛蓝(JSON)/琥珀(TS)双主色。
   字体：Plus Jakarta Sans（展示/正文）+ JetBrains Mono（代码）。
   ============================================================ */

:root {
  --bg: #eef1f6;
  --bg-grad-1: #edf1f8;
  --bg-grad-2: #e6ebf4;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef1f8;
  --line: #dde2ee;
  --line-strong: #c6cdde;
  --ink: #0b1120;
  --ink-soft: #46516e;
  --ink-faint: #8b96b0;

  --indigo: #3b5bfd;         /* JSON · 输入 */
  --indigo-deep: #2a44d6;
  --indigo-soft: rgba(59, 91, 253, .09);
  --amber: #f59e0b;          /* TS · 输出 */
  --amber-deep: #d97f06;
  --amber-soft: rgba(245, 158, 11, .12);
  --ok: #16a34a;
  --err: #e11d48;

  /* 代码上色 */
  --kw: #2a44d6;
  --prop: #0f7a5a;
  --str: #b45309;
  --punc: #98a2bd;

  --radius: 14px;
  --radius-sm: 9px;
  --max-width: 1160px;
  --mono: "JetBrains Mono", "SF Mono", "Fira Code", Consolas, monospace;
  --sans: "Plus Jakarta Sans", "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .05);
  --shadow-md: 0 2px 6px rgba(16, 24, 40, .07), 0 18px 40px rgba(16, 24, 40, .10);
  --shadow-lg: 0 4px 12px rgba(16, 24, 40, .08), 0 30px 70px rgba(16, 24, 40, .16);
}

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

body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
  position: relative;
  background:
    linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
}

/* 蓝图网格底纹 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(59, 91, 253, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 91, 253, .045) 1px, transparent 1px),
    linear-gradient(to right, rgba(59, 91, 253, .025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 91, 253, .025) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
  mask-image: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.9), rgba(0,0,0,.35) 70%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,.9), rgba(0,0,0,.35) 70%, transparent 100%);
}

main, .site-header, .site-footer { position: relative; z-index: 1; }

::selection { background: rgba(59, 91, 253, .18); color: var(--ink); }

a { color: var(--indigo-deep); text-decoration: none; }
a:hover { color: var(--indigo); }

.inner { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }

/* ============================================================
   两侧精密刻度装饰条（≥1280px 显示）
   ============================================================ */
.side-rail {
  position: fixed; top: 0; bottom: 0; width: 56px; z-index: 40;
  display: none; flex-direction: column; align-items: center;
  justify-content: space-between; padding: 118px 0 40px;
  pointer-events: none; user-select: none;
}
@media (min-width: 1280px) {
  .side-rail { display: flex; }
  .rail-left  { left: 0;  background: linear-gradient(180deg, rgba(59,91,253,.06), transparent 35%, transparent 65%, rgba(59,91,253,.06)); }
  .rail-right { right: 0; background: linear-gradient(180deg, rgba(245,158,11,.06), transparent 35%, transparent 65%, rgba(245,158,11,.06)); }
  .rail-left::after, .rail-left::before,
  .rail-right::after, .rail-right::before {
    content: ""; position: absolute; width: 1px; top: 118px; bottom: 40px; opacity: .4;
  }
  .rail-left::before { left: 6px; background: repeating-linear-gradient(to bottom, var(--indigo) 0 5px, transparent 5px 11px); }
  .rail-right::before { right: 6px; background: repeating-linear-gradient(to bottom, var(--amber) 0 5px, transparent 5px 11px); }
  .rail-left::after  { left: 12px; background: linear-gradient(var(--indigo), transparent); }
  .rail-right::after { right: 12px; background: linear-gradient(var(--amber), transparent); }
}
.rail-glyph {
  font-family: var(--mono); font-size: 14px; color: var(--ink-faint); font-weight: 600;
  writing-mode: vertical-rl; letter-spacing: .08em;
}
.rail-mark {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .26em;
  color: var(--ink-faint); text-transform: uppercase;
  writing-mode: vertical-rl; text-orientation: mixed;
  padding: 10px 0; opacity: .6;
}

/* ============================================================
   报头
   ============================================================ */
.site-header {
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.18rem; letter-spacing: -.02em; color: var(--ink); }
.logo:hover { color: var(--indigo-deep); }
.logo-img { width: 38px; height: 38px; display: block; }
.logo .ts-tag {
  font-family: var(--mono); font-size: .6rem; font-weight: 600; letter-spacing: .12em;
  color: #fff; background: var(--indigo); padding: 2px 6px; border-radius: 5px;
  transform: translateY(1px);
}
.nav-links { display: flex; gap: 2px; list-style: none; }
.nav-links a {
  display: block; padding: 7px 14px; font-size: .82rem; font-weight: 600;
  color: var(--ink-soft); border-radius: 8px; transition: background .15s, color .15s;
}
.nav-links a:hover { color: var(--indigo-deep); background: var(--indigo-soft); }

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: 68px 0 36px; position: relative; overflow: hidden; }
.hero::after {
  content: "{ }";
  font-family: var(--mono); font-weight: 600; font-size: clamp(9rem, 22vw, 20rem);
  position: absolute; right: -2rem; top: 8px; line-height: 1;
  background: linear-gradient(180deg, rgba(59,91,253,.16), rgba(245,158,11,.16));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; pointer-events: none; user-select: none;
  animation: drift 18s ease-in-out infinite;
}
@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-12px) rotate(2.5deg); }
}
.hero .inner { position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .7rem; font-weight: 600;
  letter-spacing: .24em; text-transform: uppercase; color: var(--indigo-deep);
  margin-bottom: 20px; animation: rise .5s ease both;
}
.eyebrow::before { content: ""; width: 26px; height: 2px; background: var(--indigo); border-radius: 2px; }
.hero h1 {
  font-weight: 800; font-size: clamp(2.4rem, 5.4vw, 4rem);
  line-height: 1.08; letter-spacing: -.03em; color: var(--ink);
  max-width: 760px; animation: rise .55s .06s ease both;
}
.hero h1 .hl {
  background: linear-gradient(180deg, var(--indigo), var(--indigo-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead {
  color: var(--ink-soft); font-size: 1.06rem; max-width: 620px;
  margin: 20px 0 0; animation: rise .55s .12s ease both;
}
.hero-trust { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 26px; list-style: none; animation: rise .55s .18s ease both; }
.hero-trust li { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 600; color: var(--ink-soft); }
.hero-trust li svg { width: 16px; height: 16px; flex: none; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   工作台（Workspace）
   ============================================================ */
.tool-section { padding: 30px 0 20px; }
.workspace {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: rise .6s .22s ease both;
}

/* 窗口标题栏 */
.win-chrome {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 18px; background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.win-dots { display: flex; gap: 7px; }
.win-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.win-dots i:nth-child(1) { background: #f76865; }
.win-dots i:nth-child(2) { background: #f6bf4f; }
.win-dots i:nth-child(3) { background: #4ac484; }
.win-title {
  font-family: var(--mono); font-size: .74rem; color: var(--ink-faint);
  letter-spacing: .05em; flex: 1;
}
.win-status {
  font-family: var(--mono); font-size: .66rem; color: var(--ink-faint);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 9px; letter-spacing: .04em;
}

/* 工单（选项条） */
.job-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px;
  padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.jt-field { display: flex; align-items: center; gap: 8px; }
.jt-label { font-family: var(--mono); font-size: .66rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); }
.jt-field input[type="text"] {
  font-family: var(--mono); font-size: .84rem; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 10px; width: 112px; transition: border-color .15s, box-shadow .15s;
}
.jt-field input[type="text"]:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--indigo-soft); }
.jt-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--surface-2); }
.jt-seg button {
  font-family: var(--mono); font-size: .72rem; padding: 6px 14px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: none; transition: all .15s;
}
.jt-seg button.on { background: var(--indigo); color: #fff; }
.jt-seg button:not(.on):hover { color: var(--indigo-deep); background: var(--indigo-soft); }
.jt-check { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.jt-check input { accent-color: var(--indigo); width: 15px; height: 15px; cursor: pointer; }
.jt-check span { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }
.jt-check kbd {
  font-family: var(--mono); font-size: .66rem; color: var(--indigo);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; background: var(--surface-2);
}

/* 分栏编辑器 */
.split { display: grid; grid-template-columns: 1fr 44px 1fr; min-height: 440px; background: var(--surface); }
.split-pane { display: flex; flex-direction: column; background: var(--surface); }
.pane-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.pane-label { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: .66rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.pane-label .swatch { width: 8px; height: 8px; border-radius: 2px; }
.pane-a .pane-label .swatch { background: var(--indigo); }
.pane-b .pane-label .swatch { background: var(--amber); }
.pane-a .pane-label { color: var(--indigo-deep); }
.pane-b .pane-label { color: var(--amber-deep); }
.pane-count { font-family: var(--mono); font-size: .64rem; color: var(--ink-faint); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
#json-input {
  flex: 1; width: 100%; border: none; resize: vertical; min-height: 360px;
  background: var(--surface); color: var(--ink);
  font-family: var(--mono); font-size: .86rem; line-height: 1.72;
  padding: 16px 18px; caret-color: var(--indigo);
}
#json-input:focus { outline: none; box-shadow: inset 0 0 0 2px rgba(59,91,253,.12); }
#ts-output {
  flex: 1; overflow: auto; min-height: 360px; margin: 0;
  background: var(--surface-2); padding: 16px 18px;
  font-family: var(--mono); font-size: .86rem; line-height: 1.72;
  color: var(--ink); white-space: pre; tab-size: 2;
  box-shadow: inset 3px 0 0 rgba(245, 158, 11, .18);
}
.out-empty { color: var(--ink-faint); font-style: italic; }

/* 代码上色 */
.kw   { color: var(--kw);   font-weight: 600; }
.str  { color: var(--str); }
.prop { color: var(--prop); }
.punc { color: var(--punc); }

/* 中缝按钮 */
.split-gutter {
  position: relative; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--indigo-soft), var(--amber-soft));
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
.gutter-btn {
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line-strong); color: var(--indigo-deep);
  font-size: 16px; box-shadow: var(--shadow-sm); transition: all .12s;
}
.gutter-btn:hover { border-color: var(--indigo); color: #fff; background: var(--indigo); }
.gutter-btn:active, .gutter-btn.pressed { transform: scale(.94); background: var(--indigo-deep); color: #fff; }

/* 底部工具栏 */
.workspace-bar {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.workspace-bar .group { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .05em;
  padding: 8px 15px; cursor: pointer; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  transition: all .14s;
}
.btn:hover { border-color: var(--indigo); color: var(--indigo-deep); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }
.btn-ghost { background: transparent; }

#error-box {
  margin: 0 18px 16px; padding: 11px 15px;
  border: 1px solid rgba(225, 29, 72, .4); border-left: 4px solid var(--err);
  background: rgba(225, 29, 72, .07); border-radius: 9px;
  font-family: var(--mono); font-size: .8rem; color: var(--err);
}

/* ============================================================
   Features
   ============================================================ */
.content-section { padding: 26px 0 20px; }
.content-section h2 {
  font-weight: 800; font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -.02em; margin: 20px 0 8px; color: var(--ink); text-align: center;
}
.content-section .sec-sub { text-align: center; color: var(--ink-soft); font-size: .96rem; max-width: 620px; margin: 0 auto 30px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 20px; box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--indigo); }
.feature .f-icon {
  width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--indigo-soft); color: var(--indigo-deep); margin-bottom: 14px;
  font-family: var(--mono); font-size: 1rem; font-weight: 600;
}
.feature:nth-child(2) .f-icon { background: var(--amber-soft); color: var(--amber-deep); }
.feature:nth-child(3) .f-icon { background: rgba(22,163,74,.12); color: var(--ok); }
.feature h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 7px; letter-spacing: -.01em; }
.feature p { font-size: .88rem; color: var(--ink-soft); }
.feature code { font-family: var(--mono); font-size: .82em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--indigo-deep); }

/* ============================================================
   首页 FAQ
   ============================================================ */
.faq-block { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px 24px; box-shadow: var(--shadow-sm); }
.faq-block details { border-bottom: 1px solid var(--line); }
.faq-block details:last-child { border-bottom: none; }
.faq-block summary {
  cursor: pointer; list-style: none; padding: 16px 30px 16px 0; position: relative;
  font-weight: 700; font-size: .96rem; color: var(--ink);
}
.faq-block summary::-webkit-details-marker { display: none; }
.faq-block summary::after {
  content: "+"; position: absolute; right: 0; top: 15px;
  font-family: var(--mono); font-size: 1.2rem; font-weight: 400; color: var(--indigo);
  transition: transform .2s;
}
.faq-block details[open] summary::after { transform: rotate(45deg); }
.faq-block details p { padding: 0 30px 18px 0; color: var(--ink-soft); font-size: .9rem; }
.faq-block details p code { font-family: var(--mono); font-size: .84em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; color: var(--indigo-deep); }

/* ============================================================
   文章列表（CMS 兼容）
   ============================================================ */
.article-list { display: grid; gap: 14px; }
.article-list a {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.article-list a:hover { transform: translateY(-2px); border-color: var(--indigo); box-shadow: var(--shadow-md); }
.article-list .article-title { font-weight: 700; font-size: 1.02rem; color: var(--ink); margin-bottom: 6px; line-height: 1.45; }
.article-list a:hover .article-title { color: var(--indigo-deep); }
.article-list .article-desc { font-size: .86rem; color: var(--ink-soft); line-height: 1.6; }

/* ============================================================
   文章正文（CMS 生成页兼容）
   ============================================================ */
.article-content { padding: 40px 0 50px; }
.article-content .inner { max-width: 800px; }
.article-back {
  display: inline-block; font-family: var(--mono); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 22px;
  border-bottom: 1px dashed var(--line-strong); padding-bottom: 2px; transition: color .15s, border-color .15s;
}
.article-back:hover { color: var(--indigo-deep); border-color: var(--indigo); }
.article-content h1 { font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.2; letter-spacing: -.02em; color: var(--ink); margin-bottom: 14px; }
.article-meta { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); letter-spacing: .05em; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 26px; }
.article-content h2 { font-weight: 800; font-size: 1.45rem; letter-spacing: -.01em; color: var(--ink); margin: 38px 0 15px; }
.article-content h3 { font-weight: 700; font-size: 1.16rem; color: var(--ink); margin: 28px 0 12px; }
.article-content p { margin-bottom: 18px; color: #38415c; font-size: 1.02rem; }
.article-content ul, .article-content ol { margin: 0 0 18px 26px; }
.article-content li { margin-bottom: 10px; color: #38415c; font-size: 1.02rem; }
.article-content strong { color: var(--ink); }
.article-content code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); padding: 2px 6px; border-radius: 5px; color: var(--indigo-deep); }
.article-content pre { background: #0b1120; color: #dbe4ff; padding: 18px 20px; border-radius: 12px; overflow-x: auto; margin: 0 0 20px; font-family: var(--mono); font-size: .84rem; line-height: 1.7; }
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content blockquote { border-left: 4px solid var(--indigo); background: var(--indigo-soft); padding: 14px 20px; margin: 0 0 20px; color: var(--ink-soft); border-radius: 0 10px 10px 0; }

/* CMS FAQ 区块 */
.faq-section h2 { font-weight: 800; font-size: 1.45rem; margin-bottom: 16px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 700; padding: 13px 4px; color: var(--ink); list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "Q  "; font-family: var(--mono); color: var(--indigo-deep); }
.faq details p { padding: 0 4px 16px 22px; color: var(--ink-soft); font-size: .92rem; }

/* CMS 相关文章 */
.related-articles { margin-top: 44px; border-top: 2px solid var(--ink); padding-top: 22px; }
.related-articles h2 { font-weight: 800; font-size: 1.35rem; margin-bottom: 14px; }
.related-articles ul { list-style: none; }
.related-articles li { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.related-articles a { font-weight: 600; font-size: .95rem; }

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  margin-top: 34px; border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .7); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 28px 0 24px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: center; margin-bottom: 14px; }
.footer-links a { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); transition: color .15s; }
.footer-links a:hover { color: var(--indigo-deep); }
.copyright { text-align: center; font-family: var(--mono); font-size: .7rem; color: var(--ink-faint); letter-spacing: .05em; }
.colophon { text-align: center; font-size: .76rem; color: var(--ink-faint); margin-top: 8px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .split-gutter { order: -1; border: none; border-bottom: 1px solid var(--line); padding: 10px 0; }
  .gutter-btn { transform: rotate(90deg); }
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2rem, 8vw, 2.9rem); }
}
@media (max-width: 640px) {
  .hero { padding: 44px 0 24px; }
  .job-bar { gap: 10px; }
  .nav-links a { padding: 6px 9px; font-size: .76rem; }
  .logo { font-size: 1.02rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .hero::after { animation: none; }
}