/*
 * ForgeCAD blog — the layer on top of the homepage.
 *
 * /landing-v2/styles/landing.css gives this page its tokens (--lp-*),
 * nav, buttons, closing section, and footer. This file adds only what a blog
 * needs: the listing, cards, filters, the article reading layout, sharing,
 * and the loading, empty, and error states.
 *
 * Colours reuse the homepage's own values: the plan card's paper (#fef9f3)
 * and border (#f3e1cf), the tile paper (#efebe2), the quiet button fill
 * (#f0ebe3), the code panel, and the brand orange.
 */

:root {
  /* Fallback only: scripts/chrome.js sets the homepage's measure on load. */
  --lp-content-width: calc(var(--lp-max) * 0.85);

  /* Two radii: cards, covers, and states use the homepage card radius;
     code, tables, figures, and small panels use the plan card radius. */
  --bl-radius-lg: var(--lp-card-radius);
  --bl-radius-md: 16px;

  /* Spacing scale for everything below section level. Sections use the
     homepage tokens (--lp-section-space, --lp-title-gap). */
  --bl-space-2: 8px;
  --bl-space-3: 12px;
  --bl-space-4: 16px;
  --bl-space-5: 24px;
  --bl-space-6: 32px;
  --bl-space-7: 48px;

  --bl-card: #fef9f3;
  --bl-card-line: #f3e1cf;
  --bl-card-line-strong: #ecd3ba;
  --bl-tile: #efebe2;
  --bl-tile-light: #f6f2ea;
  --bl-quiet: #f0ebe3;
  --bl-quiet-hover: #e8e1d5;
  --bl-rule: rgba(23, 18, 13, 0.09);
  --bl-popover: #fffcf7;

  /* The reading column: about 70 characters of 18 px Inter. */
  --bl-measure: 680px;
  --bl-gutter: 40px;
  --bl-nav-clear: 96px;
  --bl-ease: cubic-bezier(0.32, 0.72, 0, 1);
  --bl-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* The homepage's code panel. */
  --bl-code-bg: #262523;
  --bl-code-chrome: #1d1c1a;
  --bl-code-line: #363431;
  --bl-code-text: #dcd8d1;
}

.bl-shell > section,
.bl-shell > header {
  width: min(var(--lp-content-width), 100%);
  margin-inline: auto;
}

/* The homepage nav has no current link; public React pages underline it. */
.lp-nav-links a[aria-current="page"],
.lp-nav-menu-links a[aria-current="page"],
.lp-footer-links a[aria-current="page"] {
  color: var(--lp-ink);
  text-decoration: underline 2px var(--lp-brand);
  text-underline-offset: 6px;
}

.bl-skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--lp-ink);
  color: var(--lp-paper);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
}

.bl-skip:focus {
  transform: none;
}

.bl-icon {
  flex: none;
  display: block;
}

/* ── Shared controls ─────────────────────────────────────────────────────── */

.bl-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--bl-quiet);
  color: var(--lp-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.18s ease,
    transform 0.18s ease;
}

.bl-button:hover {
  background: var(--bl-quiet-hover);
}

.bl-button:active {
  transform: scale(0.98);
}

.bl-icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--bl-card-line);
  border-radius: 999px;
  background: var(--bl-card);
  color: var(--lp-text);
  cursor: pointer;
  text-decoration: none;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.bl-icon-button:hover {
  border-color: var(--bl-card-line-strong);
  background: #fff;
  color: var(--lp-ink);
}

.bl-icon-button.is-done {
  border-color: rgba(31, 108, 114, 0.35);
  color: #1f6c72;
}

.bl-category {
  display: inline-flex;
  align-items: center;
  color: var(--lp-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

a.bl-category:hover {
  text-decoration: underline 1.5px var(--lp-brand);
  text-underline-offset: 4px;
}

.bl-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}

.bl-avatar {
  --size: 28px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: var(--tint, var(--bl-quiet));
  box-shadow: inset 0 0 0 1px rgba(23, 18, 13, 0.06);
  color: var(--lp-ink);
  font-size: calc(var(--size) * 0.38);
  font-weight: 650;
  letter-spacing: 0.01em;
}

.bl-avatar--logo {
  background: #fff;
}

.bl-avatar--logo img {
  width: 68%;
  height: 68%;
  object-fit: contain;
}

.bl-byline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--lp-subtle);
  font-size: 14px;
}

