/* ============================================
   TEMPLATE 9: MINIMAL READING
   Ultra-clean single-column reading list,
   640px max-width, no card backgrounds or
   borders, maximum whitespace, pure focus
   on content
   ============================================ */

:root {
  --bg: #0D0D1A;
  --surface: #1A1429;
  --text: #F5F7FA;
  --text-muted: #A9B4C0;
  --accent: #66B3FF;
  --accent-soft: #66B3FF14;
  --border: #2A2A3A;
  --radius: 12px;
  --font-body: 'Syne',system-ui,sans-serif;
  --font-heading: 'Instrument Serif',Georgia,serif;
  --font-mono: ui-monospace, "SF Mono", monospace;
  --accent-text: #0D0D1A;
  --logo-plate: #ffffff;
  --logo-plate-pad: 0.375rem;
  --radius-control: 8px;
  --page-wash: linear-gradient(135deg,var(--bg) 0%,#1A1429 100%);
  --card-bg: rgba(255,255,255,.04);
  --card-border: 1px solid var(--border);
  --shadow-card: none;
}

/* ---- BASE ---- */
.blog-page,
.blog-page *,
.blog-page *::before,
.blog-page *::after {
  box-sizing: border-box;
}
.blog-page {
  /* Layout-internal values (prefixed so brand vars never collide).
     Everything — header, list, post, footer — shares one 40rem column. */
  --_gutter: clamp(1.25rem, 5vw, 2rem);
  --_column: 40rem;
  --_ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.7;
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.blog-page :where(h1, h2, h3, p, blockquote, ul, ol, figure) {
  margin: 0;
}
.blog-page :where(h1, h2, h3) {
  text-wrap: balance;
}
.blog-page :where(p, li) {
  text-wrap: pretty;
}
.blog-page img {
  max-width: 100%;
  height: auto;
}
.blog-page ::selection {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.blog-page :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---- HEADER ---- */
.blog-header {
  background: var(--bg);
}
.blog-header-inner {
  max-width: calc(var(--_column) + 2 * var(--_gutter));
  margin: 0 auto;
  padding: 2rem var(--_gutter) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.blog-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.blog-header-logo {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  border-radius: var(--radius);
}
.blog-header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.blog-header-link,
.blog-header-cta {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: color 0.2s var(--_ease);
  font-family: var(--font-ui);
}
.blog-header-link:hover,
.blog-header-link[aria-current="page"],
.blog-header-cta:hover {
  color: var(--text);
}
.blog-header-cta::after {
  content: " \2197";
}

/* ---- HERO — quiet intro, left aligned ---- */
.blog-hero {
  width: 100%;
  max-width: calc(var(--_column) + 2 * var(--_gutter));
  margin: 0 auto;
  padding: clamp(4rem, 10vw, 6rem) var(--_gutter) clamp(2.5rem, 6vw, 3.5rem);
}
.blog-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: var(--heading-weight, 600);
  line-height: 1.2;
  letter-spacing: var(--heading-tracking, -0.03em);
  color: var(--text);
  margin-bottom: 0.75rem;
  text-transform: var(--heading-case);
}
.blog-hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 32rem;
}
.blog-hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 1.25rem;
}
.blog-hero-tag {
  font-size: 0.875rem;
  color: var(--text-muted);
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-case);
  font-family: var(--font-ui);
}

