/* ============================================================================
   Blog post editorial template — scoped to .bp-root only.
   All design tokens are declared on .bp-root (NOT :root) and every selector is
   prefixed with .bp-root so none of this leaks into the rest of the site.
   See Spec/Blog Template Spec.md.
   ========================================================================== */

/* #page has overflow:hidden site-wide (blue-theme.css:39), which makes #page the
   sticky scroll container and breaks position:sticky for the TOC/rail. Reset it to
   visible so sticky resolves against the viewport. overflow:visible is universally
   supported (clip is not honoured everywhere) and the blog page CSS is built to
   avoid horizontal overflow at any width. Scoped to the blog post page via the
   bp-host class Views/Blog/Post.cshtml sets on #page, so other pages keep their
   intentional overflow:hidden. */
#page.bp-host{ overflow:visible; }

/* menu.js wraps the whole page in <div class="wsmenucontainer"> (menu.css:61) which
   has overflow:hidden at ALL widths. It is an ancestor of #page, so it is the actual
   element that makes itself the sticky scroll container and breaks the TOC/rail —
   #page.bp-host above is necessary but not sufficient on its own. Reset it to visible
   on the blog post page, desktop only: the wsmenu mobile slide-in menu (≤ ~991px) and
   the ≤1100px layout are untouched, and the TOC/rail are display:none below 1100px
   anyway. Scoped via the bp-body class Views/Blog/Post.cshtml sets on <body>, so every
   other page keeps the intentional overflow:hidden. */
@media (min-width:1100px){
  body.bp-body .wsmenucontainer{ overflow:visible; }
}

.bp-root{
  margin-top:70px;       /* clear the header logo/menu */
  /* Primary */
  --bp-primary:#1680FB; --bp-primary-strong:#0A5FCC;
  --bp-primary-tint:#E8F2FF; --bp-primary-soft:#C9DFFD;
  /* Supporting */
  --bp-pink:#E5007D; --bp-cyan:#00B7E8; --bp-teal:#006772;
  /* Neutral ramp */
  --bp-ink-0:#FFFFFF; --bp-ink-50:#F6F8FB; --bp-ink-100:#EDF1F6;
  --bp-ink-200:#DCE3ED; --bp-ink-300:#BFC9D6; --bp-ink-400:#8A95A4;
  --bp-ink-500:#5B6675; --bp-ink-700:#2E3744; --bp-ink-900:#0F1622;
  /* Semantic */
  --bp-success:#1E9E6B; --bp-warning:#E6A23C; --bp-danger:#D64545;
  /* Radius / shadow / motion */
  --bp-r-sm:6px; --bp-r-md:10px; --bp-r-lg:14px; --bp-r-xl:22px;
  --bp-shadow-sm:0 1px 2px rgba(15,22,34,.06),0 1px 0 rgba(15,22,34,.04);
  --bp-shadow-md:0 6px 18px -8px rgba(15,22,34,.18),0 2px 6px rgba(15,22,34,.06);
  --bp-ease:cubic-bezier(.2,.7,.2,1);

  font-family:Roboto,system-ui,-apple-system,Segoe UI,sans-serif;
  color:var(--bp-ink-700);
  background:var(--bp-ink-0);
  -webkit-font-smoothing:antialiased;
}
.bp-root *{box-sizing:border-box;}

/* Smooth anchored scrolling, motion-safe only */
@media (prefers-reduced-motion: no-preference){
  html{scroll-behavior:smooth;}
}

/* ---- Reading progress bar (decorative) ---------------------------------- */
.bp-root .bp-progress{
  position:fixed; inset:0 0 auto 0; height:3px; z-index:99999;
  background:transparent; pointer-events:none;
}
.bp-root .bp-progress > i{
  display:block; height:100%; width:0;
  background:linear-gradient(90deg,var(--bp-primary),var(--bp-primary-strong));
}

/* ---- Page shell --------------------------------------------------------- */
.bp-root .bp-page{max-width:1240px; margin:0 auto; padding:48px 32px 64px;}

/* ---- Eyebrow / mono labels --------------------------------------------- */
.bp-root .bp-eyebrow{
  display:flex; align-items:center; gap:12px;
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--bp-primary-strong); margin:0 0 18px;
}
.bp-root .bp-rule{display:inline-block; width:28px; height:3px; border-radius:2px; background:var(--bp-primary);}