.bl-byline strong {
  color: var(--lp-ink);
  font-weight: 600;
}

.bl-byline-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

/* ── Covers ──────────────────────────────────────────────────────────────
   Every cover is a CAD render on the homepage's tile paper, as in the
   "Application areas" section. A soft light from above gives depth. */

.bl-cover {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, var(--bl-tile-light) 0%, var(--bl-tile) 62%);
  box-shadow: inset 0 0 0 1px rgba(23, 18, 13, 0.04);
}

.bl-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 11%;
  object-fit: contain;
  opacity: 0;
  transition:
    opacity 420ms ease,
    transform 760ms var(--bl-ease);
}

.bl-cover.is-loaded .bl-cover-img {
  opacity: 1;
}

.bl-cover-mark {
  position: absolute;
  width: 44px;
  height: 44px;
  opacity: 0;
  filter: grayscale(1);
}

.bl-cover.is-empty .bl-cover-mark {
  opacity: 0.22;
}

/* ── Listing: featured article ───────────────────────────────────────────── */

.bl-featured {
  /* The homepage demo card's offset under the hero. */
  margin-top: 44px;
}

@media (max-height: 900px) {
  .bl-featured {
    margin-top: 28px;
  }
}

.bl-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--bl-card-line);
  border-radius: var(--bl-radius-lg);
  background: var(--bl-card);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 560ms var(--bl-ease),
    box-shadow 560ms var(--bl-ease);
}

.bl-feature:hover {
  border-color: var(--bl-card-line-strong);
  box-shadow: 0 12px 32px rgba(80, 52, 20, 0.06);
}

.bl-feature .bl-cover {
  min-height: clamp(300px, 30vw, 440px);
}

.bl-feature .bl-cover-img {
  padding: 12%;
}

.bl-feature:hover .bl-cover-img,
.bl-card-link:hover .bl-cover-img {
  transform: scale(1.035);
}

.bl-feature-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--bl-space-4);
  padding: clamp(28px, 3.2vw, 48px);
}

.bl-feature-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--lp-subtle);
  font-size: 13px;
}

.bl-feature-tag .bl-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 128, 26, 0.1);
  color: #a24800;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bl-feature-title {
  margin: 0;
  font-size: clamp(26px, 2.4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
}

.bl-feature-excerpt {
  margin: 0;
  color: var(--lp-muted);
  font-size: 16.5px;
  line-height: 1.6;
  text-wrap: pretty;
}

.bl-feature-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--bl-space-4);
  /* 24 px under the excerpt: the flex gap plus this. */
  margin-top: var(--bl-space-2);
}

.bl-read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lp-ink);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}

.bl-read-more .bl-icon {
  transition: transform 0.3s var(--bl-ease);
}

.bl-feature:hover .bl-read-more .bl-icon {
  transform: translateX(3px);
}

/* ── Listing: filters ────────────────────────────────────────────────────── */

.bl-browse {
  padding-top: var(--lp-section-space);
}

