/* ============================================================================
   LinkedFlow Docs — docs.linkedflow.pro
   Mismos tokens de marca que la landing (home.css). Layout de documentación:
   header fijo + sidebar de navegación + artículo. Sin dependencias externas:
   Inter autoalojada, CSP estricta.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #080b12;
  --surface: #0d111b;
  --surface-2: #111827;
  --line: rgba(127, 180, 232, 0.14);
  --line-strong: rgba(127, 180, 232, 0.28);
  --text: #e8eef9;
  --text-dim: #9aa8c2;
  --text-faint: #6b7a96;
  --brand: #4c7ea8;
  --brand-2: #7fb4e8;
  --grad: linear-gradient(92deg, #7fb4e8, #4c7ea8);
  --ok: #10b981;
  --warn: #f59e0b;
  --ai: #a78bfa;
  --danger: #f87171;
  --callout: #ff5c5c;
  --radius: 14px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 64px;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 20px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: #a9cdf2; }
h1, h2, h3, h4 { font-weight: 750; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: 2rem; margin: 0 0 0.4em; }
h2 { font-size: 1.45rem; margin: 2.2em 0 0.5em; padding-top: 0.6em; border-top: 1px solid var(--line); }
h3 { font-size: 1.12rem; margin: 1.6em 0 0.4em; }
p { margin: 0 0 1em; }
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  font-size: 0.9em;
}
table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: 0.94em; }
th, td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; }

/* ---------- Header ---------- */
.docs-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(8, 11, 18, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}
.docs-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.docs-header .brand img { height: 26px; width: auto; }
.docs-header .brand span.tag {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--brand-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 2px 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.docs-header .spacer { flex: 1; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a, .lang-switch span {
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--text-dim);
  text-transform: uppercase;
}
.lang-switch [aria-current] { background: var(--surface-2); color: var(--brand-2); border: 1px solid var(--line-strong); }
.lang-switch a:hover { color: var(--text); }
.app-cta {
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--grad);
  color: #0a0f18 !important;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* ---------- Layout ---------- */
.docs-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 0;
  max-width: 1240px;
  margin: 0 auto;
  padding-top: var(--header-h);
}
.docs-nav {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 28px 18px 40px 20px;
  border-right: 1px solid var(--line);
  font-size: 0.9rem;
}
.docs-nav .group { margin: 0 0 22px; }
.docs-nav .group > strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin: 0 0 8px;
}
.docs-nav a {
  display: block;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--text-dim);
}
.docs-nav a:hover { color: var(--text); background: var(--surface); }
.docs-nav a[aria-current] {
  color: var(--brand-2);
  background: var(--surface-2);
  font-weight: 650;
}
.docs-main { padding: 40px 40px 90px; min-width: 0; }
.docs-main .lead { color: var(--text-dim); font-size: 1.06rem; max-width: 720px; }

/* ---------- Pantallazos ---------- */
figure.shot {
  margin: 1.6em 0 1.8em;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot figcaption {
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
}

/* Leyenda numerada que acompaña a los cuadros/flechas dibujados en la captura */
ol.callouts { margin: 0 0 1.6em; padding: 0; list-style: none; counter-reset: co; }
ol.callouts li {
  position: relative;
  counter-increment: co;
  padding: 6px 0 6px 42px;
  color: var(--text-dim);
}
ol.callouts li strong { color: var(--text); }
ol.callouts li::before {
  content: counter(co);
  position: absolute;
  left: 0;
  top: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--callout);
  color: #fff;
  font-weight: 750;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Avisos ---------- */
.note, .warn-box, .tip {
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 0 0 1.2em;
  font-size: 0.94rem;
}
.note { border-left-color: var(--brand-2); background: rgba(127, 180, 232, 0.06); }
.tip { border-left-color: var(--ok); background: rgba(16, 185, 129, 0.06); }
.warn-box { border-left-color: var(--warn); background: rgba(245, 158, 11, 0.07); }
.note > p:last-child, .tip > p:last-child, .warn-box > p:last-child { margin-bottom: 0; }

/* ---------- Paginación prev/next ---------- */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 1;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--text);
}
.pager a small { display: block; color: var(--text-faint); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.07em; }
.pager a.next { text-align: right; }
.pager a:hover { border-color: var(--brand-2); }

/* ---------- Portada (índice) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 1.6em 0;
}
.card-grid a {
  display: block;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  color: var(--text);
}
.card-grid a:hover { border-color: var(--brand-2); }
.card-grid a strong { display: block; margin-bottom: 6px; }
.card-grid a span { color: var(--text-dim); font-size: 0.88rem; }

/* ---------- Footer ---------- */
.docs-footer {
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: 0.85rem;
  padding: 26px 40px;
  max-width: 1240px;
  margin: 0 auto;
}
.docs-footer a { color: var(--text-dim); }

/* ---------- Móvil ---------- */
.nav-toggle { display: none; }
@media (max-width: 900px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-nav {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: none;
  }
  .docs-nav.open { display: block; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 6px 12px;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
  }
  .docs-main { padding: 28px 20px 70px; }
  .app-cta { display: none; }
}
