.blog-page {
  /* Casper sets the root font size to 62.5%. */
  --h1-unit: 1.6rem;
  --blog-control-line: var(--mute-2);
  --blog-control-accent: var(--green);
  background-color: var(--bg);
  padding-top: 75px;
}

/* Keep Casper's base element styles out of the shared navigation. */
.blog-page .navbar-container {
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
}

.blog-page .navbar {
  background-color: var(--bg);
}

.blog-page .site-content {
  background-color: transparent;
}

.navbar-container :where(ul, li, h3) {
  margin: 0;
  padding: 0;
  line-height: inherit;
}

.navbar-container :where(h3) {
  font-family: inherit;
  letter-spacing: normal;
}

/* Keep Casper's element styles out of the shared website footer. */
.blog-page .footer {
  font-family: var(--font);
  line-height: 1.5;
}

.blog-page .footer-cta {
  text-align: start;
}

.blog-page .footer :where(h2, h3) {
  margin-top: 0;
  font-family: inherit;
}

.blog-page .footer h2 {
  margin-bottom: 0;
}

.blog-page .footer h3 {
  line-height: inherit;
}

.blog-page .footer-logo img {
  height: 32px;
  margin: 0;
}

.blog-page .footer input {
  line-height: inherit;
}

.blog-page .site-header-content {
  z-index: auto;
}

.blog-page.home-template .site-header-content > h1 {
  margin-bottom: clamp(32px, 4vw, 48px);
}

.post-template .gradient-bg {
  background-image: none;
}

.post-template .gradient-content {
  width: min(var(--content-width, 720px), calc(100% - max(4vmin, 20px) * 2));
  padding-inline: 0;
  padding-bottom: 0;
  text-align: left !important;
}

.post-template .article-tag {
  text-align: left;
}

.blog-page.post-template .article-title {
  font-size: clamp(2.8rem, 2rem + 2vw, 3.6rem);
  line-height: 1.2;
}

.post-template .article-byline {
  justify-content: flex-start;
  margin-top: clamp(24px, 4vmin, 36px);
}

