/*
 * Styles for the blog only. The captured site's styles.css carries the page chrome; these rules
 * cover the listing and post classes that did not exist before the blog was imported. Scoped by
 * class so nothing here can reach the 61 captured pages.
 */

/*
 * `header` is position:fixed at top:0, so the page needs to be pushed down by its height or the
 * first row of content sits underneath it. The 60 captured pages each carry an inline
 * `padding-top: 166.781px` on <body> — a measurement the source's own script took at desktop
 * width, frozen at capture time. This is that same value, so the blog matches the rest of the
 * site before any script runs and there is no layout shift.
 *
 * The header shrinks below 1024px (see the logo and .pho rules in styles.css), so the frozen
 * desktop number over-pads narrow screens. SiteNav.astro measures the header and corrects this
 * after load, which is why the value here only has to be right for desktop.
 */
body.page_blog {
  padding-top: 166.781px;
}

/* The listing heading needs the same breathing room the post title gets. */
body.page_blog #page > h1 { margin: 0 0 1.5rem; }
body.page_blog #page { padding-top: 3rem; }
body.page_blog .blog-page-note { margin: -1rem 0 1.5rem; opacity: 0.7; }

/*
 * styles.css styles every <ul> inside <main> as the site's checkmark list:
 *   main ul li:before { content: "\e832"; color: #65b031 }   (a fontello tick)
 *   main ul li        { margin-left: 26px; padding-left: 34px }
 * The listing is a <ul> in <main>, so each card was being given a green tick and a 26px indent.
 * Undo both here rather than changing styles.css, which the 61 captured pages depend on.
 */
.blog-index {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  overflow: visible; /* main ul sets overflow:hidden, which would clip the cards' shadow/border */
}

.blog-index > li { margin: 0; padding: 1.25rem; }
.blog-index > li::before { content: none; display: none; }

.blog-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 1.25rem;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.blog-card h2 {
  font-size: 1.15rem;
  line-height: 1.35;
  margin: 0.75rem 0 0.35rem;
}

.blog-card h2 a { text-decoration: none; }
.blog-card h2 a:hover,
.blog-card h2 a:focus { text-decoration: underline; }

.blog-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.blog-date {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0 0 0.5rem;
}

.blog-excerpt { margin: 0 0 0.75rem; }
.blog-more { margin: auto 0 0; font-weight: 600; }

.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 3rem;
}

.blog-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.blog-page {
  display: inline-block;
  min-width: 2rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  text-decoration: none;
}

.blog-page.current {
  font-weight: 700;
  border-color: currentColor;
}

/* Post page */
.blog-post { max-width: 48rem; margin: 0 auto; padding: 3rem 0 3rem; }
.blog-back { margin: 0 0 1.5rem; }
.blog-post h1 { margin: 0 0 0.5rem; line-height: 1.15; }
.blog-body { margin-top: 1.5rem; }

/* Captured post bodies float their lead image and size it in the markup; keep both from
   overflowing a narrow screen. */
.blog-body img {
  max-width: 100%;
  height: auto;
}

.blog-body figure { margin: 0 0 1.25rem; }
.blog-body figure.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.blog-body figure.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.blog-body h2 { margin: 1.75rem 0 0.75rem; }
.blog-body p { margin: 0 0 1rem; }
.blog-body ul, .blog-body ol { margin: 0 0 1rem 1.25rem; }
.blog-cta { clear: both; padding-top: 1.5rem; }

@media (max-width: 600px) {
  .blog-body figure.alignleft,
  .blog-body figure.alignright { float: none; margin: 0 0 1.25rem; }
  .blog-card-img { height: 200px; }
}
