/* ── Maargin Blog — design system aligned with maargin.ai ── */

:root {
  --bg:           #f8f6f1;
  --bg-2:         #ede8de;
  --surface:      #e0dbd1;
  --line:         rgba(0,0,0,0.07);
  --line-2:       rgba(0,0,0,0.13);
  --fg:           #16140d;
  --fg-2:         #3a3828;
  --fg-mute:      #716d60;
  --fg-dim:       rgba(60,56,44,0.70);
  --teal:         #008CAB;
  --teal-2:       #00a0b5;
  --amber:        #b87810;
  --violet:       #5b50d0;
  --ease:         cubic-bezier(0.22, 1, 0.36, 1);
  --pad:          48px;
  --ink-1-rgb:       58,56,40;
  --card-bg:         rgba(255,255,255,0.85);

  --ink-1-rgb:      212,207,195;
  --card-bg-strong: rgba(255,255,255,0.06);
  --card-bg-soft:   rgba(255,255,255,0.03);
  --card-bg-strong:  rgba(255,255,255,0.72);
  --card-bg-soft:    rgba(255,255,255,0.60);
  --max:          1360px;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Manrope', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
  --nav-h:        66px;
  --radius-card:  22px;
  --radius-pill:  999px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg-2);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,140,171,0.07), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(184,120,16,0.06), transparent 45%);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(0,140,171,0.35); color: var(--fg); }

@keyframes fadeUp { from { opacity:0; transform:translateY(18px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse  { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.45; transform:scale(1.3); } }

/* ══ NAV (same as maargin.ai / scheduler-dashboard) ══ */
.mgn-nav {
  position: fixed; top:0; left:0; right:0; z-index:200;
  padding: 20px 0;
  border-bottom: 1px solid transparent;
  transition: padding .4s var(--ease), background .4s var(--ease), border-color .4s var(--ease), backdrop-filter .4s var(--ease);
}
.mgn-nav.scrolled {
  padding: 14px 0;
  background: rgba(248,246,241,0.95);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-color: var(--line);
}
.mgn-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); gap: 24px;
}
.mgn-nav-logo { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.mgn-logo-img { height: 26px; width: auto; display: block; }
.mgn-logo-wordmark { font-family: var(--font-body); font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
.mgn-logo-dot { color: var(--teal); }
.mgn-logo-ai  { font-family: var(--font-display); font-style: italic; font-weight: 300; color: var(--teal); }

.mgn-nav-links { display: flex; gap: 36px; list-style: none; font-size: 14px; font-family: var(--font-body); }
.mgn-nav-links a {
  padding: 4px 0; position: relative; color: var(--fg-2);
  transition: color .3s var(--ease); display: inline-block;
}
.mgn-nav-links a::after {
  content: ''; position: absolute; left:0; bottom:-2px;
  height:1px; width:0; background: var(--teal);
  transition: width .4s var(--ease); display: block;
}
.mgn-nav-links a:hover, .mgn-nav-links a.active { color: var(--fg); }
.mgn-nav-links a:hover::after, .mgn-nav-links a.active::after { width: 100%; }

.mgn-btn-nav {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line-2); background: rgba(0,0,0,0.04);
  color: var(--fg); transition: all .4s var(--ease); flex-shrink:0;
}
.mgn-btn-nav:hover { background: rgba(0,0,0,0.09); border-color: var(--fg-2); transform: translateY(-1px); }
.nav-arrow { display: inline-block; transition: transform .3s var(--ease); }
.mgn-btn-nav:hover .nav-arrow { transform: translateX(2px) translateY(-2px); }

.mgn-hamburger {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; background: none; border: none; padding: 8px;
  width: 40px; height: 40px; border-radius: 8px; flex-shrink: 0;
}
.ham-bar {
  display: block; width: 22px; height: 1.5px; background: var(--fg);
  border-radius: 2px; transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.mgn-hamburger.open .ham-bar:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.mgn-hamburger.open .ham-bar:nth-child(2) { opacity: 0; }
.mgn-hamburger.open .ham-bar:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.mgn-mobile-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
  background: rgba(248,246,241,0.98); backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  flex-direction: column; justify-content: center;
  padding: 80px var(--pad) 48px; overflow-y: auto;
}
.mgn-mobile-overlay.visible { display: flex; }
.mgn-mobile-links { list-style: none; margin-bottom: 40px; }
.mgn-mobile-links li { border-bottom: 1px solid rgba(0,0,0,0.08); }
.mgn-mobile-links a {
  display: block; font-family: var(--font-display);
  font-size: clamp(26px,7vw,46px); font-weight: 300; color: var(--fg);
  letter-spacing: -0.025em; line-height: 1.1; padding: 14px 0;
}
.mgn-btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 28px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 500;
  background: var(--fg); color: var(--bg);
  border: 1px solid transparent; transition: all .4s var(--ease);
}
.mgn-btn-primary:hover { background: var(--teal); transform: translateY(-2px); }
.mgn-mobile-cta { width: 100%; justify-content: center; font-size: 15px; }
.mgn-mobile-tagline {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase; color: #a8a498; margin-top: 28px;
}

