/* =========================================================
   BLOG — "The Journal": public SEO surface for CandlEntry.
   Design: a research desk, not a card grid. Dated ledger
   entries + the candle tape as the signature element.
   Palette/type come from the shared marketing tokens in
   home.css (.home-page-v1, .blog-page share that block).
   Local tokens here are blog-specific only.
   ========================================================= */

.blog-page {
  --mono: "SF Mono", ui-monospace, "Monaco", "Menlo", monospace;
  --tape-up: var(--accent, #16a34a);
  --tape-down: var(--negative, #dc2626);

  /* Pin the footer to the bottom on short pages. */
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.blog-page > * { width: 100%; }

/* home.css's universal reset is scoped to .home-page-v1 —
   .blog-page carries its own. */
.blog-page *,
.blog-page *::before,
.blog-page *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.blog-page ::selection { background: rgba(34, 197, 94, 0.2); }

/* The shared nav is position:fixed — every page offsets below it. */
.blog-hero  { padding-top: 150px; }
.blog-article { padding-top: 160px; }

/* ── Candle tape (signature) ─────────────────────────── */
.tape-wick { fill: none; }
.tape-wick.tape-up   { stroke: var(--tape-up); }
.tape-wick.tape-down { stroke: var(--tape-down); }
.tape-body.tape-up   { fill: var(--tape-up); }
.tape-body.tape-down { fill: var(--tape-down); }

@media (prefers-reduced-motion: no-preference) {
  .blog-tape .tape-body { transform-origin: center; animation: tape-rise .45s var(--ease) both; }
  @keyframes tape-rise {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
  }
}

/* ── Hero ────────────────────────────────────────────── */
.blog-hero {
  padding-left: clamp(24px, 7vw, 96px);
  padding-right: clamp(24px, 7vw, 96px);
  padding-bottom: 34px;
}

.blog-hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.blog-hero-title {
  font-size: clamp(38px, 5vw, 54px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.blog-hero-sub {
  max-width: 52ch;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.blog-search input {
  width: 280px;
  padding: 11px 14px;
  font-size: 14px;
  font-family: var(--mono);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-secondary, #fff);
  color: var(--text-primary);
}
.blog-search input:focus {
  outline: none;
  border-color: var(--accent-light, #22c55e);
  box-shadow: 0 0 0 3px var(--accent-soft, #ecfdf5);
}

.blog-tape {
  max-width: 1120px;
  margin: 22px auto 0;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.blog-tape-caption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
  padding-bottom: 2px;
}

/* ── Ledger ──────────────────────────────────────────── */
.blog-ledger {
  list-style: none;
  margin: 0;
  padding: 8px clamp(24px, 7vw, 96px) 56px;
}

.blog-entry-link {
  display: grid;
  grid-template-columns: 110px 1fr 72px;
  gap: 28px;
  align-items: baseline;
  padding: 22px 10px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: background .18s var(--ease);
}
.blog-entry-link:hover { background: var(--bg-primary, #f8fafc); }

.blog-entry-date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted, #94a3b8);
  font-variant-numeric: tabular-nums;
}

.blog-entry-title {
  display: block;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.012em;
  color: var(--text-primary);
  line-height: 1.3;
  transition: color .18s;
}
.blog-entry-link:hover .blog-entry-title { color: var(--accent-strong, #15803d); }

.blog-entry-summary {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.blog-entry-meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Empty state ─────────────────────────────────────── */
.blog-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 80px;
}

.blog-empty-panel {
  text-align: center;
  max-width: 480px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 44px 48px;
  background: var(--bg-primary, #f8fafc);
}

.blog-empty-candle { display: block; margin: 0 auto 18px; }
.blog-empty-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.blog-empty-sub {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin: 0 0 22px;
}
.blog-empty-cta,
.blog-cta-button {
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
}

/* ── Article ─────────────────────────────────────────── */
.blog-article {
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 48px;
  flex: 1;
}

.blog-article-meta {
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}

.blog-article-title {
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.12;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.blog-article-summary {
  font-size: 17.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 8px;
}

.blog-prose {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 26px;
  margin-top: 22px;
}
.blog-prose h2, .blog-prose h3 {
  color: var(--text-primary);
  letter-spacing: -.015em;
  margin: 32px 0 10px;
  line-height: 1.25;
}
.blog-prose h2 { font-size: 23px; }
.blog-prose h3 { font-size: 18.5px; }
.blog-prose p { margin: 0 0 16px; }
.blog-prose a { color: var(--accent-strong, #15803d); font-weight: 500; }
.blog-prose ul, .blog-prose ol { padding-left: 22px; margin: 0 0 16px; }
.blog-prose li { margin-bottom: 7px; }
.blog-prose code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--bg-primary, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text-primary);
}
.blog-prose pre {
  background: var(--bg-primary, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-x: auto;
  margin: 0 0 16px;
}
.blog-prose pre code { background: none; border: none; padding: 0; }
.blog-prose blockquote {
  margin: 20px 0;
  padding: 10px 18px;
  border-left: 3px solid var(--accent-light, #22c55e);
  background: var(--accent-soft, #ecfdf5);
  border-radius: 0 10px 10px 0;
  color: var(--text-primary);
}
.blog-prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.blog-prose th, .blog-prose td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.blog-prose th { background: var(--bg-primary, #f8fafc); font-family: var(--mono); }

/* End-of-article CTA — terminal panel, quiet until it isn't. */
.blog-cta {
  margin-top: 44px;
  border: 1px solid var(--accent-border, #a7f3d0);
  border-radius: 12px;
  background: var(--accent-soft, #ecfdf5);
  padding: 26px 28px;
  text-align: center;
}
.blog-cta-title { font-weight: 700; font-size: 18px; color: var(--text-primary); margin: 0 0 6px; }
.blog-cta-sub   { font-size: 14px; color: var(--text-secondary); margin: 0 0 18px; }
.blog-cta-button { display: inline-block; text-decoration: none; }

.blog-backlink {
  display: inline-block;
  margin-top: 30px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  text-decoration: none;
}
.blog-backlink:hover { color: var(--text-primary); }

/* ── Footer ──────────────────────────────────────────── */
.blog-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 28px 24px 44px;
  text-align: center;
  color: var(--text-muted, #94a3b8);
  font-size: 13px;
  font-family: var(--mono);
}

/* ── Sitemap (/sitemap, pages#sitemap) ─────────────────
   Reuses the .blog-page shell, ledger rows and footer; only
   the "Product" card grid and section labels are new. */
.sitemap-section {
  padding: 0 clamp(24px, 7vw, 96px) 40px;
  flex: 1;
}
.sitemap-section .blog-ledger { padding: 0; }
.sitemap-heading {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-muted, #94a3b8);
  padding: 26px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.sitemap-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-top: 22px;
}
.sitemap-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  background: transparent;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.sitemap-card:hover {
  border-color: var(--accent-border, #a7f3d0);
  background: var(--accent-soft, #ecfdf5);
}
.sitemap-card-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.012em;
  color: var(--text-primary);
}
.sitemap-card:hover .sitemap-card-title { color: var(--accent-strong, #15803d); }
.sitemap-card-desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.sitemap-quiet {
  padding: 22px 10px 8px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
}
.sitemap-crawl-link {
  color: var(--accent-strong, #15803d);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}
.sitemap-crawl-link:hover { text-decoration: underline; }
.blog-footer .sitemap-crawl-link + span,
.blog-footer .sitemap-crawl-link + span + a { margin: 0 8px; }
.blog-footer > p { margin-top: 12px; }

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .blog-hero { padding-top: 124px; }
  .blog-article { padding-top: 132px; }
  .blog-entry-link { grid-template-columns: 1fr; gap: 6px; padding: 18px 4px; }
  .blog-entry-meta { text-align: left; }
  .blog-search input { width: 100%; }
  .blog-tape { overflow-x: auto; }
  .blog-empty-panel { padding: 36px 24px; }
  .sitemap-grid { grid-template-columns: 1fr; }
}