.post-template .article-byline-content {
  flex: 0 1 auto;
  flex-flow: row wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.post-template .article-byline-content .author-list {
  padding: 0;
}

.post-template .article-byline-meta {
  color: var(--ink-2);
  text-align: left;
}

.post-template .byline-meta-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.post-template .byline-reading-time {
  padding: 4px 8px;
  border-radius: 5px;
  background: var(--line);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.post-template .article-header {
  padding-top: 32px;
  padding-bottom: clamp(24px, 4vmin, 36px);
}

.post-template .article-header .article-image {
  grid-column: main-start / main-end;
  margin: 0;
}

.post-template .article-image img {
  border-radius: 8px;
}

.post-card-image-link {
  border-radius: 12px;
}

@media (min-width: 768px) {
  .blog-page.home-template .post-card-large {
    grid-column: 1 / -1;
  }
}

@media (min-width: 768px) and (max-width: 1000px) {
  .blog-page.home-template .post-feed {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-page.home-template .post-card:not(.post-card-large) {
    grid-column: span 1;
  }
}

@media (min-width: 1001px) {
  .blog-page.home-template .post-card-large:has(> .post-card-image-link) {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .blog-page.home-template .post-card-large > .post-card-image-link {
    align-self: center;
    grid-column: span 1;
  }

  .blog-page.home-template .post-card-large > .post-card-content {
    justify-content: center;
  }
}

.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px clamp(20px, 3vw, 48px);
}

.tag-filter {
  display: flex;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 10px;
}

.tag-filter .tag-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--blog-control-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.tag-filter .tag-btn:hover {
  border-color: var(--blog-control-accent);
}

.tag-filter .tag-btn.active {
  border-color: var(--blog-control-accent);
  background-color: var(--blog-control-accent);
  color: #fff;
}

.tag-filter .tag-btn:focus-visible,
.post-list-more:focus-visible {
  outline: 2px solid var(--blog-control-accent);
  outline-offset: 2px;
}

.blog-search {
  flex: 1 1 260px;
  max-width: 358px;
}

.blog-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--blog-control-line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
}

.blog-search-field:focus-within {
  outline: 2px solid var(--blog-control-accent);
  outline-offset: 1px;
}

.blog-search-field svg {
  flex: none;
  width: 22px;
  height: 22px;
}

.blog-search-field input {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.blog-search-field input::placeholder {
  color: var(--ink-2);
}

@media (max-width: 720px) {
  .blog-search {
    flex-basis: 100%;
    max-width: none;
  }

  .tag-filter .tag-btn {
    padding-inline: 14px;
  }
}

.post-list-status:not(.sr-only) {
  margin: 0;
  padding: 24px 0;
  color: var(--ink-2);
}

.blog-page [data-post-list] {
  padding-bottom: clamp(64px, 8vw, 112px);
}

.post-list-more {
  display: block;
  width: min(100%, 770px);
  min-height: 48px;
  margin: 40px auto 0;
  padding: 8px 24px;
  border: 1px solid var(--blog-control-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.post-list-more:hover {
  border-color: var(--blog-control-accent);
}

.site-main .post-card[hidden] {
  display: none;
}

/* Reading navigation */
.post-template .article-back-link {
  display: inline-flex;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
}

.post-template .article-back-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.article-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 24px;
}

.article-share {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.article-share-button {
  min-height: 44px;
  padding: 6px 16px;
  border: 1px solid var(--blog-control-line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}

.article-share-button:hover {
  border-color: var(--blog-control-accent);
}

.article-share-status {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.4;
}

.article-share-url {
  width: 100%;
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid var(--blog-control-line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.post-template .gradient-bg + .gh-content {
  padding-top: 32px;
}

.post-template .gh-content :is(h2, h3)[id] {
  scroll-margin-top: 96px;
}

/* Consistent post cards */
.blog-page .post-card[data-tags] {
  --card-title-lines: 2;
  --card-title-leading: 1.2;
  --card-excerpt-lines: 2;
}

.blog-page.home-template [data-post-list]:not(.is-filtered) .post-card-large {
  --card-title-leading: 1.12;
  --card-excerpt-lines: 3;
}

.blog-page .post-card[data-tags] .post-card-tags {
  min-height: 20px;
}

.blog-page .post-card[data-tags] .post-card-content {
  min-width: 0;
}

.blog-page .post-card[data-tags] .post-card-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--card-title-lines);
  height: calc(var(--card-title-lines) * var(--card-title-leading) * 1em);
  overflow: hidden;
  font-weight: var(--weight-semibold);
  line-height: var(--card-title-leading);
}

.blog-page.home-template [data-post-list]:not(.is-filtered) .post-card-large .post-card-title {
  display: block;
  -webkit-line-clamp: none;
  height: auto;
  overflow: visible;
  font-size: clamp(30px, 3.4vw, 42px);
  text-wrap: balance;
}

.blog-page .post-card[data-tags] .post-card-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--card-excerpt-lines);
  height: calc(var(--card-excerpt-lines) * 1.5em);
  overflow: hidden;
  line-height: 1.5;
}

.blog-page .post-card[data-tags]:not(.post-card-large) .post-card-content-link {
  flex-grow: 1;
}

.blog-page .post-card[data-tags]:not(.post-card-large) .post-card-meta {
  margin-top: auto;
  padding-top: 16px;
}

.blog-page .post-card-meta,
.blog-page .post-card-tags,
.blog-page .article-tag a {
  color: var(--ink-2);
}

.blog-page .post-card-meta > * + :not(script)::before {
  content: none;
}

.blog-page .post-card-meta-length {
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.blog-page .post-list-reset {
  margin: 0 0 24px;
  padding: 10px 16px;
  border: 1px solid var(--blog-control-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

/* Filtered results give each matching article equal space. */
.blog-page.home-template [data-post-list].is-filtered .post-feed {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.blog-page.home-template [data-post-list].is-filtered .post-card[data-tags] {
  display: flex;
  grid-column: auto;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-image-link {
  align-self: stretch;
  margin-bottom: 24px;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-content {
  justify-content: flex-start;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-content-link {
  flex-grow: 1;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-title {
  font-size: 26px;
  line-height: 1.2;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-excerpt {
  margin-top: 12px;
}

.blog-page.home-template [data-post-list].is-filtered .post-card-meta {
  margin-top: auto;
  padding-top: 16px;
}

/* Related articles */
.post-template .read-more-wrap {
  padding-bottom: clamp(64px, 8vw, 112px);
}

.post-template .read-more-heading {
  margin: 0 0 28px;
  font-size: 28px;
  font-weight: var(--weight-semibold);
  line-height: 1.3;
}

.post-template .read-more {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.post-template .read-more > .post-card:nth-child(n) {
  display: flex;
  grid-column: auto;
}

@media (max-width: 1000px) {
  .blog-page.home-template [data-post-list].is-filtered .post-feed,
  .post-template .read-more {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .post-template .article-header {
    padding-top: 24px;
  }

  .blog-toolbar {
    gap: 12px;
  }

  .blog-search {
    flex-basis: 100%;
    order: -1;
    max-width: none;
  }

  .tag-filter {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .blog-page.home-template [data-post-list].is-filtered .post-feed,
  .post-template .read-more {
    grid-template-columns: minmax(0, 1fr);
  }
}
