/* Blog Post + Index Styles - matches the main site */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #3a9be0;
  --primary-dark: #1b6a9e;
  --accent: #e87a54;
  --success: #7dc244;
  --bg-dark: #0b1627;
  --bg-section: #0f1f3a;
  --bg-card: #172a48;
  --text-primary: #e8edf5;
  --text-secondary: #8ea2bf;
  --text-muted: #7a92b2;
  --border: #1e3456;
  --radius: 8px;
  --radius-lg: 16px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

img, svg { max-width: 100%; display: block; }

/* ── Top Nav ── */
.bp-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: rgba(11, 22, 39, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(30, 52, 86, 0.5);
}

.bp-nav-logo {
  display: flex;
  align-items: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-primary);
}

.bp-nav-back {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.bp-nav-back:hover { color: var(--primary); }

/* ── Index page header ── */
.bi-header {
  max-width: 900px;
  margin: 0 auto;
  padding: 80px 40px 60px;
  text-align: center;
}

.bi-eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 16px;
}

.bi-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.bi-title-accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bi-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
}

/* ── Index grid ── */
.bi-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px 100px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

.bi-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s, box-shadow 0.3s;
  text-decoration: none;
  color: inherit;
}

.bi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(58, 155, 224, 0.4);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(58, 155, 224, 0.08);
}

.bi-card-art {
  height: 200px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.bi-card-art svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.bi-card:hover .bi-card-art svg {
  transform: scale(1.04);
}

.bi-card-body {
  padding: 24px 24px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.bi-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.75rem;
}

.bi-card-category {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(232, 122, 84, 0.12);
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.6875rem;
}

.bi-card-date {
  color: var(--text-muted);
}

.bi-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.bi-card:hover .bi-card-title {
  color: var(--primary);
}

.bi-card-excerpt {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 18px;
  flex: 1;
}

.bi-card-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}

.bi-card:hover .bi-card-link {
  gap: 10px;
}

/* ── Article page ── */
.bp-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 40px 80px;
}

.bp-header {
  text-align: center;
  margin-bottom: 48px;
}

.bp-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  font-size: 0.8125rem;
}

.bp-category {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(232, 122, 84, 0.12);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.bp-date {
  color: var(--text-muted);
}

.bp-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.bp-excerpt {
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto;
}

.bp-author {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding: 10px 16px 10px 10px;
  background: rgba(58, 155, 224, 0.06);
  border: 1px solid rgba(58, 155, 224, 0.15);
  border-radius: 4px;
}
.bp-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c25837);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(58, 155, 224, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.bp-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bp-author-info { text-align: left; }
.bp-author-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.2;
}
.bp-author-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Sources / citations block - appears before Related Reading */
.bp-sources {
  margin: 48px 0 24px;
  padding: 20px 28px;
  background: rgba(15, 31, 58, 0.4);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.bp-sources h3 {
  margin: 0 0 12px;
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.bp-sources ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text-secondary);
}
.bp-sources li {
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 6px 0;
}
.bp-sources a {
  color: var(--text-primary);
  text-decoration: underline;
  text-decoration-color: rgba(232, 122, 84, 0.4);
  text-underline-offset: 3px;
  word-break: break-word;
}
.bp-sources a:hover {
  text-decoration-color: var(--accent);
  color: var(--accent);
}
@media (max-width: 768px) {
  .bp-sources { padding: 16px 18px; margin: 36px 0 20px; }
  .bp-sources li { font-size: 0.75rem; }
}

/* Lead-magnet capture block - appears before Sources / Related */
.bp-lead-magnet {
  margin: 56px 0 32px;
  padding: 28px 32px;
  background: linear-gradient(135deg, rgba(232, 122, 84, 0.08), rgba(58, 155, 224, 0.05));
  border: 1px solid rgba(232, 122, 84, 0.2);
  border-radius: var(--radius);
}
.bp-lead-magnet h3 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}
.bp-lead-magnet p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.bp-lm-preview {
  margin: 0 0 20px;
  padding-left: 18px;
  color: var(--text-secondary);
}
.bp-lm-preview li {
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 4px 0;
}
.bp-lm-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}
.bp-lm-form input {
  flex: 1 1 200px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: var(--font-body);
}
.bp-lm-form input::placeholder { color: var(--text-muted); }
.bp-lm-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.bp-lm-form button {
  padding: 10px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 120ms ease;
}
.bp-lm-form button:hover { opacity: 0.9; }
.bp-lm-form button:disabled { opacity: 0.5; cursor: not-allowed; }
.bp-lm-status {
  width: 100%;
  margin: 6px 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.bp-lm-success {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-primary);
}
@media (max-width: 768px) {
  .bp-lead-magnet { padding: 22px 20px; margin: 40px 0 24px; }
  .bp-lead-magnet h3 { font-size: 1.0625rem; }
}