/* ══ BLOG HERO ══ */
.blog-hero {
  padding-top: calc(var(--nav-h) + 80px);
  padding-bottom: 80px;
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 1;
}
.blog-hero-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--pad);
}
.blog-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .22em; text-transform: uppercase; color: var(--teal);
  margin-bottom: 20px;
  animation: fadeUp .7s var(--ease) .1s both;
}
.blog-eyebrow::before {
  content: ''; width: 24px; height: 1px; background: currentColor;
  opacity: .6; display: inline-block;
}
.blog-hero-title {
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 100px);
  font-weight: 300; line-height: .95;
  letter-spacing: -0.035em; color: var(--fg);
  font-variation-settings: "opsz" 144;
  margin-bottom: 24px;
  animation: fadeUp .7s var(--ease) .2s both;
}
.blog-hero-title em { font-style: italic; color: var(--teal); }
.blog-hero-sub {
  font-size: 14px; color: var(--fg-2); max-width: 620px;
  line-height: 1.6;
  animation: fadeUp .7s var(--ease) .3s both;
}

/* ══ BLOG LISTING ══ */
.blog-main { position: relative; z-index: 1; padding: 72px 0 120px; }
.blog-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

.blog-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.65) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 40px;
  position: relative; overflow: hidden;
  transition: border-color .4s var(--ease), transform .4s var(--ease);
}
.blog-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
  opacity: 0; transition: opacity .4s var(--ease);
}
.blog-card:hover { border-color: rgba(0,0,0,0.13); transform: translateY(-2px); }
.blog-card:hover::before { opacity: 1; }

.blog-card-featured { max-width: 860px; }

.blog-card-meta {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.blog-tag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius-pill);
  border: 1px solid rgba(0,140,171,0.35);
  background: rgba(0,140,171,0.09); color: var(--teal);
}
.blog-date {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .1em; color: var(--fg-mute);
  margin-left: auto;
}

.blog-card-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 300; line-height: 1.1;
  letter-spacing: -0.02em; color: var(--fg);
  font-variation-settings: "opsz" 144;
  margin-bottom: 16px;
}
.blog-card-title a { transition: color .3s var(--ease); }
.blog-card-title a:hover { color: var(--teal-2); }

.blog-card-excerpt {
  font-size: 15px; line-height: 1.7; color: var(--fg-mute);
  max-width: 700px; margin-bottom: 28px;
}

.blog-card-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding-top: 20px; border-top: 1px solid var(--line);
}
.blog-author { display: flex; align-items: center; gap: 10px; }
.blog-author-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 8px var(--teal);
  animation: pulse 2.4s var(--ease) infinite; flex-shrink: 0;
}
.blog-author-name { font-size: 13px; color: var(--fg-mute); }

.blog-read-more {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--fg); padding: 10px 20px;
  border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.04);
  transition: all .3s var(--ease);
}
.blog-read-more:hover { background: rgba(0,0,0,0.09); border-color: var(--fg-2); transform: translateY(-1px); }
.blog-read-more .arrow { display: inline-block; transition: transform .3s var(--ease); }
.blog-read-more:hover .arrow { transform: translateX(3px); }

