/* Truckvisor blog — the post + index surface.
 *
 * Tokens are the landing page's .tvl set (apps/web/src/landing.css) verbatim, with ONE deliberate
 * difference the founder signed off on (2026-09-03): the landing page is night-locked, the blog
 * follows the reader's own device. A blog post is read by a stranger arriving from a search
 * result, often for several minutes — that is the one surface where their preference beats ours.
 * The Day/Night control still overrides, and sticks (localStorage) across posts.
 *
 * Written by hand, inlined into no page: scripts/build-blog.mjs copies it to /blog/blog.css so the
 * browser caches it once for every post.
 */

/* Light — the default, and what a reader with no stated preference gets. */
:root {
  --bg: #e9eef5; --panel: #ffffff; --panel2: #edf2f9;
  --ink: #0b2545; --ink2: #54657d; --line: #d7e1ee;
  --accent: #1e6fd9; --red: #b4322a; --amber: #8a5b00; --green: #136b4a;
  --redbg: #fbedeb; --amberbg: #fcf3e2; --greenbg: #e8f5ef; --navybg: #e9eff8;
  --cta: #16a971; --oncta: #ffffff;
  --figure: #f6f9fd; --shadow: 0 14px 34px rgba(11, 37, 69, 0.09);
}
/* The reader's device says dark, and the toggle has not overridden it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-tv='light']) {
    --bg: #060e18; --panel: #12213a; --panel2: #0e1b2e;
    --ink: #e9eff7; --ink2: #93a5be; --line: #243a55;
    --accent: #4da3ff; --red: #f0776c; --amber: #ffb020; --green: #2fd79b;
    --redbg: #2a1a1c; --amberbg: #2a2214; --greenbg: #0f2a24; --navybg: #16273e;
    --figure: #0e1b2e; --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  }
}
/* The toggle — last word in both directions. */
:root[data-tv='night'] {
  --bg: #060e18; --panel: #12213a; --panel2: #0e1b2e;
  --ink: #e9eff7; --ink2: #93a5be; --line: #243a55;
  --accent: #4da3ff; --red: #f0776c; --amber: #ffb020; --green: #2fd79b;
  --redbg: #2a1a1c; --amberbg: #2a2214; --greenbg: #0f2a24; --navybg: #16273e;
  --figure: #0e1b2e; --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}
:root[data-tv='light'] {
  --bg: #e9eef5; --panel: #ffffff; --panel2: #edf2f9;
  --ink: #0b2545; --ink2: #54657d; --line: #d7e1ee;
  --accent: #1e6fd9; --red: #b4322a; --amber: #8a5b00; --green: #136b4a;
  --redbg: #fbedeb; --amberbg: #fcf3e2; --greenbg: #e8f5ef; --navybg: #e9eff8;
  --figure: #f6f9fd; --shadow: 0 14px 34px rgba(11, 37, 69, 0.09);
}

*, *::before, *::after { box-sizing: border-box; }
/* A full-height column so the footer sits at the BOTTOM of a short page. Without it, a page whose
 * content is shorter than the window — the index with one post, or an empty index — ends its footer
 * wherever the content happens to stop and leaves a band of bare background beneath it.
 * `100dvh` is the load-bearing one on mobile, where the browser toolbar shrinks the viewport;
 * `100vh` above it is the fallback for anything that does not know `dvh`. */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: Barlow, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--panel); color: var(--ink); padding: 12px 18px;
  border: 1px solid var(--accent); border-radius: 0 0 8px 0;
  font-family: Oswald, sans-serif; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
}
.skip-link:focus { left: 0; }
.eyebrow {
  font-family: Oswald, sans-serif; font-size: 12px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink2);
}

