/* compulsion.app/blog — the pages rendered by the `blog` Cloud Function
   (../compulsion/functions/src/blogRender.js). The chrome (tokens, nav, buttons,
   CTA band, footer) is copied from landing.html's <style>; keep the two in step.
   No inline styles anywhere: the blog pages' CSP allows only this file. */

:root {
  --brand: #004d59;
  --brand-deep: #003740;
  --brand-soft: #e2f0f4;
  --brand-border: #bcdde5;
  --ink: #0d2229;
  --text: #1f2530;
  --muted: #5b6678;
  --faint: #8a93a6;
  --border: #e8eaef;
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 15px; border-radius: 10px; padding: 12px 22px;
  transition: transform .12s ease, box-shadow .12s ease; border: 1px solid transparent;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(0, 77, 89, 0.24); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0, 77, 89, 0.32); }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { transform: translateY(-1px); }

/* Nav */
.brand { display: inline-flex; align-items: center; }
.brand-wordmark { display: block; width: 152px; height: auto; }
header.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.navlink { font-size: 14px; font-weight: 500; color: var(--muted); }
.navlink:hover { color: var(--text); }
.nav-cta { display: flex; align-items: center; gap: 14px; }
.nav-cta .signin { font-weight: 600; color: var(--text); }
@media (max-width: 760px) { .nav-links { display: none; } }

