/* ─────────────────────────────────────────────────────────────
   Blog — blog.css
   Built entirely on shared primitives from design-system.css
   (.wrap/.section/.eyebrow/.title/.lede/.btn-secondary). This file
   only adds what's unique to the blog: post cards, post typography,
   pagination, and tag pills.
   ───────────────────────────────────────────────────────────── */

/* ── Blog listing page ───────────────────────────────────────── */
.blog-listing.section { padding: 20px 0 56px; }
.blog-listing__head { margin-bottom: 24px; }

/* ── Post grid (list + tag pages) ───────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 2rem;
}
.blog-grid--tight { margin-top: 0; }

.blog-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.blog-card:hover {
  border-color: var(--gold-d);
  transform: translateY(-3px);
  box-shadow: 0 20px 44px -28px rgba(0,0,0,.7);
}

.blog-card__cover {
  height: 128px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg4);
}

.blog-card__body { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }

.blog-card__meta-row { display: flex; align-items: center; gap: 8px; }
.blog-card__date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--iq);
}
.blog-card__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  line-height: 1.3;
}
.blog-card__title a { color: inherit; }

/* Makes the whole card clickable (title link stretched to fill the
   card) while keeping the category pill independently clickable —
   avoids nesting an <a> inside another <a>, which is invalid HTML. */
.blog-card__stretched-link { color: inherit; }
.blog-card__stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.blog-cat { position: relative; z-index: 2; }

.blog-card__desc {
  font-size: 0.875rem;
  color: var(--text2);
  line-height: 1.6;
}

.blog-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.blog-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: var(--text3);
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
}

/* ── Category pill — small, background-colored, clickable ──────
   One color per category, reusing the site's existing severity/accent
   tokens rather than inventing new arbitrary colors. */
.blog-cat {
  display: inline-flex;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.blog-cat:hover { opacity: .8; }
.blog-cat--announcements { color: var(--iq); background: rgba(203,162,74,.12); border-color: rgba(203,162,74,.3); }
.blog-cat--product { color: var(--med); background: rgba(91,141,239,.12); border-color: rgba(91,141,239,.3); }
.blog-cat--regulatory { color: var(--crit); background: rgba(229,84,75,.12); border-color: rgba(229,84,75,.3); }
.blog-cat--engineering { color: var(--ok); background: rgba(79,180,119,.12); border-color: rgba(79,180,119,.3); }
.blog-cat--company { color: var(--high); background: rgba(239,139,60,.12); border-color: rgba(239,139,60,.3); }

/* ── Pagination ──────────────────────────────────────────────── */
.blog-pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 3rem;
}

/* ── Individual post ─────────────────────────────────────────── */
/* Wrap matches the homepage's own .wrap width (var(--max)) so the post's
   edges line up with every other section on the site. The prose itself
   stays readable-width via .blog-post__body's own max-width below —
   same pattern the homepage uses (.wrap is wide, .lede caps at 72ch). */
.blog-post__wrap { max-width: var(--max); }
/* Tighter top/bottom padding than the default .section (72px) — posts
   were reading as having too much dead space above/below content. */
.blog-post.section { padding: 20px 0 56px; }
.blog-magazine .section { padding: 0 0 56px; }

.blog-post__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--text3);
  margin-bottom: 20px;
  transition: color 0.2s;
}
.blog-post__back:hover { color: var(--iq); }

.blog-post__eyebrow { margin-bottom: 0; }

.blog-post__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.blog-post__date,
.blog-post__views {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text3);
}
.blog-post__views::before { content: "·"; margin-right: 12px; color: var(--border2); }

.blog-post__share {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}
.blog-post__share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text3);
  transition: color 0.2s, background 0.2s;
  cursor: pointer;
}
.blog-post__share-btn svg { width: 15px; height: 15px; fill: currentColor; }
.blog-post__share-btn:hover { color: var(--iq); background: rgba(203,162,74,.08); }
.blog-post__share-btn[data-copied="true"] { color: var(--ok); }
.blog-post__cover {
  display: block;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin: 0 auto 24px;
}

.blog-post__card {
  /* Deliberately no border/background — open, editorial layout rather
     than a boxed card. Wider reading column than the rest of the site's
     72ch prose (.lede) since the post page has no competing content to
     stay narrow against. */
  padding: 0;
}

.blog-post__body {
  /* Matches the wrap's full width — no reading-column cap. */
  max-width: 100%;
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text2);
}
.blog-post__body p { margin-bottom: 18px; }
.blog-post__body h2 {
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.375rem;
  color: var(--text); margin: 36px 0 14px;
}
.blog-post__body h3 {
  font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 1.125rem;
  color: var(--text); margin: 28px 0 12px;
}
.blog-post__body ul,
.blog-post__body ol { margin: 0 0 18px 4px; padding-left: 0; }
.blog-post__body ul { list-style: none; }
.blog-post__body ol { list-style: decimal; padding-left: 18px; }
.blog-post__body ul li {
  position: relative;
  padding-left: 20px;
}
.blog-post__body ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--iq);
}
.blog-post__body li { margin-bottom: 8px; }
.blog-post__body a { color: var(--iq); text-decoration: underline; text-underline-offset: 3px; }
.blog-post__body a:hover { color: var(--iq2); }
.blog-post__body img { max-width: 100%; border-radius: 10px; margin: 20px 0; }
.blog-post__body code {
  font-family: 'IBM Plex Mono', monospace; font-size: .9em; color: var(--iq);
  background: rgba(203,162,74,.08); border-radius: 4px; padding: 1px 6px;
}
.blog-post__body pre {
  background: var(--bg4); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px; overflow-x: auto; margin-bottom: 18px;
}
.blog-post__body pre code { background: none; padding: 0; color: var(--text2); }
.blog-post__body blockquote {
  border-left: 3px solid var(--iq); padding-left: 16px; margin: 0 0 18px;
  color: var(--text3); font-style: italic;
}

