/* ==========================================================================
   ElVendedor Docs · hoja de estilos única
   Diseño: marca ElVendedor (naranja #ff9900, pizarra #1e293b).
   Sin fuentes ni recursos externos: el sitio funciona 100 % offline.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: 'Poppins', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  --primary: #ff9900;
  --primary-strong: #e08600;
  --primary-soft: #fff3e0;
  --primary-border: #ffd08a;
  --on-primary: #1e293b;
  --link: #b45309;
  --link-hover: #92400e;

  --accent: #1e293b;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;

  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-border: #1e293b;
  --inline-code-bg: #f1f5f9;
  --inline-code-text: #9a3412;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / 0.06);
  --shadow: 0 4px 16px rgb(15 23 42 / 0.06), 0 1px 2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 18px 50px rgb(15 23 42 / 0.16);

  --topbar-h: 4rem;
  --sidebar-w: 17rem;
  --toc-w: 15rem;
  --content-max: 51rem;

  --focus-ring: 0 0 0 3px rgb(255 153 0 / 0.45);
}

[data-theme='dark'] {
  color-scheme: dark;

  --bg: #0b1120;
  --bg-soft: #0f172a;
  --surface: #111a2e;
  --surface-2: #0f172a;
  --surface-3: #1e293b;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #e2e8f0;
  --text-muted: #a5b4c8;
  --text-faint: #8595ab;

  --primary: #ffb84d;
  --primary-strong: #ff9900;
  --primary-soft: #2b1d06;
  --primary-border: #5a3a0b;
  --on-primary: #1e293b;
  --link: #fbbf24;
  --link-hover: #fcd34d;

  --accent: #e2e8f0;
  --success: #4ade80;
  --success-soft: #052e16;
  --warning: #fbbf24;
  --warning-soft: #2b1d06;
  --danger: #f87171;
  --danger-soft: #2a0a0a;
  --info: #93c5fd;
  --info-soft: #0b1c3a;

  --code-bg: #060b16;
  --code-text: #e2e8f0;
  --code-border: #1e293b;
  --inline-code-bg: #1e293b;
  --inline-code-text: #fdba74;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow: 0 4px 16px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 18px 50px rgb(0 0 0 / 0.55);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1.5rem);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
}

p {
  margin: 0;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--primary);
  color: var(--on-primary);
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.72em;
  padding: 0.15em 0.4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  color: var(--text-muted);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: var(--on-primary);
  box-shadow: 0 6px 18px rgb(255 153 0 / 0.28);
}

.button--primary:hover {
  color: var(--on-primary);
  box-shadow: 0 10px 24px rgb(255 153 0 / 0.35);
}

.button--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.button--secondary:hover {
  border-color: var(--primary);
  color: var(--text);
}

.button--soft {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--link);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Cabecera
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 96rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.topbar__menu {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand__logo {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  background: var(--primary-soft);
}

.brand__text {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand__text strong {
  font-weight: 800;
}

.brand__text span {
  font-weight: 500;
  color: var(--text-faint);
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 1.5rem;
}

.topbar__link {
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
}

.topbar__link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.topbar__link.is-active {
  color: var(--link);
  background: var(--primary-soft);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.search-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.35rem;
  padding: 0 0.5rem 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-faint);
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
}

.search-button:hover {
  border-color: var(--primary-border);
  color: var(--text);
}

.search-button kbd {
  margin-left: 0.15rem;
}

.icon--sun,
.icon--moon {
  display: none;
}

[data-theme='light'] .icon--moon,
[data-theme='dark'] .icon--sun {
  display: block;
}

/* --------------------------------------------------------------------------
   Estructura de tres columnas
   -------------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w);
  gap: 2.5rem;
  max-width: 96rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  padding: 1.5rem 0.75rem 2rem 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border-right: 1px solid var(--border);
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding-right: 1rem;
}

.nav-group__title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  text-decoration: none;
}

.nav-group__title:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav-group__title .icon {
  width: 1rem;
  height: 1rem;
  color: var(--text-faint);
}

.nav-group.is-active .nav-group__title {
  color: var(--link);
}

.nav-group.is-active .nav-group__title .icon {
  color: var(--primary-strong);
}

.nav-group__list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--border);
  margin-left: 0.95rem;
}

.sidebar__link {
  display: block;
  margin: 0.1rem 0;
  padding: 0.34rem 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted);
  font-size: 0.89rem;
  line-height: 1.4;
  text-decoration: none;
}

.sidebar__link:hover {
  background: var(--surface-3);
  color: var(--text);
}

.sidebar__link.is-active {
  position: relative;
  color: var(--link);
  background: var(--primary-soft);
  font-weight: 600;
}

.sidebar__link.is-active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--primary-strong);
}

.sidebar__meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.55rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.76rem;
}

.sidebar__meta a {
  color: var(--text-muted);
}

.sidebar-overlay {
  display: none;
}

/* --------------------------------------------------------------------------
   Columna de contenido
   -------------------------------------------------------------------------- */

