/* static/css/dm_blog.css */

/* ───────────────────────────────────────────────────────────────────────── */
/* 0. Global reset & base styles (applies everywhere)                     */
/* ───────────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  font-size: 16px;
  background-color: #fafafa;
  color: #333;
}

body {
  min-height: 100vh;
  display: block;
  font-size: 18px;
  line-height: 1.75;
  letter-spacing: 0.5px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

/* Utility */
.text-center { text-align: center; }
.mt-1        { margin-top: 1rem; }
.mb-1        { margin-bottom: 1rem; }

/* ───────────────────────────────────────────────────────────────────────── */
/* 1. Blog-page styles (scoped to <body class="blog-post">)               */
/* ───────────────────────────────────────────────────────────────────────── */
body.blog-post {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
  background: transparent !important;
  color: var(--color-text, #333);
}

/* Header & metadata */
.blog-post header {
  border-bottom: 1px solid var(--color-border, #e5e5e5);
  margin-bottom: 40px;
  padding-bottom: 20px;
}
.blog-post .subtitle {
  font-size: 1.2em;
  color: #666;
  font-style: italic;
}
.blog-post .author-date {
  margin-top: 10px;
  font-size: 0.95em;
  color: #888;
}

/* Featured image: capped width and centered */
.blog-post .header-image {
  width: 100%;
  margin: 30px 0;
}
.blog-post .featured-image {
  display: block;
  width: 100%;
  max-width: 700px;               /* cap image width */
  margin: 30px auto;              /* center it */
  height: auto;
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Body text & headings */
.blog-post article {
  font-size: 1.1em;
}
.blog-post article::after {
  /* clearfix so floated images don't overflow the article */
  content: "";
  display: table;
  clear: both;
}
.blog-post article h2 {
  font-family: Georgia, serif;
  font-size: 1.75em;
  margin: 2em 0 0.5em;
}

/* Inline rich text images (Wagtail) */
.blog-post .richtext-image.left,
.blog-post img.richtext-image.left,
.blog-post figure.align-left,
.blog-post .align-left img {
  float: left;
  margin: 0 1rem 1rem 0;
  max-width: 50%;
}

.blog-post .richtext-image.right,
.blog-post img.richtext-image.right,
.blog-post figure.align-right,
.blog-post .align-right img {
  float: right;
  margin: 0 0 1rem 1rem;
  max-width: 50%;
}

.blog-post .richtext-image,
.blog-post img.richtext-image,
.blog-post figure.align-center,
.blog-post .align-center img {
  display: block;
  margin: 1.5rem auto;
}

/* Links & footer */
.blog-post a {
  color: var(--color-accent, #1a8917);
  text-decoration: none;
  transition: color 0.2s;
}
.blog-post a:hover {
  text-decoration: underline;
}
.blog-post footer {
  border-top: 1px solid var(--color-border, #e5e5e5);
  margin-top: 50px;
  padding-top: 20px;
  font-size: 0.9em;
  color: #777;
  text-align: center;
}
/* ───────────────────────────────────────────────────────────────────────── */
/* 2. Blog-index styles (scoped to <body class="blog-index">)             */
/* ───────────────────────────────────────────────────────────────────────── */
body.blog-index {
  margin: 0;
  padding: 40px 20px;
  background: transparent !important;
}

/* Centered, fixed-width cards of 200px */
.blog-index .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 250px));
  gap: 2rem;
  justify-content: center;  /* centers the series of 200px tracks */
  margin: 0 auto;
}

/* Card container */
.blog-index .card {
  background: #fff;
  border: 1px solid var(--color-border, #e5e5e5);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
}
.blog-index .card:hover {
  transform: translateY(-2px);
}

/* Card image (natural from 200×100 fill) */
.blog-index .card-image {
  width: 100%;
  height: auto;
  display: block;
}

/* Card content */
.blog-index .card-content {
  padding: 0.75rem;
  flex: 1;
}
.blog-index .card-content h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}
.blog-index .card-content p {
  margin-bottom: 0.5rem;
  color: #555;
  font-size: 0.9em;
}
.blog-index .card-content small {
  color: #888;
  font-size: 0.8em;
}