/* ── Magazine template ───────────────────────────────────────── */
.blog-magazine__hero {
  position: relative;
  aspect-ratio: 21 / 6;
  max-height: 340px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg4);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.blog-magazine__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.75) 100%);
}
.blog-magazine__hero-inner {
  position: relative;
  z-index: 1;
  padding-bottom: clamp(18px, 3vw, 28px);
}
.blog-post__back--on-image { color: rgba(255,255,255,.75); }
.blog-post__back--on-image:hover { color: var(--iq2); }
.blog-magazine__hero .blog-post__eyebrow { margin-bottom: 10px; }
.blog-magazine__title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: clamp(1.5rem, 3.4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -.02em;
  color: #fff;
  margin: 0 0 8px;
  max-width: 26ch;
}
.blog-magazine__date {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: rgba(255,255,255,.75);
}
.blog-magazine__meta { margin: 24px 0 8px; }
.blog-magazine__meta .blog-post__views::before { content: none; margin-right: 0; }

/* ── Author pill ────────────────────────────────────────────── */
.blog-author { display: flex; align-items: center; gap: 7px; min-width: 0; }
.blog-author--inline { flex-shrink: 0; }
.blog-author__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--iq-dim); border: 1px solid rgba(203,162,74,.25);
  color: var(--iq); font-family: 'Outfit', sans-serif;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.blog-author__name {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 12.5px; color: var(--text2); font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.blog-card__author { margin-top: 8px; min-width: 0; }
.blog-meta__sep { color: var(--border2); font-size: 11px; }

/* ── Section heading (landing "More posts") ─────────────────── */
.blog-section-heading {
  font-family: 'Outfit', sans-serif; font-weight: 700;
  font-size: 1rem; color: var(--text3);
  letter-spacing: .04em; text-transform: uppercase;
  margin: 1.75rem 0 0.85rem;
}

/* ── Featured post (latest) ─────────────────────────────────── */
.blog-featured {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  overflow: hidden;
  margin-top: 1.5rem;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  min-height: 300px;
}
.blog-featured:hover {
  border-color: var(--gold-d);
  transform: translateY(-2px);
  box-shadow: 0 20px 44px -28px rgba(0,0,0,.7);
}
.blog-featured__cover {
  position: relative;
  background-size: cover; background-position: center;
  background-color: var(--bg4);
  min-height: 240px;
}
.blog-featured__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0) 60%, var(--bg2) 100%);
}
[data-theme="light"] .blog-featured__scrim {
  background: linear-gradient(90deg, rgba(0,0,0,0) 60%, var(--bg2) 100%);
}
.blog-featured__body {
  padding: clamp(18px, 2.5vw, 28px);
  display: flex; flex-direction: column; gap: 8px; justify-content: center;
}
.blog-featured__meta-row { display: flex; align-items: center; gap: 8px; }
.blog-featured__title {
  font-family: 'Outfit', sans-serif; font-weight: 800;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem);
  line-height: 1.2; color: var(--text);
}
.blog-featured__desc { font-size: .9rem; color: var(--text2); line-height: 1.6; }
.blog-featured__foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

/* ── Font size controls ─────────────────────────────────────── */
.blog-fs-bar {
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.blog-fs-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--text3);
  letter-spacing: .05em; margin-right: 4px;
}
.blog-fs-btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 500;
  color: var(--text3); background: var(--bg4);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 9px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.blog-fs-btn:hover { color: var(--iq); border-color: var(--iq-dim); background: var(--iq-dim); }

/* ── Prev / Next navigation ─────────────────────────────────── */
.blog-post__nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 2.5rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.blog-post__nav-prev { text-align: left; }
.blog-post__nav-next { text-align: right; }
.blog-post__nav-label {
  display: block; font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--text3);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px;
}
.blog-post__nav-link {
  font-family: 'Outfit', sans-serif; font-weight: 600;
  font-size: .9375rem; color: var(--text2); line-height: 1.35;
  transition: color 0.2s;
}
.blog-post__nav-link:hover { color: var(--iq); }

@media (max-width: 860px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-featured { grid-template-columns: 1fr; min-height: auto; }
  .blog-featured__cover { min-height: 180px; }
  .blog-featured__scrim { background: linear-gradient(180deg, rgba(0,0,0,0) 60%, var(--bg2) 100%); }
}
@media (max-width: 600px) {
  .blog-grid { grid-template-columns: 1fr; }
  .blog-magazine__hero { aspect-ratio: 4 / 5; max-height: 280px; }
  .blog-post__nav { grid-template-columns: 1fr; }
  .blog-post__nav-next { text-align: left; }
  .blog-post__meta { gap: 8px; }
  .blog-post__share { margin-left: 0; width: 100%; justify-content: flex-start; }
  .blog-fs-bar { justify-content: space-between; }
}
