/* Engineer's Handbook — shared styles */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1a1a1a;
  background: #fafafa;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  font-size: 16px;
}

/* Top nav */
header.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site-header .inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header.site-header .brand {
  font-weight: 600;
  color: #0a0a0a;
  text-decoration: none;
  font-size: 14px;
  letter-spacing: -0.01em;
}
header.site-header .brand .eyebrow {
  display: block;
  font-size: 10px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 1px;
}
header.site-header nav a {
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  margin-left: 18px;
}
header.site-header nav a:hover { color: #0f3d6e; }

/* Page container */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* Page metadata */
.page-meta {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6b7280;
  margin-bottom: 8px;
}

/* Headings */
h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0a0a0a;
  margin: 0 0 16px;
  line-height: 1.2;
}
h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 32px 0 8px;
  color: #0a0a0a;
  letter-spacing: -0.01em;
}
h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 4px;
  color: #1a1a1a;
}

/* Body text */
p { margin: 12px 0; }
.lede {
  font-size: 18px;
  color: #374151;
  margin: 16px 0 28px;
  line-height: 1.5;
}

/* Lists */
ul, ol { margin: 12px 0; padding-left: 24px; }
li { margin: 4px 0; }
li > p:first-child { margin-top: 0; }

/* Code */
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f4f4f5;
  padding: 1px 5px;
  border-radius: 3px;
}
pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  background: #0f172a;
  color: #f1f5f9;
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 14px 0;
}
pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Blockquote / pull-quote */
blockquote, .pull {
  border-left: 3px solid #0f3d6e;
  padding: 8px 18px;
  margin: 18px 0;
  color: #1f2937;
  background: #f8fafc;
  font-style: italic;
}

/* Callout boxes */
.callout {
  background: #f4f4f5;
  border-radius: 6px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 14px;
}
.callout strong { color: #0f3d6e; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
th {
  background: #f4f4f5;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #374151;
}

/* Pagination */
footer.paginate {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
footer.paginate a {
  color: #0f3d6e;
  text-decoration: none;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}
footer.paginate a:hover { text-decoration: underline; }
footer.paginate .stub {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9ca3af;
}
footer.paginate .label { font-weight: 500; }
footer.paginate .next { text-align: right; }
footer.paginate .placeholder { visibility: hidden; }

/* Index page */
.toc {
  list-style: none;
  padding: 0;
  margin: 24px 0;
}
.toc li {
  margin: 0;
  border-bottom: 1px solid #e5e7eb;
}
.toc a {
  display: block;
  padding: 14px 4px;
  color: #1a1a1a;
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 18px;
}
.toc a:hover { background: #f4f4f5; }
.toc .num {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #9ca3af;
  width: 24px;
  flex-shrink: 0;
  letter-spacing: 0.1em;
}
.toc .title {
  font-size: 16px;
  font-weight: 500;
  color: #0a0a0a;
}
.toc .subtitle {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #6b7280;
  margin-top: 2px;
}

/* Loop diagram (rendered in HTML) */
.loop {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 18px 0;
  font-size: 12px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.loop .step {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  color: #1f2937;
}
.loop .step.highlight {
  background: #0f3d6e;
  color: #ffffff;
  border-color: #0f3d6e;
}
.loop .arrow {
  color: #0f3d6e;
  font-weight: 700;
}

/* Print */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }
  header.site-header, footer.paginate { display: none; }
  main { max-width: none; padding: 0; }
  pre { background: #f4f4f5; color: #000; }
  blockquote, .pull, .callout { background: #fafafa; }
}