/* ---- POST INDEX — plain reading list ---- */
.blog-index {
  width: 100%;
  max-width: calc(var(--_column) + 2 * var(--_gutter));
  margin: 0 auto;
  padding: 0 var(--_gutter) clamp(4rem, 10vw, 6rem);
}
.blog-index-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.blog-card a {
  display: flex;
  flex-direction: column;
  margin: 0 -1rem;
  padding: 1.25rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.2s var(--_ease);
}
.blog-card a:hover {
  background: var(--surface);
}
.blog-card-date {
  order: 2;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--label-tracking);
  text-transform: var(--label-case);
  font-family: var(--font-ui);
}
.blog-card-title {
  order: 0;
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: var(--heading-weight, 600);
  line-height: 1.4;
  letter-spacing: var(--heading-tracking, -0.015em);
  color: var(--text);
  margin-bottom: 0.25rem;
  text-transform: var(--heading-case);
}
.blog-card a:hover .blog-card-title {
  color: var(--accent);
}
.blog-card-excerpt {
  order: 1;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.blog-card-meta,
.blog-card-tags,
.blog-card-link {
  display: none;
}
.blog-empty {
  color: var(--text-muted);
  padding: 2rem 0;
}

/* ---- SINGLE POST ---- */
.blog-post {
  width: 100%;
  max-width: calc(var(--_column) + 2 * var(--_gutter));
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 5rem) var(--_gutter) clamp(4rem, 10vw, 6rem);
}
.blog-post-back {
  display: inline-block;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.2s var(--_ease);
  font-family: var(--font-ui);
}
.blog-post-back::before {
  content: "\2190  ";
}
.blog-post-back:hover {
  color: var(--text);
}
.blog-post-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.5rem;
  margin-bottom: 2.5rem;
}
.blog-post-title,
.blog-post-excerpt,
.blog-post-tags {
  flex-basis: 100%;
}
.blog-post-title {
  order: -2;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4.5vw, 2.25rem);
  font-weight: var(--heading-weight, 600);
  line-height: 1.2;
  letter-spacing: var(--heading-tracking, -0.03em);
  color: var(--text);
  margin-bottom: 0.75rem;
  text-transform: var(--heading-case);
}
.blog-post-excerpt {
  order: -1;
  font-size: 1.125rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
}
.blog-post-date,
.blog-post-author,
.blog-post-reading-time {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.blog-post-date ~ .blog-post-author::before,
.blog-post-date ~ .blog-post-reading-time::before {
  content: "\00B7";
  margin-right: 0.5rem;
}

/* ---- PROSE ---- */
.blog-prose {
  font-size: 1.0625rem;
  line-height: var(--leading, 1.75);
  color: var(--text);
}
.blog-prose h1,
.blog-prose h2,
.blog-prose h3 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight, 600);
  line-height: 1.35;
  letter-spacing: var(--heading-tracking, -0.02em);
  color: var(--text);
  margin: 2.5rem 0 0.75rem;
  scroll-margin-top: 2rem;
  text-transform: var(--heading-case);
}
.blog-prose > :first-child {
  margin-top: 0;
}
.blog-prose h1 { font-size: 1.5rem; }
.blog-prose h2 { font-size: 1.25rem; }
.blog-prose h3 { font-size: 1.0625rem; }
.blog-prose p {
  margin-bottom: 1.25rem;
}
.blog-prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--text) 25%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s var(--_ease), color 0.2s var(--_ease);
}
.blog-prose a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
.blog-prose strong {
  font-weight: 600;
}
.blog-prose em {
  font-style: italic;
}
.blog-prose blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--text);
  color: var(--text);
  font-style: italic;
}
.blog-prose blockquote p {
  margin: 0;
}
.blog-prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15em 0.35em;
  border-radius: var(--radius);
  color: var(--text);
}
.blog-prose ul,
.blog-prose ol {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}
.blog-prose li {
  margin-bottom: 0.375rem;
  padding-left: 0.25rem;
}
.blog-prose li::marker {
  color: var(--text-muted);
}
.blog-prose hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ---- TABLES ---- */
.blog-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.blog-prose th {
  font-weight: 500;
  color: var(--text-muted);
  text-align: left;
  padding: 0.625rem 1rem 0.625rem 0;
  border-bottom: 1px solid var(--text);
}
.blog-prose td {
  padding: 0.625rem 1rem 0.625rem 0;
  border-bottom: 1px solid var(--border);
}