/* ── site chrome, mirroring HeaderNav.tsx / FooterBar.tsx ─────────────────── */
.site-head { position: sticky; top: 0; z-index: 60; background: var(--panel); border-bottom: 1px solid var(--line); }
.head-inner { max-width: 1240px; margin: 0 auto; padding: 14px 28px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); flex: 0 0 auto; }
.brand:hover { text-decoration: none; }
.brand span { font-family: Oswald, sans-serif; font-size: 19px; font-weight: 600; letter-spacing: 0.02em; }
.head-nav { display: flex; gap: 22px; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.head-nav a {
  font-family: Oswald, sans-serif; font-size: 12.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink2); white-space: nowrap;
}
.head-nav a:hover { color: var(--ink); text-decoration: none; }
.head-nav a[aria-current] { color: var(--ink); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.btn-ghost {
  font-family: Oswald, sans-serif; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink2); background: transparent; border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 13px; cursor: pointer; white-space: nowrap; flex: 0 0 auto;
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-cta {
  font-family: Oswald, sans-serif; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--cta); color: var(--oncta); padding: 11px 18px; border-radius: 6px;
  white-space: nowrap; flex: 0 0 auto;
}
.btn-cta:hover { text-decoration: none; filter: brightness(1.08); }

.site-foot { border-top: 1px solid var(--line); background: var(--panel); margin-top: 56px; }
.foot-inner {
  max-width: 1240px; margin: 0 auto; padding: 30px 28px 26px;
  display: flex; flex-wrap: wrap; gap: 18px 24px; justify-content: space-between; align-items: center;
}
.foot-inner nav { display: flex; flex-wrap: wrap; gap: 20px; }
.foot-inner nav a, .foot-inner .copy {
  font-family: Oswald, sans-serif; font-size: 12.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink2);
}
.foot-inner nav a:hover { color: var(--ink); text-decoration: none; }

/* ── article ──────────────────────────────────────────────────────────────── */
.article { flex: 1 0 auto; max-width: 1240px; margin: 0 auto; padding: 0 28px 40px; }
.post-head { padding: 54px 0 30px; border-bottom: 1px solid var(--line); }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: Oswald, sans-serif; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px; padding: 6px 13px;
}
h1 {
  font-family: Outfit, sans-serif; font-weight: 700;
  font-size: clamp(32px, 4.2vw, 52px); line-height: 1.07; letter-spacing: -0.022em;
  margin: 20px 0 16px; max-width: 20ch; text-wrap: balance;
}
.deck {
  font-family: Outfit, sans-serif; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.5;
  color: var(--ink2); margin: 0 0 26px; max-width: 52ch; text-wrap: pretty;
}
.byline {
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center;
  font-family: Oswald, sans-serif; font-size: 12.5px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink2);
}
.byline .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.byline strong { color: var(--ink); font-weight: 500; }

.body { max-width: 68ch; margin: 0 auto; padding: 34px 0 0; }
.body p { font-size: 17.5px; line-height: 1.72; margin: 0 0 22px; text-wrap: pretty; }
.body > p:first-of-type::first-letter {
  font-family: Outfit, sans-serif; font-weight: 700; font-size: 3.1em; float: left;
  line-height: 0.82; padding: 4px 12px 0 0; color: var(--accent);
}
.body h2 {
  font-family: Oswald, sans-serif; font-weight: 500; font-size: 15px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
  margin: 46px 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line);
}
.body h3 {
  font-family: Outfit, sans-serif; font-weight: 600; font-size: 21px; line-height: 1.25;
  letter-spacing: -0.01em; margin: 30px 0 10px;
}
.body strong { font-weight: 600; }
.body code {
  font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums;
  font-size: 0.9em; font-weight: 500; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
}

/* An ordered list in a post is a RANKING (most common cause first), so the numeral is content:
 * it is set large and kept in the margin. A bare bullet list gets no such treatment. */
.body ol { list-style: none; counter-reset: rank; margin: 26px 0; padding: 0; display: grid; gap: 24px; }
.body ol > li {
  counter-increment: rank; display: grid; grid-template-columns: 46px 1fr;
  column-gap: 16px; row-gap: 0; align-items: start;
}
/* The numeral occupies row 1 of the narrow column and every child is pinned to the wide one.
 * Without the pin, grid auto-placement drops the second paragraph into the 46px column and it
 * wraps one word per line. */
