/* Server-rendered public pages: the blog index and the posts themselves.
 *
 * Loaded after design.css and app.css and built entirely from their tokens, so
 * a change to the palette or the type scale reaches these pages too. Nothing
 * here is scoped to a page; the classes describe what a thing is.
 *
 * The one place this file deliberately departs from the application's
 * defaults is body copy. The interface is a dense 15px because it is a
 * control surface being scanned; an article is 17.5px on a measure of about
 * 68 characters because it is prose being read for ten minutes.
 */

.site-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Keyboard-first navigation past the header. Off-screen until focused. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--color-accent); color: var(--color-bg);
  padding: 10px 16px; text-decoration: none;
}
.skip-link:focus { left: 0; }

.site-head { border-bottom: 1px solid var(--color-divider); }
/* Held to the article's measure rather than `.pub-head`'s own 1360px, so the
   wordmark sits directly above the headline instead of 130px to its left. */
.site-head-row { max-width: 1100px; }
.site-head .pub-nav a { text-decoration: none; color: inherit; }
.site-head .pub-nav a:hover { color: var(--color-accent); }
.site-head .pub-nav a[aria-current="page"] {
  color: var(--color-accent);
  box-shadow: inset 0 -1px 0 var(--color-accent);
}

.site-main { flex: 1; width: 100%; min-width: 0; }

.site-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 80px;
  min-width: 0;
}
/* The reading measure. 720px at 17.5px lands near 68 characters, which is the
   range where line-to-line tracking stops costing the reader anything. */
.site-wrap-narrow { max-width: 800px; }

.site-h1 { font-size: 46px; margin-bottom: 14px; max-width: 20ch; }
.site-lede {
  font-size: 18px; line-height: 1.6; max-width: 62ch;
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}

/* ── index ────────────────────────────────────────────────────────────── */

.post-list { display: grid; gap: 1px; background: var(--color-divider); margin-top: 44px; }
.post-card { background: var(--color-bg); padding: 26px 0 30px; }
.post-list .post-card:first-child { padding-top: 0; }

.post-card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-neutral-600); margin-bottom: 10px;
}
.post-card-meta .dot { opacity: 0.5; }

.post-card-title { font-size: 28px; margin: 0 0 10px; line-height: 1.15; }
.post-card-title a { color: inherit; text-decoration: none; }
.post-card-title a:hover { color: var(--color-accent); }

.post-card-desc {
  margin: 0; max-width: 68ch; font-size: 15.5px; line-height: 1.6;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.post-tag {
  font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3px 8px; border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm); color: var(--color-neutral-600);
}

/* ── post ─────────────────────────────────────────────────────────────── */

.crumbs {
  font-size: 12px; color: var(--color-neutral-600);
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px;
}
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--color-accent); }

.post-head { margin-bottom: 40px; }
.post-title { font-size: 48px; line-height: 1.06; margin: 0 0 18px; }
.post-standfirst {
  font-size: 19px; line-height: 1.6; margin: 0 0 22px; max-width: 60ch;
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}
.post-byline {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--color-neutral-600);
  padding-top: 16px; border-top: 1px solid var(--color-divider);
}
.post-byline .dot { opacity: 0.5; }

.post-toc {
  border-left: 2px solid var(--color-divider);
  padding: 4px 0 4px 20px; margin: 0 0 40px;
}
.post-toc-label {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--color-neutral-600); margin-bottom: 10px;
}
.post-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: toc; }
.post-toc li { counter-increment: toc; margin-bottom: 6px; font-size: 14.5px; }
.post-toc li::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--color-neutral-500); margin-right: 10px;
  font-family: var(--font-heading); font-size: 12px;
}
.post-toc a { color: inherit; text-decoration: none; }
.post-toc a:hover { color: var(--color-accent); }

/* ── article body ─────────────────────────────────────────────────────── */

.prose { font-size: 17.5px; line-height: 1.72; }
.prose > * { max-width: 68ch; }

.prose h2 {
  font-size: 31px; margin: 56px 0 16px; padding-top: 20px;
  border-top: 1px solid var(--color-divider);
}
.prose h3 { font-size: 22px; margin: 36px 0 12px; }
.prose h4 { font-size: 18px; margin: 28px 0 10px; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }

.prose p { margin: 0 0 22px; }
.prose a { color: var(--color-accent); text-decoration: underline; }

.prose ul, .prose ol { margin: 0 0 22px; padding-left: 24px; }
.prose li { margin-bottom: 9px; }
.prose li > ul, .prose li > ol { margin: 9px 0 0; }

.prose strong { font-weight: 600; }

