/* ==========================================================================
   Mamba Blog — shared styles for /blog and every /blog/<post>
   Matches the dark-green look of the marketing site (index.html).
   ========================================================================== */

:root {
  --bg: #050f0a;
  --bg2: #091409;
  --bg3: #0b1f10;
  --green: #2ae06a;
  --green-dim: #1ab354;
  --green-glow: rgba(42, 224, 106, 0.12);
  --green-border: rgba(42, 224, 106, 0.25);
  --text: #e8f5ec;
  --text-soft: #c9dfd0;
  --muted: #8fbf9e; /* 8.9:1 on --bg, AA/AAA for body text */
  --card: #0c1c10;
  --card-border: rgba(42, 224, 106, 0.15);
  --focus: #9dffc0;
  --radius: 16px;
  --max: 1100px;
  --prose: 720px;
  --header-h: 80px; /* matches homepage nav: 18px padding + 42px CTA + border */
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--green);
}

/* ---------- Accessibility helpers ---------- */
[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 1000;
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  background: rgba(5, 15, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.nav-logo img {
  width: 36px;
  height: 36px;
}

.nav-logo span {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .2s;
}

.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--text);
}

.nav-links a[aria-current] {
  box-shadow: inset 0 -2px 0 var(--green);
}

.nav-cta {
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity .2s;
}

.nav-cta:hover {
  opacity: .88;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumbs li+li::before {
  content: '/';
  color: var(--card-border);
  color: rgba(143, 191, 158, .5);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--green);
  text-decoration: underline;
}

.breadcrumbs [aria-current] {
  color: var(--text-soft);
}

/* ---------- Page hero (shared) ---------- */
.page-hero {
  position: relative;
  overflow: hidden;
  padding: calc(var(--header-h) + 56px) 48px 56px;
  border-bottom: 1px solid var(--card-border);
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 100% at 15% 0%, rgba(42, 224, 106, 0.09) 0%, transparent 65%),
    linear-gradient(var(--bg), var(--bg));
  pointer-events: none;
}

.page-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: linear-gradient(var(--green) 1px, transparent 1px),
    linear-gradient(90deg, var(--green) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.page-hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--green);
  margin: 28px 0 14px;
}

.page-hero h1 {
  font-size: clamp(36px, 5.5vw, 60px);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.08;
  max-width: 820px;
  margin-bottom: 18px;
  text-wrap: balance;
}

.page-hero h1 span {
  color: var(--green);
}

.page-hero .lede {
  font-size: 19px;
  color: var(--muted);
  max-width: 640px;
  font-weight: 400;
}

/* ---------- Blog index: topic filter ---------- */
.blog-main {
  padding: 48px 48px 96px;
}

.blog-main-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.topic-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
}

.topic-filter-label {
  font-size: 14px;
  color: var(--muted);
  margin-right: 6px;
}

.topic-btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 100px;
  padding: 8px 18px;
  cursor: pointer;
  min-height: 40px;
  transition: border-color .15s, color .15s, background .15s;
}

.topic-btn:hover {
  border-color: var(--green-border);
  color: var(--text);
}

.topic-btn[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
  font-weight: 700;
}

.section-heading {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 24px;
}

/* ---------- Post cards ---------- */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  list-style: none;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, transform .2s;
  height: 100%;
}

.post-card:hover,
.post-card:focus-within {
  border-color: rgba(42, 224, 106, 0.45);
  transform: translateY(-3px);
}

.post-card-media {
  aspect-ratio: 1200 / 630;
  background: var(--bg3);
  overflow: hidden;
}

.post-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  flex: 1;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.post-meta .dot {
  opacity: .6;
}

.post-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  background: rgba(42, 224, 106, 0.1);
  border: 1px solid var(--green-border);
  border-radius: 100px;
  padding: 3px 10px;
}

.post-card-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

/* Whole card is clickable, but only the title is a link for screen readers */
.post-card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-card-title a:focus-visible {
  outline: none;
}

