/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; font: inherit; color: inherit; cursor: pointer; }
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ===== Typography ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Noto Sans SC", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== Variables ===== */
:root {
  --canvas: #f5f4f1;
  --surface: rgba(255,255,255,0.65);
  --surface-solid: #fafaf8;
  --surface-elevated: #ffffff;
  --surface-hover: rgba(80,80,90,0.05);
  --brand: #5b6b6a;
  --brand-soft: rgba(91,107,106,0.10);
  --brand-light: rgba(91,107,106,0.05);
  --brand-dark: #4a5a59;
  --accent: #5b6b6a;
  --text-primary: #2a2826;
  --text-secondary: #8a8680;
  --text-tertiary: #b8b4ae;
  --border: rgba(0,0,0,0.04);
  --max: 1120px;
  --gutter: 24px;
  --nav-height: 56px;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.03);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
  --transition: 250ms cubic-bezier(0.33, 1, 0.68, 1);
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.07); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.12); }
* { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.07) transparent; }

/* ===== Navigation ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-height);
  display: flex; align-items: center;
  padding: 0 var(--gutter);
  background: rgba(245,244,241,0.80);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-inner {
  display: flex; align-items: center;
  width: 100%; max-width: var(--max); margin: 0 auto;
  gap: 32px;
}
.nav-logo {
  font-size: 16px; font-weight: 600;
  letter-spacing: 0.3px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text-primary);
}
.nav-logo-icon {
  width: 28px; height: 28px;
  background: var(--brand);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; font-weight: 600;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  font-size: 13px; font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-right {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.nav-github {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.nav-github svg { width: 16px; height: 16px; }

/* ===== Hero ===== */
.main { padding-top: var(--nav-height); }
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter) 80px;
}

