/*
  Blog theme. Source file; the generator copies it to www/blog/theme.css and the
  markdown template + index page link it. Only markdown posts and the index use
  this; verbatim HTML posts ship their own styles and never load it.

  Light theme matched to the app (see .lm-home in app-marketing-home.css and .ah
  in app-header.css): white background, ink text, terracotta-red accent,
  Montserrat headings + Inter body, hairline borders. Fonts are imported here too
  because a text-only post does not load /build/app.css (which carries them).
*/

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --red: #b75a5a;
  --red-dark: #a04c4c;
  --red-soft: #f7eeee;
  --red-tint: #fbf5f5;
  --ink: #17171f;
  --ink-2: #33333f;
  --body: #5c5c6a;
  --muted: #8a8a97;
  --line: #ececef;
  --card: #f6f4f4;
  --white: #ffffff;
  --max: 720px;
  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); }

/* --- Footer chrome --------------------------------------------------------- */
/* The header bar now comes from the app's own stylesheet (app-header.css, copied
   to /blog/app-header.css by the generator) so the blog header can't drift from
   the app. Markdown posts render the `.ah` markup server-side; verbatim HTML
   posts use the <lm-site-header> web component. See scripts/build-blog.mjs. */

.blog-footer {
  max-width: 1040px;
  margin: 72px auto 0;
  padding: 28px 24px 48px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}
.blog-footer nav { display: flex; gap: 20px; flex-wrap: wrap; }
.blog-footer a { color: var(--muted); text-decoration: none; }
.blog-footer a:hover { color: var(--red); }

/* --- Article --------------------------------------------------------------- */

.blog-article {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 20px 0;
}

.blog-article-header { margin: 28px 0 44px; }

.blog-article h1 {
  font-size: clamp(2rem, 5vw, 2.7rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}

.blog-meta {
  color: var(--muted);
  font-size: 0.95rem;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.blog-meta .dot { opacity: 0.6; }

.blog-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.blog-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--red);
  background: var(--red-soft);
  border-radius: 999px;
  padding: 3px 12px;
}

.blog-body { color: var(--ink-2); }
.blog-body > *:first-child { margin-top: 0; }
.blog-body h2 { font-size: 1.55rem; font-weight: 700; margin: 2.2em 0 0.6em; letter-spacing: -0.01em; }
.blog-body h3 { font-size: 1.22rem; font-weight: 700; margin: 1.8em 0 0.5em; }
.blog-body p, .blog-body ul, .blog-body ol { margin: 0 0 1.2em; }
.blog-body a { color: var(--red); text-underline-offset: 3px; text-decoration-color: rgba(183,90,90,0.4); }
.blog-body a:hover { color: var(--red-dark); text-decoration-color: currentColor; }
.blog-body img { max-width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); }
.blog-body blockquote {
  margin: 1.6em 0;
  padding: 2px 20px;
  border-left: 3px solid var(--red);
  color: var(--body);
}
.blog-body code {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.88em;
}
.blog-body pre {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  overflow: auto;
}
.blog-body pre code { background: none; border: 0; padding: 0; }
.blog-body hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }

/* Widget embeds inside a post. The widget supplies its own component styles;
   this just gives it room on the reading column. */
.blog-widget {
  margin: 2.5rem 0;
  min-height: 220px;
}

/* --- Index listing --------------------------------------------------------- */

.blog-index {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 24px 0;
}
.blog-index-title {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 28px 0 8px;
}
.blog-index-sub { color: var(--body); margin: 0 0 40px; font-size: 1.05rem; }

.blog-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.blog-card:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(23, 23, 31, 0.07);
}
/* Optional thumbnail (set via the post's `cover`, else `ogImage`). Full-bleed at
   the top of the card, cropped to a consistent ratio so the grid stays even. */
.blog-card-media {
  aspect-ratio: 4 / 3;
  background: var(--card);
  overflow: hidden;
}
.blog-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 22px 24px 24px;
}
.blog-card h2 { font-size: 1.22rem; font-weight: 700; margin: 0 0 8px; line-height: 1.3; color: var(--ink); }
.blog-card p { color: var(--body); font-size: 0.95rem; margin: 0 0 16px; }
.blog-card .blog-meta { margin-top: auto; font-size: 0.85rem; }

.blog-empty { color: var(--muted); padding: 40px 0; }
