/* ─── Blog: CSS Variables ────────────────────────────────────────────────── */
:root {
  --blog-primary: #16a34a;
  --blog-teal: #14b8a6;
  --blog-dark: #0f2417;
  --blog-ink: #1a2e1a;
  --blog-muted: #4b6b4b;
  --blog-surface: #f0fdf4;
  --blog-border: rgba(22, 163, 74, 0.15);
}

/* ─── Table overrides ────────────────────────────────────────────────────── */
.blog-content table,
.article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.95em;
  background: #fff;
}
.blog-content thead th,
.article-body thead th {
  background: var(--blog-surface) !important;
  color: var(--blog-ink) !important;
  font-weight: 600;
}
.blog-content th,
.blog-content td,
.article-body th,
.article-body td {
  border: 1px solid #c8e6c9;
  padding: 0.6em 1em;
  text-align: left;
  color: #2d402d;
}

/* ─── Navbar: white text when floating over dark blog heroes ─────────────── */
body.blog-page .navbar:not(.scrolled) .navbar-name,
body.blog-page .navbar:not(.scrolled) .navbar-nav a,
body.blog-page .navbar:not(.scrolled) .navbar-toggle {
  color: #fff !important;
}

body.blog-page .navbar:not(.scrolled) .navbar-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
}

body.blog-page .navbar:not(.scrolled) .navbar-nav a[aria-current='page'] {
  color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.12);
}

body.blog-page .navbar:not(.scrolled) .navbar-nav a[aria-current='page']:hover {
  color: #4ade80 !important;
  background: rgba(74, 222, 128, 0.2);
}

body.blog-page .navbar:not(.scrolled) .btn-outline {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.55);
}

body.blog-page .navbar:not(.scrolled) .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.85);
}

body.blog-page .navbar:not(.scrolled) .btn-primary {
  background: rgba(255, 255, 255, 0.18);
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
}

body.blog-page .navbar:not(.scrolled) .btn-primary:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* ─── Blog Hero (list page) ──────────────────────────────────────────────── */
.blog-hero {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 55%, #22c55e 100%);
  padding: 5.5rem 1.5rem 4.5rem;
  padding-top: calc(var(--navbar-height, 68px) + 4.5rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 80% 60% at 50% 0%,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 70%
  );
  pointer-events: none;
}
.blog-hero__inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
}
.blog-hero__label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #86efac;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.blog-hero__title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.blog-hero__sub {
  font-size: 1.1rem;
  color: #bbf7d0;
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

/* ─── Blog Container ─────────────────────────────────────────────────────── */
.blog-container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* ─── Blog Grid ──────────────────────────────────────────────────────────── */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
  align-items: start;
}
/* Featured first card spans full width in 2-col layout */
.blog-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}

/* ─── Blog Card ──────────────────────────────────────────────────────────── */
.blog-card {
  background: #fff;
  border: 1px solid #e2f0e4;
  border-radius: 16px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
  position: relative;
  overflow: hidden;
  animation: blogFadeUp 0.5s ease-out both;
}
.blog-card:nth-child(1) {
  animation-delay: 0.05s;
}
.blog-card:nth-child(2) {
  animation-delay: 0.1s;
}
.blog-card:nth-child(3) {
  animation-delay: 0.15s;
}
.blog-card:nth-child(4) {
  animation-delay: 0.2s;
}
.blog-card:nth-child(5) {
  animation-delay: 0.25s;
}
.blog-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blog-primary), var(--blog-teal));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}
.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(22, 163, 74, 0.12);
  border-color: #c8e6c9;
}
.blog-card:hover::after {
  transform: scaleX(1);
}

.blog-card__tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blog-primary);
  background: var(--blog-surface);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  align-self: flex-start;
}
.blog-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.blog-card--featured .blog-card__title {
  font-size: 1.7rem;
}
.blog-card__title a {
  color: var(--blog-ink);
  text-decoration: none;
  transition: color 0.2s;
}
.blog-card__title a:hover {
  color: var(--blog-primary);
}
.blog-card__excerpt {
  font-size: 0.93rem;
  color: var(--blog-muted);
  line-height: 1.65;
  flex: 1;
}
.blog-card--featured .blog-card__excerpt {
  font-size: 1.05rem;
}
.blog-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.blog-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e8f5e9;
  gap: 1rem;
  flex-wrap: wrap;
}
.blog-card__meta {
  display: flex;
  gap: 1rem;
  color: #6b8f6b;
  font-size: 0.82rem;
}
.blog-card__meta i {
  color: var(--blog-primary);
  margin-right: 0.35rem;
}
.blog-card__cta {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blog-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  transition: gap 0.2s;
}
.blog-card__cta:hover {
  gap: 0.65rem;
  text-decoration: none;
}