/* ══ ARTICLE page ══ */
.article-hero {
  padding-top: calc(var(--nav-h) + 72px);
  padding-bottom: 56px;
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 1;
}
.article-hero-inner { max-width: 900px; margin: 0 auto; padding: 0 var(--pad); }
.article-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--fg-mute);
  margin-bottom: 32px; transition: color .3s var(--ease);
}
.article-back:hover { color: var(--fg-2); }
.article-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.article-title {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 60px);
  font-weight: 300; line-height: 1.0;
  letter-spacing: -0.03em; color: var(--fg);
  font-variation-settings: "opsz" 144;
  margin-bottom: 20px;
}
.article-title em { font-style: italic; color: var(--teal); }
.article-lede {
  font-size: 18px; line-height: 1.65; color: var(--fg-2);
  max-width: 720px;
  border-left: 2px solid var(--teal);
  padding-left: 20px;
  margin-top: 8px;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Article body */
.article-body { position: relative; z-index: 1; padding: 72px 0 120px; }
.article-body-inner { max-width: 900px; margin: 0 auto; padding: 0 var(--pad); }

.article-body h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 34px);
  font-weight: 300; letter-spacing: -0.025em;
  color: var(--fg); font-variation-settings: "opsz" 144;
  margin: 56px 0 16px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}
.article-body h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.article-body h2 em { font-style: italic; color: var(--teal); }

.article-body h3 {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.5vw, 24px);
  font-weight: 300; font-style: italic;
  letter-spacing: -0.015em; color: var(--fg-2);
  font-variation-settings: "opsz" 144;
  margin: 32px 0 12px;
}

.article-body p {
  font-size: 16px; line-height: 1.8; color: var(--fg-2);
  margin-bottom: 20px;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.article-body ul, .article-body ol {
  padding-left: 0; list-style: none;
  margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px;
}
.article-body li {
  font-size: 15px; line-height: 1.7; color: var(--fg-2);
  padding-left: 20px; position: relative;
}
.article-body ul li::before {
  content: '·'; position: absolute; left: 0;
  color: var(--teal); font-size: 18px; line-height: 1.4;
}
.article-body ol { counter-reset: list; }
.article-body ol li::before {
  content: counter(list); counter-increment: list;
  position: absolute; left: 0;
  font-family: var(--font-mono); font-size: 11px; color: var(--teal);
  font-weight: 500; top: 4px;
}

.article-body strong { color: var(--fg); font-weight: 600; }
.article-body em { font-style: italic; color: var(--fg-2); }

.article-body a {
  color: var(--teal-2); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: rgba(0,140,171,0.27);
  transition: text-decoration-color .3s;
}
.article-body a:hover { text-decoration-color: var(--teal-2); }

/* Pull quote */
.article-pullquote {
  border-left: 3px solid var(--teal);
  padding: 20px 28px;
  margin: 40px 0;
  background: rgba(0,140,171,0.07);
  border-radius: 0 12px 12px 0;
}
.article-pullquote p {
  font-family: var(--font-display); font-style: italic;
  font-size: 20px; font-weight: 300; line-height: 1.5;
  color: var(--fg); letter-spacing: -0.01em;
  font-variation-settings: "opsz" 144;
  margin: 0; text-align: left;
}

/* Callout box */
.article-callout {
  border: 1px solid rgba(184,120,16,0.28);
  border-radius: 16px;
  background: rgba(184,120,16,0.07);
  padding: 24px 28px;
  margin: 32px 0;
}
.article-callout-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.article-callout-label::before {
  content: ''; width: 16px; height: 1px;
  background: var(--amber); opacity: .6; display: inline-block;
}
.article-callout p { font-size: 14px; line-height: 1.7; color: var(--fg-2); margin: 0; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }

/* Code / monospace block */
.article-code {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 24px;
  margin: 24px 0;
  font-family: var(--font-mono); font-size: 12px;
  line-height: 1.7; color: var(--fg-mute);
  overflow-x: auto;
}
.article-code .hl { color: var(--teal-2); }
.article-code .hl-amber { color: var(--amber); }
.article-code .hl-violet { color: #a78bfa; }

/* Table */
.article-table-wrap { overflow-x: auto; margin: 32px 0; }
.article-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.article-table th {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--fg-mute); padding: 10px 16px;
  border-bottom: 1px solid var(--line-2);
  text-align: left; white-space: nowrap;
}
.article-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  color: var(--fg-2); vertical-align: top; line-height: 1.6;
}
.article-table tr:last-child td { border-bottom: none; }
.article-table tr:hover td { background: rgba(0,0,0,0.04); }
.article-table td:first-child { color: var(--fg); font-weight: 500; }
.article-table td code {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--teal-2); background: rgba(0,140,171,0.07);
  padding: 2px 6px; border-radius: 4px;
}

