:root {
  --bg: #020617;
  --bg-2: #020617;
  --fg: #e5edff;
  --muted: #94a3b8;
  --brand: #3b82f6;
  --accent: #22d3ee;
  --violet: #7c3aed;
  --card: #02081a;
  --shadow: rgba(15, 23, 42, 0.7);
  --radius: 18px;
  --page-bg:
    radial-gradient(1200px 800px at 10% 10%, rgba(47, 209, 180, 0.14), transparent 60%),
    radial-gradient(1000px 700px at 90% -10%, rgba(139, 92, 246, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));

  /* link colors for dark mode */
  --link: #93c5fd;          /* light blue, readable on dark */
  --link-hover: #bfdbfe;    /* even lighter on hover */
  --link-visited: #c4b5fd;  /* soft violet */
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.75rem 0 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(148, 163, 184, 0.7);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

a:visited {
  color: var(--link-visited);
}

.post-body code {
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
  Cantarell, Noto Sans, Helvetica Neue, Arial;
  color: var(--fg);
  background: var(--bg);     /* fallback if pseudo-element fails */
  position: relative;        /* anchor for stacking context */
}

/* One fixed gradient layer for the entire page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--page-bg);
  background-repeat: no-repeat;
}

.post-body pre {
  border-radius: 12px;
  padding: 12px 14px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
  "Liberation Mono", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 1rem 0 1.25rem;
}

.post-body code {
  font-family: inherit;
}

/* Markdown-style doc table */
.post-body table.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.5rem;
  font-size: 0.9rem;
}

.post-body table.doc-table th,
.post-body table.doc-table td {
  padding: 6px 8px;
  text-align: left;
}


