/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
  color: #1a1a2e;
  background: #fff;
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
nav {
  border-bottom: 1px solid #e5e7eb;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 100;
}
nav .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #1a1a2e;
  text-decoration: none;
  letter-spacing: -0.02em;
}
nav .links { display: flex; gap: 1.5rem; }
nav .links a {
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
nav .links a:hover,
nav .links a.active { color: #1a1a2e; }

/* ---- Layout ---- */
.container { max-width: 820px; margin: 0 auto; padding: 3rem 1.5rem 5rem; }
.wide { max-width: 1040px; }

/* ---- Typography ---- */
h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #e5e7eb;
}
h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}
p { margin-bottom: 1rem; }
a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
hr { border: none; border-top: 1px solid #e5e7eb; margin: 2.5rem 0; }

.subtitle {
  font-size: 1.15rem;
  color: #555;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* ---- Code ---- */
code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: #f4f4f5;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
pre {
  background: #f8f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
th, td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}
th {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}
tr:last-child td { border-bottom: none; }

/* ---- Cards ---- */
.card {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card h3 { margin-top: 0; }

/* ---- Grid ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

/* ---- Stat blocks ---- */
.stat {
  text-align: center;
  padding: 1.2rem 0.5rem;
}
.stat .number {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: block;
}
.stat .label {
  font-size: 0.82rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.2rem;
}
.stat .number.green { color: #16a34a; }
.stat .number.blue { color: #0066cc; }

/* ---- Pipeline visualization ---- */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem 0;
  align-items: center;
}
.pipeline .step {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
}
.pipeline .step .num {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: #1a1a2e;
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.4rem;
}
.pipeline .arrow {
  color: #bbb;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ---- Bar chart (CSS only) ---- */
.bar-chart { margin: 1.5rem 0; }
.bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
}
.bar-label {
  width: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  flex-shrink: 0;
}
.bar-track {
  flex: 1;
  height: 28px;
  background: #f0f0f0;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  transition: width 0.6s ease;
}
.bar-fill.base { background: #94a3b8; }
.bar-fill.tuned { background: #0066cc; }
.bar-delta {
  font-size: 0.8rem;
  font-weight: 600;
  color: #16a34a;
  margin-left: 0.6rem;
  flex-shrink: 0;
  width: 60px;
}

/* ---- Sample examples ---- */
.example-tabs { display: flex; gap: 0; margin-bottom: 0; }
.example-tabs button {
  background: #f0f0f0;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  color: #666;
  font-family: inherit;
}
.example-tabs button.active {
  background: #f8f9fa;
  color: #1a1a2e;
  font-weight: 600;
}
.example-panel {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 0 6px 6px 6px;
  padding: 1.2rem;
  display: none;
}
.example-panel.active { display: block; }
.example-panel .field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.3rem;
}
.example-panel .field-value {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  white-space: pre-wrap;
}
.example-panel .meta {
  font-size: 0.8rem;
  color: #888;
}

/* ---- Callout ---- */
.callout {
  background: #f0f7ff;
  border-left: 3px solid #0066cc;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

/* ---- File tree ---- */
.file-tree {
  font-family: "SF Mono", "Fira Code", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.8;
  background: #f8f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}
.file-tree .indent { padding-left: 1.2em; }
.file-tree .comment { color: #888; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  nav { padding: 0 1rem; gap: 1rem; }
  .container { padding: 2rem 1rem 3rem; }
  h1 { font-size: 1.7rem; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .pipeline { flex-direction: column; align-items: stretch; }
  .pipeline .arrow { display: none; }
  .bar-label { width: 80px; }
}
