/* ============================================================
   Kaptor.ai blog — shared stylesheet (dark premium)
   Single source of truth for the blog index and every post.
   Posts must link this file instead of embedding styles:
     <link rel="stylesheet" href="/blog/styles/blog.css">
   ============================================================ */

:root {
  --brand-50:  #eef2f7; --brand-100: #dae3ef; --brand-200: #b8c9e0;
  --brand-300: #8da8cc; --brand-400: #6085b5; --brand-500: #44699e;
  --brand-600: #1d4ed8; --brand-700: #1a44bf; --brand-800: #17399e;
  --brand-900: #14307e; --brand-950: #0c1e4f;

  /* Dark surface / text tokens (aligned with the main site) */
  --bg-0: #0a1628;
  --bg-1: #0f1d3a;
  --bg-2: #132952;
  --bg-deep: #060d1c;
  --surface-glass: rgba(255,255,255,0.04);
  --border-1: rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.12);
  --border-accent: rgba(96,133,181,0.28);
  --text-1: #F0EEF6;
  --text-2: #D4D0E6;
  --text-3: #A8A3BF;
  --text-4: #7E7998;
  --accent-text: #60a5fa;
  --accent-soft: #8da8cc;

  --gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #14307e 100%);
  --hero-gradient: linear-gradient(160deg, #060d1c 0%, #0f1d3a 55%, #0a1628 100%);

  /* Animation palette (dark-friendly) */
  --anim-user:    #60a5fa;
  --anim-user-bg: rgba(96, 165, 250, 0.10);
  --anim-sys:     #8da8cc;
  --anim-sys-bg:  rgba(141, 168, 204, 0.10);
  --anim-llm:     #6085b5;
  --anim-ok:      #34d399;
  --anim-ok-bg:   rgba(52, 211, 153, 0.10);
  --anim-bad:     #f87171;
  --anim-bad-bg:  rgba(248, 113, 113, 0.10);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Menlo, monospace;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.45);
  --glow-sm: 0 0 24px rgba(29, 78, 216, 0.15);

  --radius: 12px;
  --radius-lg: 20px;

  /* Legacy aliases kept for safety */
  --text: var(--text-2);
  --text-muted: var(--text-3);
  --text-subtle: var(--text-4);
  --border: var(--border-1);
  --border-soft: var(--border-1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 2rem; color-scheme: dark; }
body {
  font-family: var(--font-sans);
  font-size: 16px; line-height: 1.7;
  color: var(--text-2); background: var(--bg-0);
  margin: 0; padding: 0;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(37,99,235,0.4); color: var(--text-1); }

.container { max-width: 880px; margin: 0 auto; padding: 3rem 1.5rem 6rem; }

/* ===== Language switch (topbar, posts + index) ===== */
.lang-switch { display: inline-flex; gap: 2px; }

.doc-hero {
  background: var(--hero-gradient);
  border-bottom: 1px solid var(--border-1);
  color: #fff;
  padding: 4rem 0 3.5rem;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
}
.doc-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 700px 500px at 30% 50%, rgba(96,133,181,0.18) 0%, transparent 70%),
              radial-gradient(ellipse 500px 500px at 80% 30%, rgba(29,78,216,0.22) 0%, transparent 70%);
  pointer-events: none;
}
.doc-hero-inner {
  max-width: 880px; margin: 0 auto; padding: 0 1.5rem;
  position: relative; z-index: 1;
}
.doc-kicker {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-soft);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  font-weight: 500;
}
.doc-title {
  font-family: var(--font-sans);
  font-size: clamp(2.1rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-1);
  margin: 0 0 1rem;
}
.doc-subtitle {
  font-family: var(--font-mono);
  font-size: 1rem; font-weight: 400;
  color: var(--accent-soft);
  margin-bottom: 2.5rem;
  line-height: 1.5;
}
.doc-meta {
  display: flex; flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-2);
}
.doc-meta .meta-item { display: flex; flex-direction: column; gap: 0.2rem; }
.doc-meta .meta-label {
  font-family: var(--font-mono);
  font-size: 0.7rem; letter-spacing: 0.12em;
  text-transform: uppercase; font-weight: 500;
  color: var(--text-4);
}
.doc-meta .meta-value { color: var(--text-1); font-weight: 500; font-size: 0.95rem; }
.doc-meta a {
  color: var(--text-1);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.doc-meta a:hover { border-bottom-color: #fff; }

/* ===== Headings ===== */
h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--text-1);
  letter-spacing: -0.02em;
  scroll-margin-top: 1.5rem;
}
h2 {
  font-size: 1.75rem; font-weight: 700;
  margin: 3.5rem 0 1.25rem;
  padding-bottom: 0.75rem;
  position: relative;
}
h2::after {
  content: ''; position: absolute;
  left: 0; bottom: 0;
  width: 80px; height: 3px;
  background: var(--gradient);
  border-radius: 2px;
}
h3 {
  font-size: 1.3rem; font-weight: 700;
  margin: 2.5rem 0 1rem;
  color: var(--accent-text);
}
h4 {
  font-size: 1.05rem; font-weight: 600;
  margin: 1.75rem 0 0.6rem;
  color: var(--text-1);
}