.bl-browse-head {
  display: grid;
  /* minmax(0, …): the scrolling chip rail must not set the column width. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--bl-space-5);
  margin-bottom: var(--bl-space-6);
}

.bl-browse-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--bl-space-4);
}

/* The homepage section title (.lp-how-title and its peers). */
.bl-section-title {
  margin: 0;
  font-size: clamp(28px, 2.6vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.bl-text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--lp-ink);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.bl-text-link .bl-icon {
  color: var(--lp-subtle);
}

.bl-text-link:hover {
  text-decoration: underline 1.5px var(--lp-brand);
  text-underline-offset: 4px;
}

.bl-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* The pricing page's segment track: a quiet rail, a white thumb. */
.bl-chips {
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--bl-quiet);
  overflow-x: auto;
  scrollbar-width: none;
}

.bl-chips::-webkit-scrollbar {
  display: none;
}

.bl-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--lp-text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.bl-chip:hover {
  color: var(--lp-ink);
  background: rgba(255, 255, 255, 0.5);
}

.bl-chip[aria-pressed="true"] {
  background: #fff;
  color: var(--lp-ink);
  font-weight: 600;
  box-shadow:
    0 1px 2px rgba(80, 52, 20, 0.08),
    0 0 0 1px rgba(23, 18, 13, 0.04);
}

.bl-chip-count {
  color: var(--lp-subtle);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.bl-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 300px;
  min-width: 200px;
}

.bl-search > .bl-icon {
  position: absolute;
  left: 15px;
  color: var(--lp-subtle);
  pointer-events: none;
}

.bl-search input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  border: 1px solid var(--bl-card-line);
  border-radius: 999px;
  background: var(--bl-card);
  color: var(--lp-ink);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.bl-search input::placeholder {
  color: var(--lp-subtle);
}

.bl-search input:hover {
  border-color: var(--bl-card-line-strong);
}

.bl-search input:focus {
  border-color: var(--lp-focus);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 128, 26, 0.16);
}

.bl-search input::-webkit-search-cancel-button {
  display: none;
}

.bl-search kbd,
.bl-search-clear {
  position: absolute;
  right: 10px;
}

.bl-search kbd {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--bl-card-line-strong);
  border-radius: 6px;
  color: var(--lp-subtle);
  font: 500 12px/1 Inter, sans-serif;
  pointer-events: none;
}

.bl-search-clear {
  display: none;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--bl-quiet);
  color: var(--lp-text);
  cursor: pointer;
}

.bl-search.has-value kbd {
  display: none;
}

.bl-search.has-value .bl-search-clear {
  display: grid;
}

.bl-result-meta:empty {
  display: none;
}

.bl-result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 28px;
  margin: 0;
  color: var(--lp-subtle);
  font-size: 14px;
}

.bl-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--bl-card-line);
  border-radius: 999px;
  background: var(--bl-card);
  color: var(--lp-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.bl-filter-pill:hover {
  border-color: var(--bl-card-line-strong);
}

.bl-filter-pill .bl-icon {
  color: var(--lp-subtle);
}

.bl-link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--lp-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline 1.5px var(--lp-brand);
  text-underline-offset: 4px;
  cursor: pointer;
}

/* ── Listing: cards ──────────────────────────────────────────────────────── */

.bl-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--bl-space-7) var(--lp-card-gap);
}

.bl-card {
  min-width: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .bl-card,
  .bl-feature {
    animation: bl-rise 680ms var(--bl-ease) both;
    animation-delay: calc(var(--i, 0) * 60ms);
  }
}

@keyframes bl-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.bl-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: var(--bl-radius-lg);
}

.bl-card .bl-cover {
  aspect-ratio: 16 / 11;
  border-radius: var(--bl-radius-lg);
}

.bl-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--bl-space-2);
  flex: 1;
  padding-top: var(--bl-space-4);
}

.bl-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--lp-subtle);
  font-size: 13px;
}

.bl-card-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 650;
  text-wrap: balance;
}

.bl-card-title span {
  background-image: linear-gradient(var(--lp-brand), var(--lp-brand));
  background-size: 0% 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 420ms var(--bl-ease);
}

.bl-card-link:hover .bl-card-title span,
.bl-card-link:focus-visible .bl-card-title span {
  background-size: 100% 1.5px;
}

.bl-card-excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--lp-muted);
  font-size: 15px;
  line-height: 1.55;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bl-card .bl-byline {
  margin-top: auto;
  padding-top: var(--bl-space-2);
  font-size: 13px;
}

.bl-more {
  display: flex;
  justify-content: center;
  margin-top: var(--bl-space-7);
}

.bl-more[hidden] {
  display: none;
}

