/* ============================================================
   PriceAPI — 「精密仪表」设计系统
   深墨蓝底 / 发丝网格 / 等宽标签 / 琥珀信号色
   ============================================================ */

/* ---------- 字体 ---------- */

@font-face {
  font-family: 'Plex Sans';
  src: url('/fonts/plex-sans-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plex Sans';
  src: url('/fonts/plex-sans-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plex Sans';
  src: url('/fonts/plex-sans-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('/fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('/fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('/fonts/plex-mono-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ---------- 令牌 ---------- */

:root {
  /* 墨色阶 —— 近黑带蓝调，不是纯黑 */
  --bg:        #080A0E;
  --bg-1:      #0C0F15;
  --bg-2:      #11151D;
  --bg-3:      #171C26;

  /* 发丝线 */
  --line:      #1B212B;
  --line-2:    #262E3B;
  --grid:      rgba(255, 255, 255, .022);

  /* 字色 */
  --ink:       #E9EDF3;
  --ink-2:     #96A0B0;
  --ink-3:     #5A6474;
  --ink-4:     #39424F;

  /* 琥珀信号色 —— 全站唯一强调色 */
  --sig:       #FFB44D;
  --sig-hi:    #FFC876;
  --sig-dim:   rgba(255, 180, 77, .13);
  --sig-line:  rgba(255, 180, 77, .32);

  /* 数据涨跌 */
  --up:        #46D19E;
  --down:      #FF6B6B;

  --sans: 'Plex Sans', -apple-system, BlinkMacSystemFont, 'PingFang SC',
          'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --mono: 'Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --w: 1180px;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.65 var(--sans);
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---------- 环境纹理：网格 + 颗粒 ---------- */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 68px 68px;
  -webkit-mask-image: radial-gradient(ellipse 130% 90% at 50% -10%, #000 15%, transparent 78%);
          mask-image: radial-gradient(ellipse 130% 90% at 50% -10%, #000 15%, transparent 78%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 内容浮在纹理之上 */
header, main, footer { position: relative; z-index: 1; }

/* ---------- 排版基元 ---------- */

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.018em; }

a { color: var(--sig); text-decoration: none; transition: color .16s; }
a:hover { color: var(--sig-hi); }

code, kbd, pre { font-family: var(--mono); }

.mono { font-family: var(--mono); }
.num  { font-variant-numeric: tabular-nums; }

/* 等宽小标签 —— 仪表盘刻度感 */
.tag {
  font: 500 11px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sig { color: var(--sig); }

/* ---------- 骨架 ---------- */

.wrap {
  width: 100%;
  max-width: var(--w);
  margin-inline: auto;
  padding-inline: var(--pad);
}

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

.top {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--ink);
  font: 600 15px/1 var(--mono);
  letter-spacing: -.01em;
  margin-right: auto;
}
.brand:hover { color: var(--ink); }

/* 品牌标记：一个刻度方块 */
.mark {
  width: 22px; height: 22px;
  flex: none;
  border: 1px solid var(--sig-line);
  border-radius: 3px;
  position: relative;
  background: var(--sig-dim);
}
.mark::before,
.mark::after {
  content: '';
  position: absolute;
  background: var(--sig);
}
.mark::before { left: 4px; right: 4px; top: 50%; height: 1px; transform: translateY(-50%); }
.mark::after  { top: 4px; bottom: 4px; left: 50%; width: 1px; transform: translateX(-50%); opacity: .5; }

.nav { display: flex; align-items: center; gap: 1.5rem; }
.nav a {
  font: 500 13px/1 var(--sans);
  color: var(--ink-2);
  letter-spacing: .005em;
}
.nav a:hover, .nav a[aria-current] { color: var(--ink); }

/* ---------- 状态灯 ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font: 500 11px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  position: relative;
  flex: none;
}
.dot.on { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 18%, transparent); }
.dot.on::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--up);
  animation: ping 2.4s cubic-bezier(0, 0, .2, 1) infinite;
}
.dot.off { background: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 18%, transparent); }

@keyframes ping {
  0%   { transform: scale(1);   opacity: .55; }
  70%, 100% { transform: scale(3.2); opacity: 0; }
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 38px;
  padding: 0 1.05rem;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg-2);
  color: var(--ink);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .16s, background .16s, color .16s, transform .16s;
}
.btn:hover { border-color: var(--ink-4); background: var(--bg-3); color: var(--ink); }
.btn:active { transform: translateY(1px); }

.btn-sig {
  background: var(--sig);
  border-color: var(--sig);
  color: #14100A;
  font-weight: 600;
}
.btn-sig:hover { background: var(--sig-hi); border-color: var(--sig-hi); color: #14100A; }

.btn-lg { height: 44px; padding: 0 1.4rem; font-size: 14px; }
.btn-sm { height: 30px; padding: 0 .7rem; font-size: 12px; }

/* ---------- 区块标题：编号 + 延伸发丝线 ---------- */

.sec { padding: clamp(3.5rem, 8vw, 6rem) 0; }

.sec-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2rem;
}
.sec-head .idx {
  font: 500 11px/1 var(--mono);
  color: var(--sig);
  letter-spacing: .1em;
  flex: none;
}
.sec-head h2 {
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  flex: none;
}
.sec-head .rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent);
  transform-origin: left;
  animation: draw .9s cubic-bezier(.2, .8, .2, 1) both;
}
.sec-head .note {
  font: 400 12px/1 var(--mono);
  color: var(--ink-3);
  flex: none;
}

@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- 首屏 ---------- */

.hero {
  padding: clamp(3.5rem, 10vw, 7rem) 0 clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--line);
  position: relative;
}

/* 首屏底部的琥珀色地平线 */
.hero::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--sig-line) 22%, var(--sig-line) 78%, transparent);
  opacity: .5;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1.5rem;
  padding: .38rem .7rem .38rem .5rem;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: var(--bg-1);
  font: 500 11px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  max-width: 15ch;
}
.hero h1 em {
  font-style: normal;
  color: var(--sig);
}