.post-card:has(a:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.post-card-excerpt {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.65;
}

.post-card-more {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
}

/* Featured (first) card spans the grid on desktop */
.post-grid>li.is-featured {
  grid-column: 1 / -1;
}

.post-grid>li.is-featured .post-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

.post-grid>li.is-featured .post-card-media {
  aspect-ratio: auto;
  min-height: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
}

.post-grid>li.is-featured .post-card-media img {
  height: auto;
  object-fit: contain;
}

.post-grid>li.is-featured .post-card-body {
  padding: 40px;
  justify-content: center;
  gap: 16px;
}

.post-grid>li.is-featured .post-card-title {
  font-size: clamp(24px, 2.6vw, 32px);
  letter-spacing: -0.8px;
}

.post-grid>li.is-featured .post-card-excerpt {
  font-size: 16px;
}

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--card-border);
  border-radius: var(--radius);
}

/* ---------- Topic clusters (index) ---------- */
.topics {
  margin-top: 80px;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  list-style: none;
}

.topic-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
}

.topic-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.topic-card p {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------- CTA band ---------- */
.cta-band {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #091409 0%, #0c2014 100%);
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 48px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  align-items: center;
}

.cta-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 90% at 100% 100%, rgba(42, 224, 106, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.cta-band>* {
  position: relative;
}

.cta-band h2 {
  font-size: clamp(26px, 3vw, 36px);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.cta-band p {
  color: var(--muted);
  font-size: 16px;
}

.cta-band-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-self: end;
  text-align: right;
  gap: 10px;
}

.btn-primary {
  display: inline-block;
  background: var(--green);
  color: var(--bg);
  font-weight: 700;
  font-size: 16px;
  padding: 16px 32px;
  border-radius: 8px;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(42, 224, 106, 0.3);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--text);
  font-weight: 500;
  font-size: 16px;
  padding: 15px 28px; /* 1px border keeps height equal to .btn-primary */
  border: 1px solid var(--card-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}

.btn-secondary:hover {
  border-color: var(--green);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  list-style: none;
  margin-top: 32px;
}

.btn-note {
  font-size: 13px;
  color: var(--muted);
}

.blog-cta {
  margin-top: 80px;
}

/* ==========================================================================
   Article page
   ========================================================================== */
.progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  height: 3px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: var(--green);
  z-index: 101;
}

.article-hero {
  padding-bottom: 48px;
}

.article-hero .page-hero-inner {
  max-width: 900px;
}

.article-hero h1 {
  font-size: clamp(34px, 5vw, 54px);
}

.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
  font-size: 14px;
  color: var(--muted);
}

.byline-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--green-border);
  padding: 6px;
}

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

.byline-author a {
  color: inherit;
  text-decoration: none;
}

.byline-author a:hover {
  text-decoration: underline;
}

.article-cover {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 40px auto 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.article-layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 56px 48px 96px;
  display: grid;
  grid-template-columns: minmax(0, var(--prose)) 280px;
  justify-content: space-between;
  gap: 64px;
}

/* Table of contents */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 32px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 64px);
  overflow-y: auto;
  border-left: 1px solid var(--card-border);
  padding-left: 20px;
}

.toc-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 14px;
}

.toc ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc a {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  transition: color .15s;
}

.toc a:hover,
.toc a[aria-current="true"] {
  color: var(--green);
}

.toc-mobile {
  display: none;
}

/* Prose */
.prose {
  font-size: 18px;
  line-height: 1.75;
  color: var(--text-soft);
  min-width: 0;
}

.prose> *+* {
  margin-top: 1.25em;
}

.prose h2 {
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -0.8px;
  line-height: 1.2;
  color: var(--text);
  margin-top: 2.4em;
}

.prose h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.3;
  color: var(--text);
  margin-top: 2em;
}

.prose h2+*,
.prose h3+* {
  margin-top: .75em;
}

.prose a {
  color: var(--green);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.prose a:hover {
  text-decoration-thickness: 2px;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose li+li {
  margin-top: .5em;
}

.prose li::marker {
  color: var(--green);
}

.prose blockquote {
  border-left: 3px solid var(--green);
  padding: 4px 0 4px 20px;
  color: var(--text);
  font-style: italic;
}

.prose code {
  font-size: .9em;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  padding: 1px 6px;
}

.prose figure {
  margin-top: 2em;
}

.prose figcaption {
  font-size: 14px;
  color: var(--muted);
  margin-top: 10px;
}

.callout {
  background: var(--card);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.callout-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--green);
  margin-bottom: 10px;
}

.callout ul {
  margin-top: 0;
}

.callout p+p {
  margin-top: .75em;
}

.callout.is-tip {
  border-color: var(--card-border);
  background: var(--bg3);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}

.table-wrap:focus-visible {
  outline-offset: 2px;
}

.prose table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
}