/* ── States: loading, empty, error ───────────────────────────────────────── */

.bl-skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--bl-quiet) 0%, #f6f1e9 40%, var(--bl-quiet) 80%);
  background-size: 300% 100%;
  animation: bl-shimmer 1.4s ease-in-out infinite;
}

@keyframes bl-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bl-skeleton {
    animation: none;
  }
}

.bl-skeleton-card {
  display: grid;
  gap: 12px;
}

.bl-skeleton-card .bl-skeleton:first-child {
  aspect-ratio: 16 / 11;
  border-radius: var(--bl-radius-lg);
}

.bl-skeleton-feature {
  height: clamp(300px, 30vw, 440px);
  border-radius: var(--bl-radius-lg);
}

.bl-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: clamp(48px, 6vw, 80px) 24px;
  border: 1px dashed var(--bl-card-line-strong);
  border-radius: var(--bl-radius-lg);
  text-align: center;
}

.bl-state-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 14px;
  background: var(--bl-quiet);
  color: var(--lp-text);
}

.bl-state--error .bl-state-icon {
  background: rgba(255, 128, 26, 0.12);
  color: #a24800;
}

.bl-state h2,
.bl-state h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.bl-state p {
  max-width: 420px;
  margin: 0;
  color: var(--lp-muted);
  font-size: 15px;
  line-height: 1.55;
}

.bl-state-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

/* ── Article ─────────────────────────────────────────────────────────────── */

.bl-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 3px;
  background: var(--lp-brand);
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  pointer-events: none;
}

.bl-article-shell {
  padding: 0 24px 64px;
}

/* Every block shares the homepage measure, so the cover, related posts,
   closing, and footer start and end on the same edges as the nav-led pages. */
.bl-article-shell > * {
  width: min(var(--lp-content-width), 100%);
  margin-inline: auto;
}

/* Three columns inside the measure: contents, the reading column, share.
   The rails appear only when the measure has room for them. */
.bl-article-frame {
  container: article / inline-size;
}

.bl-article-grid {
  display: grid;
  grid-template-columns:
    [full-start] minmax(0, 1fr)
    [measure-start] minmax(0, var(--bl-measure))
    [measure-end] minmax(0, 1fr)
    [full-end];
}

.bl-article-head {
  grid-column: measure;
  /* The homepage hero's top space. */
  padding-top: 52px;
}

@media (max-height: 900px) {
  .bl-article-head {
    padding-top: 32px;
  }
}

.bl-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  color: var(--lp-subtle);
  font-size: 14px;
}

.bl-crumbs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lp-text);
  font-weight: 500;
  text-decoration: none;
}

.bl-crumbs a:hover {
  color: var(--lp-ink);
  text-decoration: underline 1.5px var(--lp-brand);
  text-underline-offset: 4px;
}

.bl-article-title {
  margin: 0;
  /* The homepage hero size: no page title outranks the homepage headline. */
  font-size: clamp(32px, 3.2vw, 52px);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
  text-wrap: balance;
}

.bl-article-lead {
  margin: 18px 0 0;
  color: var(--lp-muted);
  font-size: clamp(17px, 1.3vw, 20px);
  line-height: 1.55;
  text-wrap: pretty;
}

.bl-article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding: 18px 0;
  border-block: 1px solid var(--bl-rule);
}

.bl-article-meta .bl-byline {
  font-size: 14px;
}

.bl-byline-stack {
  display: grid;
  gap: 2px;
}

.bl-byline-stack strong {
  font-size: 15px;
}

.bl-article-cover {
  grid-column: full;
  margin: 44px 0 0;
}

.bl-article-cover .bl-cover {
  aspect-ratio: 2 / 1;
  max-height: 560px;
  width: 100%;
  border-radius: var(--bl-radius-lg);
}

.bl-article-cover .bl-cover-img {
  padding: 8% 12%;
}

.bl-article-cover figcaption {
  margin-top: 12px;
  color: var(--lp-subtle);
  font-size: 13.5px;
  text-align: center;
}