/* ===== Prose ===== */
p { margin: 0 0 1.15rem; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
li { margin-bottom: 0.4rem; }
li > ul, li > ol { margin: 0.4rem 0 0; }
strong { font-weight: 600; color: var(--text-1); }
em { color: var(--text-3); }
a {
  color: var(--accent-text);
  text-decoration: none;
  border-bottom: 1px solid var(--border-accent);
  transition: all 0.2s ease;
}
a:hover { color: #93c5fd; border-bottom-color: var(--accent-text); }

/* ===== Code ===== */
code { font-family: var(--font-mono); font-size: 0.88em; }
p code, li code, td code, th code {
  background: rgba(37, 99, 235, 0.12);
  color: #a8c7fa;
  padding: 0.15em 0.45em;
  border-radius: 5px;
  font-size: 0.84em;
  border: 1px solid var(--border-accent);
}
pre {
  background: var(--bg-deep);
  color: #e2e8f0;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.6;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-2);
}
pre code { background: none; color: inherit; padding: 0; border: none; font-size: inherit; }
pre code.hljs { background: none; padding: 0; }

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.92rem;
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-1);
  box-shadow: var(--shadow-sm);
}
th, td {
  padding: 0.85rem 1.1rem;
  text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border-1);
}
th {
  background: var(--bg-deep);
  color: var(--text-1);
  font-weight: 600;
  font-size: 0.84rem;
  border-bottom: none;
}
tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

/* ===== Request/response split ===== */
table:has(th[width="60%"]) {
  border: none; box-shadow: none; background: none;
  table-layout: fixed; width: 100%;
}
table:has(th[width="60%"]) th {
  background: var(--gradient); color: #fff;
  font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 600; text-align: left;
  padding: 0.6rem 1.2rem; border-right: 3px solid var(--bg-0);
}
table:has(th[width="60%"]) th:last-child { border-right: none; }
table:has(th[width="60%"]) td {
  padding: 0; background: var(--bg-deep); border: none;
  border-right: 3px solid var(--bg-0); vertical-align: top; width: auto;
}
table:has(th[width="60%"]) td:last-child { border-right: none; }
table:has(th[width="60%"]) td > p {
  color: var(--accent-soft); font-family: var(--font-mono);
  font-size: 0.78rem; line-height: 1.55;
  margin: 0; padding: 0.25rem 1.15rem 1rem;
}
table:has(th[width="60%"]) td > p:first-child { padding-top: 0.75rem; }
table:has(th[width="60%"]) td > p code {
  background: rgba(255, 255, 255, 0.08); color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}
table:has(th[width="60%"]) td pre {
  margin: 0; border: none; border-radius: 0; box-shadow: none;
  padding: 1rem 1.15rem; font-size: 0.8rem; line-height: 1.55;
  white-space: pre-wrap; overflow-wrap: anywhere;
  word-break: break-word; overflow-x: hidden; min-height: 100%;
}
table:has(th[width="60%"]) td pre code {
  white-space: inherit; word-break: inherit; overflow-wrap: inherit; display: block;
}

