/* ---------- design tokens ---------- */
:root {
  --bg: #f7f5f2;
  --bg-2: #f2efeb;
  --surface: #ffffff;
  --ink: #1e1b19;
  --ink-2: #4f4842;
  --ink-3: #857b73;
  --line: #e7e2dc;
  --line-2: #d8d1c9;
  --red: #D20000;
  --red-deep: #A50000;
  --red-bright: #E5261F;
  --red-soft: #FBE4E4;
  --accent: #C08A2E;
  --accent-deep: #8A5A16;
  --accent-soft: #F9EFDD;
  --amber: #b7791f;
  --green: #A50000;
  --green-soft: #e8f4ee;
  --shadow-sm: 0 1px 2px rgba(32, 25, 20, .05), 0 2px 8px rgba(32, 25, 20, .04);
  --shadow-md: 0 8px 28px rgba(46, 33, 26, .09);
  --shadow-lg: 0 24px 60px rgba(46, 33, 26, .13);
  --radius: 14px;
  --max: 1200px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: #f0d9d6; }

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

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, #C81F1F, #A50000);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 10px -4px rgba(165, 0, 0,.6);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1;
  padding: 13px 22px; transition: transform .16s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #C81F1F, #C21818);
  color: #fff;
  box-shadow: 0 10px 22px -8px rgba(210, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background: linear-gradient(180deg, #C81F1F, #D20000); box-shadow: 0 14px 28px -10px rgba(210, 0, 0, .6); }
.btn-ghost { background: #fff; border-color: var(--line-2); color: var(--ink); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: #c9c0b7; background: #fdfcfb; }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 10px; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #332c27; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- tags ---------- */
.tag {
  display: inline-flex; align-items: center; height: 17px; padding: 0 5px;
  border-radius: 4px; font-size: 10px; font-weight: 700; font-style: normal;
  letter-spacing: .04em; vertical-align: 2px; margin-left: 6px;
}
.tag-hot { background: #f4e2e0; color: #D20000; }
.tag-new { background: #e6eef7; color: #2f5c95; }

/* ---------- section headers ---------- */
.eyebrow {
  font-size: 12px; letter-spacing: .28em; font-weight: 600; color: var(--ink-3);
  text-transform: uppercase; text-align: center;
}
.section-title { font-size: 38px; line-height: 1.25; letter-spacing: -.02em; font-weight: 800; margin: 14px 0 12px; text-align: center; }
.section-sub { color: var(--ink-2); font-size: 16px; line-height: 1.7; text-align: center; margin: 0 auto; max-width: 640px; }

/* ---------- misc ---------- */
.mono { font-family: var(--mono); }
.code-body {
  margin: 0; padding: 22px; font-family: var(--mono); font-size: 13px; line-height: 1.85;
  color: #ddd5cd; background: #1d1a18; border-radius: 14px; overflow-x: auto; white-space: pre;
}
.code-body .k { color: #F0A3A0; }
.code-body .s { color: #F2C4C4; }
.code-body .c { color: #7a716a; }
.code-body .n { color: #d9b26a; }
.muted { color: var(--ink-3); }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }


/* accent (orange) */
.btn-accent,
a.btn-accent {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-accent:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.tag-hot, .badge.warn, .pill-hot {
  background: var(--accent-soft); color: var(--accent-deep); border-color: #E6CFA6;
}
.link-accent { color: var(--accent-deep); }


/* button contrast guards：确保默认/hover/active/focus 都有明确前景色 */
.btn:not(.btn-primary):not(.btn-dark):not(.btn-white):not(.btn-outline):not(.btn-accent) { color: var(--ink); }
.btn.btn-primary, .btn.btn-primary:visited,
.btn.btn-primary:hover, .btn.btn-primary:active, .btn.btn-primary:focus-visible { color: #fff; }
.btn-dark, .btn-dark:visited,
.btn-dark:hover, .btn-dark:active { color: #fff; }
.btn-ghost, .btn-ghost:visited { color: var(--ink); background: #fff; border-color: var(--line-2); }
.btn-ghost:hover, .btn-ghost:active, .btn-ghost:focus-visible { color: var(--ink); background: #fdfcfb; border-color: #c9c0b7; }
.btn-white, .btn-white:hover, .btn-white:active { color: #A50000; background: #fff; }
.btn-outline, .btn-outline:hover, .btn-outline:active { color: #fff; }
.btn-accent, .btn-accent:hover, .btn-accent:active { color: #2A1B05; background: var(--accent); }
.nav-actions .btn-ghost { color: var(--ink); background: #fff; }
.nav-actions .btn-ghost:hover { color: var(--ink); background: #fdfcfb; }
.btn:focus-visible { outline: 2px solid rgba(210,0,0,.45); outline-offset: 2px; }


/* motion：按钮与导航的微交互 */
.btn {
  transition: transform .18s cubic-bezier(.22,.8,.25,1), box-shadow .22s ease,
              background .2s ease, border-color .2s ease, color .2s ease;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.985); }

.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.38) 46%, transparent 60%);
  transform: translateX(-130%); transition: transform .6s cubic-bezier(.22,.8,.25,1);
}
.btn-primary:hover::after { transform: translateX(130%); }
.btn-primary:hover { box-shadow: 0 16px 30px -12px rgba(210,0,0,.62), inset 0 1px 0 rgba(255,255,255,.2); }

.btn-ghost:hover { box-shadow: 0 12px 22px -14px rgba(30,25,20,.4); }

.nav-actions .login { position: relative; }
.nav-actions .login::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; border-radius: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform .24s cubic-bezier(.22,.8,.25,1);
}
.nav-actions .login:hover::after { transform: scaleX(1); }

.nav-actions .btn { transition: transform .18s cubic-bezier(.22,.8,.25,1), box-shadow .22s ease, background .2s ease; }
.nav-actions .btn:hover { transform: translateY(-2px); box-shadow: 0 14px 24px -16px rgba(210,0,0,.5); }

.nav-links a { transition: color .2s ease; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px; border-radius: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: center; transition: transform .24s ease;
}
.nav-links a:hover::after { transform: scaleX(1); }

.btn:focus-visible { outline: 2px solid rgba(210,0,0,.45); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn::after, .nav-links a::after, .nav-actions .login::after { transition: none !important; animation: none !important; }
  .btn:hover, .btn:active { transform: none; }
}


/* primary hover glow：更亮的红 + 柔光 + 火箭图标微动 */
.btn-primary {
  background: linear-gradient(180deg, #E12A22, #C40000);
  box-shadow: 0 10px 22px -10px rgba(210, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #EE3A31, #D20000);
  box-shadow: 0 18px 36px -14px rgba(210, 0, 0, .62), 0 0 0 6px rgba(210, 0, 0, .07), inset 0 1px 0 rgba(255, 255, 255, .25);
  transform: translateY(-2px) scale(1.015);
}
.btn-primary:active {
  background: linear-gradient(180deg, #D8231C, #B80000);
  transform: translateY(0) scale(.99);
  box-shadow: 0 8px 18px -12px rgba(210, 0, 0, .55);
}
.btn-primary svg { transition: transform .28s cubic-bezier(.22,.8,.25,1); }
.btn-primary:hover svg { transform: translate(2px, -2px) rotate(10deg); }
.btn-primary:focus-visible { outline: none; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(210, 0, 0, .45); }

@media (prefers-reduced-motion: reduce) {
  .btn-primary:hover { transform: none; }
  .btn-primary:hover svg { transform: none; }
}
