/* ============================================================
   /blog/* long-form reading layer — loaded by SitePageController
   shell AFTER cn.css. Scope: body[data-page="sitepage"].
   Covers: burger hide, progress bar, hero entrance, article
   typography for 4000+ word guides, section rhythm, tables,
   figures + lightbox, code, quotes, FAQ, reveal stagger,
   TOC, back-to-top, footer slot spacing, reduced motion.
   ============================================================ */

/* ---- 1. top menu: hide burger (same scoping as /pricing) ---- */
body[data-shell="public"][data-page="sitepage"] button#nav-toggle { display: none !important; }

/* ---- 2. reading progress bar (sp.js injects .sp-progress) ---- */
.sp-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 300; pointer-events: none;
}
.sp-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--sp-accent, #4f46e5), #818cf8, #22d3ee);
  box-shadow: 0 0 10px rgba(79, 70, 229, .45);
  border-radius: 0 3px 3px 0;
  transition: width .1s linear;
}

/* ---- 3. hero entrance + guide cover ---- */
body[data-page="sitepage"] .sp-eyebrow { animation: spRise .5s .04s cubic-bezier(.22,1,.36,1) both; }
body[data-page="sitepage"] .sp-h1      { animation: spRise .6s .1s  cubic-bezier(.22,1,.36,1) both; }
body[data-page="sitepage"] .sp-dek     { animation: spRise .6s .18s cubic-bezier(.22,1,.36,1) both; }
body[data-page="sitepage"] .sp-hero-meta,
body[data-page="sitepage"] .sp-live-wrap { animation: spRise .6s .26s cubic-bezier(.22,1,.36,1) both; }
body[data-kind="guide"] .sp-hero .hero-bg {
  background:
    radial-gradient(640px 300px at 18% -60px, var(--sp-accent-soft, #eef0ff), transparent 70%),
    radial-gradient(520px 260px at 85% 0, var(--sp-accent-soft, #eef0ff), transparent 65%);
}
body[data-kind="guide"] .sp-hero .hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(360px 140px at 60% 20%, var(--sp-accent, #4f46e5), transparent 70%);
  opacity: .06; animation: spDrift 16s ease-in-out infinite alternate;
}

/* reading-time chip (sp.js) */
.sp-meta-chip.sp-read {
  background: var(--sp-accent-soft, #eef0ff);
  border-color: rgba(79, 70, 229, .28);
  color: var(--sp-accent, #4f46e5);
  font-weight: 700;
  animation: spIn .5s .55s cubic-bezier(.22,1,.36,1) both;
}

/* ---- 4. measure + long-form typography ---- */
body[data-page="sitepage"] .sp-main { padding-top: 42px; }
.sp-article section[id] { scroll-margin-top: 96px; }          /* TOC jumps clear the sticky topbar */

.sp-p {
  font-size: 1.01rem; line-height: 1.78; color: var(--ink-2);
  max-width: 70ch; margin: 0 0 16px;
}
.sp-p-lead {
  font-size: 1.15rem; line-height: 1.6; font-weight: 500;
  color: var(--ink); max-width: 64ch;
}
.sp-sec:first-child .sp-p-lead::first-letter {                /* editorial drop cap */
  float: left; font-size: 3.05em; line-height: .88;
  font-weight: 800; color: var(--sp-accent, #4f46e5);
  padding: 4px 10px 0 0;
}
.sp-list li, .sp-note, .sp-emph li { max-width: 68ch; }
.sp-article strong { color: var(--ink); font-weight: 700; }

/* section rhythm: hairline divider + air for long reads */
.sp-sec + .sp-sec {
  margin-top: 46px; padding-top: 42px;
  background-image: linear-gradient(90deg, var(--line), rgba(124, 124, 145, 0));
  background-repeat: no-repeat; background-size: 58% 1px;
}
.sp-sec-head h2 {
  font-size: clamp(1.42rem, 2.8vw, 1.8rem); font-weight: 800;
  letter-spacing: -.022em; line-height: 1.18;
}
.sp-num {
  font-size: clamp(2.2rem, 4.4vw, 3rem);
  background: linear-gradient(160deg, var(--sp-accent, #4f46e5), rgba(79,70,229,.25));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 1;
}
.sp-sec-head:hover .sp-num { opacity: 1; }

/* h3 with accent diamond (matches .sp-list marker) */
.sp-article .sp-h3, .sp-article h3 {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 10px; font-size: 1.1rem; font-weight: 750;
  letter-spacing: -.012em; color: var(--ink); line-height: 1.35;
}
.sp-article .sp-h3::before, .sp-article h3::before {
  content: ''; width: 8px; height: 8px; flex: none;
  background: var(--sp-accent, #4f46e5); border-radius: 2px;
  transform: rotate(45deg); opacity: .85;
}

/* links: accent underline that grows on hover */
.sp-article .sp-p a, .sp-article .sp-list a, .sp-article .sp-note a {
  color: var(--sp-accent, #4f46e5); font-weight: 600; text-decoration: none;
  border-bottom: 1px solid rgba(79, 70, 229, .35);
  transition: border-color .16s ease, color .16s ease;
}
.sp-article .sp-p a:hover, .sp-article .sp-list a:hover, .sp-article .sp-note a:hover {
  border-bottom-color: currentColor;
}

/* ---- 5. tables: editorial data blocks ---- */
.sp-article .table-wrap {
  position: relative; margin: 24px 0;
  border-radius: 16px;
}
.sp-article table { font-size: .92rem; }
.sp-article thead th {
  font-size: .7rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); background: var(--surface-2);
  padding: 11px 14px; border-bottom: 1px solid var(--line);
  text-align: left; white-space: nowrap;
}
.sp-article tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink-2); line-height: 1.55; vertical-align: top;
}
.sp-article tbody tr:last-child td { border-bottom: 0; }
.sp-article tbody td:first-child { font-weight: 600; color: var(--ink); }
.sp-article tbody tr:nth-child(even) { background: rgba(124, 124, 145, .045); }
.sp-article tbody tr { transition: background .16s ease; }
.sp-article tbody tr:hover {
  background: rgba(79, 70, 229, .055);
  box-shadow: inset 3px 0 0 var(--sp-accent, #4f46e5);
}
/* horizontal-scroll edge hints (sp.js toggles can-l / can-r) */
.sp-article .table-wrap::before, .sp-article .table-wrap::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 36px;
  pointer-events: none; opacity: 0; transition: opacity .2s ease; z-index: 2;
}
.sp-article .table-wrap::before { left: 1px; background: linear-gradient(270deg, rgba(15,23,42,.11), transparent); }
.sp-article .table-wrap::after  { right: 1px; background: linear-gradient(90deg, rgba(15,23,42,.11), transparent); }
.sp-article .table-wrap.can-l::before { opacity: 1; }
.sp-article .table-wrap.can-r::after  { opacity: 1; }

/* ---- 6. figures: framed shots + lightbox (sp.js) ---- */
.sp-article figure, .sp-article .sp-fig { margin: 28px 0; text-align: center; }
.sp-article figure img, .sp-article .sp-fig img {
  display: inline-block; width: 100%; max-height: 460px; object-fit: contain;
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .10);
  transition: transform .3s cubic-bezier(.22,1,.36,1), box-shadow .3s ease;
  cursor: zoom-in;
}
.sp-article figure img:hover, .sp-article .sp-fig img:hover {
  transform: translateY(-3px); box-shadow: 0 22px 46px rgba(15, 23, 42, .16);
}
.sp-article figcaption {
  font-size: .82rem; font-style: italic; color: var(--muted);
  margin-top: 10px;
}
.sp-lb {
  position: fixed; inset: 0; z-index: 400; cursor: zoom-out;
  background: rgba(9, 10, 16, .87); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 4vh 5vw;
  animation: spFade .2s ease both;
}
.sp-lb img {
  max-width: 100%; max-height: 100%; border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65);
  animation: spZoom .26s cubic-bezier(.22,1,.36,1) both;
}

/* ---- 7. code ---- */
.sp-article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86em; background: rgba(79, 70, 229, .08);
  color: var(--sp-accent, #4f46e5);
  padding: 2px 6px; border-radius: 6px; font-weight: 600;
}
.sp-article pre {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; margin: 22px 0;
  overflow-x: auto; box-shadow: var(--sh-sm, 0 4px 16px rgba(15,23,42,.06));
  font-size: .86rem; line-height: 1.6;
}
.sp-article pre code {
  background: none; color: var(--ink); padding: 0;
  font-weight: 500; font-size: 1em;
}

/* ---- 8. pull quotes ---- */
.sp-quote {
  position: relative; margin: 30px 0; padding: 22px 26px 22px 56px;
  font-size: 1.1rem; font-style: italic; line-height: 1.6;
  background: linear-gradient(120deg, var(--sp-accent-soft, #eef0ff), var(--surface-2));
  border-left: 3px solid var(--sp-accent, #4f46e5);
  border-radius: 0 16px 16px 0;
}
.sp-quote::before {
  content: '\201C'; position: absolute; left: 16px; top: 4px;
  font-size: 3.2rem; line-height: 1; font-weight: 800; font-style: normal;
  color: var(--sp-accent, #4f46e5); opacity: .45;
}

/* ---- 9. FAQ accordions: open animation ---- */
.sp-faq-item[open] > :not(summary) { animation: spIn .3s .04s ease both; }
.sp-faq-item[open] summary { background: rgba(79, 70, 229, .04); }

/* ---- 10. in-article reveal stagger (driven by existing .in) ---- */
body[data-page="sitepage"] .sp-sec.in > * { animation: spRise .6s cubic-bezier(.22,1,.36,1) both; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(1)  { animation-delay: 0s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(2)  { animation-delay: .07s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(3)  { animation-delay: .14s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(4)  { animation-delay: .21s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(5)  { animation-delay: .28s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(6)  { animation-delay: .35s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(7)  { animation-delay: .42s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(8)  { animation-delay: .49s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(9)  { animation-delay: .56s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(10) { animation-delay: .63s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(11) { animation-delay: .7s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(12) { animation-delay: .77s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(13) { animation-delay: .84s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(14) { animation-delay: .91s; }
body[data-page="sitepage"] .sp-sec.in > *:nth-child(n+15) { animation-delay: .98s; }

/* ---- 11. TOC polish + smooth anchors ---- */
html:has(body[data-page="sitepage"]) { scroll-behavior: smooth; }
.sp-toc a { transition: color .18s ease, border-color .18s ease, transform .18s ease; }
.sp-toc a.on {
  color: var(--sp-accent, #4f46e5); font-weight: 700;
  border-left-color: var(--sp-accent, #4f46e5); transform: translateX(2px);
}
.sp-toc a:hover { transform: translateX(2px); }

/* ---- 12. back-to-top (sp.js) ---- */
.sp-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 250;
  width: 44px; height: 44px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card, #fff);
  color: var(--ink); font-size: 1.15rem; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(15, 23, 42, .16);
  opacity: 0; transform: translateY(14px) scale(.92);
  pointer-events: none; transition: opacity .25s ease, transform .25s ease, border-color .16s, color .16s;
}
.sp-top.on { opacity: 1; transform: none; pointer-events: auto; }
.sp-top:hover { border-color: var(--sp-accent, #4f46e5); color: var(--sp-accent, #4f46e5); transform: translateY(-2px); }

/* ---- 13. footer slot rendered by cn.js ---- */
#x-footer { margin-top: 52px; }

/* ---- 14. keyframes ---- */
@keyframes spRise  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes spIn    { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes spFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes spZoom  { from { opacity: 0; transform: scale(.965); } to { opacity: 1; transform: none; } }
@keyframes spDrift { from { transform: translateX(-24px); } to { transform: translateX(30px); } }

/* ---- 15. reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  body[data-page="sitepage"] .sp-eyebrow, body[data-page="sitepage"] .sp-h1,
  body[data-page="sitepage"] .sp-dek, body[data-page="sitepage"] .sp-hero-meta,
  body[data-page="sitepage"] .sp-live-wrap,
  body[data-page="sitepage"] .sp-sec.in > *,
  .sp-meta-chip.sp-read, .sp-lb, .sp-lb img,
  body[data-kind="guide"] .sp-hero .hero-bg::after { animation: none !important; }
  html:has(body[data-page="sitepage"]) { scroll-behavior: auto; }
  .sp-progress i { transition: none; }
  .sp-article figure img:hover, .sp-article .sp-fig img:hover { transform: none; }
  .sp-toc a.on, .sp-toc a:hover, .sp-top:hover { transform: none; }
}


/* ---- /blog index cards: featured thumb + 2-line clamps ---- */
.sp-blog-grid .sp-feat {
  display: block; position: relative; overflow: hidden;
  margin: -18px -18px 4px; border-radius: 15px 15px 0 0;
  aspect-ratio: 16 / 9; background: var(--line);
}
.sp-blog-grid .sp-feat img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.sp-blog-grid .sp-cat-card:hover .sp-feat img { transform: scale(1.05); }
.sp-blog-grid .sp-cat-card h3 {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.sp-blog-grid .sp-cat-empty {
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .sp-blog-grid .sp-feat img { transition: none; }
  .sp-blog-grid .sp-cat-card:hover .sp-feat img { transform: none; }
}

/* 2026-11-26: catalog layout + blog clamps */
.sp-main{max-width:1180px;margin:0 auto;padding:34px 20px 30px;display:grid;gap:34px}
.sp-cat-top{display:flex;align-items:flex-start;justify-content:space-between;gap:0px;flex-direction:column-reverse}
.sp-cat-empty{-webkit-line-clamp:2!important}
.sp-blog-grid .sp-cat-card h3{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word;margin-top:10px}
body[data-kind="blog"] span.sp-meta-chip.sp-read{display:none}
