/* (x)File prose — XF-DESIGN-01.
   The ONE presentation for an article body, shared by the published article
   (api/article.js) and the Create preview (public/create.html). The author owns
   the words; this file owns how they look. Rules:
   - every selector is scoped to .xf-prose, so it also wins over the Create
     page's Tailwind reset (element selectors) without !important;
   - no generated text (no `content:`), no text-transform, nothing hidden or
     clamped: every author word stays visible as written;
   - markup arrives sanitized and attribute-free, so authors cannot restyle it.
   Linked with ?v=<sha256 prefix of this file>; test-design.js keeps it current. */

:root {
  --xf-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --xf-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --xf-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --xf-ink: #1d1d1f;      /* headings */
  --xf-text: #222222;     /* body, ~16:1 on white */
  --xf-quote: #3a3a3c;    /* quotations, ~11:1 */
  --xf-link: #2563eb;     /* links, ~5.2:1 */
  --xf-rule: #e5e5ea;
  --xf-surface: #f5f5f7;
  --xf-accent: #d4af37;   /* quotation bar only */
  --xf-body-size: clamp(1.0625rem, 1rem + 0.35vw, 1.1875rem);  /* 17px phone → 19px desktop */
}

.xf-prose {
  max-width: 42rem;
  font-family: var(--xf-serif);
  font-size: var(--xf-body-size);
  font-weight: 400;
  line-height: 1.7;
  color: var(--xf-text);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}
.xf-prose > :first-child { margin-top: 0; }

/* Paragraphs */
.xf-prose p { margin: 0 0 1.1em; }

/* Headings: sans, always larger than body text */
.xf-prose h1, .xf-prose h2, .xf-prose h3, .xf-prose h4, .xf-prose h5, .xf-prose h6 {
  font-family: var(--xf-sans);
  color: var(--xf-ink);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 2.2em 0 0.5em;
}
.xf-prose h1 { font-size: 1.75rem; }
.xf-prose h2 { font-size: 1.5rem; }
.xf-prose h3 { font-size: 1.25rem; font-weight: 600; margin-top: 1.8em; }
.xf-prose h4, .xf-prose h5, .xf-prose h6 { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.01em; margin-top: 1.6em; }

/* A one-item numbered line standing alone ("7. Title" between paragraphs) is
   a section title: shown like h2, keeping the author's own number. */
.xf-prose ol:has(> li:only-child):not(:has(li :is(p, br, ul, ol, pre, blockquote, table))) {
  font-family: var(--xf-sans);
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--xf-ink);
  list-style: decimal inside;
  padding-left: 0;
  margin: 2.2em 0 0.5em;
}
.xf-prose ol:has(> li:only-child):not(:has(li :is(p, br, ul, ol, pre, blockquote, table))) > li { margin: 0; padding: 0; }

/* Emphasis */
.xf-prose strong, .xf-prose b { font-weight: 600; }
.xf-prose em, .xf-prose i { font-style: italic; }
.xf-prose sub, .xf-prose sup { font-size: 0.75em; line-height: 0; }  /* keeps line spacing even */

/* Lists: markers always shown (the Tailwind reset removes them otherwise) */
.xf-prose ul, .xf-prose ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.xf-prose ul { list-style: disc; }
.xf-prose ol { list-style: decimal; }
.xf-prose ul ul { list-style: circle; }
.xf-prose li { margin: 0.35em 0; padding-left: 0.2em; }
.xf-prose li > ul, .xf-prose li > ol { margin: 0.35em 0; }
.xf-prose li > p { margin-bottom: 0.5em; }

/* Quotations */
.xf-prose blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.25rem;
  border-left: 3px solid var(--xf-accent);
  font-style: italic;
  color: var(--xf-quote);
}
.xf-prose blockquote p:last-child { margin-bottom: 0; }

/* Links */
.xf-prose a {
  color: var(--xf-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(37, 99, 235, 0.35);
  text-underline-offset: 0.15em;
}
.xf-prose a:hover { text-decoration-color: currentColor; }
.xf-prose a.yt-cta { display: inline; text-decoration: none; }

/* Code and technical expressions */
.xf-prose code { font-family: var(--xf-mono); font-size: 0.875em; background: var(--xf-surface); padding: 0.1em 0.35em; border-radius: 4px; }
.xf-prose pre {
  font-family: var(--xf-mono);
  font-size: 0.875rem;
  line-height: 1.55;
  background: var(--xf-surface);
  padding: 1em 1.2em;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 1.4em;
}
.xf-prose pre code { background: none; padding: 0; font-size: inherit; }

/* Images and embeds */
.xf-prose img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: 8px; }
.xf-prose iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; margin: 1.6em 0; }

/* Dividers */
.xf-prose hr { color: var(--xf-rule); border: 0; border-top: 1px solid var(--xf-rule); width: 40%; height: 0; margin: 2.4em auto; }

/* Tables: scroll inside themselves, never the page */
.xf-prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 0 0 1.4em;
  font-family: var(--xf-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color: var(--xf-text);
}
.xf-prose th, .xf-prose td { border: 1px solid var(--xf-rule); padding: 0.55em 0.8em; text-align: left; vertical-align: top; min-width: 6.5rem; }
.xf-prose th { background: var(--xf-surface); font-weight: 600; color: var(--xf-ink); }

/* Phones */
@media (max-width: 600px) {
  .xf-prose { line-height: 1.68; }
  .xf-prose h1 { font-size: 1.5rem; }
  .xf-prose h2,
  .xf-prose ol:has(> li:only-child):not(:has(li :is(p, br, ul, ol, pre, blockquote, table))) { font-size: 1.35rem; margin-top: 1.9em; }
  .xf-prose h3 { font-size: 1.2rem; }
  .xf-prose h4, .xf-prose h5, .xf-prose h6 { font-size: 1.125rem; }
  .xf-prose table { font-size: 0.875rem; }
  .xf-prose th, .xf-prose td { padding: 0.5em 0.6em; }
}