.hero p.lead {
  margin: 1.35rem 0 0;
  max-width: 52ch;
  color: var(--ink-2);
  font-size: 15.5px;
  line-height: 1.7;
}

.hero-cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2.25rem; }

/* 首屏指标条 */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 1px;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.readout div {
  background: var(--bg-1);
  padding: 1.05rem 1.15rem;
}
.readout dt {
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.readout dd {
  margin: .6rem 0 0;
  font: 600 1.35rem/1 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.readout dd small { font-size: .55em; color: var(--ink-3); font-weight: 400; margin-left: .2em; }

/* ---------- 代码块 ---------- */

.code {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-1);
  overflow: hidden;
}
.code-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .9rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.code-bar .tag { color: var(--ink-3); }
.code-bar .copy { margin-left: auto; }

.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink-2);
  -webkit-overflow-scrolling: touch;
}
.code pre .c-key { color: var(--sig); }
.code pre .c-str { color: #8FD6A8; }
.code pre .c-num { color: #86B9FF; }
.code pre .c-dim { color: var(--ink-4); }

/* ---------- 表格 ---------- */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  background: var(--bg-1);
}
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table-wrap thead th {
  padding: .7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.table-wrap tbody td {
  padding: .82rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr { transition: background .14s; }
.table-wrap tbody tr:hover { background: var(--bg-2); }
.table-wrap tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--sig); }
.table-wrap td.name { color: var(--ink); font-weight: 500; }
.table-wrap td.n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.table-wrap th.n { text-align: right; }

/* ---------- 接口卡片 ---------- */

.ep {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-1);
  overflow: hidden;
}
.ep + .ep { margin-top: 1rem; }