/* ===== Attack summary ===== */
.attack-summary {
  background: linear-gradient(var(--surface-glass), var(--surface-glass)), var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem 1.25rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.attack-summary::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient);
}
.attack-summary h3,
.attack-summary > p:first-child strong {
  margin: 0 0 1rem; padding: 0;
  font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: var(--accent-text); font-weight: 700;
}
.attack-summary h3 { padding-bottom: 0; border-bottom: none; }
.attack-summary h3::after { display: none; }
.attack-summary > p:first-child { margin-bottom: 1rem; }
.attack-summary ul { margin-bottom: 0; padding-left: 0; list-style: none; }
.attack-summary ul li {
  margin-bottom: 0.6rem; font-size: 0.93rem; line-height: 1.6;
  position: relative; padding-left: 1.25rem;
}
.attack-summary ul li:last-child { margin-bottom: 0; }
.attack-summary ul li::before {
  content: '›'; position: absolute; left: 0.25rem;
  color: var(--accent-text); font-weight: 700;
}
.attack-summary ul li strong { color: var(--text-1); font-weight: 600; }

/* ===== Blockquote / Contents / hr / footer ===== */
blockquote {
  margin: 1.5rem 0; padding: 0.75rem 1.5rem;
  border-left: 3px solid var(--brand-600);
  color: var(--text-3); font-style: italic;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 0 var(--radius) var(--radius) 0;
}
h2#contents { margin-top: 0; }
h2#contents + ul {
  background: linear-gradient(var(--surface-glass), var(--surface-glass)), var(--bg-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.5rem 1.5rem 1.75rem;
  list-style: none; box-shadow: var(--shadow-sm);
}
h2#contents + ul li { padding: 0.3rem 0; font-size: 0.95rem; }
h2#contents + ul a { color: var(--text-2); border-bottom: none; font-weight: 500; }
h2#contents + ul a:hover { color: var(--accent-text); }
hr {
  border: none; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-2), transparent);
  margin: 3rem 0;
}
.references { font-size: 0.92rem; line-height: 1.65; }
.references li { margin-bottom: 0.7rem; }
.references a { word-break: break-word; overflow-wrap: anywhere; }
.doc-footer {
  margin-top: 4rem; padding-top: 2rem;
  border-top: 1px solid var(--border-1);
  text-align: center; color: var(--text-4); font-size: 0.85rem;
}
.doc-footer a { color: var(--accent-text); }
.doc-footer-social {
  display: flex; justify-content: center; gap: 1.25rem;
  margin-bottom: 1rem;
}
.doc-footer-social a {
  display: inline-flex; color: var(--text-4);
  transition: color 0.2s ease, transform 0.2s ease;
}
.doc-footer-social a:hover { color: var(--accent-text); transform: translateY(-1px); }
.doc-footer-social svg { width: 20px; height: 20px; display: block; }

/* ===== Figures ===== */
img {
  max-width: 100%; height: auto;
  display: block;
  margin: 1.75rem auto 0.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-2);
  background: #fff; /* light plate so white-background diagrams read as intentional */
}
p.figure-caption {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-3);
  font-style: italic;
  margin: 0.75rem auto 2rem;
  max-width: 90%;
  line-height: 1.5;
}

/* =========================================================
   ANIMATION COMPONENT
   ========================================================= */
.anim-figure {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem 1.25rem;
  margin: 2rem 0 1rem;
  box-shadow: var(--shadow-sm);
}
.anim-stage {
  position: relative;
  width: 100%;
  height: 380px;
  margin: 0 auto;
}
.anim-stage-wide { height: 420px; }

.anim-agent-box {
  position: absolute;
  top: 18px; right: 0;
  width: 56%;
  bottom: 18px;
  border: 1.5px dashed var(--border-accent);
  border-radius: 16px;
  background: rgba(96, 133, 181, 0.05);
}
.anim-agent-label {
  position: absolute;
  top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--bg-1);
  padding: 1px 12px;
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--accent-soft); font-weight: 600;
}