.bl-article-body {
  grid-column: measure;
  min-width: 0;
  padding-top: var(--bl-space-7);
}

.bl-toc,
.bl-rail {
  display: none;
  padding-top: var(--bl-space-7);
}

.bl-toc-inner,
.bl-rail-inner {
  position: sticky;
  top: var(--bl-nav-clear);
}

.bl-toc {
  grid-column: full-start / measure-start;
}

/* The share rail sits on the measure's right edge, under the cover's edge. */
.bl-rail {
  grid-column: measure-end / full-end;
  justify-self: end;
}

.bl-rail-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

@container article (min-width: 1100px) {
  .bl-article-grid {
    column-gap: var(--bl-gutter);
  }

  .bl-toc,
  .bl-rail {
    display: block;
  }

  .bl-toc-inline {
    display: none !important;
  }
}

.bl-rail-label,
.bl-toc-label {
  margin: 0 0 12px;
  color: var(--lp-subtle);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.bl-toc ol {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--bl-rule);
}

.bl-toc a {
  display: block;
  margin-left: -1px;
  padding: 6px 0 6px 14px;
  border-left: 2px solid transparent;
  color: var(--lp-subtle);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.bl-toc a[data-level="3"] {
  padding-left: 26px;
  font-size: 13.5px;
}

.bl-toc a:hover {
  color: var(--lp-ink);
}

.bl-toc a[aria-current="true"] {
  border-left-color: var(--lp-brand);
  color: var(--lp-ink);
  font-weight: 500;
}

.bl-rail-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Narrow screens fold the contents into the top of the article. */
.bl-toc-inline {
  margin: 0 0 var(--bl-space-6);
  border: 1px solid var(--bl-card-line);
  border-radius: var(--bl-radius-md);
  background: var(--bl-card);
}

.bl-toc-inline summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  color: var(--lp-ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.bl-toc-inline summary::-webkit-details-marker {
  display: none;
}

.bl-toc-inline summary .bl-icon {
  color: var(--lp-subtle);
  transition: transform 0.3s var(--bl-ease);
}

.bl-toc-inline[open] summary .bl-icon {
  transform: rotate(180deg);
}

.bl-toc-inline ol {
  margin: 0;
  padding: 0 18px 14px 36px;
  color: var(--lp-subtle);
}

.bl-toc-inline li {
  padding: 4px 0;
}

.bl-toc-inline a {
  color: var(--lp-text);
  font-size: 15px;
  text-decoration: none;
}

/* ── Prose ───────────────────────────────────────────────────────────────── */

.bl-prose {
  color: var(--lp-text);
  font-size: 18px;
  line-height: 1.72;
  overflow-wrap: break-word;
}

.bl-prose > :first-child {
  margin-top: 0;
}

.bl-prose p,
.bl-prose ul,
.bl-prose ol {
  margin: 0 0 1.3em;
}

.bl-prose h2,
.bl-prose h3,
.bl-prose h4 {
  position: relative;
  color: var(--lp-ink);
  font-weight: 700;
  scroll-margin-top: var(--bl-nav-clear);
  text-wrap: balance;
}

.bl-prose h2 {
  margin: 2.1em 0 0.6em;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.028em;
}

.bl-prose h3 {
  margin: 1.8em 0 0.5em;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.bl-prose h4 {
  margin: 1.6em 0 0.4em;
  font-size: 18px;
}

.bl-anchor {
  margin-left: 0.35em;
  color: var(--lp-subtle);
  font-weight: 500;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.bl-prose :is(h2, h3, h4):hover .bl-anchor,
.bl-anchor:focus-visible {
  opacity: 1;
}

.bl-anchor:hover {
  color: var(--lp-brand);
}

.bl-prose a:not(.bl-anchor) {
  color: var(--lp-ink);
  font-weight: 500;
  text-decoration: underline 1.5px rgba(255, 128, 26, 0.55);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.18s ease;
}

.bl-prose a:not(.bl-anchor):hover {
  text-decoration-color: var(--lp-brand);
}

.bl-prose strong {
  color: var(--lp-ink);
  font-weight: 600;
}

.bl-prose ul,
.bl-prose ol {
  padding-left: 1.35em;
}

.bl-prose li {
  margin: 0.4em 0;
  padding-left: 0.2em;
}

.bl-prose ul > li::marker {
  color: var(--lp-brand);
}

.bl-prose ol > li::marker {
  color: var(--lp-subtle);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bl-prose blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 24px;
  border-left: 2px solid var(--lp-brand);
  color: var(--lp-ink);
  font-size: 1.08em;
  line-height: 1.6;
}

.bl-prose blockquote p:last-child {
  margin-bottom: 0;
}

.bl-prose hr {
  height: 1px;
  margin: 2.6em 0;
  border: 0;
  background: var(--bl-rule);
}

.bl-prose :not(pre) > code {
  padding: 0.14em 0.4em;
  border-radius: 6px;
  background: var(--bl-quiet);
  color: var(--lp-ink);
  font-family: var(--bl-mono);
  font-size: 0.84em;
}

/* Figures and code run a little wider than the text, as in print. */
.bl-figure,
.bl-code,
.bl-table {
  margin: 2.1em -24px;
}

.bl-figure-zoom {
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: var(--bl-radius-md);
  background: radial-gradient(120% 90% at 50% 0%, var(--bl-tile-light) 0%, var(--bl-tile) 62%);
  box-shadow: inset 0 0 0 1px rgba(23, 18, 13, 0.04);
  cursor: zoom-in;
  overflow: hidden;
}

.bl-figure-zoom {
  position: relative;
}

/* An enlarge badge shows that the image opens, for mouse and keyboard alike. */
.bl-figure-zoom::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2317120d' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 4h5v5M9 20H4v-5M20 4l-6 6M4 20l6-6'/%3E%3C/svg%3E")
      center / 16px no-repeat,
    rgba(255, 252, 247, 0.92);
  box-shadow: 0 2px 8px rgba(80, 52, 20, 0.12);
  opacity: 0;
  transform: scale(0.92);
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--bl-ease);
}

.bl-figure-zoom:hover::after,
.bl-figure-zoom:focus-visible::after {
  opacity: 1;
  transform: none;
}

@media (hover: none) {
  .bl-figure-zoom::after {
    opacity: 1;
    transform: none;
  }
}

.bl-figure.is-missing .bl-figure-zoom::after {
  display: none;
}

.bl-figure img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  padding: clamp(16px, 5%, 44px);
  object-fit: contain;
}

.bl-figure img:not([src]) {
  width: 100%;
  min-height: 240px;
}

.bl-figure.is-missing .bl-figure-zoom {
  min-height: 200px;
  cursor: default;
}

.bl-figure figcaption {
  margin: 12px 24px 0;
  color: var(--lp-subtle);
  font-size: 14px;
  line-height: 1.5;
}

.bl-code {
  overflow: hidden;
  border-radius: var(--bl-radius-md);
  background: var(--bl-code-bg);
  box-shadow: 0 12px 32px rgba(23, 18, 13, 0.08);
}

.bl-code figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 8px 0 18px;
  border-bottom: 1px solid var(--bl-code-line);
  background: var(--bl-code-chrome);
  color: #8f8a83;
  font-size: 12.5px;
  font-weight: 500;
}

