/* Blog — public pages + the rendered post body.
   Uses the theme.css design tokens (loaded globally by base.html) rather than
   hard-coded hexes, with fallbacks so the page still reads if theme.css is
   ever slow. Accent: #FE2C55 pink -> #25F4EE cyan, matching landing/download.

   NOTE: .blog-body is also used by the admin editor's live preview pane
   (templates/blog/_markdown_editor.html), which is what makes the preview an
   honest representation of the published page. Style post content here, not
   in the admin stylesheet. */

.blog-page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 20px 64px;
  color: var(--text-primary, #fff);
}
.blog-page-narrow { max-width: 760px; }

/* ── header ─────────────────────────────────────────────────────── */
.blog-header { margin-bottom: 28px; }
.blog-heading {
  font-size: clamp(30px, 5vw, 44px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 10px;
  background: linear-gradient(90deg, var(--accent-gradient-start, #FE2C55), var(--accent-gradient-end, #25F4EE));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.blog-sub { font-size: 16px; line-height: 1.6; color: var(--text-secondary, #e0e0e0); margin: 0; max-width: 60ch; }
.blog-count { font-size: 13px; color: var(--text-tertiary, #a0a0a0); margin: 8px 0 0; }

.blog-breadcrumbs {
  font-size: 13px; color: var(--text-tertiary, #a0a0a0);
  margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap;
}
.blog-breadcrumbs a { color: var(--text-tertiary, #a0a0a0); text-decoration: none; }
.blog-breadcrumbs a:hover { color: var(--accent-primary, #FE2C55); }

/* ── category chips ─────────────────────────────────────────────── */
.blog-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.blog-chip {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-secondary, #e0e0e0);
  font-size: 13px; text-decoration: none; transition: border-color .15s, color .15s;
}
.blog-chip:hover { border-color: var(--accent-primary, #FE2C55); color: var(--text-primary, #fff); }
.blog-chip.active { background: var(--accent-primary, #FE2C55); border-color: var(--accent-primary, #FE2C55); color: #fff; }

/* ── featured ───────────────────────────────────────────────────── */
.blog-featured {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 0;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 16px; overflow: hidden; text-decoration: none;
  margin-bottom: 32px; transition: border-color .15s, transform .15s;
}
.blog-featured:hover { border-color: var(--accent-primary, #FE2C55); transform: translateY(-2px); }
.blog-featured-image {
  width: 100%; height: 100%; min-height: 320px; object-fit: cover;
  object-position: center 40%; display: block;
}
.blog-featured-body { padding: 26px 28px; display: flex; flex-direction: column; justify-content: center; }
.blog-featured-title { font-size: 26px; font-weight: 700; line-height: 1.25; margin: 10px 0; color: var(--text-primary, #fff); }
.blog-featured-excerpt { font-size: 15px; line-height: 1.6; color: var(--text-secondary, #e0e0e0); margin: 0 0 12px; }

/* ── card grid ──────────────────────────────────────────────────── */
.blog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}
.blog-card {
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 14px; overflow: hidden;
  transition: border-color .15s, transform .15s;
}
.blog-card:hover { border-color: var(--accent-primary, #FE2C55); transform: translateY(-2px); }
.blog-card-link { text-decoration: none; display: block; color: inherit; }
/* 4/3, not 16/9. These thumbnails come from vertical 9:16 videos, so a
   widescreen box threw most of the frame away -- heads cropped off the top,
   the dish off the bottom. object-position sits above centre because the
   subject of a cooking video usually does too. */
.blog-card-image {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  object-position: center 40%; display: block;
}
.blog-card-image-empty {
  background: linear-gradient(135deg, rgba(254,44,85,.22), rgba(37,244,238,.18));
}
.blog-card-body { padding: 16px 18px 18px; }
.blog-card-category {
  display: inline-block; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-primary, #FE2C55); text-decoration: none; margin-bottom: 6px;
}
.blog-card-title { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 4px 0 8px; color: var(--text-primary, #fff); }
.blog-card-excerpt { font-size: 14px; line-height: 1.55; color: var(--text-secondary, #e0e0e0); margin: 0 0 10px; }
.blog-card-meta { font-size: 12.5px; color: var(--text-muted, #707070); display: flex; gap: 6px; flex-wrap: wrap; }

/* ── article ────────────────────────────────────────────────────── */
.blog-article-head { margin-bottom: 22px; }
.blog-article-title { font-size: clamp(28px, 4.5vw, 40px); font-weight: 800; line-height: 1.2; margin: 8px 0 12px; }
.blog-article-meta { font-size: 13.5px; color: var(--text-tertiary, #a0a0a0); display: flex; gap: 7px; flex-wrap: wrap; }
/* max-height stops a PORTRAIT cover rendering metres tall at full article
   width; contain rather than cover so the guard never becomes a crop. */
.blog-article-cover {
  width: 100%; max-height: 560px; object-fit: contain;
  border-radius: 14px; margin-bottom: 28px; display: block;
}

.blog-preview-banner {
  background: rgba(255,165,0,.12); border: 1px solid rgba(255,165,0,.35);
  color: var(--warning, #FFA500); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 22px; font-size: 14px;
}
.blog-preview-banner a { color: var(--warning, #FFA500); margin-left: 8px; }

/* ── rendered markdown ──────────────────────────────────────────── */
.blog-body { font-size: 17px; line-height: 1.75; color: var(--text-secondary, #e0e0e0); }
.blog-body > *:first-child { margin-top: 0; }
.blog-body h1, .blog-body h2, .blog-body h3, .blog-body h4 {
  color: var(--text-primary, #fff); line-height: 1.3; margin: 1.8em 0 .6em; font-weight: 700;
}
.blog-body h1 { font-size: 1.7em; }
.blog-body h2 { font-size: 1.42em; }
.blog-body h3 { font-size: 1.2em; }
.blog-body h4 { font-size: 1.05em; }
.blog-body p { margin: 0 0 1.15em; }
.blog-body a { color: var(--accent-primary, #FE2C55); text-decoration: underline; text-underline-offset: 2px; }
.blog-body a:hover { color: var(--accent-hover, #d91d42); }
.blog-body ul, .blog-body ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.blog-body li { margin-bottom: .45em; }
.blog-body strong { color: var(--text-primary, #fff); }
.blog-body img { max-width: 100%; height: auto; border-radius: 12px; display: block; margin: 1.6em 0; }
.blog-body hr { border: 0; border-top: 1px solid var(--border-color, #2a2a2a); margin: 2.2em 0; }
.blog-body blockquote {
  margin: 1.6em 0; padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent-primary, #FE2C55);
  color: var(--text-secondary, #e0e0e0); font-style: italic;
}
.blog-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--bg-tertiary, #2a2a2a); padding: 2px 6px; border-radius: 5px;
}
.blog-body pre {
  background: var(--bg-tertiary, #2a2a2a); border: 1px solid var(--border-color, #2a2a2a);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 1.5em 0;
}
.blog-body pre code { background: none; padding: 0; }
/* Wide tables scroll inside their own box rather than widening the page. */
.blog-body table { width: 100%; border-collapse: collapse; margin: 1.5em 0; display: block; overflow-x: auto; }
.blog-body th, .blog-body td {
  border: 1px solid var(--border-color, #2a2a2a); padding: 9px 12px; text-align: left; font-size: .95em;
}
.blog-body th { background: var(--bg-tertiary, #2a2a2a); color: var(--text-primary, #fff); }

.blog-embed { margin: 1.8em 0; }
.blog-embed-video { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 12px; overflow: hidden; }
.blog-embed-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blog-embed-link {
  display: inline-block; padding: 9px 16px; border-radius: 999px;
  background: var(--bg-tertiary, #2a2a2a);
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary, #fff); text-decoration: none; font-size: 14px; font-weight: 600;
}
.blog-embed-link:hover { border-color: var(--accent-primary, #FE2C55); }

/* ── CTA / related / pagination ─────────────────────────────────── */
.blog-cta, .blog-empty {
  margin: 44px 0 0; padding: 28px; text-align: center;
  background: var(--bg-secondary, #1e1e1e);
  border: 1px solid var(--border-color, #2a2a2a); border-radius: 16px;
}
.blog-cta h2, .blog-empty h2 { font-size: 22px; margin: 0 0 8px; color: var(--text-primary, #fff); }
.blog-cta p, .blog-empty p { color: var(--text-secondary, #e0e0e0); margin: 0 0 16px; }
.blog-btn {
  display: inline-block; padding: 12px 26px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-gradient-start, #FE2C55), var(--accent-gradient-end, #25F4EE));
  color: #fff; font-weight: 700; text-decoration: none;
}
.blog-btn:hover { opacity: .92; }

.blog-related { margin-top: 48px; }
.blog-related-heading { font-size: 20px; margin: 0 0 18px; color: var(--text-primary, #fff); }

.blog-pagination { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 36px; flex-wrap: wrap; }
.blog-page-link {
  padding: 9px 18px; border-radius: 999px;
  border: 1px solid var(--border-color, #2a2a2a);
  color: var(--text-primary, #fff); text-decoration: none; font-size: 14px;
}
.blog-page-link:hover { border-color: var(--accent-primary, #FE2C55); }
.blog-page-status { font-size: 13px; color: var(--text-tertiary, #a0a0a0); }

/* ── shared public footer ───────────────────────────────────────── */
.pub-footer { border-top: 1px solid var(--border-color, #2a2a2a); margin-top: 56px; padding: 32px 20px 44px; }
.pub-footer-inner { max-width: 1080px; margin: 0 auto; text-align: center; }
.pub-footer-brand { font-weight: 800; font-size: 18px; color: var(--text-primary, #fff); margin-bottom: 14px; }
.pub-footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: center; margin-bottom: 16px; }
.pub-footer-links a { color: var(--text-tertiary, #a0a0a0); text-decoration: none; font-size: 14px; }
.pub-footer-links a:hover { color: var(--accent-primary, #FE2C55); }
.pub-footer-copy { font-size: 12.5px; color: var(--text-muted, #707070); }

@media (max-width: 760px) {
  .blog-page { padding: 26px 16px 44px; }
  .blog-featured { grid-template-columns: 1fr; }
  .blog-featured-image { min-height: 190px; }
  .blog-featured-body { padding: 20px; }
  .blog-grid { grid-template-columns: 1fr; }
  .blog-body { font-size: 16px; }
}