/* ---- CTA — no box, just a divider ---- */
.blog-post .blog-cta {
  --cta-card-bg: transparent;
  --cta-card-border: none;
  --cta-card-radius: 0px;
  --cta-button-hover-shadow: inset 0 0 0 100vmax color-mix(in srgb, var(--text) 14%, transparent);
  --cta-button-hover-transform: none;
  --cta-logo-size: 1.75rem;
}
.blog-post .blog-cta:not(.blog-cta--background-image):not(.blog-cta--split) {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0 0;
  text-align: left;
}
.blog-post .blog-cta:not(.blog-cta--background-image) .blog-cta__logo {
  margin-inline: 0;
}
.blog-post .blog-cta .blog-cta__inner {
  max-width: none;
  margin: 0;
}
.blog-post .blog-cta .blog-cta__actions,
.blog-post .blog-cta .blog-cta__reassurances {
  justify-content: flex-start;
}
.blog-post .blog-cta--value-stack .blog-cta__description {
  margin-inline: 0;
}
.blog-post .blog-cta .blog-cta__point {
  flex-direction: row;
  align-items: center;
}
.blog-post .blog-cta--split {
  --cta-card-radius: var(--radius);
  --cta-card-border: 1px solid var(--border);
}
.blog-post .blog-cta--background-image .blog-cta__inner {
  max-width: 36rem;
  margin: 0 auto;
}
.blog-post .blog-cta--background-image .blog-cta__actions {
  justify-content: center;
}

/* ---- FOOTER ---- */
.blog-footer {
  margin-top: auto;
  padding: 0 0 2.5rem;
}
.blog-footer-inner {
  max-width: calc(var(--_column) + 2 * var(--_gutter));
  margin: 0 auto;
  padding: 1.5rem var(--_gutter) 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
}
.blog-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.blog-footer-logo {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}
.blog-footer-copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.blog-footer-links {
  display: flex;
  gap: 1.25rem;
}
.blog-footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s var(--_ease);
}
.blog-footer-link:hover {
  color: var(--text);
}

