/**
 * Blog-specific styles.
 *
 * Reuses the design tokens (colors, spacing, typography, shadows, radii)
 * from /css/website.css — which is loaded BEFORE this file in base.njk
 * so all `var(--*)` references resolve.
 *
 * Layouts here:
 *   1. Blog index — featured-post hero + responsive card grid
 *   2. Post page  — hero image + narrow centered reading column +
 *                   vertical share rail (collapses on mobile)
 *   3. Related-posts section at end of post page
 *
 * Mobile-first; desktop layouts are unlocked at the existing
 * `--breakpoint-md` (~768px) and `--breakpoint-lg` (~1024px) thresholds.
 */

/* =============================================================================
 *  BLOG INDEX
 * ============================================================================ */

.blog-index {
  /* Top padding clears the fixed floating navbar (which sits at top:1.5rem
     and is ~80px tall = bottom edge at ~104px from viewport top). Matches
     the merchant-hero pattern in the marketing CSS for consistent
     content-below-navbar spacing across the site. */
  padding: calc(var(--space-4xl) + 80px) 0 var(--space-4xl);
}

.blog-index-header {
  max-width: 720px;
  margin: 0 auto var(--space-3xl);
  text-align: center;
}

.blog-index-title {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-md);
  color: var(--color-text);
}

.blog-index-title-em {
  font-family: var(--font-drama);
  font-style: italic;
  font-weight: 400;
  color: var(--color-primary);
}

.blog-index-tagline {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Category filter chip bar — sits between the index header and the
   featured-post hero. Pill-shaped buttons; one is active at a time.
   Filter logic + URL-hash sync is in index.njk's inline script. */
.blog-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
  margin: 0 auto var(--space-2xl);
  padding: 0;
}

.blog-filter-chip {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  /* Reset browser default button styles that fight our editorial look. */
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.blog-filter-chip:hover {
  background: rgba(37, 99, 235, 0.05);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.blog-filter-chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.blog-filter-chip:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Inline reset link inside the "no posts in this category" empty state. */
.blog-filter-empty-reset {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.blog-filter-empty-reset:hover {
  color: var(--color-primary-dark);
}

/* Featured post — big hero card, full width of the container, stacks
   image above body on mobile, side-by-side on desktop. */
.blog-featured {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3xl);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.blog-featured:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.blog-featured-image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-background);
}

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

.blog-featured-body {
  padding: var(--space-2xl) var(--space-xl);
}

.blog-featured-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: var(--space-sm) 0 var(--space-md);
  color: var(--color-text);
}

.blog-featured-dek {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-lg);
}

.blog-featured-category {
  /* Inherits .post-card-category base styles below */
  font-size: var(--text-xs);
}

.blog-featured-meta {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* Card grid — 1 column mobile, 2 cols tablet, 3 cols desktop. */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl);
}

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

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

/* =============================================================================
 *  POST CARDS (used on index + related-posts section)
 * ============================================================================ */

.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.post-card-image-wrap {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-background);
}

.post-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-base);
}

.post-card:hover .post-card-image {
  transform: scale(1.03);
}

.post-card-body {
  padding: var(--space-lg);
}

.post-card-category {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 4px var(--space-sm);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-sm);
}

.post-card-title {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-sm);
  color: var(--color-text);
}

.post-card-dek {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-md);
  /* Clamp the dek to ~2 lines so cards stay roughly the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-meta {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

.post-card-meta-sep {
  margin: 0 var(--space-sm);
}

/* =============================================================================
 *  POST PAGE
 * ============================================================================ */

.post {
  padding: 0 0 var(--space-4xl);
}

.post-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 540px;
  overflow: hidden;
  background: var(--color-background);
}

.post-hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-3xl) var(--space-lg) 0;
}

.post-header {
  max-width: 720px;
  margin: 0 auto var(--space-2xl);
  text-align: center;
}

.post-category-tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 4px var(--space-md);
  border-radius: var(--radius-full);
  text-decoration: none;
  margin-bottom: var(--space-lg);
  transition: background var(--transition-fast);
}

.post-category-tag:hover {
  background: rgba(37, 99, 235, 0.16);
}

.post-title {
  font-family: var(--font-heading);
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-md);
  color: var(--color-text);
}

.post-dek {
  font-family: var(--font-drama);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.4;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-xl);
}

.post-meta {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.post-meta-sep {
  margin: 0 var(--space-xs);
}

.post-meta-author {
  font-weight: 600;
  color: var(--color-text);
}

/* Side-by-side layout: share rail | body, on desktop. Stacks on mobile. */
.post-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  max-width: 720px;
  margin: 0 auto;
}

