/**
 * blog.css
 *
 * Styling for views/blog.php (index) and views/blog-post.php (single
 * post) — loaded on both (see layouts/head.php's own $page check). Same
 * container/palette convention as every other content page's own CSS
 * (css/mortgages.css's .mg-wrap, css/home-value.css, etc.): 1140px
 * max-width, #12233D headings, #4B5A70 body copy. .sr-grid/.sr-card (a
 * blog post's own [listings ...] shortcode embeds, see
 * blog-shortcodes.php) come from css/search.css, also loaded on this
 * page — not redefined here.
 */

.blog-wrap {
  max-width: var(--wrap-container, var(--container-wide-legacy));
  margin: 0 auto;
  padding: 24px var(--wrap-gutter, var(--gutter-legacy)) 48px;
  color: #12233D;
}

/* Readable line length. --blog-measure comes from the migrated-pages list in
   css/nav.css; without it (legacy) nothing is capped. Prose, headings and
   the index list stop at the measure while the container itself is wide, so
   embedded listing grids (.blog-embedded-listings, a direct child of the
   post body) can still use the full width and the nav/footer edges line up
   with the container. */
.blog-wrap .blog-index-list,
.blog-wrap .blog-post-hero,
.blog-wrap .blog-post-title,
.blog-wrap .blog-post-date,
.blog-wrap .blog-breadcrumbs,
.blog-wrap .blog-preview-notice,
.blog-wrap .blog-idx-attribution,
.blog-wrap .blog-post-body > *,
.blog-wrap .blog-post-back {
  max-width: var(--blog-measure, none);
  /* Centered so a capped column doesn't leave a wide page lopsided; with no
     cap (legacy) these blocks fill their container and the auto margins do
     nothing. The .blog-wrap prefix makes this outrank the elements' own
     `margin: 0 0 N` shorthands further down. */
  margin-left: auto;
  margin-right: auto;
}

.blog-heading {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 24px;
}

.blog-empty {
  font-size: 16px;
  color: #4B5A70;
}

/* ---- Index grid (/blog): 3 columns desktop, 2 tablet, 1 phone ----
   Full container width (not the prose measure); the heading above keeps
   its measure. Each card is one link around thumbnail + text. */

.blog-index-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.blog-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.blog-card:hover,
.blog-card:focus-within {
  box-shadow: 0 6px 18px rgba(18, 35, 61, 0.12);
  transform: translateY(-2px);
}

.blog-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.blog-card-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #E2E8F0;
}

.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 16px 18px 20px;
}

.blog-card-title {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  color: #12233D;
  margin: 0 0 6px;
}

.blog-card-link:hover .blog-card-title {
  text-decoration: underline;
}

.blog-card-date {
  font-size: 13px;
  color: #8A96A3;
  margin: 0 0 10px;
}

.blog-card-excerpt {
  font-size: 15px;
  line-height: 1.55;
  color: #4B5A70;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 991px) {
  .blog-index-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .blog-index-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

/* ---- Single post (/blog/{slug}) ---- */

.blog-post-hero {
  margin: 0 auto 28px;
}

.blog-post-hero img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  background: #E2E8F0;
}

.blog-post-hero-credit {
  font-size: 12px;
  color: #8A96A3;
  margin-top: 6px;
}

.blog-post-hero-credit a {
  color: inherit;
  text-decoration: underline;
}

.blog-post-title {
  font-size: 32px;
  font-weight: 600;
  margin: 0 0 8px;
}

.blog-post-date {
  font-size: 14px;
  color: #8A96A3;
  margin: 0 0 32px;
}

/* Prose rendered from body_markdown via league/commonmark (see
   views/blog-post.php) — generic element selectors since the actual
   markup varies post to post, not a fixed set of classes. */
.blog-post-body {
  font-size: 16px;
  line-height: 1.6;
  color: #4B5A70;
}

.blog-post-body h2 {
  font-size: 24px;
  font-weight: 600;
  color: #12233D;
  margin: 32px 0 12px;
}

.blog-post-body h3 {
  font-size: 20px;
  font-weight: 600;
  color: #12233D;
  margin: 24px 0 12px;
}