/* ---- OPTIONAL MARKUP: tags, author, reading time, hero image ---- */
.blog-card-author {
  font-weight: 500;
}
.blog-card-tag:not(:last-child)::after {
  content: ",";
}
.blog-hero-image {
  margin-top: 2.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
}
.blog-hero-image img {
  width: 100%;
  height: auto;
  display: block;
}
.blog-post-author strong {
  color: var(--text);
  font-weight: 500;
}
.blog-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  margin-top: 0.5rem;
}
.blog-post-tag {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.blog-post-tag::before {
  content: "#";
}

/* ---- RESPONSIVE + MOTION ---- */
@media (max-width: 640px) {
  .blog-card a {
    margin: 0;
    padding: 1rem 0;
  }
  .blog-prose table {
    display: block;
    overflow-x: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .blog-page *,
  .blog-page *::before,
  .blog-page *::after {
    transition-duration: 0.01ms !important;
  }
}


/* ============================================
   BASE — shared robustness layer for every layout template.
   Appended after the template CSS (and before cta-variants.css), so it only
   covers things templates do not design: unstyled post-body elements,
   keyboard focus, reduced motion, small screens, print. It uses the same
   --tokens as the templates and has no :root block of its own.
   Visual design stays in the templates.
   ============================================ */

/* Sidebar links scroll the page smoothly instead of jumping. Set on <html>
   (the scrolling box); the reduced-motion block below re-enables "auto" so
   readers who ask for less motion still jump. */
html {
  scroll-behavior: smooth;
}
.blog-page {
  overflow-wrap: break-word;
  -webkit-text-size-adjust: 100%;
}
.blog-page img {
  max-width: 100%;
}

/* ---- POST BODY: elements the templates leave to the browser ---- */
.blog-post {
  min-width: 0;
}
.blog-prose {
  min-width: 0;
  /* "anywhere" (unlike break-word) also lowers min-content, so a long URL
     cannot widen the auto-margined article on small screens. */
  overflow-wrap: anywhere;
}
.blog-prose img,
.blog-prose video,
.blog-prose svg {
  max-width: 100%;
  height: auto;
}
.blog-prose iframe {
  max-width: 100%;
}
.blog-prose img,
.blog-prose video {
  display: block;
  margin: 2rem auto;
  border-radius: var(--radius);
}
.blog-prose figure {
  margin: 2rem 0;
}
.blog-prose figure img {
  margin: 0 auto;
}
.blog-prose figcaption {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}
.blog-prose pre {
  margin: 2rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
  /* Scrolls inside itself; without this its longest line sets the intrinsic
     width of the auto-margined article and widens the whole page. */
  contain: inline-size;
}
/* Undo the inline-code chip (templates style bare `code`) inside blocks. */
.blog-prose pre code {
  display: block;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: inherit;
  font-size: inherit;
  white-space: pre;
}
.blog-prose kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  background: var(--surface);
}
.blog-prose :is(h1, h2, h3, h4, h5, h6) {
  scroll-margin-top: 5rem; /* clear the sticky header on #anchor jumps */
}
.blog-prose h4 {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}
.blog-prose li > p {
  margin-bottom: 0.5rem;
}
.blog-prose li > :is(ul, ol) {
  margin: 0.5rem 0;
}
.blog-prose > :first-child {
  margin-top: 0;
}
.blog-prose > :last-child {
  margin-bottom: 0;
}

/* No author before it, so no separator dot. */
.blog-card-meta > .blog-card-reading-time:first-child::before {
  content: none;
}

/* ---- AUTHOR BOX (post pages; only for an author with a bio) ---- */
.blog-author-box {
  max-width: 48rem;
  margin: 3rem 0 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius, 0.5rem);
  background: var(--surface);
}
.blog-author-box__label {
  margin: 0 0 0.25rem;
  font-family: var(--font-ui, inherit);
  font-size: 0.75rem;
  font-weight: var(--label-weight, 600);
  letter-spacing: var(--label-tracking, 0.06em);
  text-transform: var(--label-case, uppercase);
  color: var(--text-muted);
}
.blog-author-box__name {
  margin: 0 0 0.375rem;
  font-family: var(--font-heading);
  font-weight: var(--heading-weight, 700);
  color: var(--text);
}
.blog-author-box__bio {
  margin: 0;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ---- FAQ SECTION (blog index and post pages) ----
   Lives inside .blog-index / .blog-post, so it takes each template's own
   container width and gutters. Type follows the same personality tokens as the
   rest of the template (heading weight/tracking/case, UI font, leading, radius);
   each falls back to a neutral value when the brand sets none. */
.blog-faq {
  max-width: 48rem;
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
}
.blog-post .blog-faq {
  margin: 3.5rem 0;
}
.blog-faq__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: var(--heading-weight, 700);
  letter-spacing: var(--heading-tracking, normal);
  text-transform: var(--heading-case, none);
  line-height: 1.25;
  margin: 0 0 1.25rem;
}
.blog-faq__item {
  border-top: 1px solid var(--border);
}
.blog-faq__item:last-child {
  border-bottom: 1px solid var(--border);
}
.blog-faq__question {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0;
  font-family: var(--font-ui, inherit);
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}
.blog-faq__question::-webkit-details-marker {
  display: none;
}
.blog-faq__question::after {
  content: "+";
  flex: none;
  color: var(--accent);
  font-weight: 400;
}
.blog-faq__item[open] > .blog-faq__question::after {
  content: "\2212";
}
.blog-faq__answer {
  margin: 0;
  padding: 0 0 1.25rem;
  color: var(--text-muted);
  line-height: var(--leading, 1.65);
}

/* ---- READING PROGRESS BAR: a thin bar along the top of the window that fills
   as a post is read and never moves backwards. Shown whenever the sidebar rail
   below is not (small screens, narrow margins, posts without headings). ---- */
.blog-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 60;
  pointer-events: none;
}
.blog-progress__bar {
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--read, 0));
  transition: transform 0.1s linear;
}
.blog-post:is([data-toc-mode="margin"], [data-toc-mode="shift"], [data-toc-mode="squeeze"]) .blog-progress {
  display: none;
}

/* ---- POST SIDEBAR: table of contents with a reading indicator ----
   Wide screens (1024px and up): always shown. It sits in the margin beside the
   article when there is room; otherwise the page script slides the article left
   ("shift") or narrows it ("squeeze"). Below that width it becomes a "Contents"
   button with a panel ("panel"). The mode is data-toc-mode on .blog-post. */
.blog-post {
  position: relative;
}
.blog-toc {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 100%;
  width: 14rem;
  margin-left: 1rem;
}
.blog-post:is([data-toc-mode="margin"], [data-toc-mode="shift"], [data-toc-mode="squeeze"]) .blog-toc {
  display: block;
}
/* No room beside the article, but the window is wide: slide the article left to
   make some (--toc-shift is set by the page script)... */
