/* =========================================================
   Blog styles.

   IMPORTANT: style.css sets `html { font-size: 62.5% }`, so 1rem = 10px
   across the whole site. Every value here is on that scale — a "1.6rem"
   below is 16px, not 25.6px. Mixing in 16px-based rem values is what made
   this page render at ~62% of its intended size.

   Design language is inherited from the home page: same container width,
   same 4.8rem section headings, same 2rem card radius, same tokens from
   :root in style.css (--primary, --text-primary, --sub-text, --success).
   ========================================================= */

.blog-shell {
  --blog-border: #e6e8ec;
  --blog-surface: #ffffff;
  --blog-tint: #f7f8fa;
  --blog-radius: 2rem;
  --blog-shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
    0 8px 24px rgba(16, 24, 40, 0.05);
  --blog-shadow-hover: 0 2px 4px rgba(2, 32, 153, 0.06),
    0 16px 40px rgba(2, 32, 153, 0.12);

  /* style.css styles the bare `main` element as the home page hero:
     height: 76.4rem, overflow: hidden, blue background, side margins and a
     border radius. The blog shell is also a <main>, so it inherited a fixed
     764px height that clipped every post card. Reset those here. */
  display: block;
  height: auto;
  min-height: 0;
  overflow: visible;
  margin: 0;
  border-radius: 0;
  position: static;
  /* The site header is position:fixed and 80px tall, so content must start
     below it. Legacy pages get this from `main { margin-top: 8rem }`, which
     is reset above. */
  padding: 8rem 0 0;
  background: var(--blog-surface);
  color: var(--text-primary);
}

.blog-shell a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

/* style.css turns `main .container` into the home hero's two-column grid
   (1.5fr 1fr, 10rem gap). The blog shell is a <main>, so the shared CTA's
   .container was being squeezed into the first column. Restore the plain
   centred container. */
.blog-shell .container {
  display: block;
  height: auto;
  grid-template-columns: none;
  gap: 0;
  position: static;
}

.blog-container {
  max-width: 1310px;
  width: 100%;
  padding: 0 1.5rem;
  margin: auto;
}

/* ---------- Listing hero ---------- */
.blog-hero {
  padding: 8rem 0 4rem;
  text-align: center;
}

.blog-hero .eyebrow {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: #0220990f;
  padding: 0.6rem 1.4rem;
  border-radius: 5rem;
  margin-bottom: 2rem;
}

.blog-hero h1 {
  font-size: 4.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  max-width: 76rem;
  margin: 0 auto 1.6rem;
}

.blog-hero p {
  font-size: 1.8rem;
  color: var(--sub-text);
  max-width: 62rem;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- Tag cloud ---------- */
.blog-tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 3rem;
}

.blog-tag-cloud .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.3rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--blog-tint);
  border: 1px solid var(--blog-border);
  padding: 0.7rem 1.4rem;
  border-radius: 5rem;
  transition: all 0.18s ease;
}

.blog-tag-cloud .tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.blog-tag-cloud .tag-count {
  font-size: 1.1rem;
  opacity: 0.55;
}

/* ---------- Post grid ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem;
  padding: 4rem 0 8rem;
}

.blog-card {
  background: var(--blog-surface);
  border: 1px solid var(--blog-border);
  border-radius: var(--blog-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.blog-card:hover {
  transform: translateY(-0.4rem);
  box-shadow: var(--blog-shadow-hover);
  border-color: #02209933;
}

.blog-card a.blog-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  color: inherit;
}

.blog-card .cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--primary) 0%, #0369a1 100%);
  background-size: cover;
  background-position: center;
}

.blog-card .body {
  padding: 2.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1.2rem;
}

.blog-card .meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 1.3rem;
  color: var(--sub-text);
}

.blog-card .meta .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #d0d5dd;
  display: inline-block;
}

.blog-card h2 {
  font-size: 2.2rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.blog-card p {
  color: var(--sub-text);
  font-size: 1.5rem;
  line-height: 1.6;
  flex: 1;
}

.blog-card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

.blog-card .tag {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--sub-text);
  background: var(--blog-tint);
  border: 1px solid var(--blog-border);
  padding: 0.4rem 1rem;
  border-radius: 5rem;
}

.blog-empty {
  text-align: center;
  padding: 6rem 0 10rem;
  color: var(--sub-text);
  font-size: 1.6rem;
}

/* ---------- Post hero ---------- */
.blog-post-hero {
  padding: 6rem 0 3rem;
}

.blog-post-hero .blog-container {
  max-width: 82rem;
}

.blog-post-hero .crumbs {
  font-size: 1.4rem;
  color: var(--sub-text);
  margin-bottom: 2.4rem;
}