/* ---- Hero --------------------------------------------------------------- */
.bp-root .bp-hero{
  display:grid; grid-template-columns:1fr 360px; gap:48px; align-items:start;
  margin:0 0 36px;
}
.bp-root .bp-hero--solo{grid-template-columns:1fr;}
.bp-root .bp-title{
  font-weight:900; font-size:64px; line-height:1.04; letter-spacing:-.035em;
  color:var(--bp-ink-900); margin:0; text-wrap:balance;
}
.bp-root .bp-dek{
  font-size:20px; line-height:1.45; color:var(--bp-ink-500);
  margin:18px 0 0; text-wrap:pretty;
}
.bp-root .bp-byline{display:flex; align-items:center; gap:14px; margin-top:26px;}
.bp-root .bp-avatar{
  width:44px; height:44px; border-radius:50%; flex:none;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:15px; color:#fff;
  background:linear-gradient(135deg,var(--bp-primary),var(--bp-primary-strong));
}
.bp-root .bp-author{display:block; font-weight:700; color:var(--bp-ink-900); font-size:15px;}
.bp-root .bp-byline-sub{
  display:block; margin-top:3px;
  font-family:"Roboto Mono",ui-monospace,monospace; font-size:12px;
  letter-spacing:.06em; text-transform:uppercase; color:var(--bp-ink-400);
}

/* In short card */
.bp-root .bp-hero-card{
  background:linear-gradient(170deg,var(--bp-primary-tint) 0%,#FFFAFF 100%);
  border:1px solid var(--bp-primary-soft); border-radius:var(--bp-r-xl);
  padding:28px; position:relative; overflow:hidden;
}
.bp-root .bp-hero-card::after{
  content:""; position:absolute; right:-40px; bottom:-40px;
  width:180px; height:180px; border-radius:50%;
  background:radial-gradient(circle,rgba(22,128,251,.16),transparent 70%);
}
.bp-root .bp-hero-card-label{
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--bp-primary-strong); margin-bottom:12px;
}
.bp-root .bp-hero-card-blurb{margin:0 0 16px; font-size:15px; line-height:1.5; color:var(--bp-ink-700);}
.bp-root .bp-keyfacts{list-style:none; margin:0; padding:0; display:grid; gap:10px;}
.bp-root .bp-keyfacts li{
  position:relative; padding-left:22px; font-size:15px; line-height:1.45;
  color:var(--bp-ink-900);
}
.bp-root .bp-keyfacts li::before{
  content:""; position:absolute; left:0; top:8px; width:8px; height:8px;
  border-radius:50%; background:var(--bp-primary);
}
.bp-root .bp-hero-jump{
  display:inline-block; margin-top:18px; padding-top:14px;
  border-top:1px dashed var(--bp-primary-soft);
  font-weight:500; font-size:14px; color:var(--bp-primary-strong);
  text-decoration:none;
}
.bp-root .bp-hero-jump:hover{color:var(--bp-primary);}

/* Full-width hero image band (preserved per-post brand visual) */
.bp-root .bp-hero-img{margin:0 0 8px;}
.bp-root .bp-hero-img img{
  width:100%; aspect-ratio:16/9; object-fit:cover;
  border-radius:var(--bp-r-lg); display:block;
}

/* ---- Grid: TOC | article | rail ---------------------------------------- */
.bp-root .bp-grid{
  display:grid; grid-template-columns:230px minmax(0,1fr) 230px;
  gap:56px; margin-top:48px;
}
.bp-root .bp-toc{position:sticky; top:88px; align-self:start;}
.bp-root .bp-toc-label{
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--bp-ink-400); margin:0 0 14px;
}
.bp-root .bp-toc ol{list-style:none; margin:0; padding:0;}
.bp-root .bp-toc li a{
  display:block; padding:7px 12px; border-left:2px solid var(--bp-ink-200);
  color:var(--bp-ink-500); font-size:13.5px; line-height:1.4;
  text-decoration:none; transition:color .15s var(--bp-ease);
}
.bp-root .bp-toc li a:hover{color:var(--bp-ink-900);}
.bp-root .bp-toc li.active a{
  color:var(--bp-primary-strong); border-left-color:var(--bp-primary);
  background:linear-gradient(90deg,var(--bp-primary-tint),transparent);
}