.blog-post[data-toc-mode="shift"] {
  left: calc(var(--toc-shift, 0px) * -1);
}
/* ...or, for layouts whose article already fills the window, narrow it and put
   the sidebar in the freed space on the right. */
.blog-post[data-toc-mode="squeeze"] {
  padding-right: calc(15rem + var(--_gutter, 1.5rem));
}
.blog-post[data-toc-mode="squeeze"] .blog-toc {
  left: auto;
  right: var(--_gutter, 1.5rem);
  margin-left: 0;
}
.blog-toc__toggle {
  display: none;
}
.blog-toc__sticky {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  font-size: 0.8125rem;
  line-height: 1.4;
}
.blog-toc__title {
  margin: 0 0 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.blog-toc__track {
  position: relative;
  padding-left: 0.875rem;
}
/* The rail, and the part of it that fills as the post is read. */
.blog-toc__track::before,
.blog-toc__progress {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  background: var(--border);
}
.blog-toc__progress {
  background: var(--accent);
  transform-origin: top;
  transform: scaleY(var(--toc-progress, 0));
  transition: transform 0.12s linear;
}
.blog-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.blog-toc__item {
  margin: 0;
  /* H1 sits flush, H2 one step in, H3 two, and so on. */
  padding-left: calc(var(--toc-depth, 0) * 0.75rem);
}
.blog-toc__link {
  display: block;
  padding: 0.25rem 0;
  color: var(--text-muted);
  text-decoration: none;
}
.blog-toc__link:hover,
.blog-toc__link.is-read {
  color: var(--text);
}
.blog-toc__link[aria-current="location"] {
  color: var(--accent);
  font-weight: 600;
}

/* Collapsed form: a floating button that opens the same list as a panel. */
.blog-post[data-toc-mode="panel"] .blog-toc {
  display: block;
  position: fixed;
  top: auto;
  bottom: 1rem;
  right: 1rem;
  left: auto;
  width: auto;
  margin: 0;
  z-index: 50;
}
.blog-post[data-toc-mode="panel"] .blog-toc .blog-toc__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.5rem 0.875rem;
  font-family: var(--font-ui, inherit);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control, 999px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}
.blog-post[data-toc-mode="panel"] .blog-toc .blog-toc__toggle::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-1px, -1px);
  transition: transform 0.15s ease;
}
.blog-post[data-toc-mode="panel"] .blog-toc[data-open] .blog-toc__toggle::after {
  transform: rotate(45deg) translate(-1px, -1px);
}
.blog-post[data-toc-mode="panel"] .blog-toc .blog-toc__sticky {
  display: none;
  /* Keep this its own scroll container (it can scroll when the list is long),
     so a #anchor jump is scrolled by the page, not silently absorbed here. */
  overscroll-behavior: contain;
  position: absolute;
  top: auto;
  right: 0;
  bottom: calc(100% + 0.5rem);
  width: min(20rem, calc(100vw - 2rem));
  max-height: min(60vh, 28rem);
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius, 0.5rem);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  font-size: 0.875rem;
}
.blog-post[data-toc-mode="panel"] .blog-toc[data-open] .blog-toc__sticky {
  display: block;
}
.blog-post[data-toc-mode="panel"] .blog-toc .blog-toc__link {
  padding: 0.4rem 0;
}

