/* ============================================================
   Nava Engineering Blog - Light Theme
   Font: JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg: #fcfbf8;
  --bg-sunken: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f2f0ea;
  --border: #e2ded4;
  --border-strong: #c9c3b6;
  --text: #17171a;
  --muted: #56524b;
  --faint: #6c665e;
  --accent: #8f5300;
  --accent-soft: rgba(143, 83, 0, 0.09);
  --trace: #2f5d9e;
  --trace-soft: rgba(47, 93, 158, 0.07);
  --ok: #276b45;
  --err: #9e3527;
  --err-soft: rgba(158, 53, 39, 0.07);

  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --measure: 104ch;
  --radius: 3px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
}

/* ---------- reading progress ---------- */
.progress-track {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  z-index: 100;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}
.progress-label {
  position: fixed;
  top: 10px; right: 16px;
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0.06em;
  z-index: 100;
  background: var(--bg);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- layout ---------- */
.container {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4.5rem 2rem 6rem;
}

/* ---------- header ---------- */
.post-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}
.post-kicker {
  font-size: 0.7rem;
  color: var(--faint);
  margin-bottom: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.post-title {
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.28;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.post-deck {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 86ch;
}
.byline {
  margin-top: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
/* row of author cards; add more .author-card blocks for more authors */
.authors {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: center;
}
.author-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
/* avatar slot - drop an <img class="avatar"> or a <span class="avatar">initials</span> in later */
.author-card .avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--faint);
  flex-shrink: 0;
}
.author-card .author-text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.author-card .name {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
}
.author-card .role {
  font-size: 0.66rem;
  color: var(--muted);
}
.author-card .team {
  font-size: 0.66rem;
  color: var(--faint);
}
/* the date / read-time line under the authors */
.byline .meta {
  font-size: 0.72rem;
  color: var(--faint);
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  align-items: center;
}
.byline .meta .sep { color: var(--border-strong); }

/* ---------- headings ---------- */
h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 3.5rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 2rem;
}
h2 .num {
  color: var(--accent);
  font-weight: 500;
  margin-right: 0.6rem;
  font-size: 0.85rem;
}
h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 2.25rem;
  margin-bottom: 0.7rem;
}
h4 {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- prose ---------- */
p { margin-bottom: 1.3rem; max-width: 94ch; }
strong { font-weight: 600; }
a {
  color: var(--trace);
  text-decoration: underline;
  text-decoration-color: rgba(47, 93, 158, 0.3);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: var(--trace); }

ul, ol { margin-bottom: 1.3rem; padding-left: 1.6rem; max-width: 94ch; }
li { margin-bottom: 0.45rem; }
li::marker { color: var(--faint); }

/* ---------- code ---------- */
code {
  font-size: 0.8rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.12em 0.38em;
}
pre {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem;
  overflow-x: auto;
  margin-bottom: 1.6rem;
  font-size: 0.78rem;
  line-height: 1.65;
}
pre code { background: none; border: none; padding: 0; }

/* the spine equation */
.identity {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin: 1.8rem 0;
  font-size: 0.82rem;
  line-height: 1.9;
  overflow-x: auto;
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 1.6rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th {
  text-align: left;
  font-weight: 600;
  padding: 0.5rem 0.7rem;
  border-bottom: 2px solid var(--border-strong);
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- callouts ---------- */
.evidence, .insight, .warn {
  padding: 0.85rem 1.1rem;
  margin: 1.7rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.82rem;
  max-width: 94ch;
}
.evidence { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.insight  { background: var(--trace-soft);  border-left: 3px solid var(--trace); }
.warn     { background: var(--err-soft);    border-left: 3px solid var(--err); }

/* closing call-to-action */
.cta {
  margin: 1.6rem 0 0.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.cta p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
}
.cta a {
  color: var(--accent);
  font-weight: 600;
}

.evidence::before, .insight::before, .warn::before {
  display: block;
  font-size: 0.63rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
}
.evidence::before { content: 'measured'; color: var(--accent); }
.insight::before  { content: 'why it matters'; color: var(--trace); }
.warn::before     { content: 'where it breaks'; color: var(--err); }

/* ---------- figures ---------- */
figure { margin: 2.4rem 0; }
figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-size: 0.72rem;
  color: var(--faint);
  margin-top: 0.8rem;
  line-height: 1.65;
  max-width: 92ch;
}
figcaption .fignum { color: var(--muted); font-weight: 600; }

hr { border: none; border-top: 1px solid var(--border); margin: 3.5rem 0; }

/* ---------- toc ---------- */
.toc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.7rem;
  margin-bottom: 2.75rem;
  font-size: 0.8rem;
}
.toc-title {
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  margin-bottom: 0.9rem;
}
.toc ol {
  counter-reset: toc;
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
  columns: 2;
  column-gap: 2.5rem;
}
.toc li { counter-increment: toc; margin-bottom: 0.4rem; break-inside: avoid; }
.toc li::before {
  content: counter(toc) '.';
  color: var(--faint);
  margin-right: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--trace); }

/* ---------- footer ---------- */
.post-footer {
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .toc ol { columns: 1; }
}
@media (max-width: 640px) {
  .container { padding: 2.5rem 1.1rem 4rem; }
  .post-title { font-size: 1.3rem; }
  pre { font-size: 0.7rem; padding: 0.8rem; }
  table { font-size: 0.7rem; }
  .progress-label { display: none; }
}

/* ---------- raw experiment figures (PPT graphs) ---------- */
.raw-figure {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 0.75rem;
  margin: 2.4rem 0;
}
.raw-figure img { display: block; width: 100%; height: auto; }
.raw-figure figcaption::before {
  content: 'raw experiment output · ';
  color: var(--accent);
  font-weight: 600;
}

/* ---------- series pager ---------- */
.pager {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: stretch;
  margin: 2.5rem 0 0;
  flex-wrap: wrap;
}
.pager a {
  flex: 1 1 240px;
  display: block;
  padding: 0.9rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease;
}
.pager a:hover { border-color: var(--trace); }
.pager .dir {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 0.35rem;
}
.pager .ttl { display: block; font-size: 0.82rem; font-weight: 600; line-height: 1.35; }
.pager a.next { text-align: right; }
.pager a.all { flex: 0 0 auto; text-align: center; }

/* ---------- series strip in header ---------- */
.series-strip {
  font-size: 0.7rem;
  color: var(--faint);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.series-strip a { color: var(--muted); text-decoration: none; }
.series-strip a:hover { color: var(--trace); }
.series-strip .here { color: var(--text); font-weight: 600; }
.series-strip .sepdot { color: var(--border-strong); margin: 0 0.45rem; }

/* ---------- draft markers ---------- */
.draft-tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 2px;
  vertical-align: middle;
}
.draft-banner {
  margin: 0 0 2rem;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}
.draft-banner strong { font-weight: 700; }
