/*!
 * blog-blocks.css — styles for the 1CA blog editor's content blocks (v1, 2026-10-21).
 *
 * Canonical copy: onechanneladmin-latest/apps/web/src/components/RichTextEditor/blog-blocks.css
 * (the admin editor uses the same rules for its preview via blogBlocksCss.js). Copy this file
 * unchanged into any site that renders 1CA blog posts and load it AFTER the site's own blog CSS.
 *
 * Contract
 *  - Posts carry class names only (no <style>, no inline layout CSS). The save sanitizer keeps
 *    exactly the classes styled here (BLOG_BLOCK_CLASS_NAMES) plus the blog-faq__* FAQ classes.
 *  - Scope: put class "oca-content" on the element that wraps the post HTML. Blocks are styled
 *    inside .oca-content or inside an .oca-blog wrapper. Posts without block classes are untouched.
 *  - .oca-blog (optional wrapper inside the post) also applies the long-form "article theme":
 *    cream page, Instrument Sans body, Bricolage headings, section rhythm, table and FAQ styling.
 *  - Theme a site by overriding the --oca-* custom properties on .oca-content.
 *  - Fonts (load them in the page): Bricolage Grotesque 700/800, Instrument Sans 400-700,
 *    IBM Plex Mono 400/500, e.g. https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=Instrument+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap
 *
 * Blocks (HTML the editor writes):
 *  callout   <aside class="oca-callout oca-takeaways|oca-tip|oca-note|oca-warning">…</aside>
 *  answer    <p class="oca-answer">…</p>
 *  toc       <nav class="oca-toc [oca-toc--1col]"><p><strong>Title</strong></p><ol><li><a href="#id">…</a></li></ol></nav>
 *  steps     <ol class="oca-steps [oca-steps--checklist]"><li><strong>Lead:</strong> text</li></ol>
 *  table     <div class="oca-table"><table class="[oca-highlight|oca-roi|oca-zebra]"><caption>…</caption>…</table></div>
 *  cta       <aside class="oca-cta oca-mid-cta|oca-band"><p><strong>Title</strong></p><p>Text</p>
 *              <p class="oca-actions"><a class="oca-btn" href>Primary</a> <a class="oca-btn-line" href>Secondary</a></p></aside>
 *  faq       <section class="blog-faq"><h2 class="blog-faq__title">…</h2><div class="blog-faq__list">
 *              <div class="blog-faq__item"><h3 class="blog-faq__question">…</h3><div class="blog-faq__answer"><p>…</p></div></div></div></section>
 *  author    <aside class="oca-author" data-initials="1CA"><div><p><strong>Name</strong></p><p>Bio</p></div></aside>
 *  sources   <section class="oca-sources"><h2>…</h2><p>…</p><ol><li>…</li></ol></section>
 */