.hero {
  padding: 64px 0 56px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-tag {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand);
  letter-spacing: 0.3px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.hero-desc {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
}
.hero-actions {
  display: flex; gap: 10px;
  flex-wrap: wrap;
}
.hero-code {
  position: relative;
  margin-top: 16px;
  justify-self: end;
}
.hero-code-block {
  background: var(--brand);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  font-family: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.9;
  color: rgba(255,255,255,0.85);
  overflow-x: auto;
  white-space: pre;
  width: 100%;
  min-width: 320px;
  box-shadow: var(--shadow-lg);
}
.hero-code-block .hl { color: rgba(255,255,255,0.55); }
.hero-code-block .hl-k { color: #b8d4d0; }
.hero-code-block .hl-s { color: #e8d5b8; }

/* ===== Brand Banner ===== */
.brand-banner {
  background: var(--brand);
  border-radius: var(--radius-md);
  padding: 32px 40px;
  margin-bottom: 56px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.banner-item {
  text-align: center;
  color: #fff;
}
.banner-item-num {
  font-size: 20px; font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}
.banner-item-label {
  font-size: 12px; opacity: 0.7;
}
.banner-item-desc {
  font-size: 11px; opacity: 0.55;
  margin-top: 4px;
}

/* ===== Section ===== */
.section { margin-bottom: 56px; }
.section-alt { margin-bottom: 72px; }
.section-compact { margin-bottom: 40px; }
.section-header {
  margin-bottom: 24px;
}
.section-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.section-header h2 {
  font-size: 18px; font-weight: 700;
  color: var(--text-primary);
}
.section-header p {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 6px;
  max-width: 480px;
}

/* ===== Button ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn svg { width: 16px; height: 16px; }

/* ===== Features ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.feature-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.feature-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-light);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.feature-icon svg { width: 18px; height: 18px; }
.feature-card h3 {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.feature-card p {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Rules (非卡片分区) ===== */
.rules-wrap {
  background: rgba(91,107,106,0.04);
  border-radius: var(--radius-md);
  padding: 32px;
}
.rules-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.rule-item {
  display: flex; align-items: flex-start; gap: 12px;
}
.rule-icon {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.rule-icon svg { width: 14px; height: 14px; }
.rule-text h4 {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.rule-text p {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.5;
}

/* ===== Workflow ===== */
.workflow {
  position: relative;
}
.workflow-line {
  display: none;
}
.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.steps-row + .steps-row {
  margin-top: 16px;
}
.step-card {
  padding: 24px 20px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  position: relative;
}
.step-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-card h3 {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
}
.step-card p {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 38px;
}

/* ===== Usage ===== */
.usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.usage-card {
  padding: 24px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.usage-card-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.usage-card h4 {
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
}
.usage-card > p {
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 14px;
}
.usage-card.highlight {
  background: var(--brand-light);
}

/* ===== Code Block ===== */
.code-block {
  background: rgba(42,40,38,0.04);
  border-radius: var(--radius-xs);
  padding: 14px 18px;
  font-family: "SF Mono", "Fira Code", "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
}
.code-block .comment { color: var(--text-tertiary); }
.code-block .keyword { color: var(--brand); }

/* ===== Scenarios (无卡片) ===== */
.scenes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.scene-item {
  padding: 16px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--surface);
  backdrop-filter: blur(12px);
  transition: background var(--transition);
}
.scene-item h4 {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.scene-item p {
  font-size: 11px; color: var(--text-tertiary);
}

/* ===== CTA ===== */
.cta-section {
  text-align: center;
  padding: 48px 0 16px;
}
.cta-section h2 {
  font-size: 18px; font-weight: 700;
  margin-bottom: 8px;
}
.cta-section p {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 20px;
}
.cta-actions {
  display: flex; gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Footer ===== */
.footer {
  padding: 32px var(--gutter);
  background: rgba(245,244,241,0.50);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.footer-copy { font-size: 12px; color: var(--text-tertiary); }
.footer-links { display: flex; gap: 16px; }
.footer-links a {
  font-size: 12px; color: var(--text-secondary);
  transition: color var(--transition);
}

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-elevated);
  backdrop-filter: blur(16px);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  opacity: 0; transform: translateX(-50%) translateY(12px);
  pointer-events: none;
  transition: all var(--transition);
  z-index: 500;
  white-space: nowrap;
}
.toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ===== Hover States ===== */
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { color: var(--text-primary); background: var(--surface-hover); }
  .nav-github:hover { color: var(--text-primary); background: var(--surface-hover); }
  .btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91,107,106,0.25); }
  .btn-secondary:hover { background: var(--surface-solid); transform: translateY(-1px); }
  .btn-ghost:hover { background: var(--surface-hover); color: var(--text-primary); }
  .feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
  .step-card:hover { box-shadow: var(--shadow-md); }
  .usage-card:hover { box-shadow: var(--shadow-md); }
  .scene-item:hover { background: var(--brand-soft); }
  .footer-links a:hover { color: var(--text-primary); }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .rules-list { grid-template-columns: 1fr; }
  .scenes { grid-template-columns: repeat(2, 1fr); }
  .brand-banner { grid-template-columns: repeat(3, 1fr); padding: 24px; }
}

@media (max-width: 768px) {
  :root { --gutter: 16px; --nav-height: 52px; --max: 100%; }
  .nav-links { display: none; }
  .nav-github span { display: none; }
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
  .hero-code { justify-self: stretch; }
  .hero-code-block { min-width: 0; }
  .hero { padding: 40px 0 32px; }
  .hero h1 { font-size: 18px; }
  .features-grid { grid-template-columns: 1fr; }
  .steps-row { grid-template-columns: 1fr; }
  .steps-row + .steps-row { margin-top: 0; }
  .usage-grid { grid-template-columns: 1fr; }
  .brand-banner { grid-template-columns: 1fr; gap: 20px; padding: 24px 20px; }
  .rules-wrap { padding: 24px 20px; }
  .scenes { grid-template-columns: repeat(2, 1fr); }
  .section { margin-bottom: 48px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .hero-desc { font-size: 13px; }
  .section-header h2 { font-size: 16px; }
  .scenes { grid-template-columns: 1fr; }
  .brand-banner { padding: 20px 16px; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