.anim-actor {
  position: absolute;
  text-align: center;
  z-index: 1;
}
.anim-actor .actor-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(96, 133, 181, 0.15);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  margin: 0 auto 4px;
  border: 2px solid var(--border-accent);
}
.anim-actor .actor-icon.attacker {
  background: var(--anim-bad-bg);
  color: var(--anim-bad);
  border-color: rgba(248, 113, 113, 0.35);
}
.anim-actor .actor-icon.doc {
  background: var(--anim-bad-bg);
  color: var(--anim-bad);
  border-color: rgba(248, 113, 113, 0.3);
}
.anim-actor .actor-label {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.anim-actor .actor-label.attacker { color: var(--anim-bad); }

.anim-bubble {
  position: absolute;
  padding: 10px 12px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.45;
  text-align: left;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 1.4s cubic-bezier(0.25, 1, 0.5, 1);
  opacity: 0;
}
.anim-bubble .role {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
  margin-bottom: 4px;
  font-weight: 600;
}

.anim-bubble.user {
  background: var(--anim-user-bg);
  border: 1.5px solid var(--anim-user);
  color: var(--anim-user);
}
.anim-bubble.system {
  background: var(--anim-sys-bg);
  border: 1.5px solid var(--anim-sys);
  color: var(--anim-sys);
}
.anim-bubble.attacker {
  background: var(--anim-bad-bg);
  border: 1.5px dashed var(--anim-bad);
  color: var(--anim-bad);
}
.anim-bubble.response-ok {
  background: var(--anim-ok-bg);
  border: 1.5px solid var(--anim-ok);
  color: var(--anim-ok);
}
.anim-bubble.response-bad {
  background: var(--anim-bad-bg);
  border: 1.5px solid var(--anim-bad);
  color: var(--anim-bad);
}

.anim-merged {
  position: absolute;
  background: var(--bg-1);
  border: 1.5px solid var(--border-2);
  border-radius: 10px;
  overflow: hidden;
  opacity: 0;
  z-index: 6;
  transition: all 1.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.anim-merged .seg {
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.35;
}
.anim-merged .seg + .seg { border-top: 1px solid var(--border-1); }
.anim-merged .seg .role {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2px;
  font-weight: 700;
}
.anim-merged .seg.sys { color: var(--anim-sys); }
.anim-merged .seg.sys .role { color: var(--anim-sys); }
.anim-merged .seg.usr { background: rgba(96, 165, 250, 0.06); color: var(--anim-user); }
.anim-merged .seg.usr .role { color: var(--anim-user); }
.anim-merged .seg.atk {
  background: rgba(248, 113, 113, 0.07);
  border-top: 1.5px dashed var(--anim-bad) !important;
  color: var(--anim-bad);
}
.anim-merged .seg.atk .role { color: var(--anim-bad); }

.anim-llm {
  position: absolute;
  text-align: center;
  z-index: 1;
  opacity: 0.4;
  transition: all 0.8s ease;
}
.anim-llm .llm-box {
  width: 60px; height: 60px;
  background: var(--bg-2);
  border: 2px solid var(--brand-400);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem; font-weight: 700;
  color: var(--accent-text);
  transition: all 0.6s ease;
}
.anim-llm .llm-label {
  font-family: var(--font-mono); font-size: 0.65rem;
  color: var(--text-3);
}
.anim-llm .llm-role {
  font-family: var(--font-mono); font-size: 0.6rem;
  color: var(--anim-sys);
  margin-top: 2px;
  transition: color 0.4s;
}
.anim-llm.compromised .llm-box {
  border-color: var(--anim-bad);
  box-shadow: 0 0 18px rgba(248, 113, 113, 0.35);
}
.anim-llm.compromised .llm-role { color: var(--anim-bad); }
.anim-llm.healthy .llm-box {
  border-color: var(--anim-ok);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.3);
}

.anim-arrow {
  position: absolute;
  font-size: 22px;
  color: var(--brand-400);
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 1;
  font-family: var(--font-mono);
}

.anim-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}
.anim-btn {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border-radius: 8px;
  border: none;
  background: var(--gradient);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}
.anim-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md), var(--glow-sm); }
.anim-btn.danger { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); }

.anim-caption {
  text-align: center;
  margin: 0.85rem auto 0;
  min-height: 2.4em;
  max-width: 640px;
  font-size: 0.92rem;
  color: var(--text-3);
  line-height: 1.5;
}
.anim-caption.warn { color: var(--anim-bad); font-weight: 500; }
.anim-caption.ok   { color: var(--anim-ok);  font-weight: 500; }

/* =========================================================
   BLOG INDEX
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 22, 40, 0.85);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-1);
  height: 72px;
  display: flex; align-items: center;
}
/* .topbar-inner replicates the SPA header container (Tailwind
   `container mx-auto px-6`) so the bar keeps the exact same geometry
   when navigating between the home and the blog. */
