/*
 * The blog's own styling.
 *
 * Why this exists at all, when the page already links the site's compiled
 * Tailwind: that stylesheet is *purged*. Tailwind scans the source it is built
 * from and emits only the utilities it finds there, and a PHP file it has never
 * seen is invisible to that scan. Checking the built CSS shows exactly that —
 * `prose`, `leading-relaxed`, `object-cover`, `aspect-video` and `py-14` are
 * all absent, because nothing in the React site uses them.
 *
 * So this page takes the *tokens* from that stylesheet rather than its classes.
 * --color-primary, --color-dark and the --text-* scale are custom properties
 * emitted by Tailwind v4's @theme block, so they are there whatever the purge
 * decided, and a change to the site's palette moves this with it.
 *
 * Every var() carries a literal fallback: if the compiled stylesheet is ever
 * missing — a failed build, a half-finished deploy — a blog post should still
 * be a readable page rather than unstyled text.
 *
 * Dark mode matches the site: `.dark` on <html>, set by the inline script in
 * PublicPage and toggled by blog.js.
 */

:root {
  --blog-ink: var(--color-dark, #172023);
  --blog-bg: #ffffff;
  --blog-muted: rgba(23, 32, 35, 0.62);
  --blog-line: rgba(23, 32, 35, 0.12);
  --blog-surface: rgba(23, 32, 35, 0.03);
  --blog-accent: var(--color-primary, #07be8a);
}

:root.dark {
  --blog-ink: #f4f7f7;
  --blog-bg: #000000;
  --blog-muted: rgba(255, 255, 255, 0.58);
  --blog-line: rgba(255, 255, 255, 0.14);
  --blog-surface: rgba(255, 255, 255, 0.05);
}

/* ------------------------------------------------------------------ shell */

/*
 * The site header is `fixed h-24`, so content starts underneath it. The
 * marketing pages each handle this in their own hero; an article has no hero,
 * so it is handled here.
 */
.blog-main {
  background: var(--blog-bg);
  color: var(--blog-ink);
  padding-top: 9rem;
  padding-bottom: 5rem;
  font-family: 'Bricolage Grotesque', 'Bricolage Grotesque Fallback',
               ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.blog-wrap {
  width: 100%;
  max-width: 87.5rem; /* the site's own --spacing-8xl container */
  margin: 0 auto;
  padding: 0 1rem;
}

/* Prose wants a measure, not a container. */
.blog-narrow {
  max-width: 46rem;
}

@media (min-width: 1024px) {
  .blog-wrap { padding: 0; }
  .blog-narrow { padding: 0 1rem; }
}

.blog-eyebrow {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blog-accent);
  margin: 0 0 0.75rem;
}

.blog-title {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.blog-lede {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--blog-muted);
  margin: 0 0 2rem;
  max-width: 46rem;
}

.blog-byline {
  font-size: 0.9375rem;
  color: var(--blog-muted);
  margin: 0 0 2rem;
}

.blog-back {
  color: var(--blog-muted);
  text-decoration: none;
}

.blog-back:hover { color: var(--blog-accent); }

.blog-cover {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28rem;
  object-fit: cover;
  border-radius: 1rem;
  margin: 0 0 2.5rem;
  background: var(--blog-surface);
}

.blog-preview-flag {
  background: rgba(183, 121, 31, 0.12);
  color: #8a5a12;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  margin: 0 0 1.5rem;
}

:root.dark .blog-preview-flag { color: #e3ac54; }

.blog-empty {
  color: var(--blog-muted);
  padding: 3rem 0;
}

/* ------------------------------------------------------------- the article */

/*
 * Set for reading: a measure around 70 characters, generous leading, and
 * enough space above a heading that it belongs to what follows rather than
 * floating between two paragraphs.
 */
.post-body {
  font-size: 1.125rem;
  line-height: 1.75;
  color: var(--blog-ink);
}

.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }

.post-body p { margin: 0 0 1.5rem; }

.post-body h2 {
  font-size: 1.875rem;
  line-height: 1.25;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 3rem 0 1rem;
}

.post-body h3 {
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 600;
  margin: 2.25rem 0 0.75rem;
}

.post-body h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
}

.post-body a {
  color: var(--blog-accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.5rem;
  padding-left: 1.5rem;
}

.post-body li { margin-bottom: 0.5rem; }

.post-body blockquote {
  margin: 2rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--blog-accent);
  color: var(--blog-muted);
  font-size: 1.25rem;
  line-height: 1.6;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  margin: 2rem 0;
}

.post-body figure { margin: 2rem 0; }

.post-body figcaption {
  font-size: 0.875rem;
  color: var(--blog-muted);
  margin-top: 0.5rem;
}

.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--blog-surface);
  border-radius: 0.375rem;
  padding: 0.15em 0.4em;
}

.post-body pre {
  background: var(--blog-surface);
  border: 1px solid var(--blog-line);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 2rem 0;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: 0.9375rem;
}

/* A wide table must scroll inside itself rather than widening the page. */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 1rem;
  display: block;
  overflow-x: auto;
}

.post-body th,
.post-body td {
  text-align: left;
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--blog-line);
}

.post-body th { font-weight: 600; }

.post-body hr {
  border: 0;
  border-top: 1px solid var(--blog-line);
  margin: 2.5rem 0;
}

.blog-rule {
  border: 0;
  border-top: 1px solid var(--blog-line);
  margin: 3.5rem 0 2.5rem;
}

/* ----------------------------------------------------------------- the CTA */

.blog-cta {
  background: var(--blog-surface);
  border: 1px solid var(--blog-line);
  border-radius: 1rem;
  padding: 2rem;
}

.blog-cta h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
}

.blog-cta p {
  color: var(--blog-muted);
  margin: 0 0 1.25rem;
}

.blog-cta-button {
  display: inline-block;
  background: var(--blog-accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  border-radius: 9999px;
  transition: opacity 0.2s ease;
}

.blog-cta-button:hover { opacity: 0.88; }

/* --------------------------------------------------------------- the index */

.blog-index-head { margin-bottom: 3rem; }

.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

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

@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.blog-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--blog-line);
  border-radius: 1rem;
  overflow: hidden;
  background: var(--blog-bg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08),
              0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.blog-card-image {
  display: block;
  aspect-ratio: 16 / 9;
  background: var(--blog-surface);
  overflow: hidden;
}

.blog-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.blog-card-date {
  font-size: 0.8125rem;
  color: var(--blog-muted);
}

.blog-card-title {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
}

.blog-card-excerpt {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--blog-muted);
  flex: 1;
}

.blog-card-more {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--blog-accent);
  margin-top: 0.25rem;
}

.blog-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 3rem;
  font-size: 0.9375rem;
  color: var(--blog-muted);
}

.blog-pager a {
  color: var(--blog-accent);
  text-decoration: none;
  font-weight: 600;
}

/*
 * Topic tags, under the post.
 *
 * Deliberately not links. A tag archive page per tag would add a dozen thin,
 * near-duplicate listings competing with the index they came from; these say
 * what the post is about without adding a crawlable URL.
 */
.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
}

.blog-tag {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: var(--blog-muted);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.4375rem 0.75rem;
}