.body ol > li::before {
  content: counter(rank, decimal-leading-zero); grid-column: 1; grid-row: 1;
  font-family: 'JetBrains Mono', monospace; font-size: 26px; font-weight: 700;
  line-height: 1; color: var(--accent); opacity: 0.55; padding-top: 5px;
}
.body ol > li > * { grid-column: 2; }
.body ol > li > p { margin: 0 0 10px; }
.body ol > li > p:first-child > strong {
  display: block; font-family: Outfit, sans-serif; font-weight: 600; font-size: 21px;
  line-height: 1.25; letter-spacing: -0.01em; margin-bottom: 8px; color: var(--ink);
}
.body ol > li > p:last-child { margin-bottom: 0; }
.body ul { margin: 0 0 22px; padding-left: 22px; }
.body ul li { font-size: 17.5px; line-height: 1.68; margin-bottom: 9px; }

.body blockquote {
  margin: 34px 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent);
  font-family: Outfit, sans-serif; font-size: 21px; line-height: 1.42; font-weight: 500;
  letter-spacing: -0.008em; color: var(--ink);
}
.body blockquote p { font-family: inherit; font-size: inherit; line-height: inherit; margin: 0; }

/* Figures break out past the reading column; their contents scroll rather than the page. */
.body figure { margin: 34px 0; width: min(92vw, 980px); margin-left: 50%; transform: translateX(-50%); }
.fig-frame {
  background: var(--figure); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px; overflow-x: auto; box-shadow: var(--shadow);
}
.body figcaption {
  font-family: Oswald, sans-serif; font-size: 12px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--ink2); margin-top: 11px; text-align: center;
}
.body figure svg { display: block; width: 100%; min-width: 620px; height: auto; }
.body figure img { display: block; width: 100%; height: auto; border-radius: 8px; }

.body table { border-collapse: collapse; width: 100%; min-width: 520px; }
.body th, .body td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); }
.body th:first-child, .body td:first-child { text-align: left; }
.body thead th {
  font-family: Oswald, sans-serif; font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink2);
}
.body tbody td { font-size: 16px; }
.body tbody td:not(:first-child) {
  font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; font-size: 14.5px;
}
/* In a money table the amount column is the deductions: red. The FIRST row is what was earned and
 * the LAST row is the answer — neither is a deduction, so neither is red. */
.body tbody tr:not(:first-child):not(:last-child) td:nth-child(2) { color: var(--red); }
.body tbody tr:last-child td { border-bottom: 0; font-weight: 700; }
.body tbody tr:last-child { background: var(--greenbg); }

.callout { margin: 36px 0; background: var(--greenbg); border: 1px solid var(--green); border-radius: 13px; padding: 22px 24px; }
.callout .eyebrow { color: var(--green); }
.callout p { font-size: 16.5px; line-height: 1.66; margin: 10px 0 0; }
.callout ul { margin: 12px 0 0; padding-left: 20px; }
.callout li { font-size: 16.5px; line-height: 1.62; margin-bottom: 7px; }

.post-foot {
  max-width: 68ch; margin: 46px auto 0; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between;
}
.post-foot p { margin: 0; font-size: 16px; color: var(--ink2); max-width: 42ch; line-height: 1.6; }

/* ── index ────────────────────────────────────────────────────────────────── */
/* Its OWN container, never the article's .body — `.body h2` sets Oswald/uppercase/accent for a
 * section heading, and at equal specificity those declarations leaked onto the post titles here
 * and rendered the whole list uppercase and blue. */
.index-body { padding: 34px 0 0; }
.index-head { padding: 54px 0 26px; border-bottom: 1px solid var(--line); }
.index-head h1 { max-width: 24ch; }
.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a { display: block; padding: 28px 0; color: inherit; }
.post-list a:hover { text-decoration: none; }
.post-list a:hover h2 { color: var(--accent); }
.post-list h2 {
  font-family: Outfit, sans-serif; font-weight: 700; font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.18; letter-spacing: -0.018em; margin: 10px 0 8px; max-width: 24ch; text-wrap: balance;
}
.post-list p { margin: 0 0 10px; font-size: 17px; line-height: 1.6; color: var(--ink2); max-width: 58ch; }
.empty { padding: 40px 0; color: var(--ink2); font-size: 17px; }

@media (max-width: 900px) {
  .head-nav { display: none; }
  .body figure { width: 100%; margin-left: 0; transform: none; }
  .fig-frame { padding: 14px; border-radius: 11px; }
  .article { padding: 0 20px 30px; }
  .head-inner, .foot-inner { padding-left: 20px; padding-right: 20px; }
}