.bl-code-copy {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #aaa59d;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease;
}

.bl-code-copy:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--bl-code-text);
}

.bl-code-copy.is-done {
  color: #8cc576;
}

.bl-code pre {
  margin: 0;
  padding: 18px 22px 20px;
  overflow-x: auto;
  scrollbar-color: #45423e transparent;
  color: var(--bl-code-text);
  font-family: var(--bl-mono);
  font-size: 14px;
  line-height: 1.7;
  tab-size: 2;
}

.bl-code code {
  font-family: inherit;
}

/* highlight.js tokens in the homepage code panel's colours. */
.hljs-keyword,
.hljs-built_in,
.hljs-variable.language_,
.hljs-meta {
  color: #ff8a3d;
}

.hljs-string,
.hljs-regexp {
  color: #8cc576;
}

.hljs-number,
.hljs-literal {
  color: #e8b764;
}

.hljs-comment {
  color: #8f8b83;
  font-style: italic;
}

.hljs-title.class_,
.hljs-type,
.hljs-attr,
.hljs-property {
  color: #e4c28f;
}

.hljs-title.function_ {
  color: #f1ede6;
}

.bl-table {
  overflow-x: auto;
  border: 1px solid var(--bl-card-line);
  border-radius: var(--bl-radius-md);
  background: var(--bl-card);
}