/* ---- KEYBOARD FOCUS ---- */
.blog-page :is(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ---- REDUCED MOTION: keep colour changes, drop movement ---- */
@media (prefers-reduced-motion: reduce) {
  .blog-page *,
  .blog-page *::before,
  .blog-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .blog-card:hover,
  .blog-card a:hover,
  .blog-card-link:hover {
    transform: none !important;
  }
}

/* ---- SMALL SCREENS ---- */
@media (max-width: 640px) {
  .blog-header-inner {
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .blog-header-nav {
    gap: 1rem;
  }
  .blog-hero,
  .blog-index,
  .blog-post {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .blog-footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .blog-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }
  .blog-footer-links {
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
  }
  .blog-prose pre {
    padding: 0.875rem 1rem;
    font-size: 0.8125rem;
  }
  /* Wide tables scroll inside themselves instead of widening the page. */
  .blog-prose table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    contain: inline-size;
  }
  .blog-prose :is(th, td) {
    overflow-wrap: normal;
    min-width: 6rem;
  }
}

/* ---- PRINT ---- */
@media print {
  .blog-header,
  .blog-footer,
  .blog-post-back,
  .blog-toc,
  .blog-progress,
  .blog-cta,
  [class*="blog-cta--"] {
    display: none !important;
  }
  .blog-page {
    background: #fff;
    color: #000;
    min-height: 0;
  }
  .blog-post {
    max-width: none;
    padding: 0;
  }
  .blog-prose pre {
    white-space: pre-wrap;
    overflow: visible;
  }
  .blog-prose a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
}


/* ============================================
   CTA VARIANT STYLES
   Shared component styles injected into every
   layout template (loaded last). Uses the same token contract:
   --bg, --surface, --text, --text-muted,
   --accent, --accent-soft, --accent-text, --border,
   --radius, --font-heading, --font-body.

   --accent-text is auto-derived via WCAG contrast
   ratio, so text on an --accent fill stays readable
   for any accent hue.

   LAYOUT HOOKS
   Layouts restyle every variant at once by setting
   these on `.blog-post .blog-cta` (that selector
   out-ranks the defaults below):
     --cta-card-bg       panel fill
     --cta-card-border   panel border (shorthand)
     --cta-card-radius   panel corner radius
     --cta-card-shadow   panel elevation
     --cta-radius        control (button) radius
     --cta-pad           panel padding
     --cta-button-bg / -shadow / -hover-shadow / -hover-transform
                         primary button treatment
     --cta-logo-size     logo height (0 hides it)
   Brands can set the button too, via the --button-*
   tokens derived from their CSS (templates.ts). The
   brand wins over the layout; the layout wins over
   the defaults here.
   Nothing here may hard-code a light or dark colour
   that sits on a brand colour: brands can make any
   layout dark.
   ============================================ */

.blog-cta {
  --cta-bg: var(--surface);
  --cta-text: var(--text);
  --cta-text-muted: var(--text-muted);
  --cta-accent: var(--accent);
  --cta-accent-soft: var(--accent-soft);
  --cta-accent-text: var(--accent-text);
  --cta-border: var(--border);
  --cta-radius: min(var(--radius), 2rem);
  /* Panels clip their children, so a pill radius would cut into the text.
     Cap the corner so the padding always clears the curve. */
  --cta-card-radius: min(var(--radius), 1.25rem);
  --cta-card-bg: var(--cta-bg);
  --cta-card-border: 1px solid var(--cta-border);
  --cta-card-shadow: none;
  --cta-pad: clamp(1.75rem, 4vw, 2.75rem);
  --cta-button-bg: var(--cta-accent);
  --cta-button-shadow: none;
  --cta-button-hover-shadow:
    0 0 0 1px color-mix(in srgb, var(--cta-accent) 40%, transparent),
    0 8px 24px -8px color-mix(in srgb, var(--cta-accent) 70%, transparent);
  --cta-button-hover-transform: translateY(-1px);
  --cta-logo-size: 2.25rem;
  /* Always-dark ink for the background-image variant, tinted by the brand. */
  --cta-ink: color-mix(in srgb, var(--cta-accent) 22%, #0b0d12);

  margin: 3.5rem 0 0;
  padding: 0;
  color: var(--cta-text);
  font-family: var(--font-body);
}

.blog-cta__inner {
  max-width: 40rem;
  margin: 0 auto;
}

/* ---- Shared typography ---- */
.blog-cta__eyebrow {
  margin: 0 0 0.625rem;
  font-family: var(--font-ui, var(--font-body));
  font-size: 0.75rem;
  font-weight: var(--label-weight, 600);
  line-height: 1.3;
  text-transform: var(--label-case, uppercase);
  letter-spacing: var(--label-tracking, 0.08em);
  color: var(--cta-accent);
}

.blog-cta__title {
  margin: 0 0 0.625rem;
  font-family: var(--font-heading);
  font-size: clamp(1.375rem, 2.6vw, 1.875rem);
  font-weight: var(--heading-weight, 700);
  line-height: 1.2;
  letter-spacing: var(--heading-tracking, -0.01em);
  text-transform: var(--heading-case, none);
  text-wrap: balance;
  color: inherit;
}

.blog-cta__description {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--cta-text-muted);
  text-wrap: pretty;
}

.blog-cta__footer {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: var(--cta-text-muted);
}

/* ---- Shared actions ---- */
.blog-cta__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.blog-cta__primary,
.blog-cta__secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.6875rem 1.375rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-control, var(--cta-radius));
  font-family: var(--font-ui, var(--font-body));
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.blog-cta__primary {
  background: var(--button-bg, var(--cta-button-bg));
  border-color: transparent;
  color: var(--cta-accent-text);
  box-shadow: var(--button-shadow, var(--cta-button-shadow));
}