.blog-post-body p {
  margin: 0 0 16px;
}

.blog-post-body ul,
.blog-post-body ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.blog-post-body li {
  margin-bottom: 6px;
}

.blog-post-body a {
  color: #1D5FB8;
}

.blog-post-body blockquote {
  margin: 0 0 16px;
  padding: 4px 16px;
  border-left: 3px solid #E2E8F0;
  color: #6B7A90;
}

.blog-post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* A [listings ...] shortcode's rendered grid — same .sr-grid the rest of
   the site uses (css/search.css), just with blog-post-specific vertical
   spacing since it sits inline between paragraphs of prose rather than
   as a page's own primary content. */
.blog-embedded-listings-block {
  margin: 8px auto 24px;
}

/* Exactly 3 cards, spanning the same measure as the prose above/below. */
.blog-embedded-listings {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 700px) {
  .blog-embedded-listings {
    grid-template-columns: minmax(0, 1fr);
  }
}

.blog-embedded-see-more {
  text-align: center;
  margin: 20px 0 0;
}

.blog-embedded-see-more-btn {
  display: inline-block;
  background: #1E40AF;
  color: #FFFFFF;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 8px;
}

.blog-post-body a.blog-embedded-see-more-btn,
.blog-post-body a.blog-embedded-see-more-btn:visited,
.blog-post-body a.blog-embedded-see-more-btn:hover {
  color: #FFFFFF;
}

.blog-embedded-see-more-btn:hover {
  background: #16327F;
}

.blog-post-back {
  margin-top: 32px;
  font-size: 15px;
}

.blog-post-back a {
  color: #1D5FB8;
  text-decoration: none;
}

.blog-post-back a:hover {
  text-decoration: underline;
}

.blog-notfound {
  text-align: center;
  padding-top: 64px;
}

/* ---- Breadcrumbs, preview banner, IDX disclaimer ---- */

.blog-breadcrumbs {
  margin-bottom: 16px;
  font-size: 14px;
}

.blog-breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
  color: #6B7A90;
}

.blog-breadcrumbs li + li::before {
  content: "/";
  margin-right: 4px;
  color: #8A96A3;
}

.blog-breadcrumbs a {
  color: #1D5FB8;
  text-decoration: none;
}

.blog-breadcrumbs a:hover {
  text-decoration: underline;
}

.blog-preview-notice {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #78350F;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.blog-idx-attribution {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid #E2E8F0;
}

.blog-idx-attribution img {
  display: block;
  margin-bottom: 8px;
}

.blog-idx-attribution p {
  font-size: 12px;
  line-height: 1.5;
  color: #4B5A70;
  margin: 0;
}

/* ---- [stats area=...] box ---- */

.blog-stats-box {
  background: #F4F7FB;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 16px 20px;
  margin: 8px auto 24px;
}

.blog-stats-title {
  font-size: 18px;
  font-weight: 600;
  color: #12233D;
  margin: 0 0 12px;
}

.blog-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px 16px;
  margin: 0 0 12px;
}

.blog-stats-item dt {
  font-size: 13px;
  color: #6B7A90;
  margin: 0 0 2px;
}

.blog-stats-item dd {
  font-size: 20px;
  font-weight: 600;
  color: #12233D;
  margin: 0;
}

.blog-stats-note {
  font-size: 12px;
  color: #6B7A90;
  margin: 0;
}

/* ---- [market-snapshot ...] tables ---- */

.blog-snapshot {
  margin: 8px auto 24px;
  overflow-x: auto;
}

.blog-snapshot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  color: #12233D;
}

.blog-snapshot-table th,
.blog-snapshot-table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid #E2E8F0;
}

.blog-snapshot-table thead th {
  font-size: 13px;
  color: #6B7A90;
  font-weight: 600;
  border-bottom: 2px solid #E2E8F0;
}

.blog-snapshot-table tbody th {
  font-weight: 500;
}

.blog-snapshot-value {
  display: block;
  font-weight: 600;
}

.blog-snapshot-delta {
  display: block;
  font-size: 12px;
  color: #6B7A90;
}

.blog-snapshot-note {
  font-size: 12px;
  color: #6B7A90;
  margin: 8px 0 0;
}