/* Section divider */
.article-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 48px 0; color: var(--fg-mute);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .18em;
  text-transform: uppercase;
}
.article-divider::before, .article-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* PASEOS highlight box */
.paseos-box {
  border: 1px solid rgba(0,140,171,0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(0,140,171,0.04) 0%, rgba(0,140,171,0.07) 100%);
  padding: 28px 32px;
  margin: 40px 0;
  position: relative; overflow: hidden;
}
.paseos-box::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,140,171,0.47), transparent);
}
.paseos-box-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--teal-2); margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.paseos-box-label::before {
  content: ''; width: 16px; height: 1px;
  background: var(--teal-2); opacity: .6; display: inline-block;
}
.paseos-box h4 {
  font-family: var(--font-display); font-size: 22px; font-weight: 300;
  font-style: italic; color: var(--fg); letter-spacing: -0.015em;
  font-variation-settings: "opsz" 144; margin-bottom: 12px;
}
.paseos-box p { font-size: 14px; line-height: 1.75; color: var(--fg-2); margin-bottom: 12px; text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.paseos-box p:last-child { margin-bottom: 0; }
.paseos-box a { color: var(--teal-2); text-underline-offset: 3px; text-decoration: underline; text-decoration-color: rgba(0,140,171,0.27); }

/* Stat strip */
.article-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; margin: 40px 0;
}
.article-stat {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0,0,0,0.04);
  padding: 20px 24px;
  text-align: center;
}
.article-stat-val {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 300; letter-spacing: -0.03em;
  color: var(--fg); font-variation-settings: "opsz" 144;
  display: block; margin-bottom: 4px;
}
.article-stat-label {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--fg-mute);
}

/* Operations grid */
.ops-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin: 32px 0;
}
.ops-card {
  border: 1px solid var(--line);
  border-left: 2px solid rgba(184,120,16,0.38);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.65) 100%);
  padding: 24px 24px 22px;
  transition: border-color .3s var(--ease), border-left-color .3s var(--ease), transform .3s var(--ease);
}
.ops-card:hover {
  border-color: rgba(0,0,0,0.10);
  border-left-color: rgba(184,120,16,0.70);
  transform: translateY(-2px);
}
.ops-card-tag {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.ops-card-tag::before {
  content: ''; display: inline-block; width: 12px; height: 1px;
  background: var(--amber); opacity: .6;
}
.ops-card h4 {
  font-family: var(--font-display); font-size: 18px;
  font-weight: 300; font-style: italic; color: var(--fg);
  letter-spacing: -0.01em; font-variation-settings: "opsz" 144;
  margin-bottom: 10px;
}
.ops-card p { font-size: 13px; line-height: 1.7; color: var(--fg-mute); text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.ops-card:last-child:nth-child(odd) { grid-column: 1 / -1; max-width: calc(50% - 8px); }

/* Decision boxes */
.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 28px 0 32px;
}
.decision-card {
  border: 1px solid var(--line-2);
  border-radius: 16px;
  padding: 22px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72) 0%, rgba(255,255,255,0.60) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.decision-card-action {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 10px;
}
.decision-card p { font-size: 13px; color: var(--fg-mute); line-height: 1.6; text-align: left; }
.decision-card.run-local { border-color: rgba(0,140,171,0.35); }
.decision-card.run-local .decision-card-action { color: var(--teal); }
.decision-card.escalate  { border-color: rgba(0,140,171,0.22); }
.decision-card.escalate  .decision-card-action { color: var(--teal-2); }
.decision-card.queue     { border-color: rgba(184,120,16,0.38); }
.decision-card.queue     .decision-card-action { color: var(--amber); }

/* Architecture diagram */
.arch-diagram-wrap {
  margin: 32px 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(248,246,241,0.80);
  padding: 28px 16px;
  overflow-x: auto;
}
.arch-diagram { width: 100%; max-width: 640px; display: block; margin: 0 auto; }

/* ══ FOOTER ══ */
.blog-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0; position: relative; z-index: 1;
}
.blog-footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.blog-footer-copy {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .1em; color: var(--fg-mute);
}

