/* Tasg blog article typography — for server-rendered pages outside the SPA
   bundle (first use: /blog/introducing-tasg). CDO, 30 Aug 2026.

   Principles, matching the app's accessibility standards:
   - Everything font-related is rem so browser text scaling works; nothing
     is clipped by fixed heights, so any zoom level just reflows.
   - All colour pairs meet WCAG AA with margin. Links use the same values
     as the app's contrast floor: primary-600 (#3A5ACC) on light, primary-300
     (#92A7ED) on dark grounds. Never colour alone: links are underlined.
   - Light and dark follow prefers-color-scheme (a static page has no app
     theme toggle); both palettes are defined here, dark is not an afterthought.
   - Measure capped at 42rem (~65ch) for comfortable reading.

   Usage: wrap the article in <main class="article"> … </main>. Elements
   inside need no extra classes. */

:root {
  --article-bg: #F9FAFB;        /* gray-50 */
  --article-fg: #111827;        /* gray-900 · 16.9:1 */
  --article-muted: #4B5563;     /* gray-600 · 7.2:1 — bylines, captions */
  --article-link: #3A5ACC;      /* primary-600 · 5.9:1 */
  --article-accent: #4F71E0;    /* brand, decorative only (rules, marks) */
  --article-code-bg: #EEF2FC;   /* primary-50 */
  --article-border: #E5E7EB;    /* gray-200 */
  --article-focus: #4F71E0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --article-bg: #030712;      /* gray-950 */
    --article-fg: #F3F4F6;      /* gray-100 · 17.2:1 */
    --article-muted: #9CA3AF;   /* gray-400 · 7.5:1 */
    --article-link: #92A7ED;    /* primary-300 · ~7:1 */
    --article-accent: #92A7ED;
    --article-code-bg: #131E42; /* primary-900 */
    --article-border: #1F2937;  /* gray-800 */
    --article-focus: #93ABFF;   /* matches the app's dark focus colour */
  }
}

.article {
  background: var(--article-bg);
  color: var(--article-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;         /* 17px at default settings */
  line-height: 1.7;
  max-width: 42rem;             /* ~65ch measure */
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;   /* phone-first gutters */
  -webkit-text-size-adjust: 100%;
}

@media (min-width: 48rem) {
  .article { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Headings: tight scale, generous space above, bound to what follows. */
.article h1 {
  font-size: 2.25rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}
.article h2 {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  margin: 2.5rem 0 0.75rem;
}
.article h3 {
  font-size: 1.1875rem;
  line-height: 1.3;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
}

.article p { margin: 0 0 1.25rem; }

/* Byline / date line under the h1. */
.article .article-meta {
  color: var(--article-muted);
  font-size: 0.9375rem;
  margin: 0 0 2.5rem;
}

.article a {
  color: var(--article-link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.article a:hover { text-decoration-thickness: 2px; }
.article a:focus-visible {
  outline: 2px solid var(--article-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.article ul, .article ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
.article li { margin-bottom: 0.375rem; }
.article li::marker { color: var(--article-accent); }

.article blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--article-accent);
  color: var(--article-muted);
}
.article blockquote p:last-child { margin-bottom: 0; }

.article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--article-code-bg);
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
}
.article pre {
  background: var(--article-code-bg);
  border: 1px solid var(--article-border);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;             /* wide code scrolls inside itself, the page never does */
  margin: 0 0 1.25rem;
}
.article pre code { background: none; padding: 0; font-size: 0.875rem; line-height: 1.6; }

.article img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--article-border);
}
.article figcaption {
  color: var(--article-muted);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}

.article hr {
  border: 0;
  border-top: 1px solid var(--article-border);
  margin: 2.5rem 0;
}

.article table { border-collapse: collapse; width: 100%; margin: 0 0 1.25rem; display: block; overflow-x: auto; }
.article th, .article td { border: 1px solid var(--article-border); padding: 0.5rem 0.75rem; text-align: left; }
.article th { font-weight: 600; }