.prose blockquote {
  margin: 30px 0; padding: 2px 0 2px 22px;
  border-left: 2px solid var(--color-accent);
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
  font-size: 18px;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Inline code sits inside a line of 17.5px prose, so it is sized in `em` --
   at a fixed px it looks like a different typeface has been dropped in.
   The horizontal padding is deliberately small: at 5px the tinted box pushes
   a following comma clear of the word it belongs to, and `execute()` , reads
   as a typesetting mistake. */
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.87em;
  background: color-mix(in srgb, var(--color-text) 7%, transparent);
  padding: 1px 2px; border-radius: var(--radius-sm);
  overflow-wrap: break-word;
}
.prose pre {
  margin: 26px 0; padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  /* The one element allowed its own scrollbar. A code sample is the usual way
     a phone-width page ends up scrolling sideways as a whole. */
  overflow-x: auto;
  max-width: 100%;
}
.prose pre code {
  background: none; padding: 0; font-size: 13.5px; line-height: 1.62;
  white-space: pre;
}
:root[data-theme="dark"] .prose pre { background: #101317; }

.prose table {
  width: 100%; border-collapse: collapse; margin: 28px 0; font-size: 15px;
}
.prose thead th {
  text-align: left; font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  border-bottom: 1px solid var(--color-text); padding: 8px 12px 8px 0;
}
.prose tbody td {
  padding: 10px 12px 10px 0; border-bottom: 1px solid var(--color-divider);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: 0; }
/* Tables are the other reliable source of sideways scroll; this keeps it
   inside the element. Full container width rather than the 68ch reading
   measure -- prose is read line by line and wants a short measure, a table is
   read cell by cell and wants room. */
.prose > .table-wrap { overflow-x: auto; max-width: 100%; }
.prose .table-wrap table { min-width: 560px; }

.prose hr {
  height: 1px; border: 0; background: var(--color-divider); margin: 44px 0;
}

.prose img { border: 1px solid var(--color-divider); margin: 28px 0; }

/* An aside inside an article: a caveat, a definition, a number worth pulling
   out. Written in markdown as <div class="callout" markdown="1">. */
.prose .callout {
  margin: 30px 0; padding: 18px 22px;
  border: 1px solid var(--color-divider);
  border-left: 3px solid var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 5%, transparent);
  font-size: 16px;
}
.prose .callout > *:last-child { margin-bottom: 0; }
.prose .callout-label {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--color-accent); margin-bottom: 8px;
  font-family: var(--font-heading);
}

/* The closing section that talks about the product. Marked out from the
   article rather than blended into it: a reader who has just been given ten
   minutes of analysis is owed a visible line between the argument and the
   pitch, and a reader who wants to skip it should be able to see where. */
.prose .cta {
  margin: 60px 0 0; padding: 30px 32px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface);
  max-width: 100%;
}
.prose .cta h2, .prose .cta h3 {
  border: 0; padding: 0; margin: 0 0 14px; font-size: 26px;
}
.prose .cta > *:last-child { margin-bottom: 0; }
.prose .cta p, .prose .cta ul { font-size: 16.5px; }
.prose .cta-label {
  font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--color-neutral-600); margin-bottom: 12px;
  font-family: var(--font-heading);
}
.prose .cta-actions {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px;
}
/* `.prose a` is (0,1,1) and `.btn-primary` is (0,1,0), so inside an article the
   link rule wins and paints the button's label in the accent colour -- on top
   of the accent-coloured button, which renders it invisible. These restore the
   button's own colours at a specificity that beats the prose link rule. */
.prose .btn { text-decoration: none; }
.prose .btn-primary { color: var(--color-bg); }
.prose .btn-secondary { color: var(--color-text); }
:root[data-theme="dark"] .prose .cta { background: #14181d; }

.post-related { margin-top: 72px; }
.post-related .post-list { margin-top: 24px; }

/* ── footer ───────────────────────────────────────────────────────────── */

.site-foot {
  border-top: 1px solid var(--color-divider);
  padding: 40px 40px 48px; margin-top: auto;
  font-size: 13px; color: var(--color-neutral-700);
}
.site-foot-cols {
  display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px;
  max-width: 1100px; margin: 0 auto; min-width: 0;
}
.site-foot-cols > * { min-width: 0; }
.site-foot-cols > div:not(:first-child) { display: grid; gap: 6px; align-content: start; }
.site-foot-blurb { margin: 0; max-width: 46ch; }
.site-foot-label {
  color: var(--color-neutral-500); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { color: var(--color-accent); }

/* ── narrow screens ───────────────────────────────────────────────────── */
/* Same 860px breakpoint the application uses. Sizes drop, nothing reflows into
   a second axis, and no element is allowed to set the page's width. */

@media (max-width: 860px) {
  .site-wrap { padding: 32px 20px 60px; }
  /* Matches .site-wrap's gutter, so the wordmark stays above the headline. */
  .site-head-row { padding-inline: 20px; }
  .site-h1 { font-size: 34px; max-width: none; }
  .site-lede { font-size: 16.5px; }

  .post-card-title { font-size: 23px; }
  .post-card-desc { font-size: 15px; }

  .post-title { font-size: 33px; }
  .post-standfirst { font-size: 17px; }

  .prose { font-size: 17px; }
  .prose h2 { font-size: 25px; margin-top: 42px; }
  .prose h3 { font-size: 20px; }
  .prose pre { padding: 14px; }
  .prose pre code { font-size: 12.5px; }
  .prose .cta { padding: 22px 20px; }
  .prose .cta h2, .prose .cta h3 { font-size: 22px; }
  .prose .cta-actions a { width: 100%; }
  .prose blockquote { font-size: 17px; }

  .post-toc { margin-bottom: 32px; }

  .site-foot { padding: 32px 20px 40px; }
  .site-foot-cols { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
