/* =============================================================
   pages/blog.css — Blog-specific styles
   Loaded only on BlogIndexPage and BlogPage via {% block extra_css %}
   This sits on top of the main.css layer stack; all variables
   from 01-settings.css (and any page_theme overrides) are available.
   ============================================================= */


/* ── Blog Index — article card listing ───────────────────── */

.blog-listing {
  display: grid;
  gap: var(--space-lg);
  margin-block-start: var(--space-lg);
}

.blog-listing__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-white);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.blog-listing__item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

/* Thumbnail wrapper — holds the image + optional background colour.
   CSS Grid with place-items: start keeps the image at its natural size
   so background is visible in any space the image doesn't cover. */
.blog-listing__thumb {
  display: grid;
  place-items: start;
  flex-shrink: 0;
  width: 240px;
  min-height: 80px;
  border-radius: calc(var(--border-radius) - 2px);
  overflow: hidden;
}

/* Base image rule — natural size, never upscaled */
.blog-listing__item img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  border-radius: 0;
}

/* Body wrapper — stacks title / date / intro / read-more in a column */
.blog-listing__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1;
  min-width: 0;
}

.blog-listing__item h2 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  margin-block: 0;
}

.blog-listing__item h2 a {
  color: var(--body-text);
  text-decoration: none;
}

.blog-listing__item h2 a:hover {
  color: var(--body-link-hover);
}

.blog-listing__item .intro {
  color: var(--color-gray-dark);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-block: var(--space-xs);
}

.blog-listing__item .intro p {
  margin: 0;
}

/* Read more button — push to the bottom of the card body */
.blog-listing__body .btn-read-more {
  margin-block-start: auto;
  align-self: flex-start;
}


/* ── Card style: Index Card (default — stacked) ───────────── */
/* No extra rules needed; the base flex-column layout is Index Card.
   On mobile the thumb is full-width so cap it there too. */
.blog-listing--index_card .blog-listing__thumb {
  width: 100%;
}


/* ── Card style: Double-Column with Image ─────────────────── */
/* Thumb is flush against the card edge (no padding on that side).
   It stretches the full card height, and is only as wide as the image. */

@media (min-width: 640px) {
  .blog-listing--double_column .blog-listing__item--has-image {
    flex-direction: row;
    align-items: stretch;   /* thumb stretches full card height */
    padding: 0;             /* padding moved to body so thumb reaches edges */
    overflow: hidden;       /* card border-radius clips the thumb corners */
  }

  .blog-listing--double_column .blog-listing__item--has-image .blog-listing__thumb {
    width: auto;            /* shrinks to natural image width */
    min-height: unset;
    border-radius: 0;       /* card overflow:hidden handles corner clipping */
  }

  .blog-listing--double_column .blog-listing__item--has-image .blog-listing__body {
    padding: var(--space-lg);
  }
}


/* ── Blog Index — intro text below subheader ─────────────── */

.blog-subheader-text {
  margin-block: var(--space-lg);
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--body-text);
}

.blog-subheader-text p:first-child {
  margin-block-start: 0;
}


/* ── Blog Post — reading experience ──────────────────────── */

/* Date + meta bar */
.meta {
  font-size: 0.875rem;
  color: var(--color-gray-dark);
  margin-block: var(--space-xs) var(--space-md);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Hero image at the top of a post — never upscaled */
body.page-blog-post .site-main img:first-of-type {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  margin-block-end: var(--space-lg);
}

/* Post intro */
body.page-blog-post .intro {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-gray-dark);
  margin-block: var(--space-md) var(--space-lg);
}

/* "Return to blog" link */
body.page-blog-post .site-main > p:last-of-type a {
  display: inline-block;
  margin-block-start: var(--space-lg);
  font-size: 0.875rem;
  color: var(--body-link);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

/* Tags section */
.tags {
  margin-block-start: var(--space-xl);
  padding-block-start: var(--space-md);
  border-top: 1px solid var(--color-gray-mid);
}

.tags h2 {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gray-dark);
  margin-block-end: var(--space-sm);
}

.tags button {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: transparent;
  border: 1px solid var(--color-gray-mid);
  border-radius: 2rem;
  font-size: 0.8125rem;
  color: var(--body-link);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.tags button:hover {
  background: var(--body-link);
  color: var(--color-white);
  border-color: var(--body-link);
}


/* ── Read More button on blog index cards ─────────────────── */

.blog-listing__body .btn-read-more {
  display: inline-block;
  margin-block-start: auto;
  align-self: flex-start;
  padding: 0.55em 1.4em;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}

.blog-listing__body .btn-read-more--solid {
  background-color: var(--color-brand-accent, #e07b39);
  color: var(--color-white, #fff) !important;
  border-color: var(--color-brand-accent, #e07b39);
}

.blog-listing__body .btn-read-more--solid:hover {
  background-color: var(--color-brand-primary, #1a3a5c);
  border-color: var(--color-brand-primary, #1a3a5c);
  color: var(--color-white, #fff) !important;
}

.blog-listing__body .btn-read-more--outline {
  background-color: transparent;
  color: var(--color-brand-accent, #e07b39) !important;
  border-color: var(--color-brand-accent, #e07b39);
}

.blog-listing__body .btn-read-more--outline:hover {
  background-color: var(--color-brand-accent, #e07b39);
  color: var(--color-white, #fff) !important;
}

.blog-listing__body .btn-read-more--ghost {
  background-color: transparent;
  color: var(--color-brand-accent, #e07b39) !important;
  border-color: transparent;
  padding-inline: 0.2em;
}

.blog-listing__body .btn-read-more--ghost:hover {
  text-decoration: underline;
  color: var(--color-brand-primary, #1a3a5c) !important;
}