.blog-cta__primary::after {
  content: "\2192";
  margin-left: 0.5em;
  transition: transform 0.15s;
}

.blog-cta__primary:hover {
  box-shadow: var(--button-hover-shadow, var(--cta-button-hover-shadow));
  transform: var(--button-hover-transform, var(--cta-button-hover-transform));
}

.blog-cta__primary:active {
  transform: none;
}

.blog-cta__primary:hover::after {
  transform: translateX(3px);
}

.blog-cta__secondary {
  background: transparent;
  border-color: var(--cta-border);
  color: var(--cta-text);
}

.blog-cta__secondary:hover {
  background: var(--cta-accent-soft);
  border-color: var(--cta-accent);
}

.blog-cta__primary:focus-visible,
.blog-cta__secondary:focus-visible {
  outline: 2px solid var(--cta-accent);
  outline-offset: 3px;
}

/* ---- Logo ---- */
/* The product logo sits above the copy at a fixed height, whatever its
   natural size. Two classes in the selector: every layout has
   `.blog-page img { max-width: 100%; height: auto }`, which out-ranks a
   single class and would show the logo at its natural size.
   Logos are often dark marks on a transparent ground, so dark brands
   (--logo-plate, set in templates.ts) and the coloured or dark variants
   (split, background-image) put it on a light plate. */
.blog-cta .blog-cta__logo {
  display: block;
  box-sizing: content-box;
  width: auto;
  max-width: min(10rem, 100%);
  height: var(--cta-logo-size);
  max-height: 3rem;
  margin: 0 0 1rem;
  padding: var(--logo-plate-pad, 0);
  object-fit: contain;
  background: var(--logo-plate, transparent);
  border-radius: min(var(--cta-card-radius), 0.625rem);
}

.blog-cta--minimal .blog-cta__logo,
.blog-cta--value-stack .blog-cta__logo,
.blog-cta--question-led .blog-cta__logo,
.blog-cta--background-image .blog-cta__logo {
  margin-inline: auto;
}

.blog-cta--split .blog-cta__logo,
.blog-cta--background-image .blog-cta__logo {
  padding: 0.375rem;
  background: #fff;
}

/* ---- Shared panel ---- */
.blog-cta--minimal,
.blog-cta--split,
.blog-cta--value-stack,
.blog-cta--side-by-side,
.blog-cta--question-led {
  background: var(--cta-card-bg);
  border: var(--cta-card-border);
  border-radius: var(--cta-card-radius);
  box-shadow: var(--cta-card-shadow);
}

/* ---- MINIMAL ---- */
.blog-cta--minimal {
  padding: var(--cta-pad);
  text-align: center;
}

.blog-cta--minimal .blog-cta__inner {
  max-width: 34rem;
}

.blog-cta--minimal .blog-cta__actions {
  justify-content: center;
}

/* ---- SPLIT ---- */
.blog-cta--split {
  display: grid;
  overflow: hidden;
}

.blog-cta--split .blog-cta__split-pitch {
  padding: var(--cta-pad);
  background: var(--cta-accent);
  color: var(--cta-accent-text);
}

.blog-cta--split .blog-cta__eyebrow,
.blog-cta--split .blog-cta__description {
  color: inherit;
}

.blog-cta--split .blog-cta__eyebrow {
  opacity: 0.8;
}

.blog-cta--split .blog-cta__description {
  margin-bottom: 0;
  opacity: 0.9;
}

.blog-cta--split .blog-cta__split-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: var(--cta-pad);
}