.prose caption {
  text-align: left;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--card-border);
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
}

.prose thead th {
  background: var(--bg3);
  color: var(--text);
  font-weight: 700;
}

.prose tbody th {
  color: var(--text);
  font-weight: 600;
}

.prose tr:last-child>* {
  border-bottom: 0;
}

/* Inline CTA inside the article */
.inline-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  background: linear-gradient(135deg, #091409 0%, #0c2014 100%);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.inline-cta p {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 17px;
  flex: 1 1 280px;
}

/* Beat `.prose a` (green, underlined) so button text stays dark on green */
.prose .btn-primary,
.inline-cta .btn-primary {
  color: var(--bg);
  text-decoration: none;
}

.inline-cta .btn-primary {
  font-size: 15px;
  padding: 12px 22px;
  white-space: nowrap;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 24px;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  color: var(--green);
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item .faq-answer {
  padding-bottom: 20px;
  font-size: 16px;
  color: var(--muted);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .site-header {
    padding: 18px 32px;
  }

  .nav-links {
    display: none;
  }

  .page-hero,
  .blog-main {
    padding-left: 32px;
    padding-right: 32px;
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .topics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 40px 32px 80px;
    gap: 0;
  }

  .article-layout>.toc {
    display: none;
  }

  .toc-mobile {
    display: block;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0 20px;
  }

  .toc-mobile summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    padding: 16px 0;
    font-size: 16px;
  }

  .toc-mobile ol {
    padding: 0 0 16px 1.2em;
    font-size: 16px;
  }

  .toc-mobile li+li {
    margin-top: .35em;
  }

  .toc-mobile a {
    color: var(--muted);
    text-decoration: none;
  }

  .toc-mobile a:hover {
    color: var(--green);
  }

  .article-cover {
    margin-left: 32px;
    margin-right: 32px;
  }

}

@media (max-width: 960px) {
  .post-grid>li.is-featured .post-card {
    display: flex;
  }

  .post-grid>li.is-featured .post-card-media {
    display: block;
    min-height: 0;
    aspect-ratio: 1200 / 630;
  }

  .post-grid>li.is-featured .post-card-media img {
    height: 100%;
    object-fit: cover;
  }

  .post-grid>li.is-featured .post-card-body {
    padding: 28px;
  }

  .cta-band {
    grid-template-columns: 1fr;
    padding: 36px 28px;
  }

  .cta-band-actions {
    align-items: flex-start;
    justify-self: start;
    text-align: left;
  }
}

@media (max-width: 767px) {
  :root {
    --header-h: 76px;
  }

  .site-header {
    padding: 16px 20px;
  }

  .page-hero {
    padding: calc(var(--header-h) + 32px) 16px 40px;
  }

  .page-hero .lede {
    font-size: 17px;
  }

  .blog-main {
    padding: 32px 16px 64px;
  }

  .post-grid,
  .topics-grid {
    grid-template-columns: 1fr;
  }

  .article-layout {
    padding: 32px 16px 64px;
  }

  .article-cover {
    margin: 28px 16px 0;
  }

  .prose {
    font-size: 17px;
  }

  .callout,
  .inline-cta {
    padding: 20px;
  }

  .faq-item {
    padding: 0 18px;
  }

}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .post-card:hover,
  .post-card:focus-within,
  .btn-primary:hover {
    transform: none;
  }
}

/* Windows high-contrast / forced colors */
@media (forced-colors: active) {

  .topic-btn[aria-pressed="true"],
  .btn-primary,
  .nav-cta {
    border: 2px solid ButtonText;
  }

  .progress {
    display: none;
  }
}

@media print {

  .site-header,
  .progress,
  .toc,
  .toc-mobile,
  .inline-cta,
  .site-footer {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .prose,
  .prose h2,
  .prose h3 {
    color: #000;
  }

  .page-hero {
    padding-top: 0;
  }
}
