/* content-rendering.css — canonical rules for any page that renders markdown body content.
   Loaded globally via views/layouts/main.ejs so every surface inherits the same
   .blog-post__content typography + .article-callout / .article-stats / .article-comparison /
   .article-steps / .article-highlight visual library.

   Consumers (every page that wraps body content in `<div class="blog-post__content">`):
     - Blog post pages (views/pages/intangibles/blog-post.ejs)
     - Academy lesson pages (views/pages/academy/gamified-lesson.ejs)
     - Glossary term pages (views/pages/intangibles/glossary-term.ejs)
     - FAQ answer pages (views/pages/intangibles/faq-answer.ejs)
     - AI guides (views/pages/ai/*.ejs)
     - Startup guides + honeypots (views/pages/startups/*.ejs)
     - Any future content surface should also use the .blog-post__content wrapper.

   Authoring rules: website/CLAUDE.md rules 78-94 (visual formatting) + rule 94a (this file).
   Markdown post-processor: website/utils/markdown.js (transformCallouts emits the class
   names defined below).

   SINGLE SOURCE OF TRUTH — do not duplicate .article-* or .blog-post__content rules into
   per-domain CSS files (blog.css, academy.css, etc.). Those files exist for surface
   chrome only (listing grids, hero cards, author bios, lesson modal, badges, etc.).
*/

/* ─── Blog-post content block — typography for markdown body ─── */

.blog-post__content {
  line-height: var(--line-height-relaxed);
}

.blog-post__content h2 {
  font-size: var(--font-size-2xl);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.blog-post__content h3 {
  font-size: var(--font-size-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.blog-post__content p {
  margin-bottom: var(--space-5);
}

.blog-post__content ul,
.blog-post__content ol {
  margin-bottom: var(--space-5);
  padding-left: var(--space-6);
}

.blog-post__content li {
  margin-bottom: var(--space-2);
  list-style-type: disc;
  color: var(--color-charcoal-light);
}

.blog-post__content ol li {
  list-style-type: decimal;
}

.blog-post__content blockquote {
  border-left: 3px solid var(--color-accent-orange);
  padding-left: var(--space-5);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-text-muted);
}

.blog-post__content a {
  color: var(--color-accent-orange);
  text-decoration: underline;
}

.blog-post__content img {
  border-radius: var(--border-radius);
  margin: var(--space-6) 0;
}

/* ─── Article Rich Formatting ─── */

/* Table responsive wrapper */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-8) 0;
}

.table-responsive table {
  margin: 0;
}

/* Tables — global styles for all content tables.
 *
 * Tables get an explicit white background so they read as a distinct
 * card regardless of their parent section. Without this, tables placed
 * inside a `.section--light` (cream #faf9f5) wrapper inherited the
 * section background, which was identical to the even-row zebra colour
 * (also `--color-bg-light` #faf9f5) — making the stripes invisible.
 * Setting the table to `--color-bg-card` (white) keeps the stripes
 * legible whether the parent section is white or cream.
 */
.blog-post__content table,
.section table,
.container table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-8) 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background-color: var(--color-bg-card);
}

.blog-post__content thead,
.section thead,
.container thead {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
}

.blog-post__content th,
.section th,
.container th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.blog-post__content td,
.section td,
.container td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-charcoal-light);
}

.blog-post__content tbody tr:last-child td,
.section tbody tr:last-child td,
.container tbody tr:last-child td {
  border-bottom: none;
}

.blog-post__content tbody tr:nth-child(even),
.section tbody tr:nth-child(even),
.container tbody tr:nth-child(even) {
  background-color: var(--color-bg-light);
}

.blog-post__content tbody tr:hover,
.section tbody tr:hover,
.container tbody tr:hover {
  background-color: var(--color-accent-orange-tint);
}

/* Inline code */
.blog-post__content code {
  background-color: var(--color-bg-alt);
  color: var(--color-accent-blue);
  padding: 0.15em 0.4em;
  border-radius: var(--border-radius-sm);
  font-size: 0.88em;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Code blocks */
.blog-post__content pre {
  background-color: var(--color-primary-dark);
  color: var(--color-bg-light);
  padding: var(--space-5);
  border-radius: var(--border-radius-lg);
  overflow-x: auto;
  margin: var(--space-6) 0;
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
}

.blog-post__content pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

/* Horizontal rules */
.blog-post__content hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-border), transparent);
  margin: var(--space-10) 0;
}

/* ─── Callout Boxes ─── */
/* Transformed from blockquotes by markdown post-processor */

.article-callout {
  border-radius: var(--border-radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-8) 0;
  position: relative;
  line-height: var(--line-height-relaxed);
  /* Belt-and-braces: clip the tinted background to the rounded corners so
     it never bleeds past the callout's bounding box when followed by an
     <hr> or section heading. */
  overflow: hidden;
}

/* Visual rhythm — restore breathing space between a callout and the next
   structural element (section header or divider). Without these rules,
   margin-collapse against an adjacent <hr> or <h2>/<h3> can leave the
   callout butting against the boundary and break the typographic rhythm. */
.article-callout + h2,
.article-callout + h3,
.article-callout + hr {
  margin-top: var(--space-10);
}

h2 + .article-callout,
h3 + .article-callout {
  margin-top: var(--space-6);
}

