/* Shared styling for blog post body content, rendered from the
   blog_posts.content field. Used by both the static build
   (generate-blog-posts.js) and the client-side renderer
   (blog-post.html) so the two rendering paths cannot drift apart. */

/* ── Category colour system ──────────────────────────────────
   Five category colours, reused from existing brand accents
   (Evidence Vault, Correspondence Vault, Atlas, Reports, and the
   Philosophy Statement Builder) rather than inventing new ones.
   Coral (--coral) stays reserved for CTAs and is never assigned
   to a category, so the CTA button always stands out.
   A `.category-*` class is added to a wrapping element
   (article-wrap, post-card, or filter-pill) by generate-blog-posts.js,
   blog.html and blog-post.html, using the category -> class mapping
   in js/category-colors.js, so all three rendering paths agree on
   which class a given category gets. --category-ink is a
   contrast-checked text colour (white or near-black) for use where
   the colour is a solid fill, since a couple of the brand hues are
   too light for reliable white-text contrast (see th rule below). */
:root {
  --category-color-general:    #4B9B7A;
  --category-tint-general:     #E8F1EE;
  --category-ink-general:      #1A1A18;

  --category-color-law:        #7F77DD;
  --category-tint-law:         #EEEDFB;
  --category-ink-law:          #1A1A18;

  --category-color-practical:  #5A7A3A;
  --category-tint-practical:   #EAEEE5;
  --category-ink-practical:    #FFFFFF;

  --category-color-community:  #E8A030;
  --category-tint-community:   #FCF3E4;
  --category-ink-community:    #1A1A18;

  --category-color-philosophy: #D4537E;
  --category-tint-philosophy:  #FAE9EE;
  --category-ink-philosophy:   #1A1A18;
}

.category-general    { --category-color: var(--category-color-general);    --category-tint: var(--category-tint-general);    --category-ink: var(--category-ink-general); }
.category-law         { --category-color: var(--category-color-law);        --category-tint: var(--category-tint-law);        --category-ink: var(--category-ink-law); }
.category-practical   { --category-color: var(--category-color-practical);  --category-tint: var(--category-tint-practical);  --category-ink: var(--category-ink-practical); }
.category-community   { --category-color: var(--category-color-community);  --category-tint: var(--category-tint-community);  --category-ink: var(--category-ink-community); }
.category-philosophy  { --category-color: var(--category-color-philosophy); --category-tint: var(--category-tint-philosophy); --category-ink: var(--category-ink-philosophy); }

/* ── Table of contents ──────────────────────────────────────
   Auto-generated from a post's H2 headings by js/toc.js. Sits as the
   first child of .article-content, so it appears right after the
   title/meta/rule and before the first paragraph. Colour-matches the
   post's category via the --category-color/--category-tint custom
   properties set by the .category-* class on the ancestor article-wrap,
   falling back to coral when a post has no category. */