/* ─── Blog tag pill ──────────────────────────────────────────────────────── */
.blog-tag {
  display: inline-block;
  background: linear-gradient(135deg, var(--blog-primary), var(--blog-teal));
  color: #fff;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.blog-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* ─── Article page wrapper ───────────────────────────────────────────────── */
.article-page {
  background: var(--blog-surface);
  min-height: calc(100vh - 200px);
}

/* ─── Article header ─────────────────────────────────────────────────────── */
.article-header {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 55%, #22c55e 100%);
  padding: 4.5rem 0 3rem;
  padding-top: calc(var(--navbar-height, 68px) + 3.5rem);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.article-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 60% 80% at 85% 50%,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 60%
  );
  pointer-events: none;
}
.article-header__inner {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.article-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: #86efac;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 1.5rem;
  transition:
    gap 0.2s,
    color 0.2s;
}
.article-back:hover {
  gap: 0.65rem;
  color: #bbf7d0;
  text-decoration: none;
}
.article-category {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #86efac;
  background: rgba(22, 163, 74, 0.25);
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
}
.article-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 1rem;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}
.article-desc {
  font-size: 1.1rem;
  color: #bbf7d0;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  max-width: 680px;
}
.article-byline {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  color: #86efac;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.article-byline__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.article-byline__item i {
  opacity: 0.75;
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ─── Article two-column layout ──────────────────────────────────────────── */
.article-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2.5rem;
  align-items: start;
  padding: 3rem 0;
}

/* ─── Article body typography ────────────────────────────────────────────── */
.article-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #2d402d;
}
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  color: var(--blog-ink);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  scroll-margin-top: 80px;
}
.article-body h2 {
  font-size: 1.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blog-border);
}
.article-body h3 {
  font-size: 1.3rem;
  color: #14532d;
}
.article-body h4 {
  font-size: 1.1rem;
}
.article-body p {
  margin-bottom: 1.4rem;
}
.article-body a {
  color: var(--blog-primary);
  text-decoration: underline;
  text-decoration-color: rgba(22, 163, 74, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}
.article-body a:hover {
  text-decoration-color: var(--blog-primary);
}
.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 2rem auto;
  display: block;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.article-body code {
  background: var(--blog-surface);
  color: #14532d;
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-size: 0.88em;
  font-weight: 600;
  border: 1px solid #d1fae5;
  font-family: 'JetBrains Mono', Consolas, monospace;
}
.article-body pre {
  background: var(--blog-dark);
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid rgba(22, 163, 74, 0.15);
}
.article-body pre code {
  background: none;
  padding: 0;
  border: none;
  color: #a7c4a7;
  font-size: 0.9rem;
}
.article-body blockquote {
  border-left: 4px solid var(--blog-primary);
  background: linear-gradient(
    135deg,
    rgba(22, 163, 74, 0.04),
    rgba(20, 184, 166, 0.04)
  );
  padding: 1.25rem 1.75rem;
  margin: 2rem 0;
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--blog-muted);
}
.article-body ul,
.article-body ol {
  margin-bottom: 1.4rem;
  padding-left: 1.75rem;
}
.article-body li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}
.article-body hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d1fae5, transparent);
  margin: 2.5rem 0;
}

/* ─── Sidebar / TOC ──────────────────────────────────────────────────────── */
.article-sidebar {
  position: sticky;
  top: 90px;
}
.toc-widget {
  background: #fff;
  border: 1px solid #e2f0e4;
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(22, 163, 74, 0.06);
}
.toc-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--blog-primary);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.toc-item a {
  display: block;
  font-size: 0.84rem;
  color: var(--blog-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  line-height: 1.4;
  transition:
    background 0.2s,
    color 0.2s;
}
.toc-item a:hover,
.toc-item a.active {
  background: var(--blog-surface);
  color: var(--blog-primary);
  text-decoration: none;
}
.toc-h3 a {
  padding-left: 1.5rem;
  font-size: 0.8rem;
}

/* ─── Blog CTA ───────────────────────────────────────────────────────────── */
.blog-cta {
  margin-top: 1rem;
  padding: 2.75rem;
  background: linear-gradient(135deg, #16a34a, #14b8a6);
  border-radius: 20px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.blog-cta::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 70%
  );
  animation: ctaFloat 8s ease-in-out infinite;
}
@keyframes ctaFloat {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}
.blog-cta h3 {
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}
.blog-cta p {
  font-size: 1.05rem;
  opacity: 0.92;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}
.cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.cta-button {
  background: #fff;
  color: var(--blog-primary);
  padding: 0.875rem 1.75rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    color 0.2s;
}
.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  color: var(--blog-primary);
  text-decoration: none;
}
.cta-button-outline {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(8px);
}
.cta-button-outline:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: #fff;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.blog-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--blog-muted);
  font-size: 1.05rem;
  padding: 3rem;
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
.article-header,
.article-layout {
  animation: blogFadeUp 0.5s ease-out;
}
@keyframes blogFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .blog-card--featured {
    grid-column: 1/-1;
    grid-template-columns: 1fr;
  }
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    position: static;
  }
  .toc-widget {
    display: none;
  }
}
@media (max-width: 640px) {
  .blog-hero {
    padding: calc(var(--navbar-height, 68px) + 2.5rem) 1rem 2.5rem;
  }
  .article-header {
    padding: calc(var(--navbar-height, 68px) + 2rem) 1rem 2rem;
  }
  .blog-container {
    padding: 2rem 1rem;
  }
  .blog-grid {
    grid-template-columns: 1fr;
  }
  .blog-card {
    padding: 1.25rem;
  }
  .blog-cta {
    padding: 2rem 1.25rem;
  }
  .blog-cta h3 {
    font-size: 1.35rem;
  }
  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
  .cta-button {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }
}