/* ══ RESPONSIVE ══ */
@media (max-width: 1100px) {
  :root { --pad: 36px; }
}
@media (max-width: 860px) {
  :root { --pad: 28px; }
  .mgn-nav-links { display: none; }
  .mgn-btn-nav   { display: none; }
  .mgn-hamburger { display: flex; }
  .article-stats { grid-template-columns: 1fr 1fr; }
  .ops-grid      { grid-template-columns: 1fr; }
  .decision-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  :root { --pad: 20px; }
  .article-stats { grid-template-columns: 1fr; }
  .blog-card { padding: 24px; }
}

/* ── colored text legibility ── */
.article-body em,
.ops-card-title em { font-weight: 600; }
article h2 em, article h3 em { font-weight: inherit; }
code { font-weight: 500; }


/* ════════════════════════════════════════════════════════════
   DARK THEME OVERRIDES — blog.css
   ════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  --bg: #07090c;
  --bg-0: #07090c;
  --bg-1: #0a1016;
  --bg-2: #0d141c;
  --bg-3: #121a24;
  --surface: #121a24;
  --fg: #f4f1ea;
  --fg-2: #d4cfc3;
  --fg-mute: #8b8679;
  --fg-dim: rgba(244,241,234,0.55);
  --ink-0: #f4f1ea;
  --ink-1: #d4cfc3;
  --ink-2: #8b8679;
  --ink-3: rgba(244,241,234,0.38);
  --teal: #008CAB;
  --teal-2: #5eead4;
  --amber: #f5b971;
  --violet: #7c6ff0;
  --line: rgba(255,255,255,0.06);
  --line-2: rgba(255,255,255,0.11);
}

/* Dark-mode contrast for the "Read article" pill (was using black alphas) */
[data-theme="dark"] .blog-read-more {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.13);
}
[data-theme="dark"] .blog-read-more:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.25);
}

[data-theme="dark"] .article-hero,
[data-theme="dark"] .blogs-hero { background: transparent; }

[data-theme="dark"] .article-body,
[data-theme="dark"] .blogs-listing { background: transparent; }

