@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* 更现代的中性色调 */
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-subtle: #f5f5f5;
  --bg-code: #1a1a1a;
  
  --text: #0f0f0f;
  --text-secondary: #525252;
  --text-muted: #737373;
  
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --border-subtle: #f0f0f0;
  
  --accent: #171717;
  --accent-hover: #262626;
  --accent-subtle: rgba(23, 23, 23, 0.05);
  
  --link: #2563eb;
  --link-hover: #1d4ed8;
  
  --success: #16a34a;
  --warning: #ca8a04;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --content: 1100px;
  --content-narrow: 720px;
  
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Monaco, "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout */
.page {
  position: relative;
  z-index: 1;
}

.shell {
  width: min(calc(100% - 48px), var(--content));
  margin: 0 auto;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 250, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  width: min(calc(100% - 48px), var(--content));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.7;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

/* Navigation */
.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  text-decoration: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 450;
  transition: all 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-subtle);
  font-weight: 500;
}

/* Locale Switch */
.locale-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  gap: 2px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.locale-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: calc(var(--radius) - 2px);
  transition: all 0.15s ease;
}

.locale-link:hover {
  color: var(--text);
}

.locale-link[aria-current="true"] {
  color: var(--text);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-sm);
}

/* Hero Section */
.hero {
  padding: 64px 0 32px;
}

.hero-grid {
  display: grid;
  gap: 40px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.hero-copy {
  grid-column: span 7;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fade-up 0.6s ease both;
}

.hero-panel {
  grid-column: span 5;
  animation: fade-up 0.7s ease both;
}

/* Typography */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 {
  font-size: clamp(2.5rem, 4.5vw, 3.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.lead {
  color: var(--text-secondary);
  font-size: 1.125rem;
  line-height: 1.7;
  max-width: 60ch;
  margin: 0;
}

p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Eyebrow / Label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Hero Home Specific */
.hero-home .hero-copy {
  grid-column: span 7;
}

.hero-home .hero-panel {
  grid-column: span 5;
}

.hero-home h1 {
  max-width: none;
  text-wrap: balance;
}

.hero-home .lead {
  max-width: 72ch;
  text-wrap: pretty;
}

.hero-home .panel-stack {
  gap: 16px;
}

.hero-home .glass {
  padding: 20px;
}

.hero-home .stats {
  gap: 10px;
}

.hero-home .stat {
  padding: 14px;
}

.hero-home .code-block {
  font-size: 12px;
  line-height: 1.65;
  padding: 14px 16px;
}

/* Hero Subpage */
.hero-subpage {
  padding: 48px 0 24px;
}

.hero-subpage .hero-copy {
  grid-column: 1 / -1;
  gap: 12px;
  max-width: none;
}

.hero-subpage h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  max-width: none;
}

.hero-subpage .lead {
  max-width: 82ch;
}

.hero-subpage.hero-with-panel .hero-copy {
  grid-column: span 8;
  max-width: none;
}

.hero-subpage.hero-with-panel .hero-panel {
  grid-column: span 4;
  align-self: start;
}

/* CTA Buttons */
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.button-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

/* Cards & Panels */
.card,
.glass,
.callout,
.step,
.reference-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.glass {
  padding: 24px;
}

.panel-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stats */
.stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}

.stat strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.stat span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Sections */
.section {
  padding: 32px 0 48px;
}

.section-heading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.section-heading .lead {
  max-width: 82ch;
  text-wrap: pretty;
}

/* Card Grids */
.cards-3,
.cards-2 {
  display: grid;
  gap: 16px;
}

.cards-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cards-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card h3 {
  margin-bottom: 4px;
}

.card p {
  font-size: 14px;
  line-height: 1.65;
}

/* Pills */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
}

.pill:hover {
  background: var(--border-subtle);
  border-color: var(--border-strong);
}

a.pill {
  color: var(--text-secondary);
  text-decoration: none;
}

a.pill:hover {
  color: var(--text);
}

/* Code Blocks */
.code-block,
pre {
  margin: 0;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--bg-code);
  color: #e5e5e5;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text);
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

/* Steps */
.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: none;
}

.step {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step h3 {
  margin-bottom: 4px;
}

.step p {
  font-size: 14px;
}

.step pre {
  margin-top: 8px;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Lists */
.list {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.8;
}

.list li {
  margin-bottom: 4px;
}

.list li::marker {
  color: var(--text-muted);
}

/* Callout */
.callout {
  padding: 28px;
  background: var(--bg-elevated);
}

.callout h3 {
  margin: 8px 0 12px;
}

.callout .pill-row {
  margin-top: 20px;
}

/* Reference Table */
.reference-box {
  overflow: hidden;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.reference-table th,
.reference-table td {
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.reference-table th {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--bg-subtle);
}

.reference-table tr:last-child td {
  border-bottom: none;
}

.reference-table td code {
  font-size: 12px;
}

/* Footer */
.footer {
  padding: 32px 0 64px;
}

.footer-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 14px;
}

.footer-card strong {
  font-weight: 600;
  color: var(--text);
}

.footer-card div div {
  color: var(--text-muted);
  margin-top: 4px;
}

/* Chinese Language Support */
html[lang^="zh"] body {
  font-family: "Noto Sans SC", var(--font-sans);
}

html[lang^="zh"] h1,
html[lang^="zh"] h2,
html[lang^="zh"] h3 {
  letter-spacing: 0.02em;
}

html[lang^="zh"] .hero-home h1 {
  max-width: none;
  word-break: keep-all;
  overflow-wrap: normal;
  line-height: 1.18;
}

html[lang^="zh"] .nowrap {
  white-space: nowrap;
}

html[lang^="zh"] .eyebrow,
html[lang^="zh"] .kicker {
  letter-spacing: 0.06em;
}

/* Animations */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */
@media (max-width: 980px) {
  .hero-copy,
  .hero-panel {
    grid-column: 1 / -1;
  }
  
  .hero-panel {
    max-width: 480px;
  }

  .cards-3,
  .cards-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .topbar-meta {
    width: 100%;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
  }
  
  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
  }
  
  .nav a {
    min-width: 0;
    justify-content: center;
    text-align: center;
    padding: 8px 10px;
    font-size: 13px;
    white-space: nowrap;
    word-break: keep-all;
  }

  .locale-switch {
    align-self: flex-end;
  }

  .hero {
    padding-top: 48px;
  }
  
  .hero-subpage.hero-with-panel .hero-copy,
  .hero-subpage.hero-with-panel .hero-panel {
    grid-column: 1 / -1;
  }

  .hero-home .hero-copy,
  .hero-home .hero-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  :root {
    --content: 100%;
  }
  
  .shell,
  .topbar-inner {
    width: calc(100% - 32px);
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .hero-home h1,
  .hero-subpage h1 {
    font-size: 1.875rem;
  }

  html[lang^="zh"] .nowrap {
    white-space: normal;
  }
  
  .lead {
    font-size: 1rem;
  }
  
  .button {
    width: 100%;
  }
  
  .cta-row {
    flex-direction: column;
  }
  
  .nav {
    width: 100%;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 6px;
  }
  
  .nav a {
    padding: 8px 8px;
  }
  
  .locale-switch {
    align-self: flex-end;
  }
  
  .card,
  .glass,
  .callout,
  .step {
    padding: 20px;
  }
  
  .reference-table {
    font-size: 13px;
  }
  
  .reference-table th,
  .reference-table td {
    padding: 12px 16px;
  }
  
  .step-index {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: rgba(37, 99, 235, 0.15);
  color: var(--text);
}