section { padding: 80px 0; }
.section-head { max-width: 680px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { font-size: 34px; line-height: 1.14; letter-spacing: -0.02em; font-weight: 800; color: var(--ink); margin: 12px 0 14px; }
.section-head p { font-size: 17px; color: var(--muted); }

.cta { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; text-align: center; }
.cta h2 { font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 14px; }
.cta p { font-size: 18px; color: #bfe4ea; max-width: 540px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

footer { background: var(--brand-deep); color: #9fbcc3; padding: 40px 0; font-size: 13.5px; }
.foot-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.foot-links { display: flex; gap: 22px; flex-wrap: wrap; }
.foot-links a:hover { color: #fff; }

/* Cards (index, "more from the blog") */
.bp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.bp-card {
  display: flex; flex-direction: column; gap: 10px; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
/* A post's first image, full-bleed across the top of its card */
.bp-card-img { display: block; width: calc(100% + 44px); margin: -22px -22px 6px; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-soft); }
.bp-card:hover { transform: translateY(-2px); border-color: var(--brand-border); box-shadow: 0 12px 28px rgba(0, 77, 89, 0.10); }
.bp-topic { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); }
.bp-card h3 { font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; color: var(--ink); }
.bp-card p {
  font-size: 14.5px; color: var(--muted); line-height: 1.55; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bp-card-by { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); line-height: 1.45; padding-top: 12px; border-top: 1px solid var(--border); }
.bp-card-by strong { color: var(--text); font-weight: 600; }

.bp-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.bp-avatar-lg { width: 64px; height: 64px; }
.bp-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 13px; }
.bp-avatar-lg.bp-initials { font-size: 20px; }

/* Index */
.bp-hero { padding: 64px 0 24px; background: radial-gradient(1100px 520px at 78% -12%, #e8f4f7 0%, #ffffff 58%); }
.bp-hero .section-head { margin-bottom: 0; }
.bp-hero h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; color: var(--ink); margin: 12px 0 14px; text-wrap: balance; }
.bp-filters { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.bp-filter { font-size: 13px; font-weight: 500; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; }
.bp-filter:hover { border-color: var(--brand-border); color: var(--text); }
.bp-filter.on { background: var(--brand); border-color: var(--brand); color: #fff; }
section.bp-list { padding-top: 40px; }
.bp-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Article: contents + share | the post | author + about Compulsion.
   The rails drop out as the window narrows (see the media queries), and their
   inline copies (.bp-share-inline, .bp-about-inline) take over. */
html { scroll-behavior: smooth; }
.bp-article-wrap {
  display: grid; grid-template-columns: 190px minmax(0, 700px) 240px; gap: 56px;
  justify-content: center; max-width: 1280px; margin: 0 auto; padding: 0 24px;
}
.bp-article { min-width: 0; padding: 40px 0 24px; line-height: 1.7; }
.bp-rail { padding-top: 48px; }
.bp-sticky { position: sticky; top: 96px; }
.bp-rail-title { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }

.bp-toc { margin-bottom: 30px; }
.bp-toc ol { list-style: none; border-left: 2px solid var(--border); }
.bp-toc a { display: block; padding: 5px 0 5px 12px; margin-left: -2px; border-left: 2px solid transparent; font-size: 13.5px; line-height: 1.4; color: var(--muted); }
.bp-toc a:hover { color: var(--brand); border-left-color: var(--brand); }

.bp-share { display: flex; gap: 8px; }
.bp-share-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: #fff; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; transition: color .12s, border-color .12s, background .12s;
}
.bp-share-btn svg { width: 16px; height: 16px; }
.bp-share-btn:hover { color: var(--brand); border-color: var(--brand-border); background: var(--brand-soft); }
.bp-share-inline { display: none; margin: -14px 0 28px; }

.bp-side-author { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--border); }
.bp-side-author .bp-avatar-lg { display: flex; margin-bottom: 14px; }
.bp-side-author .bp-name { font-size: 15px; margin: 0; }
.bp-side-author p {
  font-size: 13.5px; color: var(--muted); line-height: 1.55; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden;
}
.bp-side-author a { display: inline-block; margin-top: 8px; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.bp-about-card { background: var(--brand-soft); border: 1px solid var(--brand-border); border-radius: var(--radius); padding: 18px; }
.bp-about-card .bp-rail-title { color: var(--brand); }
.bp-about-card p { font-size: 13.5px; color: var(--text); line-height: 1.55; margin-bottom: 14px; }
.bp-about-btn { width: 100%; justify-content: center; padding: 10px 16px; font-size: 14px; }
.bp-about-link { display: block; text-align: center; margin-top: 10px; font-size: 13.5px; font-weight: 600; color: var(--brand); }
.bp-about-inline { display: none; margin-top: 28px; }

/* Reading progress along the top edge. Pure CSS (scroll-driven animation);
   browsers without it simply don't show the bar. */
.bp-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .bp-progress {
    display: block; position: fixed; top: 0; left: 0; z-index: 60; width: 100%; height: 3px;
    background: var(--brand); transform-origin: 0 50%; transform: scaleX(0);
    animation: bp-progress linear both; animation-timeline: scroll(root);
  }
  @keyframes bp-progress { to { transform: scaleX(1); } }
}

.bp-crumbs { font-size: 13.5px; color: var(--faint); margin-bottom: 14px; }
.bp-crumbs a { color: var(--brand); font-weight: 600; }
.bp-crumbs a:hover { text-decoration: underline; }
.bp-article h1 { font-size: 40px; line-height: 1.14; letter-spacing: -0.02em; font-weight: 800; color: var(--ink); margin: 0 0 14px; text-wrap: balance; }
.bp-lede { font-size: 19px; color: var(--muted); line-height: 1.55; margin-bottom: 24px; }
.bp-byline { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 32px; font-size: 14.5px; }
.bp-byline .bp-avatar { width: 44px; height: 44px; }
.bp-byline strong { color: var(--ink); }
.bp-meta { font-size: 13px; color: var(--muted); }
.bp-body { font-size: 17.5px; overflow-wrap: break-word; }
.bp-body p { margin: 0 0 1.2em; }
.bp-body h2 { font-size: 26px; line-height: 1.25; font-weight: 700; color: var(--ink); margin: 1.6em 0 0.5em; letter-spacing: -0.01em; scroll-margin-top: 88px; }
.bp-body img { display: block; max-width: 100%; height: auto; margin: 1.6em auto; border-radius: 12px; }
.bp-body h3 { font-size: 20px; line-height: 1.3; font-weight: 700; color: var(--ink); margin: 1.4em 0 0.4em; }
.bp-body ul, .bp-body ol { margin: 0 0 1.2em; padding-left: 1.4em; }
.bp-body li { margin-bottom: 0.35em; }
.bp-body blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--brand); color: var(--muted); font-style: italic; }
.bp-body a { color: var(--brand); text-decoration: underline; }
.bp-author-box { display: flex; gap: 16px; align-items: flex-start; margin-top: 44px; padding: 22px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.bp-about { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bp-name { font-size: 16px; font-weight: 700; color: var(--ink); margin-top: 2px; }
.bp-author-box p { font-size: 14.5px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.bp-author-box a { display: inline-block; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--brand); }
.bp-more-section { background: var(--bg-soft); border-top: 1px solid var(--border); margin-top: 56px; }
.bp-missing { text-align: center; padding: 96px 24px; color: var(--muted); }
.bp-missing h1 { font-size: 30px; color: var(--ink); margin-bottom: 10px; }
.bp-missing a { color: var(--brand); font-weight: 600; }

@media (max-width: 1180px) {
  .bp-article-wrap { grid-template-columns: minmax(0, 700px) 240px; gap: 48px; }
  .bp-rail-left { display: none; }
  .bp-share-inline { display: flex; }
}
@media (max-width: 960px) {
  .bp-article-wrap { grid-template-columns: minmax(0, 700px); }
  .bp-rail-right { display: none; }
  .bp-about-inline { display: block; }
}
@media (max-width: 900px) { .bp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .nav-inner { height: 58px; }
  .nav-cta { gap: 10px; }
  .nav-cta .btn { padding: 9px 14px; font-size: 14px; }
  .brand-wordmark { width: 124px; }
  section { padding: 56px 0; }
  .section-head h2 { font-size: 28px; }
  .cta h2 { font-size: 30px; }
  .bp-grid { grid-template-columns: minmax(0, 1fr); }
  .bp-hero { padding: 40px 0 16px; }
  .bp-hero h1 { font-size: 32px; }
  .bp-article-wrap { padding: 0 16px; }
  .bp-article { padding: 28px 0 16px; }
  .bp-article h1 { font-size: 30px; }
  .bp-body { font-size: 16.5px; }
  .bp-author-box { flex-direction: column; }
}
@media (max-width: 370px) { .nav-cta .signin { display: none; } }