.topbar-inner {
  width: 100%;
  margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
@media (min-width: 640px)  { .topbar-inner { max-width: 640px; } }
@media (min-width: 768px)  { .topbar-inner { max-width: 768px; } }
@media (min-width: 1024px) { .topbar-inner { max-width: 1024px; } }
@media (min-width: 1280px) { .topbar-inner { max-width: 1280px; } }
@media (min-width: 1536px) { .topbar-inner { max-width: 1536px; } }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; border-bottom: none;
  font-weight: 800; letter-spacing: -0.025em; font-size: 1.25rem;
  color: var(--text-1);
}
.brand-mark { width: 34px; height: 34px; display: block; flex-shrink: 0; }
.brand-accent { color: var(--accent-text); }
.brand img { height: 32px; margin: 0; border: none; box-shadow: none; background: none; border-radius: 0; }
.topbar-nav { display: flex; align-items: center; gap: 1.75rem; margin-left: auto; }
.topbar-nav a.link {
  color: var(--text-2); text-decoration: none; border-bottom: none;
  font-weight: 500; font-size: 0.875rem;
  white-space: nowrap;
  transition: color 0.2s;
}
.topbar-nav a.link:hover { color: var(--text-1); }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }
.lang-switch { border-left: 1px solid var(--border-1); padding-left: 1.5rem; margin-left: 0; gap: 4px; }
.lang-switch a, .lang-switch button {
  font-family: var(--font-mono); font-weight: 700; font-size: 0.875rem;
  padding: 4px 8px; border-radius: 6px;
  border: 1px solid transparent; background: transparent; color: #64748b; cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.lang-switch a.active, .lang-switch button.active {
  color: var(--accent-text); background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1);
}
.lang-switch a:hover:not(.active), .lang-switch button:hover:not(.active) { color: #cbd5e1; }
.cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px;
  background: var(--gradient); color: #fff;
  border-radius: 8px; text-decoration: none; border-bottom: none;
  font-weight: 600; font-size: 0.9rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg), var(--glow-sm); color: #fff; }

/* Mobile hamburger + dropdown panel (mirrors the SPA header) */
.topbar-burger {
  display: none;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-1); padding: 4px; border-radius: 8px;
  align-items: center; justify-content: center;
  transition: background 0.2s;
}
.topbar-burger:hover { background: rgba(255,255,255,0.05); }
.topbar-burger .icon-menu, .topbar-burger .icon-close { width: 24px; height: 24px; display: block; }
.topbar-burger .icon-close { display: none; }
.topbar.menu-open .topbar-burger .icon-menu { display: none; }
.topbar.menu-open .topbar-burger .icon-close { display: block; }

.topbar-mobile {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border-1);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  flex-direction: column; gap: 1rem;
}
.topbar-mobile a.link {
  color: var(--text-2); text-decoration: none; border-bottom: 1px solid var(--border-1);
  font-size: 1.125rem; font-weight: 500; padding: 0.75rem 0;
  transition: color 0.2s;
}
.topbar-mobile a.link:hover { color: var(--text-1); }
.topbar-mobile a.cta { margin-top: 1rem; width: 100%; justify-content: center; padding: 1rem; }

.page-hero {
  background: var(--hero-gradient);
  border-bottom: 1px solid var(--border-1);
  color: #fff;
  padding: 5rem 0 4.5rem;
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 700px 500px at 30% 50%, rgba(96,133,181,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 30%, rgba(29,78,216,0.22) 0%, transparent 70%);
  pointer-events: none;
}
.page-hero-inner {
  max-width: 1000px; margin: 0 auto; padding: 0 1.5rem;
  position: relative; z-index: 1;
}
.kicker {
  font-family: var(--font-mono);
  color: var(--accent-soft); font-size: 0.8rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 500; margin-bottom: 1rem;
}
.page-title {
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800; letter-spacing: -0.025em;
  line-height: 1.05; margin: 0 0 1rem;
  color: var(--text-1);
}
.page-subtitle {
  font-family: var(--font-mono);
  color: var(--accent-soft); font-size: 1rem;
  max-width: 620px;
}

.posts {
  max-width: 1200px; margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}
.post-card {
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  border-radius: 16px; overflow: hidden;
  text-decoration: none; color: inherit; border-bottom: 1px solid var(--border-1);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow-sm);
  border-color: var(--border-2);
}
.post-cover {
  width: 100%; aspect-ratio: 16 / 9;
  background: var(--gradient);
  object-fit: cover; display: block;
  margin: 0; border: none; border-radius: 0; box-shadow: none;
}
.post-body { padding: 1.5rem 1.6rem 1.8rem; flex: 1; display: flex; flex-direction: column; }
.post-tag {
  display: inline-block;
  font-family: var(--font-mono); font-size: 0.7rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent-text); font-weight: 600;
  margin-bottom: 0.8rem;
}
.post-title {
  font-size: 1.25rem; font-weight: 700; line-height: 1.3;
  color: var(--text-1); margin: 0 0 0.7rem; letter-spacing: -0.015em;
}
.post-excerpt {
  color: var(--text-3); font-size: 0.95rem; line-height: 1.65;
  margin: 0 0 1.2rem; flex: 1;
}
.post-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; color: var(--text-4);
  padding-top: 1rem; border-top: 1px solid var(--border-1);
}
.post-meta .read-more { color: var(--accent-text); font-weight: 600; }
.post-meta .read-more::after { content: ' →'; }