.blog-cta--split .blog-cta__primary {
  min-width: 12rem;
}

.blog-cta--split .blog-cta__secondary {
  min-height: 0;
  padding: 0.25rem;
  border: none;
  color: var(--cta-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.blog-cta--split .blog-cta__secondary:hover {
  background: none;
  color: var(--cta-text);
}

@media (min-width: 640px) {
  .blog-cta--split {
    grid-template-columns: 3fr 2fr;
  }
}

/* ---- VALUE STACK ---- */
.blog-cta--value-stack {
  padding: var(--cta-pad);
  text-align: center;
}

.blog-cta--value-stack .blog-cta__actions {
  justify-content: center;
}

/* One supporting line between the headline and the benefits. */
.blog-cta--value-stack .blog-cta__description {
  max-width: 32rem;
  margin: 0 auto;
  font-size: 0.9375rem;
}

.blog-cta__points {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0 1.75rem;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .blog-cta__points {
    grid-template-columns: repeat(3, 1fr);
  }
}

.blog-cta__point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--cta-text);
}

/* A tick in an accent-soft disc. */
.blog-cta__point-dot {
  position: relative;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--cta-accent-soft);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--cta-accent) 35%, transparent);
}

.blog-cta__point-dot::after,
.blog-cta__check::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 28%;
  height: 50%;
  border: solid var(--cta-accent);
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* ---- SIDE BY SIDE ---- */
.blog-cta--side-by-side {
  display: grid;
  gap: 1.5rem;
  align-items: center;
  padding: var(--cta-pad);
}

.blog-cta--side-by-side .blog-cta__description {
  margin-bottom: 0;
}

.blog-cta--side-by-side .blog-cta__actions {
  flex-direction: column;
  align-items: stretch;
}

@media (min-width: 640px) {
  .blog-cta--side-by-side {
    grid-template-columns: 1fr auto;
    gap: 2.5rem;
  }
}

/* ---- BACKGROUND IMAGE ---- */
/* Always dark (brand-tinted ink), so white copy works on light and dark
   brands alike. */
.blog-cta--background-image {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: calc(var(--cta-pad) * 1.4) var(--cta-pad);
  border-radius: var(--cta-card-radius);
  background:
    radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--cta-accent) 45%, transparent), transparent 65%),
    var(--cta-ink);
  color: #fff;
  text-align: center;
}

.blog-cta--background-image .blog-cta__description {
  color: rgba(255, 255, 255, 0.78);
}

.blog-cta--background-image .blog-cta__actions {
  justify-content: center;
}

.blog-cta__bg-pattern {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.22) 1px, transparent 1.5px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(80% 80% at 50% 50%, #000, transparent);
  mask-image: radial-gradient(80% 80% at 50% 50%, #000, transparent);
  pointer-events: none;
}

.blog-cta .blog-cta__primary--inverted {
  background: #fff;
  border-color: #fff;
  color: #0b0d12;
  box-shadow: none;
}

.blog-cta .blog-cta__primary--inverted:hover {
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18), 0 8px 28px -6px rgba(255, 255, 255, 0.35);
}

.blog-cta__secondary--inverted {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.blog-cta__secondary--inverted:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
}

.blog-cta--background-image .blog-cta__primary:focus-visible,
.blog-cta--background-image .blog-cta__secondary:focus-visible {
  outline-color: #fff;
}

/* ---- QUESTION LED ---- */
.blog-cta--question-led {
  padding: var(--cta-pad);
  text-align: center;
}

.blog-cta--question-led .blog-cta__actions {
  justify-content: center;
}

.blog-cta__reassurances {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--cta-text-muted);
}

.blog-cta__reassurance {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.blog-cta__check {
  position: relative;
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
}

.blog-cta__check::after {
  border-width: 0 1.75px 1.75px 0;
}

/* ---- Small screens ---- */
@media (max-width: 479px) {
  .blog-cta__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .blog-cta__primary,
  .blog-cta__secondary {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blog-cta__primary,
  .blog-cta__secondary,
  .blog-cta__primary::after {
    transition: none;
  }

  .blog-cta__primary:hover,
  .blog-cta__primary:hover::after {
    transform: none;
  }
}