.article-callout p {
  margin-bottom: var(--space-3);
}

.article-callout p:last-child {
  margin-bottom: 0;
}

.article-callout__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: var(--space-2);
}

/* Key Takeaway — orange */
.article-callout--takeaway {
  background-color: var(--color-accent-orange-tint);
  border-left: 4px solid var(--color-accent-orange);
}

.article-callout--takeaway .article-callout__label {
  color: var(--color-accent-orange);
}

/* Example — green */
.article-callout--example {
  background-color: var(--color-accent-green-tint);
  border-left: 4px solid var(--color-accent-green);
}

.article-callout--example .article-callout__label {
  color: var(--color-accent-green);
}

/* Note / Info — blue */
.article-callout--note {
  background-color: var(--color-accent-blue-tint);
  border-left: 4px solid var(--color-accent-blue);
}

.article-callout--note .article-callout__label {
  color: var(--color-accent-blue);
}

/* Warning — red/error */
.article-callout--warning {
  background-color: var(--color-error-tint);
  border-left: 4px solid var(--color-error);
}

.article-callout--warning .article-callout__label {
  color: var(--color-error);
}

/* Definition — gold */
.article-callout--definition {
  background-color: var(--color-accent-gold-tint);
  border-left: 4px solid var(--color-accent-gold);
}

.article-callout--definition .article-callout__label {
  color: var(--color-accent-gold);
}

/* ─── Nested callout reset ─── */
/* Prevent margin/border issues when callouts appear inside highlight boxes */
.article-highlight .article-callout {
  margin: var(--space-4) 0;
  background-color: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.35);
}

.article-highlight .article-callout__label {
  color: rgba(255, 255, 255, 0.9);
}

.article-highlight .article-callout p {
  color: rgba(255, 255, 255, 0.85);
}

/* Nested callouts inside callouts: reduce outer margin */
.article-callout .article-callout {
  margin: var(--space-3) 0;
}

/* ─── Stat Blocks ─── */
/* Use HTML in markdown: <div class="article-stats">...</div> */

.article-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.article-stat {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5) var(--space-4);
  text-align: center;
}

.article-stat__value {
  display: block;
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-accent-orange);
  line-height: 1;
  margin-bottom: var(--space-2);
}

.article-stat__label {
  display: block;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--line-height-normal);
}

/* Stat block colour variants */
.article-stat--green .article-stat__value { color: var(--color-accent-green); }
.article-stat--blue .article-stat__value { color: var(--color-accent-blue); }
.article-stat--gold .article-stat__value { color: var(--color-accent-gold); }

/* ─── Highlight Box ─── */
/* Full-width highlighted section for key concepts */

.article-highlight {
  background: linear-gradient(135deg, var(--color-primary-dark) 0%, #1e2a3a 100%);
  color: var(--color-white);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8) var(--space-8);
  margin: var(--space-10) 0;
}

.article-highlight h2,
.article-highlight h3,
.article-highlight h4 {
  color: var(--color-white);
  margin-top: 0;
}

.article-highlight p {
  color: rgba(255, 255, 255, 0.85);
}

.article-highlight a {
  color: var(--color-accent-orange);
}

.article-highlight .btn {
  color: var(--color-white);
}

/* ─── Comparison Cards ─── */
/* Side-by-side comparison of two concepts */

.article-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-8) 0;
}

.article-comparison__card {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  background: var(--color-white);
}

.article-comparison__card h4 {
  margin-top: 0;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border);
}

.article-comparison__card:first-child h4 {
  border-bottom-color: var(--color-accent-orange);
}

.article-comparison__card:last-child h4 {
  border-bottom-color: var(--color-accent-blue);
}

.article-comparison__card ul {
  padding-left: var(--space-5);
  margin: 0;
}

.article-comparison__card li {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-charcoal-light);
}

.article-comparison__card p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

/* ─── Process Steps ─── */
/* Numbered step-by-step with visual connectors */

.article-steps {
  margin: var(--space-8) 0;
  counter-reset: step-counter;
}

.article-step {
  display: flex;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  position: relative;
}

.article-step::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--color-accent-orange);
  color: var(--color-white);
  border-radius: var(--border-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
}

.article-step::after {
  content: '';
  position: absolute;
  left: 19px;
  top: 44px;
  bottom: -24px;
  width: 2px;
  background: var(--color-border);
}

.article-step:last-child::after {
  display: none;
}

.article-step__content h4 {
  margin: 0 0 var(--space-2) 0;
  font-size: var(--font-size-md);
}

.article-step__content p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-charcoal-light);
}

/* ─── Mobile responsive ─── */
@media (max-width: 640px) {
  .blog-post__content table,
  .section table,
  .container table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .blog-post__content th,
  .blog-post__content td,
  .section th,
  .section td,
  .container th,
  .container td {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
  }

  .article-stats {
    grid-template-columns: 1fr 1fr;
  }

  .article-stat__value {
    font-size: var(--font-size-2xl);
  }

  .article-comparison {
    grid-template-columns: 1fr;
  }

  .article-callout {
    padding: var(--space-4) var(--space-5);
  }

  .article-highlight {
    padding: var(--space-6);
  }

  .blog-post__content h2 {
    font-size: var(--font-size-xl);
  }

  .blog-post__content h3 {
    font-size: var(--font-size-lg);
  }
}