.bl-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
  line-height: 1.5;
}

.bl-table th,
.bl-table td {
  padding: 12px 18px;
  text-align: left;
  vertical-align: top;
}

.bl-table th {
  background: #f8f0e5;
  color: var(--lp-ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.bl-table td {
  border-top: 1px solid var(--bl-card-line);
}

.bl-table code {
  white-space: nowrap;
}

/* ── Article footer ──────────────────────────────────────────────────────── */

.bl-article-end {
  display: grid;
  gap: var(--bl-space-6);
  margin-top: var(--bl-space-7);
  padding-top: var(--bl-space-6);
  border-top: 1px solid var(--bl-rule);
}

.bl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bl-tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--bl-quiet);
  color: var(--lp-text);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.18s ease;
}

.bl-tag::before {
  content: "#";
  margin-right: 2px;
  color: var(--lp-subtle);
}

.bl-tag:hover {
  background: var(--bl-quiet-hover);
  color: var(--lp-ink);
}

.bl-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.bl-share-row h2 {
  margin: 0;
  color: var(--lp-ink);
  font-size: 16px;
  font-weight: 600;
}

.bl-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bl-author-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: var(--bl-space-5);
  border: 1px solid var(--bl-card-line);
  border-radius: var(--bl-radius-md);
  background: var(--bl-card);
}

.bl-author-card p {
  margin: 0;
  color: var(--lp-muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.bl-author-card strong {
  display: block;
  margin-bottom: 2px;
  color: var(--lp-ink);
  font-size: 15.5px;
}

.bl-related {
  padding-top: var(--lp-section-space);
}

.bl-related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--bl-space-4);
  margin-bottom: var(--lp-title-gap);
}

.bl-related-head a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--lp-ink);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
}

.bl-related-head a:hover {
  text-decoration: underline 1.5px var(--lp-brand);
  text-underline-offset: 4px;
}

/* ── Share menu ──────────────────────────────────────────────────────────── */

.bl-share {
  position: relative;
}

.bl-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 232px;
  padding: 6px;
  border: 1px solid var(--lp-line);
  border-radius: 16px;
  background: var(--bl-popover);
  box-shadow: 0 24px 50px rgba(80, 52, 20, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px) scale(0.98);
  transform-origin: 100% 0;
  transition:
    opacity 200ms var(--bl-ease),
    transform 320ms var(--bl-ease),
    visibility 0s linear 320ms;
}

.bl-share.is-open .bl-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 200ms var(--bl-ease),
    transform 320ms var(--bl-ease),
    visibility 0s;
}

.bl-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--lp-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.bl-menu-item .bl-icon {
  color: var(--lp-text);
}

.bl-menu-item:hover,
.bl-menu-item:focus-visible {
  background: rgba(23, 18, 13, 0.05);
  outline: none;
}

.bl-menu-item.is-done .bl-icon {
  color: #1f6c72;
}

.bl-menu-sep {
  height: 1px;
  margin: 6px 8px;
  background: var(--lp-line);
}

/* ── Lightbox ────────────────────────────────────────────────────────────── */

.bl-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.bl-lightbox::backdrop {
  background: rgba(23, 18, 13, 0.78);
  backdrop-filter: blur(6px);
}

.bl-lightbox[open] {
  display: grid;
  place-items: center;
  animation: bl-fade 260ms ease;
}