.empty-note {
  grid-column: 1 / -1;
  text-align: center; color: var(--text-4); padding: 3rem 0;
  font-family: var(--font-mono); font-size: 0.9rem;
}

.footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--border-1);
  color: var(--text-3);
  padding: 2.5rem 1.5rem;
  text-align: center; font-size: 0.85rem;
}
.footer a { color: var(--text-1); text-decoration: none; border-bottom: none; }
.footer-social {
  display: flex; justify-content: center; gap: 1.25rem;
  margin-bottom: 1rem;
}
.footer-social a {
  display: inline-flex; color: var(--text-3);
  transition: color 0.2s ease, transform 0.2s ease;
}
.footer-social a:hover { color: #fff; transform: translateY(-1px); }
.footer-social svg { width: 20px; height: 20px; display: block; }

/* ===== Responsive ===== */
/* Same breakpoint as the SPA header (which collapses to a burger below lg/1024px) */
@media (max-width: 1023px) {
  .topbar-nav { display: none; }              /* inline menu hidden, moves into the panel */
  /* High specificity so the index's [data-lang] `display: revert` can't re-show it */
  .topbar .topbar-actions .cta { display: none; }  /* bar CTA hidden, moves into the panel */
  .topbar-burger { display: inline-flex; }
  .lang-switch { border-left: none; padding-left: 0; }
  .topbar.menu-open .topbar-mobile { display: flex; }
  .posts { padding: 2.5rem 1.5rem 4rem; gap: 1.5rem; }
  .page-hero { padding: 3.5rem 0 3rem; }
}
@media (max-width: 480px) {
  .brand { font-size: 1.05rem; white-space: nowrap; }
  .brand-mark { width: 28px; height: 28px; }
}
@media (max-width: 700px) {
  .anim-stage { height: 460px; }
  .anim-stage-wide { height: 520px; }
  .anim-agent-box { width: 100%; top: 180px; bottom: 0; }
  .anim-agent-label { top: -10px; }
  .anim-bubble { font-size: 0.65rem; }

  .doc-hero { padding: 2.5rem 0 2rem; margin-bottom: 2rem; }
  .doc-title { font-size: 1.7rem; }
  .doc-subtitle { font-size: 0.88rem; }
  .doc-meta { gap: 1rem 1.5rem; }
  .container { padding: 1rem 1.25rem 4rem; }
  h2 { font-size: 1.4rem; margin-top: 2.5rem; }
  h3 { font-size: 1.1rem; }
  pre { font-size: 0.78rem; padding: 0.9rem 1rem; }
  table { font-size: 0.84rem; }
  th, td { padding: 0.65rem 0.8rem; }
  .attack-summary { padding: 1.1rem 1.2rem 0.95rem; }
}

/* ===== Language visibility (index) - default EN ===== */
[data-lang="es"] { display: none; }
html[lang="es"] [data-lang="en"] { display: none; }
html[lang="es"] [data-lang="es"] { display: revert; }

/* ===== Print (stays light) ===== */
@media print {
  body { background: #fff; color: #1e293b; }
  .topbar { display: none; }
  .doc-hero { background: none; color: var(--brand-950); padding: 0 0 1.5rem; margin-bottom: 1.5rem; border-bottom: 2px solid var(--brand-600); }
  .doc-hero::before { display: none; }
  .doc-title, .doc-kicker, .doc-subtitle, .doc-meta .meta-value { color: var(--brand-950); }
  .anim-figure { display: none; }
  .container { max-width: 100%; padding: 0; }
  a { color: var(--brand-950); border-bottom: none; }
  h2, h3, h4, strong { color: #0c1e4f; }
  h2, h3 { page-break-after: avoid; }
  pre, table, .attack-summary, img { page-break-inside: avoid; }
}