.article-toc {
  background: var(--category-tint, #fce8e3);
  border-left: 3px solid var(--category-color, var(--coral));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 2em;
}
.article-toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--category-color, var(--coral));
  text-align: left;
}
.article-toc-heading { font-size: 1.15rem; font-weight: 500; }
.article-toc-chevron { flex-shrink: 0; transition: transform 0.15s; }
.article-toc[data-collapsed="true"] .article-toc-chevron { transform: rotate(-90deg); }
.article-toc-list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.article-toc[data-collapsed="true"] .article-toc-list { display: none; }
.article-toc-list a { display: block; color: #2C2C2A; text-decoration: none; font-size: 1.02rem; line-height: 1.6; padding: 0.375rem 0; }
.article-toc-list a:hover { text-decoration: underline; color: var(--category-color, var(--coral)); }

@media (max-width: 640px) {
  .article-toc-heading { font-size: 1.1rem; }
  .article-toc-list a { font-size: 1rem; }
}

.article-content { font-size: 16px; line-height: 1.8; color: #2C2C2A; }
.article-content p  { margin-bottom: 1em; }
.article-content h2 { font-size: 20px; font-weight: 500; color: #1A1A18; margin: 2em 0 0.6em; padding-left: 0.75rem; border-left: 3px solid var(--coral); scroll-margin-top: 90px; }
.article-content h3 { font-size: 17px; font-weight: 500; color: #1A1A18; margin: 1.5em 0 0.5em; }
.article-content blockquote { border-left: 3px solid var(--coral); background: var(--bg); padding: 0.85rem 1.25rem; border-radius: 0 var(--radius) var(--radius) 0; margin: 1em 0; font-style: italic; color: var(--muted); }
.article-content strong { color: #1A1A18; font-weight: 500; }
.article-content a { color: var(--coral); }
.article-content a:hover { text-decoration: underline; }
.article-content figure { margin: 1.5em 0; text-align: center; }
.article-content figure img { max-width: 100%; border-radius: 6px; display: block; margin: 0 auto; }
.article-content figcaption { font-size: 0.85em; color: var(--muted); margin-top: 0.5em; font-style: italic; }
.article-content ul, .article-content ol { margin: 1em 0 1em 1.5em; }
.article-content li { margin-bottom: 0.35em; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.93rem; }
.article-content th, .article-content td { padding: 12px 16px; text-align: left; vertical-align: top; }
.article-content th { background: var(--category-color, var(--dark)); color: var(--category-ink, #fff); font-weight: 500; }
.article-content td { border-bottom: 1px solid var(--border); }
.article-content tr:last-child td { border-bottom: none; }
.article-content th:first-child, .article-content td:first-child { width: 110px; }
.article-content td:first-child { border-left: 3px solid var(--coral); }
.article-content tr:nth-child(odd) td { background: #e0f2ea; }
.article-content tr:nth-child(even) td { background: #fdf2e3; }
.article-content a.btn { color: #fff; }
.article-content .btn-primary { display: inline-block; background: var(--coral); color: #fff; border: 2px solid var(--coral); border-radius: var(--radius); padding: 0.6rem 1.4rem; font-size: 0.92rem; font-weight: 500; text-decoration: none; cursor: pointer; transition: opacity 0.15s; }
.article-content .btn-primary:hover { opacity: 0.88; }

/* ── Pull quotes ── */
.article-content blockquote.pull-quote {
  quotes: none;
  border: none;
  border-left: 4px solid var(--category-color, var(--coral));
  background: none;
  border-radius: 0;
  font-style: normal;
  color: var(--category-color, var(--coral));
  font-size: 1.3em;
  font-weight: 500;
  line-height: 1.5;
  padding: 0.2rem 0 0.2rem 1.25rem;
  margin: 1.75em 0;
}
.article-content blockquote.pull-quote::before,
.article-content blockquote.pull-quote::after { content: none; }

/* ── Activity items (activity + "what this demonstrates" note) ──
   Card background/border use the post's category colour via the
   --category-color/--category-tint custom properties set by the
   .category-* class on the ancestor .article-wrap, so this is
   automatically correct for any category, not just Practical Guides. */
.article-content .activity-item {
  background: var(--category-tint, #fce8e3);
  border-left: 3px solid var(--category-color, var(--coral));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25em 0;
}
.article-content .activity-item p { margin-bottom: 0.5em; }
.article-content .activity-item p:last-child { margin-bottom: 0; }
.article-content .activity-evidence {
  font-style: italic;
  color: var(--muted);
  font-size: 0.92em;
}
.article-content .activity-evidence::before {
  content: "▸ ";
  font-style: normal;
  font-weight: 600;
  color: var(--category-color, var(--coral));
}

/* ── Key stage grid infographic ── */
.article-content .key-stage-grid-wrap { margin: 1.75em 0; }
.article-content .key-stage-grid-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1A1A18;
  text-align: center;
  margin-bottom: 1rem;
}
.article-content .key-stage-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.9rem;
}
.article-content .key-stage-card {
  border-radius: var(--radius);
  padding: 1.25rem 0.75rem;
  text-align: center;
}
.article-content .key-stage-card .ks-name { font-weight: 500; font-size: 0.85rem; margin-bottom: 0.5em; }
.article-content .key-stage-card .ks-age { font-size: 1.7rem; font-weight: 700; line-height: 1.1; margin-bottom: 0.4em; }
.article-content .key-stage-card .ks-years { font-size: 0.78rem; color: #1A1A18; margin-bottom: 0; }
.article-content .ks-card-1 { background: var(--category-tint-general); }
.article-content .ks-card-1 .ks-name, .article-content .ks-card-1 .ks-age { color: var(--category-color-general); }
.article-content .ks-card-2 { background: var(--category-tint-community); }
.article-content .ks-card-2 .ks-name, .article-content .ks-card-2 .ks-age { color: var(--category-color-community); }
.article-content .ks-card-3 { background: var(--category-tint-law); }
.article-content .ks-card-3 .ks-name, .article-content .ks-card-3 .ks-age { color: var(--category-color-law); }
.article-content .ks-card-4 { background: var(--category-tint-philosophy); }
.article-content .ks-card-4 .ks-name, .article-content .ks-card-4 .ks-age { color: var(--category-color-philosophy); }
.article-content .ks-card-5 { background: var(--category-tint-practical); }
.article-content .ks-card-5 .ks-name, .article-content .ks-card-5 .ks-age { color: var(--category-color-practical); }

@media (max-width: 600px) {
  .article-content .key-stage-grid { grid-template-columns: repeat(2, 1fr); }
  .article-content .key-stage-card:nth-child(5) { grid-column: 1 / -1; max-width: 260px; margin: 0 auto; }
}

/* ── Infographic ── */
.article-content .infographic-wrap {
  background: #fce8e3;
  border-radius: var(--radius);
  padding: 1.75rem 1.25rem;
  margin: 1.75em 0;
  text-align: center;
}
/* Opt-in modifier: fills the container with the post's own category tint
   instead of the default coral tint, so an infographic drawn in a category
   colour sits on a background that matches it. Additive on purpose, so
   existing posts whose infographics use coral accents keep the coral tint
   they were designed against. */
.article-content .infographic-wrap.infographic-tinted {
  background: var(--category-tint, #fce8e3);
}
.article-content .infographic-wrap svg { width: 100%; height: auto; margin: 0 auto; }
.article-content .infographic-wrap svg.infographic-desktop { display: block; }
.article-content .infographic-wrap svg.infographic-mobile { display: none; }
.article-content .infographic-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1A1A18;
  margin-bottom: 1rem;
}
.article-content .infographic-caption {
  font-size: 0.95rem;
  color: #1A1A18;
  margin: 0.75rem 0 0;
}
.article-content .infographic-source {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

/* ── Four-area framework grid (2x2 card layout) ──
   Border/heading colour use the post's category colour via the
   --category-color/--category-tint custom properties set by the
   .category-* class on the ancestor .article-wrap, so this is
   automatically correct for any category. */
.article-content .framework-grid-wrap { margin: 1.75em 0; }
.article-content .framework-grid-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1A1A18;
  text-align: center;
  margin-bottom: 1rem;
}
.article-content .framework-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}
.article-content .framework-card {
  background: var(--category-tint, #fce8e3);
  border: 2px solid var(--category-color, var(--coral));
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
}
.article-content .framework-icon {
  width: 30px;
  height: 30px;
  color: var(--category-color, var(--coral));
  margin-bottom: 0.6rem;
}
.article-content .framework-card-title {
  font-weight: 500;
  font-size: 1rem;
  color: var(--category-color, var(--coral));
  margin-bottom: 0.4em;
}
.article-content .framework-card-text {
  font-size: 0.88rem;
  color: #1A1A18;
  line-height: 1.5;
  margin-bottom: 0;
}

@media (max-width: 640px) {
  .article-content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 600px) {
  .article-content .infographic-wrap svg.infographic-desktop { display: none; }
  .article-content .infographic-wrap svg.infographic-mobile { display: block; }
  .article-content .framework-grid { grid-template-columns: 1fr; }
}

/* ── Example wording box ── A light callout for quoted sample text,
   e.g. showing a parent what real report wording could look like.
   Colour matches the post's category via --category-color/--category-tint
   set by the .category-* class on the ancestor .article-wrap. ── */
.article-content .example-box {
  background: var(--category-tint, #fce8e3);
  border: 1px solid var(--category-color, var(--coral));
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.25em 0;
}
.article-content .example-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--category-color, var(--coral));
  margin-bottom: 0.5em;
}
.article-content .example-box blockquote {
  border: none;
  background: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
  font-style: italic;
  color: #1A1A18;
}

/* ── Checklist card infographic (numbered list) ── */
.article-content .checklist-card-wrap {
  background: var(--category-tint, #fce8e3);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.25rem;
  margin: 1.75em 0;
}
.article-content .checklist-card-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: #1A1A18;
  text-align: center;
  margin-bottom: 1.1rem;
}
.article-content .checklist-list { list-style: none; margin: 0; padding: 0; }
.article-content .checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.article-content .checklist-item:last-child { border-bottom: none; }
.article-content .checklist-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--category-color, var(--coral));
  color: var(--category-ink, #fff);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.article-content .checklist-text {
  font-size: 0.95rem;
  color: #1A1A18;
  line-height: 1.5;
  padding-top: 0.15rem;
}

/* ── Do / don't two-column comparison card ── */
.article-content .dodont-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.75em 0;
}
.article-content .dodont-col {
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
}
.article-content .dodont-col-do {
  background: var(--category-tint, #fce8e3);
  border: 2px solid var(--category-color, var(--coral));
}
.article-content .dodont-col-dont {
  background: #FBEAE6;
  border: 2px solid #C24A3A;
}
.article-content .dodont-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.75em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.article-content .dodont-col-do .dodont-title { color: var(--category-color, var(--coral)); }
.article-content .dodont-col-dont .dodont-title { color: #C24A3A; }
.article-content .dodont-list { list-style: none; margin: 0; padding: 0; }
.article-content .dodont-list li {
  font-size: 0.88rem;
  color: #1A1A18;
  line-height: 1.5;
  padding: 0.35em 0;
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .article-content .dodont-wrap { grid-template-columns: 1fr; }
}