@media (prefers-color-scheme: dark) {
  body {
    /* REMOVED the background */
    background: var(--bg);
  }

  header {
    background: linear-gradient(to bottom, rgba(10,15,28,.85), rgba(10,15,28,.55));
    border-bottom: 1px solid rgba(255,255,255,.06);
  }

  .card {
    background: var(--card, rgba(15,23,42,0.85));
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.4);
  }

  .post-body pre {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #e5e7eb;
  }

  .post-body table.doc-table th,
  .post-body table.doc-table td {
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #e5e7eb;
  }

  .post-body table.doc-table th {
    background: rgba(15, 23, 42, 0.95);
    font-weight: 600;
  }

  .post-body table.doc-table tr:nth-child(odd) td {
    background: rgba(15, 23, 42, 0.88);
  }

  .post-body table.doc-table tr:nth-child(even) td {
    background: rgba(15, 23, 42, 0.78);
  }

  /* ---- Micro SVG: themeable primitives (default = dark) ---- */

  .mm-partner {
    fill: rgba(229, 237, 255, 0.04);
    stroke: rgba(148, 163, 184, 0.32);
    stroke-width: 1;
  }

  .mm-window {
    fill: rgba(229, 237, 255, 0.16);
  }

  .mm-cloud {
    fill: rgba(59, 130, 246, 0.10);
    stroke: rgba(59, 130, 246, 0.35);
    stroke-width: 1.2;
  }

  .mm-arrow-fwd {
    fill: rgba(34, 211, 238, 0.70);
  }

  .mm-ack {
    fill: none;
    stroke: rgba(148, 163, 184, 0.35);
    stroke-width: 2.4;
    stroke-dasharray: 5 6;
    stroke-linecap: round;
  }

  .mm-arrow-ack {
    fill: rgba(148, 163, 184, 0.55);
  }

  .mm-pulse {
    fill: none;
    stroke: rgba(34, 211, 238, 0.35);
    stroke-width: 2;
  }

  footer {
    border-top: 1px solid rgba(255,255,255,.08);
  }

}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --bg-2: #ffffff;
    --fg: #020617;
    --muted: #64748b;
    --brand: #2563eb;  /* keep your blue, slightly tuned for light */
    --accent: #0ea5e9;
    --card: #ffffff;
    --shadow: rgba(15, 23, 42, 0.06);

    /* link colors for light mode */
    --link: #1d4ed8;         /* solid blue on white */
    --link-hover: #1d4ed8;   /* same, but we’ll lean on underline change */
    --link-visited: #6d28d9; /* purple but still readable */
  }

  /* Light mode: hero copy should be crisp */
  .hero h1 {
    color: #020617; /* near-black */
  }

  .hero-sub {
    color: #0f172a; /* slate-900 */
  }

  .hero-bullets li {
    color: #0f172a; /* slate-900 */
  }

  .hero-weave img {
    filter: drop-shadow(0 14px 30px rgba(15, 23, 42, 0.18));
  }

  body {
    position: relative;
    background: var(--bg); /* fallback */
  }

  body::before {
    background:
      radial-gradient(1200px 800px at 10% 10%, rgba(37, 99, 235, 0.08), transparent 60%),
      radial-gradient(1000px 700px at 90% -10%, rgba(14, 165, 233, 0.08), transparent 60%),
      linear-gradient(180deg, var(--bg), var(--bg-2));
    background-repeat: no-repeat;
  }

  .post-body pre {
    background: #f1f5f9; /* light slate */
    border: 1px solid rgba(148, 163, 184, 0.5);
    color: #0f172a;
  }

  .post-body table.doc-table th,
  .post-body table.doc-table td {
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: #0f172a;
  }

  .post-body table.doc-table th {
    background: #e2e8f0; /* slate-200-ish */
    font-weight: 600;
  }

  .post-body table.doc-table tr:nth-child(odd) td {
    background: #ffffff;
  }

  .post-body table.doc-table tr:nth-child(even) td {
    background: #f8fafc; /* almost-white for subtle striping */
  }

  /* Make header light instead of dark */
  header {
    background: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.96),
      rgba(255, 255, 255, 0.92)
    );
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
  }

  .site-footer{
    border-top-color: rgba(15, 23, 42, 0.10);
  }
  .footer-bottom{
    border-top-color: rgba(15, 23, 42, 0.08);
  }
  .footer-links a:hover,
  .footer-links button:hover{
    background: rgba(37, 99, 235, 0.08);
  }

  .cookie-modal{
    background: rgba(15, 23, 42, 0.28);
  }
  .cookie-card{
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: 0 20px 70px rgba(15, 23, 42, 0.14);
    color: #020617;
  }
  .cookie-card p{
    color: rgba(15, 23, 42, 0.72);
  }
  .cookie-x{
    background: rgba(37, 99, 235, 0.10);
    color: #020617;
  }
  .cookie-close{
    background: rgba(37, 99, 235, 0.10);
    color: #020617;
    border-color: rgba(37, 99, 235, 0.22);
  }

  .nav-group-left {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  }

  .nav-item:hover { background: rgba(37, 99, 235, 0.08); }

  /* Cards (including blog cards) on light background */

  .nav-divider{
    background: rgba(15, 23, 42, 0.14);
  }

  .nav-item:hover{
    background: rgba(37, 99, 235, 0.08);
  }

  .nav-cta{
    border-color: rgba(37, 99, 235, 0.18);
    background: rgba(255, 255, 255, 0.70);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  }

  .nav-cta-primary{
    border-color: rgba(37, 99, 235, 0.26);
    background: linear-gradient(90deg, rgba(37,99,235,0.14), rgba(14,165,233,0.10));
  }

  .card {
    background: var(--card);
    box-shadow: 0 14px 30px var(--shadow);
    border-color: rgba(148, 163, 184, 0.35);
  }

  /* Optional: footer border less “neon” in light mode */
  footer {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
  }

  /* If you have nav links/pills from earlier tweaks, keep them readable in light mode */
  .nav-link::after {
    background: linear-gradient(90deg, var(--brand), var(--accent));
  }

  /* Light mode: hero flow card should look "glass + blue" instead of grey fog */
  .hero-flow-card {
    box-shadow: 0 18px 60px rgba(15, 23, 42, 0.12);
  }

  .hero-flow-card .hf-card {
    fill: rgba(255, 255, 255, 0.82);
    stroke: rgba(37, 99, 235, 0.28); /* brand-blue tint */
    stroke-width: 1.35;
  }

  .hero-flow-card .hf-stage {
    fill: rgba(37, 99, 235, 0.06);   /* very light blue wash */
    stroke: rgba(15, 23, 42, 0.18);
    stroke-width: 1.15;
  }

  .hero-flow-card .hf-label {
    fill: rgba(2, 6, 23, 0.88);      /* readable label text */
    font-weight: 700;
  }

  .hero-flow-card .hf-icon-stroke {
    fill: rgba(255, 255, 255, 0.65);
    stroke: rgba(15, 23, 42, 0.45);
    stroke-width: 1.7;
  }

  .hero-flow-card .hf-icon-muted {
    stroke: rgba(15, 23, 42, 0.38);
    stroke-width: 1.5;
  }

  .hero-flow-card .hf-icon-fill {
    fill: rgba(37, 99, 235, 0.85);   /* blue “signal” */
  }

  .hero-flow-card .hf-target {
    fill: rgba(255, 255, 255, 0.75);
    stroke: rgba(37, 99, 235, 0.45);
    stroke-width: 1.5;
  }

  .hero-flow-card .hf-out {
    stroke: rgba(15, 23, 42, 0.22);
    stroke-width: 2.6;
  }

  .hero-flow-card .hf-baseline {
    stroke: rgba(15, 23, 42, 0.16);
  }

  .hero-flow-card .hf-micro {
    fill: rgba(15, 23, 42, 0.55);
  }

  /* ---- Light mode: Micro SVG flows (Ingest / Learn / Deliver) ---- */
  /* Container background for the micro cards */
  .micro {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(37, 99, 235, 0.18);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
  }

  /* Outer frame in the SVG */
  .mm-card {
    fill: rgba(255, 255, 255, 0.78);
    stroke: rgba(15, 23, 42, 0.18);
    stroke-width: 1.1;
  }

  /* Default path styling (if any mm-path lacks a specific stroke) */
  .mm-path {
    opacity: 0.98;
  }

  /* Default “branch” styling */
  .mm-branch {
    stroke: rgba(15, 23, 42, 0.24);
    opacity: 0.95;
  }

  /* ---- Micro SVG: theme overrides for shapes that were previously hard-coded ---- */

  .mm-partner {
    fill: rgba(37, 99, 235, 0.06);
    stroke: rgba(15, 23, 42, 0.18);
  }

  .mm-window {
    fill: rgba(15, 23, 42, 0.32);
  }

  .mm-cloud {
    fill: rgba(37, 99, 235, 0.10);
    stroke: rgba(37, 99, 235, 0.28);
  }

  .mm-arrow-fwd {
    fill: rgba(37, 99, 235, 0.65);
  }

  .mm-ack {
    stroke: rgba(15, 23, 42, 0.24);
  }

  .mm-arrow-ack {
    fill: rgba(15, 23, 42, 0.38);
  }

  .mm-pulse {
    stroke: rgba(37, 99, 235, 0.28);
  }

  /* Dots: make them visible on light backgrounds */
  .mm-dot {
    fill: rgba(37, 99, 235, 0.92);               /* brand blue dot */
    filter: drop-shadow(0 0 10px rgba(37, 99, 235, 0.18));
  }

  /* Labels should be dark in light mode */
  .mm-label {
    fill: rgba(2, 6, 23, 0.72);
  }

  /* Review pill: light blue glass */
  .mm-pill {
    fill: rgba(37, 99, 235, 0.08);
    stroke: rgba(37, 99, 235, 0.28);
  }

  /* Review pill text: darker */
  .mm-pill-text {
    fill: rgba(2, 6, 23, 0.72);
  }

  /* Deliver hub: lightly blue so it reads as “center” */
  .mm-hub {
    fill: rgba(37, 99, 235, 0.10);
    stroke: rgba(37, 99, 235, 0.28);
  }

  /* Learn micro: semantic strokes (your classes) */
  .mm-path-high {
    stroke: rgba(34, 197, 94, 0.90);   /* green */
  }
  .mm-path-low {
    stroke: rgba(239, 68, 68, 0.85);   /* red */
  }

  /* (Optional) If you want your dashed branch to be red in light mode too */
  .mm-branch.mm-path-low {
    stroke: rgba(239, 68, 68, 0.65);
  }

  /* Light mode: make the animated hero dots visible (brand blue, like micros) */
  .hero-flow-card .hf-msg {
    fill: rgba(37, 99, 235, 0.92); /* brand blue */
    opacity: 0.92;                 /* keep your animation-friendly baseline */
  }
}
