:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --max-w: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid var(--border);
  padding: 56px 0 48px;
}

.hero-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(1.9rem, 3.8vw, 2.75rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 780px;
}

.hero p {
  margin: 0 0 24px;
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-alt); }

/* Sections & Cards */
main { padding: 40px 0 64px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: -0.015em;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.96rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  line-height: 1.38;
}

.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }

.card p {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.card-link {
  font-weight: 600;
  font-size: 0.92rem;
}

/* Feature banner */
.feature-box {
  margin-top: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  box-shadow: var(--shadow);
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.feature-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
}

/* Article & Prose layout */
.prose-wrap {
  max-width: 800px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 44px);
  box-shadow: var(--shadow);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.prose-wrap h1 {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  line-height: 1.28;
  letter-spacing: -0.02em;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.prose-wrap h2 {
  margin: 30px 0 12px;
  font-size: 1.35rem;
  line-height: 1.35;
  padding-top: 8px;
}

.prose-wrap h3 {
  margin: 22px 0 8px;
  font-size: 1.1rem;
}

.prose-wrap p { margin: 0 0 16px; color: #1e293b; }

.prose-wrap ul, .prose-wrap ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: #1e293b;
}

.prose-wrap li { margin-bottom: 8px; }

.callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  margin: 20px 0;
  color: #1e3a8a;
  font-size: 0.95rem;
}

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 16px 18px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 16px 0 20px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

p code, li code {
  background: var(--surface-alt);
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
}

.related-box {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.related-box h3 { margin-top: 0; }

/* Tools */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.tool-card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.tool-card .tool-desc {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

label.field-label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

textarea, input[type="text"], input[type="email"], input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.94rem;
  color: var(--text);
  background: #fff;
}

textarea.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  min-height: 150px;
  resize: vertical;
}

textarea:focus, input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--accent);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.status-msg {
  font-size: 0.88rem;
  min-height: 22px;
  margin-top: 6px;
  color: #059669;
  font-weight: 500;
}

.status-msg.error { color: #dc2626; }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .hero { padding: 38px 0 34px; }
  .header-inner { justify-content: space-between; }
}