/* Related reading block at the end of every post */
.bp-related {
  margin: 56px 0 32px;
  padding: 24px 28px;
  background: rgba(58, 155, 224, 0.04);
  border: 1px solid rgba(58, 155, 224, 0.15);
  border-radius: var(--radius);
}
.bp-related h3 {
  margin: 0 0 14px;
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.bp-related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bp-related li { padding: 0; }
.bp-related a {
  display: block;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(15, 31, 58, 0.5);
  border: 1px solid rgba(58, 155, 224, 0.08);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.bp-related a:hover,
.bp-related a:focus-visible {
  background: rgba(232, 122, 84, 0.08);
  border-color: rgba(232, 122, 84, 0.35);
  transform: translateX(3px);
  outline: none;
}
@media (max-width: 768px) {
  .bp-related { margin: 40px 0 24px; padding: 18px 20px; }
  .bp-related a { font-size: 0.875rem; padding: 8px 12px; }
}

.bi-byline-row {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: rgba(58, 155, 224, 0.06);
  border: 1px solid rgba(58, 155, 224, 0.15);
  border-radius: 100px;
}
.bi-byline-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #c25837);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(58, 155, 224, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.bi-byline-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bi-byline-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.bi-byline {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.bi-byline strong { color: var(--accent); font-weight: 700; }

.bp-hero {
  margin: 56px 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  background: var(--bg-section);
}

.bp-hero svg {
  width: 100%;
  height: auto;
  display: block;
}

/* [groblog v2 PR B] AI-generated hero image (replaces procedural SVG
 * when post.hero_image_url is set). object-fit: cover keeps the aspect
 * ratio crisp regardless of which aspect the tenant configured. */
.bp-hero-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Inline image body block. Generous breathing room so generated
 * visuals feel like editorial pauses, not banners. */
.bp-figure {
  margin: 40px 0;
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-section);
}
.bp-figure img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}
.bp-figure figcaption {
  padding: 12px 18px;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  border-top: 1px solid var(--border);
}

.bp-body {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.bp-body p,
.bp-body ul,
.bp-body ol {
  margin-bottom: 22px;
}

.bp-body p:first-of-type::first-letter {
  font-family: var(--font-heading);
  float: left;
  font-size: 4rem;
  line-height: 0.85;
  font-weight: 700;
  margin: 6px 12px 0 0;
  color: var(--accent);
}

.bp-body h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 20px;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.bp-body h3 {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 36px;
  margin-bottom: 14px;
  line-height: 1.3;
}

.bp-body h4 {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 28px;
  margin-bottom: 12px;
}

.bp-body h2 + p,
.bp-body h3 + p,
.bp-body h4 + p {
  margin-top: 0;
}

.bp-body h2 + p::first-letter,
.bp-body h3 + p::first-letter {
  /* Don't drop-cap paragraphs after headings */
  font-family: inherit;
  float: none;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  margin: 0;
  color: inherit;
}

.bp-body ul,
.bp-body ol {
  padding-left: 24px;
}

.bp-body li {
  margin-bottom: 10px;
  line-height: 1.7;
}

.bp-body ul li::marker {
  color: var(--accent);
}

.bp-body blockquote {
  margin: 28px 0;
  padding: 18px 24px;
  border-left: 3px solid var(--accent);
  background: rgba(232, 122, 84, 0.06);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-primary);
}

.bp-body blockquote p { margin-bottom: 0; }

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

.bp-body a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(58, 155, 224, 0.4);
  transition: text-decoration-color 0.2s, color 0.2s;
}

.bp-body a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.bp-body img {
  max-width: 100%;
  border-radius: 12px;
  margin: 24px 0;
  border: 1px solid var(--border);
}

/* ── Article CTA ── */
.bp-cta {
  margin-top: 64px;
  padding: 40px;
  background: linear-gradient(135deg, rgba(58, 155, 224, 0.08) 0%, rgba(232, 122, 84, 0.06) 100%);
  border: 1px solid rgba(58, 155, 224, 0.18);
  border-radius: var(--radius-lg);
  text-align: center;
}

.bp-cta h3 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.bp-cta p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 1rem;
}

.bp-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent);
  color: #fff !important;
  font-weight: 600;
  border-radius: 4px;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.bp-cta-btn:hover {
  background: #d96840;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(232, 122, 84, 0.35);
}

/* ── Footer ── */
.bp-footer {
  border-top: 1px solid var(--border);
  padding: 32px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.bp-footer a {
  color: var(--text-secondary);
  margin: 0 4px;
}

.bp-footer a:hover {
  color: var(--primary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .bp-nav { padding: 14px 20px; }
  .bi-header { padding: 60px 20px 40px; }
  .bi-grid { padding: 0 20px 60px; gap: 20px; }
  .bp-article { padding: 40px 20px 60px; }
  .bp-hero { margin: 40px -20px; border-radius: 0; }
  .bp-cta { padding: 32px 24px; }
  .bp-body p:first-of-type::first-letter {
    font-size: 3rem;
    margin: 4px 8px 0 0;
  }
}
