/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #0f172a;
  background: #f8fafc;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --mono: 'JetBrains Mono', 'IBM Plex Mono', 'Menlo', monospace;
  --fg: #0f172a;
  --fg-dim: #475569;
  --bg: #f8fafc;
  --bg-alt: #eef2f7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --accent: #0ea5e9;
  --accent-strong: #0369a1;
  --ok: #059669;
  --plus: #0ea5e9;
  --code-bg: #0f172a;
  --code-fg: #e2e8f0;
  --code-muted: #64748b;
  --code-kw: #7dd3fc;
  --code-str: #86efac;
  --code-fn: #fbbf24;
  --code-const: #f472b6;
  --code-var: #e2e8f0;
  --code-num: #fca5a5;
  --code-comment: #64748b;
  --code-hl: #fde68a;
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}
.container.narrow { max-width: 760px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  text-decoration: none;
  color: var(--fg);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.logo-plus {
  color: var(--plus);
  font-size: 22px;
  line-height: 1;
}
.nav {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 13px;
}
.nav a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color .15s ease;
}
.nav a:hover { color: var(--fg); }
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}
.lang-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0.02em;
}
.lang-btn.active { color: var(--fg); text-decoration: underline; text-underline-offset: 4px; }
.lang-btn:hover { color: var(--fg); }
.lang-sep { color: var(--border); }

/* ---------- hero ---------- */
.hero {
  padding: 96px 0 72px;
  border-bottom: 1px solid var(--border);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  margin: 0 0 20px;
}
.hero-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  color: var(--fg);
}
.plus-mark {
  display: inline-block;
  color: var(--plus);
  font-size: 1.25em;
  font-weight: 700;
  margin-right: 8px;
  transform: translateY(0.05em);
}
.hero-lead {
  font-size: 18px;
  max-width: 720px;
  color: var(--fg-dim);
  margin: 0 0 40px;
}
.hero-lead code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--fg);
}
.hero-examples {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 520px;
}
.hero-examples code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--fg);
}
.mark {
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.mark.ok { background: #d1fae5; color: #065f46; }

/* ---------- sections ---------- */
.section {
  padding: 88px 0;
  border-bottom: 1px solid var(--border);
}
.section-alt { background: var(--bg-alt); }
.section h2 {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(26px, 3.5vw, 36px);
  letter-spacing: -0.01em;
  margin: 0 0 32px;
}
.section-lead {
  font-size: 17px;
  color: var(--fg-dim);
  max-width: 780px;
  margin: 0 0 32px;
}
.section p code, .card p code, .reason p code, .container.narrow p code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: rgba(14, 165, 233, 0.08);
  color: var(--accent-strong);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- grids ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.card-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  background: var(--bg-alt);
  color: var(--fg-dim);
  border-radius: 4px;
  border: 1px solid var(--border);
}
.card h3 {
  margin: 0;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
}
.card p {
  margin: 0 0 16px;
  color: var(--fg-dim);
}

.abnf {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0;
  line-height: 1.6;
}
.abnf code { font-family: inherit; }
.abnf .hl {
  background: rgba(253, 230, 138, 0.2);
  color: var(--code-hl);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.footnote {
  margin-top: 24px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-dim);
}
.footnote a { color: var(--accent-strong); text-decoration: none; border-bottom: 1px solid var(--border); }
.footnote a:hover { border-bottom-color: var(--accent-strong); }

/* ---------- reasons ---------- */
.reason {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.reason-num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
  margin-bottom: 12px;
}
.reason h3 {
  font-family: var(--mono);
  font-size: 17px;
  margin: 0 0 10px;
  font-weight: 700;
}
.reason p {
  margin: 0;
  color: var(--fg-dim);
  font-size: 15px;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  overflow-x: auto;
}
.tab {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 18px;
  cursor: pointer;
  color: var(--fg-dim);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--fg); }
.tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.tab-panels { position: relative; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1e293b;
  border-radius: 8px 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: #94a3b8;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  margin-top: 20px;
}
.code-file::before { content: '● '; color: #64748b; }
.copy-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.copy-btn:hover { background: #334155; border-color: #475569; }
.copy-btn.copied { border-color: var(--ok); color: #6ee7b7; }

.tab-panel pre {
  margin: 0;
  padding: 20px;
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  border-radius: 0 0 8px 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-top: none;
}
.tab-panel code { font-family: inherit; }

/* syntax */
.kw { color: var(--code-kw); }
.str { color: var(--code-str); }
.fn { color: var(--code-fn); }
.const { color: var(--code-const); }
.var { color: var(--code-var); }
.num { color: var(--code-num); }
.c1 { color: var(--code-comment); font-style: italic; }

/* ---------- conclusion ---------- */
.container.narrow p {
  font-size: 17px;
  color: var(--fg-dim);
}
blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 17px;
  color: var(--fg);
  border-radius: 0 8px 8px 0;
}
.cta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.cta {
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  border-radius: 6px;
  text-decoration: none;
  transition: border-color .15s ease, color .15s ease;
}
.cta:hover { border-color: var(--accent); color: var(--accent-strong); }

/* ---------- footer ---------- */
.site-footer {
  padding: 32px 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.dim { color: var(--fg-dim); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .nav { display: none; }
  .hero { padding: 64px 0 48px; }
  .section { padding: 64px 0; }
  .header-inner { height: 56px; }
}