/* ---- Article ------------------------------------------------------------ */
.bp-root .bp-article{
  max-width:680px; margin:0 auto; counter-reset:bp-h2;
  font-size:18.5px; line-height:1.68; color:var(--bp-ink-700);
}
.bp-root .bp-article > :first-child{margin-top:0;}
.bp-root .bp-article p{margin:0 0 22px; text-wrap:pretty;}
.bp-root .bp-article a{color:var(--bp-primary-strong); text-underline-offset:2px;}
.bp-root .bp-article strong{color:var(--bp-ink-900); font-weight:700;}
.bp-root .bp-article ul,
.bp-root .bp-article ol{margin:0 0 22px; padding-left:24px;}
.bp-root .bp-article li{margin:0 0 9px;}
.bp-root .bp-article img{max-width:100%; height:auto; border-radius:var(--bp-r-md);}
.bp-root .bp-article h2,
.bp-root .bp-article h3{color:var(--bp-ink-900); scroll-margin-top:96px;}
.bp-root .bp-article h2{
  position:relative; counter-increment:bp-h2;
  font-weight:900; font-size:34px; line-height:1.12; letter-spacing:-.025em;
  margin:54px 0 18px;
}
.bp-root .bp-article h2::before{
  content:counter(bp-h2,decimal-leading-zero);
  position:absolute; left:-58px; top:6px;
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:13px; letter-spacing:.12em; color:var(--bp-primary);
}
.bp-root .bp-article h3{
  font-weight:700; font-size:21px; line-height:1.24; letter-spacing:-.01em;
  margin:34px 0 12px;
}
/* Drop cap on the first paragraph */
.bp-root .bp-article > p:first-of-type::first-letter{
  float:left; font-weight:900; font-size:72px; line-height:.85;
  padding:6px 14px 0 0; color:var(--bp-primary); letter-spacing:-.04em;
}
/* Decorative 3-dot rule (any <hr> in body) */
.bp-root .bp-article hr{
  border:0; margin:44px auto; height:8px; width:64px;
  display:flex; align-items:center; justify-content:space-between;
  background:none;
}
.bp-root .bp-article hr::before,
.bp-root .bp-article hr::after{
  content:""; width:6px; height:6px; border-radius:50%;
  background:var(--bp-primary); opacity:.55;
}
.bp-root .bp-article hr{position:relative;}
.bp-root .bp-article hr::after{box-shadow:0 0 0 0 transparent;}

/* Pull quote (AI emits <blockquote><p>…</p></blockquote>) */
.bp-root .bp-article blockquote{
  margin:30px -32px; padding:28px 32px 28px 36px;
  background:var(--bp-primary-tint); border-left:3px solid var(--bp-primary);
  border-radius:0 var(--bp-r-lg) var(--bp-r-lg) 0; position:relative;
}
.bp-root .bp-article blockquote p{
  margin:0; font-weight:500; font-size:22px; line-height:1.4;
  letter-spacing:-.01em; color:var(--bp-ink-900);
}
.bp-root .bp-article blockquote::before{
  content:"\201C"; position:absolute; top:6px; right:18px;
  font-family:Georgia,serif; font-size:54px; line-height:1;
  color:var(--bp-primary); opacity:.35;
}