[data-theme="dark"] .article-body h2,
[data-theme="dark"] .article-body h3 { color: #f4f1ea; }

[data-theme="dark"] .article-body p,
[data-theme="dark"] .article-body li { color: #d4cfc3; }

[data-theme="dark"] .ops-card {
  background: linear-gradient(160deg, rgba(10,16,22,0.6) 0%, rgba(5,8,12,0.45) 100%);
  border-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] .blog-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  box-shadow: none;
  border-color: rgba(255,255,255,0.06);
}

[data-theme="dark"] table thead th {
  background: rgba(255,255,255,0.04);
  color: #8b8679;
}
[data-theme="dark"] table tbody tr { border-color: rgba(255,255,255,0.05); }
[data-theme="dark"] table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] table tbody td { color: #d4cfc3; }

[data-theme="dark"] blockquote {
  border-left-color: rgba(0,140,171,0.40);
  background: rgba(0,140,171,0.06);
  color: #d4cfc3;
}

[data-theme="dark"] code {
  background: rgba(0,140,171,0.15);
  color: #5eead4;
  border-color: rgba(0,140,171,0.20);
}

[data-theme="dark"] .article-body em { color: #5eead4; }

/* ── Logo invert in dark mode ── */
[data-theme="dark"] img[src="maargin-logo.svg"] { filter: invert(1) brightness(2); }

/* ── Body background ── */
[data-theme="dark"] body { background: #07090c; color: #d4cfc3; }

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(0,140,171,0.14), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(245,185,113,0.07), transparent 45%);
}

[data-theme="dark"] .article-hero-inner h1,
[data-theme="dark"] .blogs-hero h1 { color: #f4f1ea; }

[data-theme="dark"] .article-hero-inner p,
[data-theme="dark"] .blogs-hero p { color: #d4cfc3; }

[data-theme="dark"] .blog-author-name,
[data-theme="dark"] .blog-date { color: #8b8679; }

[data-theme="dark"] .blog-article-nav a { color: #d4cfc3; border-color: rgba(255,255,255,0.10); }
[data-theme="dark"] .blog-article-nav a:hover { color: #f4f1ea; background: rgba(255,255,255,0.04); }

/* blog text boldness */
.article-body p, .article-body li { font-weight: 450; }
.article-body h2, .article-body h3 { font-weight: 400; }
.blog-card .body-copy, .blog-card p { font-weight: 450; }
.article-hero-eyebrow { font-weight: 600; letter-spacing: 0.18em; }
.blog-tag { font-weight: 600; }

/* ── Comprehensive text boldness ── */
.article-body p,
.article-body li { font-weight: 500 !important; color: var(--ink-0) !important; font-size: 17px; }
.article-body h2 { font-weight: 500 !important; color: var(--ink-0) !important; font-size: clamp(22px,3vw,30px); }
.article-body h3 { font-weight: 500 !important; color: var(--ink-0) !important; font-size: clamp(18px,2.5vw,24px); }
.article-body blockquote { font-weight: 500 !important; color: var(--ink-1) !important; }
.blog-card p, .blog-card-body { font-weight: 500 !important; color: var(--ink-0) !important; font-size: 16px; }
.blog-card-title, .blog-hero-title { font-weight: 400 !important; }
.blog-card-excerpt { font-weight: 500 !important; color: var(--ink-1) !important; }
.article-hero-inner p { font-weight: 500 !important; color: var(--ink-1) !important; font-size: 18px; }
.article-body { font-size: 17px; font-weight: 450; color: var(--ink-0); }
.ops-card p { font-weight: 500 !important; color: var(--ink-1) !important; }
.ops-card-title { font-weight: 500 !important; }

/* Nav in blog pages */
.mgn-nav-links a { font-weight: 600 !important; font-size: 14px; }
.blog-meta, .blog-date, .blog-read-time { font-weight: 500; color: var(--ink-2); }

/* Toggle button */
.theme-toggle-btn {
  font-weight: 600 !important;
  border: 1.5px solid var(--accent, #008CAB) !important;
  color: var(--accent, #008CAB) !important;
  background: rgba(0,140,171,0.06) !important;
}

/* ════════════════════════════════════════════════════════════
   DARK-MODE FIXES — code blocks, architecture figure, tables
   (these previously used light/white backgrounds → looked grey)
   ════════════════════════════════════════════════════════════ */
[data-theme="dark"] .article-code {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.015) 100%);
  border-color: rgba(255,255,255,0.09);
  color: #b9b4a7;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
}
[data-theme="dark"] .article-code::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,140,171,0.45), transparent);
}

[data-theme="dark"] .arch-diagram-wrap {
  background:
    radial-gradient(120% 110% at 50% 0%, rgba(0,140,171,0.07), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.035) 0%, rgba(255,255,255,0.01) 100%);
  border-color: rgba(255,255,255,0.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

[data-theme="dark"] .article-table th { color: #8b8679; border-bottom-color: rgba(255,255,255,0.12); }
[data-theme="dark"] .article-table td { border-bottom-color: rgba(255,255,255,0.07); color: #d4cfc3; }
[data-theme="dark"] .article-table td:first-child { color: #f4f1ea; }
[data-theme="dark"] .article-table tr:hover td { background: rgba(255,255,255,0.03); }

/* Training-pipeline bold labels — styled identically to the code
   entries in the Technology stack table (teal pill) */
.pipeline-list strong {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--teal-2);
  background: rgba(0,140,171,0.07);
  padding: 2px 6px;
  border-radius: 4px;
}
[data-theme="dark"] .pipeline-list strong {
  background: rgba(0,140,171,0.15);
  color: #5eead4;
}

/* Decision cards (RUN_LOCAL / ESCALATE / QUEUE) — dark, were light grey */
[data-theme="dark"] .decision-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.045) 0%, rgba(255,255,255,0.015) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
[data-theme="dark"] .decision-card p { color: #8b8679; }