@keyframes bl-fade {
  from {
    opacity: 0;
  }
}

.bl-lightbox figure {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 0;
  padding: 24px;
}

.bl-lightbox img {
  max-width: min(92vw, 1400px);
  max-height: 82dvh;
  padding: 4%;
  border-radius: var(--bl-radius-md);
  background: var(--bl-tile);
  object-fit: contain;
}

.bl-lightbox figcaption {
  max-width: 640px;
  color: rgba(255, 252, 247, 0.82);
  font-size: 14px;
  text-align: center;
}

.bl-lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  border-color: transparent;
  background: rgba(255, 252, 247, 0.12);
  color: #fff;
}

.bl-lightbox-close:hover {
  background: rgba(255, 252, 247, 0.22);
  color: #fff;
}

/* ── Preview bar and toast ───────────────────────────────────────────────── */

.bl-preview-bar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100% - 32px);
  padding: 8px 8px 8px 18px;
  border-radius: 999px;
  background: var(--lp-ink);
  box-shadow: 0 18px 40px rgba(23, 18, 13, 0.25);
  color: #f3ede4;
  font-size: 14px;
  transform: translateX(-50%);
}

.bl-preview-bar strong {
  color: #fff;
  font-weight: 600;
}

.bl-preview-bar .bl-live {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--lp-brand);
  box-shadow: 0 0 0 4px rgba(255, 128, 26, 0.2);
}

.bl-preview-bar a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.bl-preview-bar a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.bl-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--lp-ink);
  box-shadow: 0 18px 40px rgba(23, 18, 13, 0.25);
  color: #fbf6ee;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition:
    opacity 240ms var(--bl-ease),
    transform 420ms var(--bl-ease);
}

.bl-toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bl-toast[data-tone="success"] .bl-icon {
  color: #8cc576;
}

.bl-toast[data-tone="error"] .bl-icon {
  color: #ff8a3d;
}

body:has(.bl-preview-bar) .bl-toast {
  bottom: 84px;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .bl-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bl-feature {
    grid-template-columns: 1fr;
  }

  .bl-feature .bl-cover {
    min-height: 0;
    aspect-ratio: 16 / 10;
  }

  .bl-toolbar {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .bl-search {
    flex-basis: auto;
  }

  .bl-chips {
    align-self: flex-start;
    max-width: 100%;
  }
}

@media (max-width: 760px) {
  /* The homepage's phone gutter and hero top. */
  .bl-article-shell {
    padding-inline: 16px;
  }

  .bl-article-head {
    padding-top: 36px;
  }

  .bl-featured,
  .bl-article-cover {
    margin-top: 20px;
  }

  .bl-figure,
  .bl-code,
  .bl-table {
    margin-inline: 0;
  }

  .bl-figure figcaption {
    margin-inline: 2px;
  }
}

@media (max-width: 640px) {
  .bl-grid {
    grid-template-columns: 1fr;
  }

  .bl-chips {
    align-self: stretch;
    border-radius: 18px;
  }

  .bl-prose {
    font-size: 17px;
    line-height: 1.68;
  }

  .bl-prose h2 {
    font-size: 24px;
  }

  .bl-prose h3 {
    font-size: 19px;
  }

  .bl-code pre {
    padding: 16px 18px;
    font-size: 13px;
  }

  .bl-article-meta {
    align-items: flex-start;
  }

  .bl-article-cover .bl-cover {
    aspect-ratio: 4 / 3;
    border-radius: 18px;
  }

  .bl-share-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .bl-preview-bar {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: space-between;
    transform: none;
  }

  .bl-preview-bar .bl-preview-text span {
    display: none;
  }
}

/* Uploaded videos use the article's existing figure spacing and caption. */
.bl-figure-video {
  display: block;
  width: 100%;
  max-height: 75vh;
  border-radius: 16px;
  background: #17120d;
}

/* Authoring and public controls use the native hidden attribute. */
[hidden] {
  display: none !important;
}