.ep-head {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.method {
  padding: .22rem .5rem;
  border-radius: 3px;
  font: 600 10.5px/1.4 var(--mono);
  letter-spacing: .07em;
}
.method.get  { background: rgba(70, 209, 158, .13); color: var(--up); }
.method.post { background: var(--sig-dim); color: var(--sig); }
.ep-head .path { font: 500 13px/1 var(--mono); color: var(--ink); }
.ep-head .auth {
  margin-left: auto;
  font: 400 11px/1 var(--mono);
  color: var(--ink-3);
  letter-spacing: .04em;
}
.ep-body { padding: 1.1rem; }
.ep-body > p { margin: 0 0 1rem; color: var(--ink-2); font-size: 13.5px; }

/* 参数表 */
.params { width: 100%; min-width: 0; border-collapse: collapse; margin: 0 0 1rem; }
.params th, .params td {
  padding: .5rem .75rem .5rem 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.params th { font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.params td:first-child { font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.params td:nth-child(2) { font-family: var(--mono); color: var(--ink-3); white-space: nowrap; }
.params td:last-child { color: var(--ink-2); }
.params tr:last-child td { border-bottom: 0; }

/* ---------- 表单 ---------- */

.auth-page {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  padding: 3rem var(--pad);
}
.card {
  width: 100%;
  max-width: 396px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-1);
  padding: clamp(1.6rem, 4vw, 2.2rem);
  position: relative;
}
/* 卡片顶部的琥珀刻度 */
.card::before {
  content: '';
  position: absolute;
  top: -1px; left: 24px; width: 44px; height: 1px;
  background: var(--sig);
}
.card h1 { font-size: 1.32rem; margin-bottom: .45rem; }
.card > p.sub { margin: 0 0 1.75rem; color: var(--ink-3); font-size: 13px; }

.field { margin-bottom: 1.05rem; }
.field label {
  display: block;
  margin-bottom: .45rem;
  font: 500 10.5px/1 var(--mono);
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.field input {
  width: 100%;
  height: 40px;
  padding: 0 .8rem;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1 var(--sans);
  transition: border-color .16s, box-shadow .16s;
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus {
  outline: none;
  border-color: var(--sig-line);
  box-shadow: 0 0 0 3px var(--sig-dim);
}
.field .hint { margin: .4rem 0 0; font-size: 11.5px; color: var(--ink-4); }

.form-foot {
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-3);
  text-align: center;
}

.msg {
  display: none;
  margin-bottom: 1.1rem;
  padding: .6rem .8rem;
  border-radius: 4px;
  font-size: 12.5px;
  line-height: 1.5;
}
.msg.show { display: block; }
.msg.err { background: rgba(255, 107, 107, .1); border: 1px solid rgba(255, 107, 107, .25); color: #FFA0A0; }
.msg.ok  { background: rgba(70, 209, 158, .1);  border: 1px solid rgba(70, 209, 158, .25);  color: #7FE3BE; }

/* ---------- 密钥展示 ---------- */

.keybox {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--sig-line);
  border-radius: 5px;
  background: var(--sig-dim);
}
.keybox code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 13px;
  color: var(--sig-hi);
  letter-spacing: .01em;
}

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

footer {
  border-top: 1px solid var(--line);
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: 2.25rem 0;
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
  justify-content: space-between;
}
footer .tag { color: var(--ink-4); }
footer nav { display: flex; gap: 1.4rem; }
footer nav a { font-size: 12.5px; color: var(--ink-3); }
footer nav a:hover { color: var(--ink-2); }

/* ---------- 入场动画 ---------- */

.rise { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.d1 { animation-delay: .06s } .d2 { animation-delay: .12s }
.d3 { animation-delay: .18s } .d4 { animation-delay: .24s }
.d5 { animation-delay: .32s } .d6 { animation-delay: .40s }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- 窄屏 ---------- */

@media (max-width: 720px) {
  .nav { gap: 1rem; }
  .nav a.hide-sm { display: none; }
  .sec-head { flex-wrap: wrap; }
  .sec-head .note { width: 100%; }
  .top .wrap { gap: 1rem; }
}
