/* ============================================================
   Blog hub + article template
   Loaded after styles.css and system.css.
   ============================================================ */

/* ---------- hub hero ---------- */
.bg-hero { padding: 72px 0 8px; }
.bg-hero h1 {
  font-size: clamp(38px, 5.4vw, 72px);
  line-height: .98;
  letter-spacing: -.035em;
  margin: 16px 0 0;
  max-width: 15ch;
}
.bg-hero h1 em { font-family: var(--font-editorial, "Instrument Serif", Georgia, serif); font-style: italic; font-weight: 400; letter-spacing: -.015em; }
.bg-hero .bg-dek { max-width: 56ch; margin-top: 18px; }

/* ---------- featured post ---------- */
.bg-feature {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 0;
  margin-top: 44px;
  border: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface, #fff);
  text-decoration: none;
  color: inherit;
  transition: box-shadow .25s ease, transform .25s ease;
}
.bg-feature:hover { transform: translateY(-2px); box-shadow: 0 18px 44px rgba(23,21,27,.09); }
.bg-feature-media { position: relative; aspect-ratio: 16/11; overflow: hidden; background: var(--canvas, #F6F2EF); }
.bg-feature-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-feature-body { padding: 40px 42px; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.bg-feature-body h2 { font-size: clamp(24px, 2.5vw, 34px); line-height: 1.1; letter-spacing: -.025em; margin: 0; }
.bg-feature-body p { margin: 0; color: var(--ink-secondary, #5A565D); line-height: 1.6; }

/* ---------- meta line ---------- */
.bg-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted, #6A6469); }
.bg-meta .bg-dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.bg-cat {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(33,72,216,.09); color: var(--primary, #2148D8);
}
.bg-card .bg-cat, .bg-feature-body .bg-cat, .bg-related-card .bg-cat, .bg-head .bg-cat { align-self: flex-start; }

.bg-cat.is-ops { background: rgba(255,201,60,.28); color: #6B4A00; }
.bg-cat.is-search { background: rgba(124,58,237,.10); color: #5B21B6; }

/* ---------- filters ---------- */
.bg-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 46px 0 26px; }
.bg-filter {
  appearance: none; border: 1px solid var(--border); background: transparent;
  font: inherit; font-size: 14px; color: var(--ink-secondary, #5A565D);
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.bg-filter:hover { border-color: var(--ink); color: var(--ink); }
.bg-filter[aria-pressed="true"] { background: var(--ink, #17151B); border-color: var(--ink, #17151B); color: #fff; }
.bg-count { margin-left: auto; font-size: 13px; color: var(--ink-muted, #6A6469); }

.bg-grid.g2 { grid-template-columns: repeat(2, 1fr); }

/* ---------- post grid ---------- */
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.bg-card {
  display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background: var(--surface, #fff); text-decoration: none; color: inherit;
  transition: transform .22s ease, box-shadow .22s ease;
}
.bg-card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(23,21,27,.08); }
.bg-card-media { aspect-ratio: 16/10; overflow: hidden; background: var(--canvas, #F6F2EF); }
.bg-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bg-card-body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.bg-card-body h3 { font-size: 19px; line-height: 1.22; letter-spacing: -.015em; margin: 0; }
.bg-card-body p { margin: 0; font-size: 14.5px; line-height: 1.55; color: var(--ink-secondary, #5A565D); }
.bg-card-body .bg-meta { margin-top: auto; font-size: 11.5px; }

/* ---------- article layout ---------- */
.bg-article { padding: 34px 0 80px; }
/* One centred column. The article used to sit at the viewport's left edge with
   1012px of grid to fill and 598px of text in it, which left a dead band on the
   right and a headline squeezed to 378px. */
.bg-article > .wrap { max-width: 1060px; }
.bg-crumbs { font-size: 13px; color: var(--ink-muted, #6A6469); display: flex; gap: 8px; flex-wrap: wrap; }
.bg-crumbs a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.bg-crumbs a:hover { border-bottom-color: currentColor; }

.bg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  align-items: start;
  margin-top: 26px;
}
.bg-head { max-width: none; }
.bg-head h1 { font-size: clamp(32px, 4vw, 52px); line-height: 1.04; letter-spacing: -.03em; margin: 14px 0 0; }
.bg-standfirst { font-size: clamp(17px, 1.5vw, 20px); line-height: 1.55; color: var(--ink-secondary, #5A565D); margin: 18px 0 0; max-width: 58ch; }

.bg-hero-img { margin: 30px 0 0; }
.bg-hero-img img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
  object-fit: cover; border-radius: 18px; background: var(--surface, #fff);
}

.bg-byline { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.bg-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--primary, #2148D8); color: #fff;
  font-size: 13px; font-weight: 700; letter-spacing: .02em;
}
.bg-byline-text { font-size: 13.5px; line-height: 1.45; color: var(--ink-secondary, #5A565D); }
.bg-byline-text b { color: var(--ink); font-weight: 600; }

/* ---------- short answer (AEO) ---------- */
.bg-answer {
  margin: 34px 0 0; padding: 22px 24px;
  border: 1px solid rgba(33,72,216,.22);
  border-left: 3px solid var(--primary, #2148D8);
  border-radius: 14px;
  background: rgba(33,72,216,.04);
  max-width: none;
}
.bg-answer h2 {
  font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--primary, #2148D8); margin: 0 0 8px; font-weight: 700;
}
.bg-answer p { margin: 0; font-size: 16px; line-height: 1.62; }

/* ---------- prose ---------- */
.bg-prose { max-width: none; margin-top: 40px; }
.bg-prose h2 {
  font-size: clamp(23px, 2.3vw, 30px); line-height: 1.15; letter-spacing: -.025em;
  margin: 46px 0 14px; scroll-margin-top: 118px;
}
.bg-prose h3 { font-size: 19px; line-height: 1.25; letter-spacing: -.012em; margin: 30px 0 10px; }
.bg-prose p { margin: 0 0 18px; font-size: 17px; line-height: 1.68; }
.bg-prose ul, .bg-prose ol { margin: 0 0 20px; padding-left: 22px; }
.bg-prose li { font-size: 17px; line-height: 1.66; margin-bottom: 9px; }
.bg-prose a { color: var(--primary, #2148D8); text-decoration: underline; text-underline-offset: 2px; }
.bg-prose strong { font-weight: 650; }
.bg-prose blockquote {
  margin: 30px 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--ink, #17151B);
  font-family: var(--font-editorial, "Instrument Serif", Georgia, serif);
  font-style: italic; font-size: 23px; line-height: 1.42;
}
.bg-prose table { width: 100%; border-collapse: collapse; margin: 24px 0; font-size: 15px; }
.bg-prose th, .bg-prose td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.bg-prose th { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-muted, #6A6469); }
.bg-prose td:first-child { font-weight: 600; }

/* ---------- takeaways ---------- */
.bg-takeaways { margin: 38px 0 0; padding: 24px 26px; border-radius: 16px; background: #FBF7F0; border: 1px solid #EDE4D6; }
.bg-takeaways h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 12px; color: #6B4A00; }
.bg-takeaways ul { margin: 0; padding-left: 20px; }
.bg-takeaways li { font-size: 15.5px; line-height: 1.6; margin-bottom: 8px; }

/* ---------- faq ---------- */
.bg-faq { margin-top: 46px; max-width: 66ch; }
.bg-faq h2 { font-size: clamp(22px, 2.2vw, 28px); letter-spacing: -.02em; margin: 0 0 18px; }
.bg-faq .stage h3 { font-size: 16.5px; margin: 0 0 8px; letter-spacing: -.01em; }
.bg-faq .stage p { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-secondary, #5A565D); }

/* ---------- author box ---------- */
.bg-author { margin-top: 52px; padding: 26px 28px; border: 1px solid var(--border); border-radius: 18px; display: flex; gap: 18px; align-items: flex-start; max-width: 66ch; background: var(--surface, #fff); }
.bg-author .bg-avatar { width: 52px; height: 52px; font-size: 15px; }
.bg-author h3 { margin: 0 0 6px; font-size: 16px; }
.bg-author p { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--ink-secondary, #5A565D); }
.bg-author a { color: var(--primary, #2148D8); }

/* ---------- related ---------- */
.bg-related { margin-top: 56px; }
.bg-related h2 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted, #6A6469); margin: 0 0 18px; }
.bg-related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 66ch; }
.bg-related-card { border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; text-decoration: none; color: inherit; background: var(--surface, #fff); transition: transform .2s ease, box-shadow .2s ease; }
.bg-related-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(23,21,27,.07); }
.bg-related-card h3 { margin: 8px 0 6px; font-size: 16.5px; line-height: 1.3; letter-spacing: -.01em; }
.bg-related-card p { margin: 0; font-size: 13.5px; color: var(--ink-muted, #6A6469); }

/* ---------- sticky rail ---------- */
.bg-rail { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 20px; }
.bg-toc { border: 1px solid var(--border); border-radius: 16px; padding: 20px 22px; background: var(--surface, #fff); }
.bg-toc h2 { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted, #6A6469); margin: 0 0 12px; }
.bg-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.bg-toc li { counter-increment: toc; margin: 0; }
.bg-toc a {
  display: block; padding: 7px 0 7px 26px; position: relative;
  font-size: 13.5px; line-height: 1.42; color: var(--ink-secondary, #5A565D);
  text-decoration: none; border-left: 2px solid transparent;
}
.bg-toc a::before { content: counter(toc, decimal-leading-zero); position: absolute; left: 8px; font-size: 10.5px; color: var(--ink-muted, #6A6469); top: 9px; }
.bg-toc a:hover { color: var(--ink); }
.bg-toc a.is-active { color: var(--primary, #2148D8); border-left-color: var(--primary, #2148D8); font-weight: 600; }
.bg-toc a.is-active::before { color: var(--primary, #2148D8); }

.bg-rail-cta { border-radius: 18px; padding: 24px 24px 26px; background: var(--ink, #17151B); color: #fff; }
.bg-rail-cta h2 { font-size: 17px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
.bg-rail-cta p { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; color: rgba(255,255,255,.72); }
.bg-rail-cta .button-primary { background: #FFC93C; color: #17151B; width: 100%; justify-content: center; }
.bg-rail-cta .bg-rail-link { display: block; margin-top: 10px; font-size: 13px; color: rgba(255,255,255,.8); text-align: center; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.3); padding-bottom: 2px; }

.bg-toc-mobile { display: none; margin: 30px 0 0; }

/* ---------- mobile floating cta ---------- */
.bg-float { display: none; }

@media (max-width: 1080px) {
  .bg-layout { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  /* centre the column when the rail stacks, otherwise the text returns to the left edge */
  .bg-crumbs, .bg-head, .bg-hero-img, .bg-answer, .bg-prose, .bg-byline, .bg-takeaways, .bg-faq, .bg-author { max-width: 640px; margin-left: auto; margin-right: auto; }
  .bg-rail { position: static; order: 2; max-width: 640px; margin: 34px auto 0; }
  .bg-rail .bg-toc { display: none; }
  .bg-toc-mobile { display: block; }
  .bg-grid, .bg-grid.g2 { grid-template-columns: 1fr 1fr; }
  .bg-feature { grid-template-columns: 1fr; }
  .bg-feature-body { padding: 28px; }
}

@media (max-width: 760px) {
  .bg-hero-img img { border-radius: 14px; aspect-ratio: 16 / 9; }
  .bg-hero { padding: 40px 0 0; }
  .bg-grid, .bg-grid.g2 { grid-template-columns: 1fr; }
  .bg-prose h2 { margin-top: 36px; }
  .bg-prose p, .bg-prose li { font-size: 16.5px; }
  .bg-related-grid { grid-template-columns: 1fr; }
  .bg-author { flex-direction: column; }
  .bg-count { display: none; }

  /* sticky bottom cta on phones */
  .bg-float {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(246,242,239,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    transform: translateY(120%); transition: transform .28s ease;
  }
  .bg-float.is-visible { transform: none; }
  .bg-float a { flex: 1; justify-content: center; font-size: 14px; padding: 13px 10px; }
  .bg-article { padding-bottom: 120px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-feature, .bg-card, .bg-related-card, .bg-float { transition: none !important; }
}