/* ---------- tokens (override per site) ---------- */
:is(.oca-blog, .oca-content) {
  --oca-ink: #1C1847; --oca-body: #4A4666; --oca-muted: #5B5776; --oca-bg: #FBF8F3; --oca-alt: #F1ECE4; --oca-surface: #FFFFFF;
  --oca-line: #E8E1D6; --oca-line2: #E0D8CA; --oca-orange: #F2711C; --oca-pink: #E8175D; --oca-plum: #8E2C96; --oca-violet: #5545A0; --oca-amber: #FDB03C;
  --oca-display: 'Bricolage Grotesque', Georgia, sans-serif;
  --oca-sans: 'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --oca-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
:is(.oca-blog, .oca-content) [class*="oca-"],
:is(.oca-blog, .oca-content) [class*="oca-"]::before,
:is(.oca-blog, .oca-content) [class*="oca-"]::after { box-sizing: border-box; }

/* ---------- article theme (.oca-blog wrapper only) ---------- */
.oca-blog {
  box-sizing: border-box; width: 100%; max-width: none; margin: 0; padding: clamp(24px,4vw,48px) clamp(16px,3vw,40px) 64px;
  background: var(--oca-bg); color: var(--oca-body); font-family: var(--oca-sans); font-size: 17px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.oca-blog *, .oca-blog *::before, .oca-blog *::after { box-sizing: border-box; }
.oca-blog p { margin: 0 0 20px; }
.oca-blog strong { color: var(--oca-ink); font-weight: 700; }
.oca-blog a { color: var(--oca-plum); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.oca-blog a:hover { color: var(--oca-pink); }
.oca-blog a:focus-visible { outline: 3px solid var(--oca-orange); outline-offset: 2px; border-radius: 4px; }
.oca-blog em { font-style: italic; }

/* motion (article theme only; off for reduced motion) */
@keyframes oca-fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes oca-slideIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
@keyframes oca-pulse { 0% { box-shadow: 0 0 0 0 rgba(242,113,28,.55); } 100% { box-shadow: 0 0 0 14px rgba(242,113,28,0); } }
.oca-blog > p:first-of-type,
.oca-blog .oca-takeaways,
.oca-blog .oca-toc,
.oca-blog > section,
.oca-blog .oca-mid-cta,
.oca-blog .oca-band,
.oca-blog .oca-author { animation: oca-fadeUp .7s ease both; }
.oca-blog > p:first-of-type { animation-delay: .05s; }
.oca-blog > p:nth-of-type(2) { animation: oca-fadeUp .7s .12s ease both; }
.oca-blog .oca-takeaways { animation-delay: .18s; }
.oca-blog .oca-toc { animation-delay: .26s; }
.oca-blog > section:nth-of-type(1) { animation-delay: .08s; }
.oca-blog > section:nth-of-type(2) { animation-delay: .12s; }
.oca-blog > section:nth-of-type(3) { animation-delay: .16s; }
.oca-blog .oca-steps > li { animation: oca-slideIn .55s ease both; }
.oca-blog .oca-steps > li:nth-child(1) { animation-delay: .05s; }
.oca-blog .oca-steps > li:nth-child(2) { animation-delay: .12s; }
.oca-blog .oca-steps > li:nth-child(3) { animation-delay: .19s; }
.oca-blog .oca-steps > li:nth-child(4) { animation-delay: .26s; }
.oca-blog .oca-steps > li:nth-child(5) { animation-delay: .33s; }
.oca-blog .oca-steps > li:nth-child(6) { animation-delay: .4s; }
.oca-blog .oca-steps > li:nth-child(7) { animation-delay: .47s; }
.oca-blog .oca-steps > li:nth-child(8) { animation-delay: .54s; }
.oca-blog a.oca-btn { animation: oca-pulse 1.8s 1s ease-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .oca-blog *, .oca-blog *::before, .oca-blog *::after { animation: none !important; transition: none !important; }
}

/* headings and sections */
.oca-blog h2 { font-family: var(--oca-display); font-weight: 800; color: var(--oca-ink); font-size: clamp(28px,3.4vw,38px); line-height: 1.08; letter-spacing: -.03em; margin: 0 0 18px; text-wrap: balance; }
.oca-blog h3 { font-family: var(--oca-display); font-weight: 700; color: var(--oca-ink); font-size: 22px; line-height: 1.25; letter-spacing: -.015em; margin: 34px 0 12px; }
.oca-blog section { margin: 0; padding: 56px 0 0; scroll-margin-top: 90px; }
.oca-blog section + section { border-top: 1px solid var(--oca-line); margin-top: 56px; }
.oca-blog > p:first-of-type { font-size: 20px; color: var(--oca-ink); line-height: 1.55; }

/* lists */
.oca-blog ul { margin: 0 0 22px; padding-left: 1.2em; }
.oca-blog ul li { margin-bottom: 10px; }
.oca-blog ul li::marker { color: var(--oca-orange); }

/* ---------- steps / checklist ---------- */
:is(.oca-blog, .oca-content) ol.oca-steps { list-style: none; margin: 24px 0; padding: 0; counter-reset: oca-st; display: grid; gap: 14px; }
:is(.oca-blog, .oca-content) ol.oca-steps > li { counter-increment: oca-st; position: relative; min-height: 72px; margin: 0; padding: 16px 18px 16px 70px; background: var(--oca-surface); border: 1px solid var(--oca-line); border-radius: 16px; }
:is(.oca-blog, .oca-content) ol.oca-steps > li::before { content: counter(oca-st); position: absolute; left: 18px; top: 16px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #FFE8D6; color: #9A4209; font-family: var(--oca-mono); font-size: 14px; font-weight: 500; line-height: 1; }
:is(.oca-blog, .oca-content) ol.oca-steps > li > span { display: block; }
:is(.oca-blog, .oca-content) ol.oca-steps > li > p { margin: 0 0 10px; }
:is(.oca-blog, .oca-content) ol.oca-steps > li > p:last-child { margin-bottom: 0; }

/* ---------- callouts ---------- */
/* key takeaways */
:is(.oca-blog, .oca-content) .oca-takeaways { background: #FFF1D2; border-radius: 22px; padding: 24px 26px; margin: 30px 0; }
:is(.oca-blog, .oca-content) .oca-takeaways > p:first-child { margin-bottom: 12px; }
:is(.oca-blog, .oca-content) .oca-takeaways > p:first-child strong { font-family: var(--oca-display); font-size: 20px; letter-spacing: -.01em; }
:is(.oca-blog, .oca-content) .oca-takeaways ul { margin: 0; }
:is(.oca-blog, .oca-content) .oca-takeaways li { color: #5A3E00; }
:is(.oca-blog, .oca-content) .oca-takeaways li:last-child { margin-bottom: 0; }

/* table of contents (2 columns, 1 with oca-toc--1col) */
:is(.oca-blog, .oca-content) .oca-toc { background: var(--oca-surface); border: 1px solid var(--oca-line); border-radius: 22px; padding: 24px 26px; margin: 0 0 8px; }
:is(.oca-blog, .oca-content) .oca-toc > p { margin: 0 0 12px; }
:is(.oca-blog, .oca-content) .oca-toc > p strong { font-family: var(--oca-display); font-size: 20px; letter-spacing: -.01em; }
:is(.oca-blog, .oca-content) .oca-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: oca-toc; columns: 2 240px; column-gap: 28px; }
:is(.oca-blog, .oca-content) .oca-toc--1col ol { columns: 1; }
:is(.oca-blog, .oca-content) .oca-toc li { counter-increment: oca-toc; break-inside: avoid; padding: 7px 0; border-bottom: 1px solid var(--oca-line); font-size: 15px; display: flex; gap: 10px; }
:is(.oca-blog, .oca-content) .oca-toc li::before { content: counter(oca-toc, decimal-leading-zero); font-family: var(--oca-mono); font-size: 12px; color: var(--oca-orange); padding-top: 3px; }
:is(.oca-blog, .oca-content) .oca-toc li > p { margin: 0; }
:is(.oca-blog, .oca-content) .oca-toc a { text-decoration: none; color: var(--oca-ink); font-weight: 500; }
:is(.oca-blog, .oca-content) .oca-toc a:hover { color: var(--oca-plum); }

/* ---------- tables ---------- */
:is(.oca-blog, .oca-content) .oca-table { overflow-x: auto; margin: 24px 0 28px; border: 1px solid var(--oca-line); border-radius: 20px; background: var(--oca-surface); -webkit-overflow-scrolling: touch; }
.oca-blog table { border-collapse: collapse; width: 100%; min-width: 0; font-size: 15px; line-height: 1.45; margin: 0; border: 0; }
.oca-blog caption { caption-side: top; text-align: left; padding: 18px 20px 10px; font-family: var(--oca-display); font-weight: 700; font-size: 18px; color: var(--oca-ink); }
.oca-blog th, .oca-blog td { text-align: left; vertical-align: top; padding: 12px 20px; border: 0; border-bottom: 1px solid var(--oca-line); background: none; }
.oca-blog thead th { font-size: 13px; font-weight: 600; color: var(--oca-muted); background: var(--oca-alt); border-bottom: 1px solid var(--oca-line2); }
.oca-blog tbody th { color: var(--oca-ink); font-weight: 600; }
.oca-blog tbody tr:last-child > * { border-bottom: 0; }
/* ROI / totals: last two rows tinted, last row large */
:is(.oca-blog, .oca-content) .oca-roi tbody tr:nth-last-child(-n+2) > * { background: #FFF4EA; }
:is(.oca-blog, .oca-content) .oca-roi tbody tr:last-child th, :is(.oca-blog, .oca-content) .oca-roi tbody tr:last-child td { color: #C2410C; font-family: var(--oca-display); font-size: 18px; font-weight: 800; }
/* comparison: third column (the recommended option) emphasised */
:is(.oca-blog, .oca-content) .oca-highlight th:nth-child(3), :is(.oca-blog, .oca-content) .oca-highlight td:nth-child(3) { background: #F4F1FD; }
:is(.oca-blog, .oca-content) .oca-highlight thead th:nth-child(3) { background: #ECE8FA; color: #3F318A; }
/* zebra rows */
:is(.oca-blog, .oca-content) table.oca-zebra tbody tr:nth-child(even) > * { background: #FAF7F2; }

/* tip (violet, bulb icon) */
:is(.oca-blog, .oca-content) .oca-tip { background: #ECE8FA; color: #2E2470; border-radius: 18px; padding: 20px 22px 20px 64px; position: relative; margin: 26px 0; }
:is(.oca-blog, .oca-content) .oca-tip::before { content: ""; position: absolute; left: 20px; top: 20px; width: 30px; height: 30px; border-radius: 9px; background: var(--oca-violet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M9 18h6M10 22h4M12 2a7 7 0 0 0-4 12.7V17h8v-2.3A7 7 0 0 0 12 2z'/%3E%3C/svg%3E") center/16px no-repeat; }
:is(.oca-blog, .oca-content) .oca-tip strong { color: inherit; }
/* note (left accent; oca-formula is the legacy name) */
:is(.oca-blog, .oca-content) :is(.oca-note, .oca-formula) { background: var(--oca-surface); border: 1px solid var(--oca-line); border-left: 5px solid var(--oca-orange); border-radius: 16px; padding: 18px 22px; margin: 26px 0; }
/* warning (left accent, red) */
:is(.oca-blog, .oca-content) .oca-warning { background: #FFF5F2; border: 1px solid #F8D3C7; border-left: 5px solid #C2410C; border-radius: 16px; padding: 18px 22px; margin: 26px 0; color: #5B1F07; }
:is(.oca-blog, .oca-content) .oca-warning strong { color: #9A2B05; }
/* direct answer (lead paragraph with left accent) */
:is(.oca-blog, .oca-content) .oca-answer { font-size: 19px; color: var(--oca-ink); border-left: 4px solid var(--oca-orange); padding-left: 18px; }
:is(.oca-blog, .oca-content) .oca-answer strong { font-weight: 600; }

/* ---------- CTA banner (mid-article, dark) ---------- */
:is(.oca-blog, .oca-content) .oca-mid-cta { background: #1C1847; color: #D8D4F0; border-radius: 22px; padding: 26px 28px; margin: 56px 0 0; display: grid; gap: 4px; }
:is(.oca-blog, .oca-content) .oca-mid-cta p, :is(.oca-blog, .oca-content) .oca-mid-cta span { margin: 0; color: #D8D4F0 !important; }
:is(.oca-blog, .oca-content) .oca-mid-cta p:first-child strong { font-family: var(--oca-display); font-size: 24px; letter-spacing: -.02em; color: #fff !important; }
:is(.oca-blog, .oca-content) .oca-mid-cta :is(p:last-child, .oca-actions) { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 0; }
/* buttons (links with oca-btn / oca-btn-line) */
:is(.oca-blog, .oca-content) a.oca-btn, :is(.oca-blog, .oca-content) a.oca-btn-line { display: inline-block; font-size: 15px; font-weight: 700; padding: 13px 22px; border-radius: 999px; text-decoration: none !important; line-height: 1.2; box-sizing: border-box; }
:is(.oca-blog, .oca-content) a.oca-btn { background: var(--oca-orange); color: #1C1847 !important; }
:is(.oca-blog, .oca-content) a.oca-btn:hover, :is(.oca-blog, .oca-content) a.oca-btn:focus { background: #F58A3F; color: #1C1847 !important; }
:is(.oca-blog, .oca-content) a.oca-btn-line { border: 1.5px solid #fff; color: #fff !important; font-weight: 600; background: transparent; }
:is(.oca-blog, .oca-content) a.oca-btn-line:hover, :is(.oca-blog, .oca-content) a.oca-btn-line:focus { background: #fff; color: #1C1847 !important; }

/* ---------- FAQ (blog-faq block) ---------- */
:is(.oca-blog, .oca-content) .blog-faq__item { background: var(--oca-surface); border: 1px solid var(--oca-line); border-radius: 18px; padding: 18px 22px; margin: 16px 0 0; }
:is(.oca-blog, .oca-content) h3.blog-faq__question { margin: 0; padding: 0 0 6px; font-size: 19px; }
:is(.oca-blog, .oca-content) .blog-faq__answer p { margin: 0; font-size: 16px; }
:is(.oca-blog, .oca-content) .blog-faq__answer p + p { margin-top: 12px; }

/* ---------- CTA band (closing, dark with colour wheel) ---------- */
:is(.oca-blog, .oca-content) .oca-band { background: #1C1847; color: #D8D4F0; border-radius: 26px; padding: clamp(26px,5vw,44px); margin: 30px 0 0; position: relative; overflow: hidden; }
:is(.oca-blog, .oca-content) .oca-band::after { content: ""; position: absolute; right: -70px; bottom: -70px; width: 220px; height: 220px; border-radius: 50%; background: conic-gradient(#E8175D 0 22%,#F2711C 22% 41%,#FDB03C 41% 52%,#8E2C96 52% 74%,#5545A0 74% 100%); opacity: .9; }
:is(.oca-blog, .oca-content) .oca-band > * { position: relative; z-index: 1; max-width: none; width: 100%; }
:is(.oca-blog, .oca-content) .oca-band p, :is(.oca-blog, .oca-content) .oca-band span { margin: 0 0 14px; color: #D8D4F0 !important; }
:is(.oca-blog, .oca-content) .oca-band p:first-child strong { display: block; font-family: var(--oca-display); font-weight: 800; font-size: clamp(26px,3.4vw,36px); line-height: 1.05; letter-spacing: -.03em; color: #fff !important; }
:is(.oca-blog, .oca-content) .oca-band .oca-actions { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0; margin: 20px 0; }
:is(.oca-blog, .oca-content) .oca-band p:last-child { font-size: 14px; margin: 0; color: #D8D4F0 !important; }
:is(.oca-blog, .oca-content) .oca-band p:last-child a { color: #FDC93C !important; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- author box ---------- */
:is(.oca-blog, .oca-content) .oca-author { display: flex; gap: 16px; align-items: flex-start; margin: 48px 0 0; padding: 24px; border: 1px solid var(--oca-line); border-radius: 20px; background: var(--oca-surface); }
:is(.oca-blog, .oca-content) .oca-author::before { content: "1CA"; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg,#F2711C,#E8175D 50%,#5545A0); color: #fff; font-family: var(--oca-display); font-weight: 800; font-size: 16px; }
:is(.oca-blog, .oca-content) .oca-author[data-initials]::before { content: attr(data-initials); }
:is(.oca-blog, .oca-content) .oca-author > div { min-width: 0; }
:is(.oca-blog, .oca-content) .oca-author strong { font-family: var(--oca-display); font-size: 18px; color: var(--oca-ink); }
:is(.oca-blog, .oca-content) .oca-author p { margin: 4px 0 0; font-size: 15px; }

/* ---------- sources (#sources = legacy id hook) ---------- */
:is(.oca-blog, .oca-content) :is(#sources, .oca-sources) h2 { font-size: 24px; }
:is(.oca-blog, .oca-content) :is(#sources, .oca-sources) p, :is(.oca-blog, .oca-content) :is(#sources, .oca-sources) li { font-size: 14px; color: var(--oca-muted); }
:is(.oca-blog, .oca-content) :is(#sources, .oca-sources) ol { padding-left: 1.4em; margin: 0; }
:is(.oca-blog, .oca-content) :is(#sources, .oca-sources) li { margin-bottom: 8px; }
:is(.oca-blog, .oca-content) :is(#sources, .oca-sources) li::marker { font-family: var(--oca-mono); color: var(--oca-orange); }

/* legacy markup: FAQ written as <section id="faq"><h3>Q</h3><p>A</p> (before the blog-faq block) */
.oca-blog #faq > h3 { background: var(--oca-surface); border: 1px solid var(--oca-line); border-bottom: 0; border-radius: 18px 18px 0 0; padding: 18px 22px 6px; margin: 16px 0 0; font-size: 19px; }
.oca-blog #faq > h3 + p { background: var(--oca-surface); border: 1px solid var(--oca-line); border-top: 0; border-radius: 0 0 18px 18px; padding: 0 22px 18px; margin: 0; font-size: 16px; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  .oca-blog { font-size: 16px; padding-left: 16px; padding-right: 16px; }
  .oca-blog section { padding-top: 40px; }
  .oca-blog section + section { margin-top: 40px; }
  :is(.oca-blog, .oca-content) .oca-toc ol { columns: 1; }
  :is(.oca-blog, .oca-content) .oca-tip { padding-left: 22px; padding-top: 60px; }
  :is(.oca-blog, .oca-content) .oca-band::after { width: 140px; height: 140px; right: -50px; bottom: -50px; }
  .oca-blog table { font-size: 14px; }
  .oca-blog th, .oca-blog td { padding: 10px 12px; }
}