.blog-post-hero .crumbs a {
  color: var(--sub-text);
}

.blog-post-hero .crumbs a:hover {
  color: var(--primary);
}

.blog-post-hero .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.blog-post-hero .tag {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: #0220990f;
  padding: 0.6rem 1.2rem;
  border-radius: 5rem;
  transition: all 0.18s ease;
}

.blog-post-hero h1 {
  font-size: 4.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 2rem;
}

.blog-post-hero .lede {
  font-size: 1.9rem;
  line-height: 1.6;
  color: var(--sub-text);
  margin-bottom: 3rem;
}

.blog-post-hero .meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 1.4rem;
  color: var(--sub-text);
  padding-top: 2.4rem;
  border-top: 1px solid var(--blog-border);
}

.blog-post-hero .meta .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #d0d5dd;
  display: inline-block;
}

.blog-post-cover {
  max-width: 100rem;
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
}

.blog-post-cover img {
  width: 100%;
  border-radius: var(--blog-radius);
  display: block;
}

/* ---------- Article body ---------- */
.blog-article {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  font-size: 1.8rem;
  line-height: 1.8;
  color: #344054;
}

.blog-article > * + * {
  margin-top: 1.4em;
}

.blog-article h2 {
  font-size: 3.2rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-top: 2.2em;
}

.blog-article h3 {
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-primary);
  margin-top: 1.8em;
}

.blog-article h4 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 1.6em;
}

.blog-article p {
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.blog-article a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.blog-article ul,
.blog-article ol {
  padding-left: 2.4rem;
}

.blog-article li {
  margin-top: 0.5em;
}

.blog-article li::marker {
  color: var(--primary);
}

.blog-article strong {
  color: var(--text-primary);
  font-weight: 600;
}

.blog-article blockquote {
  border-left: 3px solid var(--primary);
  background: var(--blog-tint);
  padding: 2rem 2.4rem;
  border-radius: 0 1.2rem 1.2rem 0;
  color: #344054;
}

.blog-article blockquote p {
  color: inherit;
}

.blog-article code {
  background: var(--blog-tint);
  border: 1px solid var(--blog-border);
  color: var(--primary);
  padding: 0.2em 0.45em;
  border-radius: 0.6rem;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.blog-article pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 2rem 2.4rem;
  border-radius: 1.2rem;
  overflow-x: auto;
  font-size: 1.4rem;
  line-height: 1.6;
}

.blog-article pre code {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

.blog-article img {
  width: 100%;
  border-radius: 1.2rem;
  margin: 1em 0;
}

.blog-article hr {
  border: 0;
  border-top: 1px solid var(--blog-border);
  margin: 3em 0;
}

.blog-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.5rem;
  border: 1px solid var(--blog-border);
  border-radius: 1.2rem;
  overflow: hidden;
}

.blog-article th,
.blog-article td {
  padding: 1.2rem 1.6rem;
  text-align: left;
  border-bottom: 1px solid var(--blog-border);
  color: #344054;
}

.blog-article th {
  background: var(--blog-tint);
  font-weight: 600;
  color: var(--text-primary);
}

.blog-article tr:last-child td {
  border-bottom: 0;
}

/* Heading anchors (rehype-autolink-headings, behavior: wrap) */
.blog-article :is(h2, h3, h4) {
  scroll-margin-top: 10rem;
}

.blog-article :is(h2, h3, h4) > a {
  color: inherit;
  text-decoration: none;
}

.blog-article :is(h2, h3, h4) > a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: #d0d5dd;
}

/* ---------- Tag chips as links ---------- */
a.tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Related posts ---------- */
.blog-related {
  padding-top: 6rem;
  border-top: 1px solid var(--blog-border);
}

.blog-related h2 {
  font-size: 3.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.blog-related .blog-grid {
  padding: 3rem 0 0;
}

/* The end-of-post CTA is the shared components/SiteCta.tsx block, styled by
   `section .cta` in style.css — identical to the home page. Nothing to add
   here; the old bespoke .blog-cta-card styles were removed with it. */

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 660px) {
  .blog-hero {
    padding: 5rem 0 3rem;
  }
  .blog-hero h1,
  .blog-post-hero h1 {
    font-size: 3.4rem;
  }
  .blog-hero p {
    font-size: 1.6rem;
  }
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 2.4rem;
    padding: 3rem 0 5rem;
  }
  .blog-article {
    font-size: 1.7rem;
  }
  .blog-article h2 {
    font-size: 2.6rem;
  }
  .blog-article h3 {
    font-size: 2.1rem;
  }
  .blog-cta-card {
    padding: 4rem 2.4rem;
  }
  .blog-cta-card h3 {
    font-size: 2.6rem;
  }
}