@media (min-width: 1024px) {
  .post-layout {
    /* Push the share rail outside the 720px reading column so the body
       stays at its target measure but the share buttons stick alongside. */
    max-width: 920px;
    grid-template-columns: 60px 1fr;
    gap: var(--space-2xl);
    align-items: start;
  }
}

/* =============================================================================
 *  SHARE BUTTONS (vertical rail on desktop, horizontal row on mobile)
 * ============================================================================ */

.post-share {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

@media (min-width: 1024px) {
  .post-share {
    flex-direction: column;
    border: none;
    padding: 0;
    position: sticky;
    /* Clear the fixed floating navbar (top:1.5rem + ~80px tall = bottom
       edge at ~104px from viewport top) with breathing room so the SHARE
       label and buttons don't hide behind it on scroll. */
    top: calc(var(--space-lg) + 5rem);
  }
}

.post-share-label {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
}

.post-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.post-share-btn:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: rgba(37, 99, 235, 0.04);
  transform: translateY(-1px);
}

.post-share-copied {
  color: var(--color-accent) !important;
  border-color: var(--color-accent) !important;
}

/* =============================================================================
 *  POST BODY — the actual article content
 * ============================================================================ */

.post-body {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--color-text);
  max-width: 720px;
}

.post-body > p {
  margin: 0 0 var(--space-lg);
}

.post-body > p:first-of-type::first-letter {
  /* Subtle editorial first-letter treatment without going full drop-cap. */
  font-weight: 600;
}

.post-body h2 {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: var(--space-2xl) 0 var(--space-md);
  color: var(--color-text);
}

.post-body h3 {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  margin: var(--space-xl) 0 var(--space-sm);
  color: var(--color-text);
}

.post-body ul,
.post-body ol {
  margin: 0 0 var(--space-lg);
  padding-left: var(--space-xl);
  /* Re-enable list markers inside blog post bodies. The marketing CSS
     ships a global `ul, ol { list-style: none; }` reset (intended for
     nav lists, footer link groups, hero feature lists, etc.) which
     also strips markers from prose lists in blog posts. Restoring them
     here scopes the prose-list treatment to `.post-body` only — site
     UI lists elsewhere stay marker-less. */
}

.post-body ul {
  list-style-type: disc;
}

.post-body ol {
  list-style-type: decimal;
}

.post-body li {
  margin-bottom: var(--space-sm);
}

.post-body li > p {
  margin: 0 0 var(--space-sm);
}

.post-body a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.post-body a:hover {
  color: var(--color-primary-dark);
}

.post-body strong {
  font-weight: 700;
  color: var(--color-text);
}

.post-body em {
  font-family: var(--font-drama);
  font-style: italic;
  font-weight: 400;
}

.post-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 0 0 0 var(--space-lg);
  margin: var(--space-xl) 0;
  font-family: var(--font-drama);
  font-style: italic;
  font-weight: 400;
  font-size: var(--text-xl);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-background);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.post-body pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-dark);
  color: #e2e8f0;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.post-body pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
}

/* Tables in post body — used for decision rubrics, comparison grids, etc.
   Editorial style: subtle row separators, distinguished header row, no
   harsh outer borders. Reuses design tokens for consistency with the
   rest of the blog typography. */
.post-body table {
  width: 100%;
  margin: 0 0 var(--space-lg);
  border-collapse: collapse;
  font-size: var(--text-base);
}

.post-body table th,
.post-body table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

.post-body table th {
  background: var(--color-background);
  font-weight: 600;
  font-family: var(--font-heading);
  border-bottom-width: 2px;
  color: var(--color-text);
}

.post-body table tr:last-child td {
  border-bottom: none;
}

/* =============================================================================
 *  RELATED POSTS SECTION
 * ============================================================================ */

.post-related {
  background: var(--color-background);
  /* Symmetric top/bottom padding bumped from --space-3xl (4rem) to
     --space-4xl (6rem) so the section breathes — gives clear space
     between the post body above and the footer below, and prevents
     the cards from sitting flush against the dark footer band. */
  padding: var(--space-4xl) 0;
  border-top: 1px solid var(--color-border);
}

.post-related-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-xl);
  color: var(--color-text);
}

.post-related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

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

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

/* =============================================================================
 *  EMPTY STATE
 * ============================================================================ */

.blog-empty {
  text-align: center;
  padding: var(--space-3xl) 0;
  color: var(--color-text-muted);
  font-family: var(--font-heading);
  font-size: var(--text-lg);
}