/* Callout (AI emits <div class="callout">, optional .info / .danger) */
.bp-root .bp-article .callout{
  display:flex; gap:14px; margin:26px 0; padding:16px 18px;
  background:#FFFBEB; border:1px solid #FCE7A3; border-radius:var(--bp-r-md);
}
.bp-root .bp-article .callout::before{
  content:"!"; flex:none; width:28px; height:28px; border-radius:8px;
  background:#FBBF24; color:#fff; font-weight:700;
  display:flex; align-items:center; justify-content:center;
}
.bp-root .bp-article .callout p{margin:0; font-size:15px; line-height:1.5; color:#78350F;}
.bp-root .bp-article .callout.info{background:var(--bp-primary-tint); border-color:var(--bp-primary-soft);}
.bp-root .bp-article .callout.info::before{background:var(--bp-primary);}
.bp-root .bp-article .callout.info p{color:var(--bp-primary-strong);}
.bp-root .bp-article .callout.danger{background:rgba(214,69,69,.08); border-color:rgba(214,69,69,.35);}
.bp-root .bp-article .callout.danger::before{background:var(--bp-danger);}
.bp-root .bp-article .callout.danger p{color:#7F1D1D;}

/* ---- Right rail --------------------------------------------------------- */
.bp-root .bp-rail{position:sticky; top:88px; align-self:start; display:grid; gap:20px;}
.bp-root .bp-share{display:grid; gap:8px;}
.bp-root .bp-share-label{
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--bp-ink-400); margin:0 0 4px;
}
.bp-root .bp-share button{
  display:flex; align-items:center; gap:12px; width:100%;
  padding:9px 12px; background:#fff; border:1px solid var(--bp-ink-200);
  border-radius:var(--bp-r-md); color:var(--bp-ink-700); font-size:14px;
  font-family:inherit; cursor:pointer; text-align:left;
  transition:border-color .15s var(--bp-ease),color .15s var(--bp-ease);
}
.bp-root .bp-share button:hover{border-color:var(--bp-primary-strong); color:var(--bp-primary-strong);}
.bp-root .bp-share button .g{
  flex:none; width:20px; height:20px; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  font-family:"Roboto Mono",ui-monospace,monospace; font-size:11px; font-weight:700;
  background:var(--bp-ink-100); color:var(--bp-ink-500);
}
.bp-root .bp-cta{
  background:linear-gradient(170deg,var(--bp-primary),var(--bp-primary-strong));
  color:#fff; border-radius:var(--bp-r-lg); padding:22px;
  box-shadow:0 18px 40px -16px rgba(22,128,251,.55);
}
.bp-root .bp-cta-eyebrow{
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  opacity:.85; margin-bottom:8px;
}
.bp-root .bp-cta h3{margin:0 0 8px; font-weight:900; font-size:20px; line-height:1.2; color:#fff;}
.bp-root .bp-cta p{margin:0 0 16px; font-size:14px; line-height:1.5; color:rgba(255,255,255,.85);}
.bp-root .bp-cta a{
  display:inline-block; padding:10px 18px; background:#fff;
  color:var(--bp-primary-strong); font-weight:700; font-size:14px;
  border-radius:999px; text-decoration:none;
}
.bp-root .bp-cta a:hover{background:var(--bp-ink-50);}

/* ---- TL;DR -------------------------------------------------------------- */
.bp-root .bp-tldr{
  position:relative; overflow:hidden; margin:64px auto 0; max-width:1240px;
  background:linear-gradient(170deg,var(--bp-ink-900),#1A2231);
  border-radius:var(--bp-r-xl); padding:32px 36px;
}
.bp-root .bp-tldr::after{
  content:""; position:absolute; right:-60px; top:-60px;
  width:220px; height:220px; border-radius:50%;
  background:radial-gradient(circle,rgba(22,128,251,.45),transparent 70%);
}
.bp-root .bp-tldr-label{
  display:flex; align-items:center; gap:12px;
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--bp-primary); margin:0 0 14px;
}
.bp-root .bp-tldr-label .bp-rule{background:var(--bp-primary);}
.bp-root .bp-tldr h2{margin:0 0 12px; font-weight:700; font-size:24px; color:#fff;}
.bp-root .bp-tldr p{margin:0 0 12px; font-size:16px; line-height:1.6; color:rgba(255,255,255,.78);}
.bp-root .bp-tldr p:last-child{margin-bottom:0;}

/* ---- Focus states ------------------------------------------------------- */
.bp-root a:focus-visible,
.bp-root button:focus-visible{
  outline:0;
  box-shadow:0 0 0 3px rgba(22,128,251,.25),0 0 0 1px var(--bp-primary) inset;
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width:1100px){
  .bp-root .bp-grid{grid-template-columns:1fr; gap:0;}
  .bp-root .bp-toc,
  .bp-root .bp-rail{display:none;}
  .bp-root .bp-hero{grid-template-columns:1fr;}
  .bp-root .bp-title{font-size:48px; line-height:1.06;}
  .bp-root .bp-article h2::before{display:none;}
  .bp-root .bp-article{max-width:none;}
}
@media (max-width:640px){
  .bp-root .bp-page{padding:28px 20px 48px;}
  .bp-root .bp-article blockquote{margin-left:0; margin-right:0;}
  .bp-root .bp-tldr{padding:24px 22px;}
}

/* ---- Print -------------------------------------------------------------- */
@media print{
  .bp-root .bp-progress,
  .bp-root .bp-toc,
  .bp-root .bp-rail{display:none !important;}
  .bp-root .bp-grid{grid-template-columns:1fr;}
}

/* ============================================================================
   Standard card (AI/author emits <div class="standard-card"> … </div>).
   Accounting-standards explainer. Self-contained: own 600px + print rules.
   All accent colour derives from the single --bp-primary token via color-mix;
   a pre-token solid fallback is declared first for browsers without color-mix.
   ========================================================================== */
.bp-root .bp-article .standard-card{
  position:relative; overflow:hidden;
  margin:32px 0;
  background:var(--bp-ink-50);
  border:1px solid var(--bp-ink-200);
  border-radius:var(--bp-r-xl);
  padding:36px;
}
.bp-root .bp-article .standard-card::before{
  content:""; position:absolute; left:0; right:0; top:0; height:4px;
  background:var(--bp-primary);
}
.bp-root .bp-article .standard-card .card-header{
  display:flex; align-items:flex-start; justify-content:space-between;
  flex-wrap:wrap; gap:10px 16px; margin:0 0 4px;
}
.bp-root .bp-article .standard-card .card-name{
  margin:0; font-weight:900; font-size:30px; line-height:1.12;
  letter-spacing:-.02em; color:var(--bp-ink-900);
}
.bp-root .bp-article .standard-card .card-tag{
  flex:none; align-self:flex-start;
  display:inline-block; padding:6px 14px; border-radius:999px;
  font-family:"Roboto Mono",ui-monospace,monospace; font-weight:500;
  font-size:12px; letter-spacing:.12em; text-transform:uppercase;
  background:var(--bp-primary-tint);
  color:var(--bp-primary-strong);
  background:color-mix(in srgb, var(--bp-primary) 12%, #fff);
  color:color-mix(in srgb, var(--bp-primary) 72%, var(--bp-ink-900));
}
.bp-root .bp-article .standard-card .card-for{
  margin:0 0 24px; font-style:italic; font-size:15px; line-height:1.5;
  color:var(--bp-ink-500);
}
.bp-root .bp-article .standard-card .rule-of-two{
  margin:0 0 16px; text-align:center; font-style:italic;
  font-size:15px; line-height:1.5; color:var(--bp-ink-500);
}
.bp-root .bp-article .standard-card .thresholds{
  display:grid; grid-template-columns:repeat(3,1fr); gap:14px;
  margin:0 0 28px;
}
.bp-root .bp-article .standard-card .threshold{
  display:flex; flex-direction:column; align-items:center;
  text-align:center; gap:6px;
  background:var(--bp-ink-100);
  border:1px solid var(--bp-ink-200);
  border-radius:var(--bp-r-lg);
  padding:20px 16px;
}
.bp-root .bp-article .standard-card .threshold-value{
  font-weight:900; font-size:24px; line-height:1.15;
  letter-spacing:-.02em; color:var(--bp-ink-900);
}
.bp-root .bp-article .standard-card .threshold-label{
  font-family:"Roboto Mono",ui-monospace,monospace;
  font-size:12px; line-height:1.4; letter-spacing:.04em;
  color:var(--bp-ink-500);
}
.bp-root .bp-article .standard-card p{
  margin:0 0 20px; font-size:18.5px; line-height:1.68;
  color:var(--bp-ink-700); text-wrap:pretty;
}
.bp-root .bp-article .standard-card p strong{
  color:var(--bp-ink-900); font-weight:700;
}
.bp-root .bp-article .standard-card > p:last-child{ margin-bottom:0; }

/* ---- Standard card: ≤600px ---------------------------------------------- */
@media (max-width:600px){
  .bp-root .bp-article .standard-card{ padding:26px; }
  .bp-root .bp-article .standard-card .card-name{ font-size:26px; }
  .bp-root .bp-article .standard-card .thresholds{ grid-template-columns:1fr; }
  .bp-root .bp-article .standard-card .threshold{
    flex-direction:row; align-items:center; justify-content:space-between;
    text-align:left; gap:16px;
  }
  .bp-root .bp-article .standard-card .threshold-label{ text-align:right; }
}

/* ---- Standard card: print / no-colour ----------------------------------- */
@media print{
  .bp-root .bp-article .standard-card{
    background:#fff; border:1px solid #000;
  }
  .bp-root .bp-article .standard-card::before{
    height:2px; background:#000;
  }
  .bp-root .bp-article .standard-card .card-tag{
    background:#fff; color:#000; border:1px solid #000;
  }
  .bp-root .bp-article .standard-card .threshold{
    background:#fff; border:1px solid #000;
  }
}
