/*
  Blog layout. Loaded AFTER styles.css, which supplies the palette tokens, the Archivo face, the
  header/footer and the .btn ramp — this file adds only what the blog needs on top.

  Structure follows novita.ai/blog (hero, filter row, one featured post, a grid beneath, a
  "Latest posts" rail); the palette, type and chrome are Inference Exchange's own.

  Post covers are drawn in CSS from the accent ramp rather than shipped as images: D7 forbids a
  third-party origin, and a generated cover means adding a post costs no asset pipeline.
*/

.blog-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px 96px;
}

/* ── Hero ──────────────────────────────────────────────────────────────────────────────── */

.blog-hero {
  padding: 72px 0 48px;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: 48px;
}

.blog-hero h1 {
  font-size: clamp(38px, 6vw, 62px);
}

/* ── Two-column shell ──────────────────────────────────────────────────────────────────── */

.blog-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  align-items: start;
}

/* ── Post cards ────────────────────────────────────────────────────────────────────────── */

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  margin-top: 32px;
}

.post-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.post-card:hover .post-card-title {
  color: var(--color-accent-600);
}

.post-card:hover .post-cover {
  transform: translateY(-3px);
}

.post-card-title {
  margin: 18px 0 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.015em;
  transition: color 0.15s ease;
}

.post-card-excerpt {
  margin-top: 10px;
  color: var(--color-neutral-800);
  font-size: 15px;
}

.post-meta {
  margin-top: 14px;
  font-size: 13px;
  color: var(--color-neutral-800);
}

/* The featured card is the same card at a larger scale — one rule set, two sizes. */
.post-card-featured .post-card-title {
  font-size: 30px;
  margin-top: 22px;
}

.post-card-featured .post-card-excerpt {
  font-size: 16.5px;
  max-width: 62ch;
}

/* ── Generated covers ──────────────────────────────────────────────────────────────────── */

.post-cover {
  position: relative;
  display: flex;
  align-items: flex-end;
  aspect-ratio: 16 / 9;
  padding: 24px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-accent-800), var(--color-accent-500) 62%);
  transition: transform 0.15s ease;
}

.post-card-featured .post-cover {
  aspect-ratio: 21 / 9;
  padding: 34px;
}

/* A faint token-ledger motif — repeating rules, like rows on the trade desk. */
.post-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.12) 0 1px,
    transparent 1px 34px
  );
  pointer-events: none;
}

.post-cover-word {
  position: relative;
  z-index: 1;
  font-size: clamp(16px, 2.6vw, 27px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 18ch;
}

.post-card-featured .post-cover-word {
  font-size: clamp(20px, 3.1vw, 35px);
}

.post-cover-tag {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent-200);
}

.post-card-featured .post-cover-tag {
  top: 28px;
  left: 34px;
}

/* ── Sidebar rail ──────────────────────────────────────────────────────────────────────── */

.blog-rail {
  position: sticky;
  top: 24px;
}

.rail-heading {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-item {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  background: var(--color-neutral-100);
  text-decoration: none;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}

.rail-item:hover {
  border-color: var(--color-accent-500);
  color: var(--color-accent-600);
}

.rail-item[aria-current='page'] {
  border-color: var(--color-accent-500);
  background: var(--color-accent-100);
}

.rail-cta {
  margin-top: 28px;
  padding: 22px 20px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--color-accent-700), var(--color-accent-500));
  color: #fff;
}

.rail-cta p {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.rail-cta a {
  display: inline-block;
  margin-top: 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* ── Article ───────────────────────────────────────────────────────────────────────────── */

.article-header {
  padding: 56px 0 0;
}

.article-back {
  font-size: 14px;
  font-weight: 600;
}

.article-header h1 {
  margin-top: 20px;
  font-size: clamp(32px, 4.6vw, 50px);
  max-width: 20ch;
}

.article-meta {
  margin-top: 16px;
  font-size: 14px;
  color: var(--color-neutral-800);
}

.article-cover {
  margin: 34px 0 0;
}

.article-body {
  margin-top: 36px;
  max-width: 68ch;
  font-size: 17.5px;
  line-height: 1.68;
}

.article-body p {
  margin-bottom: 22px;
}

.article-body h2 {
  margin: 40px 0 14px;
  font-size: 26px;
}

.article-body strong {
  font-weight: 700;
}

.article-body a {
  color: var(--color-accent-600);
}

/* ── Mobile (375px first) ──────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .blog-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }

  .blog-rail {
    position: static;
  }

  .post-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-main {
    padding: 0 18px 72px;
  }

  .blog-hero {
    padding: 48px 0 32px;
  }

  .post-card-featured .post-cover {
    aspect-ratio: 16 / 9;
  }
}

/* ── Article figure (video hero) ───────────────────────────────────────────────────────── */

.article-figure {
  margin: 34px 0 0;
}

.article-video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: var(--color-surface);
}

.article-figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  color: var(--color-neutral-800);
}

/* A looping clip is decoration, not content — someone who asked the OS for less motion should get
   the poster frame and nothing moving. `autoplay` is in the markup for everyone else, so this pauses
   it rather than trusting the attribute to be absent. */
@media (prefers-reduced-motion: reduce) {
  .article-video {
    /* Paused by blog.js; this keeps the first frame visible if the script never runs. */
    animation: none;
  }
}