.content {
  min-width: 0;
  padding: 2.25rem 0 3rem;
}

.prose {
  max-width: var(--content-max);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

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

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

.page-title {
  font-size: clamp(1.9rem, 1.2rem + 2vw, 2.6rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.6rem;
}

.page-lead {
  max-width: 46rem;
  color: var(--text-muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 1rem 0 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
}

.page-meta__sep {
  color: var(--border-strong);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-muted);
}

.badge--cliente {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--link);
}

.badge--implementador {
  border-color: #bfdbfe;
  background: var(--info-soft);
  color: var(--info);
}

[data-theme='dark'] .badge--implementador {
  border-color: #1e3a8a;
}

.badge--ambos {
  border-color: #bbf7d0;
  background: var(--success-soft);
  color: var(--success);
}

[data-theme='dark'] .badge--ambos {
  border-color: #14532d;
}

/* --------------------------------------------------------------------------
   Tipografía del contenido
   -------------------------------------------------------------------------- */

.prose > * + * {
  margin-top: 1.15rem;
}

.prose h2 {
  margin-top: 2.6rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: clamp(1.4rem, 1.1rem + 0.8vw, 1.75rem);
  letter-spacing: -0.02em;
}

.prose h3 {
  margin-top: 1.9rem;
  font-size: 1.22rem;
}

.prose h4 {
  margin-top: 1.5rem;
  font-size: 1.05rem;
}

.prose p,
.prose li {
  color: var(--text-muted);
  line-height: 1.7;
}

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

.prose > h2 + p,
.prose > h3 + p {
  margin-top: 0.7rem;
}

.prose ul,
.prose ol {
  margin: 1rem 0 0;
  padding-left: 1.4rem;
}

.prose li + li {
  margin-top: 0.4rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: 0.4rem;
}

.prose a {
  font-weight: 500;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.4rem 1.1rem;
  border-left: 3px solid var(--primary);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
}

.prose blockquote p {
  margin: 0.4rem 0;
}

.prose hr {
  margin: 2.25rem 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.prose img {
  display: block;
  margin: 1.5rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.prose figure {
  margin: 1.5rem 0;
}

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
}

/* Los títulos de tarjetas no heredan el estilo de h2 del contenido */
.prose .audience-card__title,
.prose .not-found h2 {
  margin: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

/* Tablas */

.table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.prose th {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.prose td {
  color: var(--text-muted);
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose table code {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: keep-all;
}

.prose tbody tr:hover {
  background: var(--surface-2);
}

/* Código */

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.15em 0.38em;
  border-radius: 5px;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  overflow-wrap: anywhere;
}

.code-block {
  position: relative;
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--code-border);
  background: var(--code-bg);
  overflow: hidden;
}

.code-block::before {
  content: attr(data-lang);
  display: block;
  padding: 0.45rem 0.9rem;
  border-bottom: 1px solid rgb(255 255 255 / 0.08);
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.code-block code {
  padding: 0;
  background: transparent;
  color: var(--code-text);
  font-size: inherit;
  white-space: pre;
}

.code-copy {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  z-index: 2;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 6px;
  background: rgb(15 23 42 / 0.7);
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.code-block:hover .code-copy,
.code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover {
  border-color: var(--primary);
  color: #fff;
}

/* Anclas de encabezado */

.heading-anchor {
  float: left;
  margin-left: -1.1em;
  width: 1.1em;
  color: var(--border-strong);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}

h2:hover > .heading-anchor,
h3:hover > .heading-anchor,
.heading-anchor:focus {
  opacity: 1;
}

.heading-anchor:hover {
  color: var(--primary-strong);
}

/* Bloques destacados */

.aside {
  display: flex;
  gap: 0.8rem;
  margin: 1.6rem 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.aside__icon {
  font-size: 1rem;
  line-height: 1.5;
}

.aside__body {
  min-width: 0;
}

.aside__body > :first-child {
  margin-top: 0;
}

.aside__body > :last-child {
  margin-bottom: 0;
}

.aside__title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--text);
  font-size: 0.92rem;
}

.aside p,
.aside li {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.aside--tip,
.aside--note {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.aside--tip .aside__body,
.aside--note .aside__body {
  color: var(--success);
}

.aside--info {
  border-left-color: var(--info);
  background: var(--info-soft);
}

.aside--caution,
.aside--warning {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.aside--danger {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.aside--tip .aside__title,
.aside--info .aside__title,
.aside--caution .aside__title,
.aside--warning .aside__title,
.aside--danger .aside__title {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Tarjetas reutilizables (portadas de sección, landing)
   -------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow);
  color: var(--text);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  margin-bottom: 0.25rem;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.card__title {
  font-weight: 700;
  font-size: 1rem;
}

.card__text {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.card__arrow {
  margin-top: auto;
  padding-top: 0.5rem;
  color: var(--link);
  font-size: 0.82rem;
  font-weight: 600;
}

.audience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 1rem;
}

.audience-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.6rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.audience-card::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.audience-card__eyebrow {
  color: var(--text-faint);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audience-card__title {
  font-size: 1.3rem;
}

.audience-card p {
  color: var(--text-muted);
  font-size: 0.94rem;
}

.audience-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.section-card--cliente::after {
  background: linear-gradient(90deg, #ff9900, #ffb84d);
}

.section-card--implementador::after {
  background: linear-gradient(90deg, #1d4ed8, #60a5fa);
}

.section-card--referencia::after {
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

/* --------------------------------------------------------------------------
   TOC
   -------------------------------------------------------------------------- */

.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 2.25rem 0 2rem;
  scrollbar-width: thin;
}

.toc__inner {
  padding-left: 1.25rem;
  border-left: 1px solid var(--border);
}

.toc__title {
  margin-bottom: 0.6rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc__item a {
  display: block;
  padding: 0.22rem 0;
  color: var(--text-faint);
  font-size: 0.8rem;
  line-height: 1.45;
  text-decoration: none;
}

.toc__item a:hover {
  color: var(--text);
}

.toc__item a.is-active {
  color: var(--link);
  font-weight: 600;
}

.toc__item--h3 a {
  padding-left: 0.7rem;
  font-size: 0.77rem;
}

.toc__top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  color: var(--text-faint);
  font-size: 0.76rem;
  text-decoration: none;
}

.toc__top .icon {
  width: 0.9rem;
  height: 0.9rem;
  transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   Pie de página del artículo
   -------------------------------------------------------------------------- */

.pager-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0.9rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.pager:hover {
  border-color: var(--primary-border);
  color: var(--text);
  transform: translateY(-1px);
}

.pager .icon {
  color: var(--primary-strong);
}

.pager span {
  display: flex;
  flex-direction: column;
}

.pager small {
  color: var(--text-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pager strong {
  font-size: 0.92rem;
}

.pager--next {
  justify-content: flex-end;
  text-align: right;
}

.pager--next .icon {
  order: 2;
}

.edit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-decoration: none;
}

.edit-link:hover {
  color: var(--link);
}

.feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-top: 2.25rem;
  padding: 1.1rem 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.feedback__title {
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.feedback__text {
  flex: 1 1 16rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Portada (landing)
   -------------------------------------------------------------------------- */

.page--splash .topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
}

.splash {
  padding: 0 1.25rem;
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 0 -1.25rem;
  padding: calc(var(--topbar-h) + 4rem) 0 3.5rem;
  background:
    radial-gradient(60rem 30rem at 70% -10%, rgb(255 153 0 / 0.22), transparent 60%),
    radial-gradient(40rem 24rem at 10% 10%, rgb(29 78 216 / 0.1), transparent 65%),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.hero__glow {
  position: absolute;
  inset: auto -10% -60% auto;
  width: 40rem;
  height: 40rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(255 153 0 / 0.16), transparent 65%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  max-width: 58rem;
  margin: 0 auto;
  padding: 0 1.25rem;
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  padding: 0.32rem 0.8rem;
  border: 1px solid var(--primary-border);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 600;
}

.hero__title {
  font-size: clamp(2.2rem, 1.4rem + 4vw, 3.6rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.hero__tagline {
  max-width: 44rem;
  margin: 1.1rem auto 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 0.95rem + 0.4vw, 1.18rem);
  line-height: 1.65;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.9rem;
}

.splash__content {
  max-width: 72rem;
  margin: 0 auto;
  padding: 3.25rem 1.25rem 4rem;
}

.splash__content > h2 {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem);
  letter-spacing: -0.02em;
  text-align: center;
}

.splash__content > p {
  max-width: 44rem;
  margin: 0.75rem auto 0;
  color: var(--text-muted);
  text-align: center;
}

.splash__content .card-grid {
  margin-top: 1.75rem;
}

.feature-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.feature {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.feature strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.95rem;
}

.feature span {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Buscador
   -------------------------------------------------------------------------- */

.search-dialog {
  width: min(42rem, calc(100vw - 2rem));
  max-height: min(34rem, calc(100vh - 6rem));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-dialog::backdrop {
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(3px);
}

.search-dialog__panel {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}

.search-dialog__field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.search-dialog__field .icon {
  color: var(--text-faint);
}

.search-dialog__field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
}

.search-dialog__field input::placeholder {
  color: var(--text-faint);
}

.search-results {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  overflow-y: auto;
}

.search-result {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}

.search-result:hover,
.search-result.is-selected {
  background: var(--primary-soft);
  color: var(--text);
}

.search-result__title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.search-result__section {
  color: var(--link);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.search-result__text {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-dialog__hint {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 0.75rem;
}

.search-empty {
  padding: 1.4rem 0.9rem;
  color: var(--text-faint);
  font-size: 0.88rem;
  text-align: center;
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.not-found {
  padding: 2rem 0;
}

.not-found__code {
  color: var(--primary-strong);
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.not-found h2 {
  margin-top: 0.75rem;
  border-top: 0;
  padding-top: 0;
}

.not-found__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   Pie de página
   -------------------------------------------------------------------------- */

.footer {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer__inner {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(0, 2fr);
  gap: 2.5rem;
  max-width: 96rem;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 2rem;
}

.footer__brand {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.footer__brand img {
  border-radius: 10px;
  background: var(--primary-soft);
}

.footer__name {
  font-weight: 800;
  font-size: 1.02rem;
}

.footer__tagline {
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.footer__columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1.5rem;
}

.footer__title {
  margin-bottom: 0.6rem;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer__column ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__column li + li {
  margin-top: 0.35rem;
}

.footer__column a {
  color: var(--text-muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.footer__column a:hover {
  color: var(--link);
  text-decoration: underline;
}

.footer__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  max-width: 96rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 1000px) {
  .topbar__nav {
    display: none;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .topbar__menu {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 45;
    width: min(20rem, 85vw);
    max-height: none;
    padding: 1.25rem 1rem 2rem;
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  body.nav-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    z-index: 44;
    border: 0;
    background: rgb(15 23 42 / 0.45);
    cursor: pointer;
  }

  body.nav-open {
    overflow: hidden;
  }

  .content {
    padding-top: 1.5rem;
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .topbar__inner {
    padding: 0 0.9rem;
    gap: 0.5rem;
  }

  .brand__text span {
    display: none;
  }

  .search-button__label,
  .search-button kbd {
    display: none;
  }

  .search-button {
    width: 2.35rem;
    justify-content: center;
    padding: 0;
  }

  .hero {
    padding-top: calc(var(--topbar-h) + 2.5rem);
  }

  .page-meta {
    font-size: 0.76rem;
  }

  .pager-nav {
    grid-template-columns: 1fr;
  }

  .splash__content {
    padding-top: 2.25rem;
  }
}

/* --------------------------------------------------------------------------
   Impresión
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --text-muted: #333;
  }

  .topbar,
  .sidebar,
  .toc,
  .footer,
  .search-dialog,
  .pager-nav,
  .feedback,
  .edit-link,
  .sidebar-overlay {
    display: none !important;
  }

  .layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  .content {
    padding: 0;
  }

  .prose {
    max-width: none;
  }

  .prose a {
    color: #000;
    text-decoration: underline;
  }

  .code-block {
    border-color: #ccc;
    background: #f6f6f6;
    color: #000;
  }

  .code-block code {
    color: #000;
    white-space: pre-wrap;
  }

  .code-block::before {
    color: #555;
    border-bottom-color: #ddd;
  }

  .code-copy {
    display: none;
  }

  .aside {
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .prose h2,
  .prose h3 {
    break-after: avoid;
  }
}
