/**
 * sdk.joyeriazafirox.com — Plataforma de Desarrollo de Zafirox
 * Diseño editorial de alta joyería, precisión tecnológica y developer experience soberana.
 */
:root {
  /* Roles oficiales: la paleta vive en zafirox-topbar-{primitives,theme}.css. */
  --zafiro: var(--zfx-as-selection);
  --zafiro-profundo: var(--zfx-as-text);
  --zafiro-luz: var(--zfx-brand-azul-faceta);
  --faceta: var(--zfx-as-selection);
  --oro: var(--zfx-as-accent);
  --oro-claro: var(--zfx-brand-champagne-gold);
  --oro-tenue: var(--zfx-as-text-subtle);
  --onix: var(--zfx-as-text);
  --carbon: var(--zfx-as-surface-subtle);
  --grafito: var(--zfx-brand-grafito);
  --marfil: var(--zfx-as-bg);
  --marfil-suave: var(--zfx-as-surface-subtle);
  --blanco: var(--zfx-as-surface);
  --gris-100: var(--zfx-as-surface-subtle);
  --gris-200: var(--zfx-as-surface-strong);
  --gris-300: var(--zfx-as-border-strong);
  --gris-400: var(--zfx-as-text-subtle);
  --gris-600: var(--zfx-as-text-subtle);
  --texto: var(--zfx-as-text);
  --texto-suave: var(--zfx-as-text-muted);
  --texto-tenue: var(--zfx-as-text-subtle);
  --borde: var(--zfx-as-border);
  --borde-suave: var(--zfx-as-border-soft);
  --borde-fuerte: var(--zfx-as-border-strong);
  --borde-oro: var(--zfx-as-accent-line);

  /* Tipografía y métricas */
  --font-body: var(--zfx-as-font);
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "Liberation Mono", Menlo, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --topbar: 70px;
  --sidebar: 272px;
  --toc: 240px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-card: 22px;
  --radius-pill: 999px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar) + 24px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--texto);
  background: var(--marfil);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--zafiro);
  text-decoration: none;
  transition: color 180ms ease;
}

a:hover {
  color: var(--zafiro-profundo);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button {
  font: inherit;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

:focus-visible {
  outline: 2px solid var(--faceta);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--onix);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius);
  z-index: 100;
  font-weight: 700;
}

.skip:focus {
  left: 12px;
}

/* ==========================================================================
   Barra superior (Topbar)
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar);
  background: rgba(248, 246, 241, 0.88);
  border-bottom: 1px solid var(--borde);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(18, 104, 179, 0.03);
}

.topbar::after {
  content: "";
  display: block;
  height: 2px;
  background: linear-gradient(90deg,
    var(--zafiro-profundo) 0%,
    var(--zafiro) 35%,
    var(--oro) 70%,
    transparent 100%
  );
  opacity: 0.85;
}

.topbar-inner {
  max-width: 1520px;
  min-width: 0;
  margin: 0 auto;
  height: 100%;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: var(--onix);
  font-weight: 750;
  font-size: 19px;
  letter-spacing: -0.025em;
  white-space: nowrap;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 37px;
  display: grid;
  place-items: center;
  position: relative;
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18, 104, 179, 0.25), transparent 70%);
  filter: blur(4px);
  z-index: -1;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(18, 104, 179, 0.25));
}

.brand-name {
  color: var(--onix);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-separator {
  color: var(--oro);
  font-weight: 400;
  margin: 0 1px;
  opacity: 0.75;
}

.brand-product {
  color: var(--zafiro-profundo);
  background: rgba(18, 104, 179, 0.08);
  border: 1px solid rgba(18, 104, 179, 0.2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.topnav a {
  position: relative;
  padding: 8px 14px;
  color: var(--gris-600);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.topnav a:hover {
  background: rgba(15, 23, 42, 0.05);
  color: var(--texto);
  text-decoration: none;
}

.topnav a.current {
  color: var(--zafiro-profundo);
  background: rgba(18, 104, 179, 0.09);
  font-weight: 750;
}

.topbar-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.version {
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(214, 179, 92, 0.12);
  color: var(--zafiro-profundo);
  border: 1px solid rgba(214, 179, 92, 0.38);
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.topbar-link {
  color: var(--gris-600);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: color 160ms ease;
}

.topbar-link:hover {
  color: var(--zafiro);
  text-decoration: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  background: var(--onix);
  color: #fff;
  font-weight: 750;
  font-size: 14px;
  letter-spacing: 0.01em;
  border: 1px solid var(--onix);
  box-shadow: 0 4px 14px rgba(11, 12, 14, 0.16);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 140ms var(--ease-spring);
}

.button:hover {
  background: var(--zafiro-profundo);
  border-color: var(--zafiro-profundo);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(8, 58, 104, 0.25);
}

.button:active {
  transform: scale(0.98);
}

.button.secondary {
  background: var(--blanco);
  color: var(--zafiro-profundo);
  border: 1px solid var(--borde-fuerte);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.button.secondary:hover {
  background: #fff;
  border-color: var(--zafiro);
  color: var(--zafiro);
  box-shadow: 0 4px 14px rgba(18, 104, 179, 0.12);
}

/* ==========================================================================
   Estructura general (Shell)
   ========================================================================== */
.shell {
  max-width: 1520px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  gap: 48px;
  padding: 0 32px;
}

/* Barra lateral de navegación */
.sidebar {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  height: calc(100dvh - var(--topbar));
  overflow-y: auto;
  padding: 34px 0 48px;
  border-right: 1px solid var(--borde);
  scrollbar-width: thin;
}

.sidebar-toggle {
  display: none;
}

.nav-section {
  margin-bottom: 28px;
  padding-right: 20px;
}

.nav-section h2 {
  margin: 0 0 10px 10px;
  color: var(--gris-400);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.nav-section a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--gris-600);
  font-size: 14px;
  font-weight: 550;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.nav-section a:hover {
  background: rgba(18, 104, 179, 0.06);
  color: var(--texto);
  text-decoration: none;
}

.nav-section a.active {
  background: rgba(18, 104, 179, 0.1);
  color: var(--zafiro-profundo);
  font-weight: 750;
  box-shadow: inset 3px 0 0 var(--zafiro);
}

/* Columna de contenido principal */
.content {
  width: 100%;
  min-width: 0;
  padding: 40px 0 80px;
}

.breadcrumb {
  margin: 0 0 8px;
  color: var(--zafiro);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content > h1 {
  max-width: 840px;
  font-size: 42px;
  line-height: 1.15;
  margin: 0 0 14px;
  color: var(--onix);
  font-weight: 650;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 840px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--texto-suave);
  margin: 0 0 32px;
}

/* Tabla de contenido flotante derecha (TOC) */
.toc {
  position: sticky;
  top: var(--topbar);
  height: calc(100vh - var(--topbar));
  height: calc(100dvh - var(--topbar));
  overflow-y: auto;
  padding: 38px 0 32px 20px;
  font-size: 13px;
  border-left: 1px solid var(--borde);
  margin-top: 1px;
  align-self: start;
  scrollbar-width: thin;
}

.toc:empty {
  border: 0;
}

.toc h2 {
  margin: 0 0 12px;
  color: var(--gris-400);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.toc li {
  margin: 6px 0;
}

.toc li.level-3 {
  padding-left: 14px;
}

.toc a {
  color: var(--gris-600);
  text-decoration: none;
  display: block;
  padding: 2px 0;
  line-height: 1.4;
  transition: color 160ms ease;
}

.toc a:hover,
.toc a.active {
  color: var(--zafiro);
  font-weight: 650;
  text-decoration: none;
}

/* ==========================================================================
   Portada informativa (Hero)
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: stretch;
  gap: 40px;
  padding: 16px 0 36px;
  border-bottom: 1px solid var(--borde);
}

.hero-copy {
  min-width: 0;
  padding: 16px 0 10px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: rgba(18, 104, 179, 0.08);
  border: 1px solid rgba(18, 104, 179, 0.2);
  color: var(--zafiro-profundo);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--oro);
  box-shadow: 0 0 8px var(--oro);
  animation: pulseDot 3s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hero h1 {
  max-width: 680px;
  margin: 0 0 18px;
  color: var(--onix);
  font-size: clamp(38px, 4.8vw, 56px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.hero .lead {
  max-width: 640px;
  font-size: 17px;
  line-height: 1.62;
  color: var(--texto-suave);
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0 28px;
}

.hero-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--gris-600);
  font-size: 13px;
}

.hero-signals span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.hero-signals strong {
  color: var(--zafiro-profundo);
  font-size: 13.5px;
}

/* Tarjeta visual Hero: Bóveda de Desarrollador Zafirox */
.hero-visual {
  min-height: 400px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 34px 30px 32px;
  isolation: isolate;
  border-radius: var(--radius-card);
  background:
    radial-gradient(circle at 50% -10%, rgba(59, 145, 209, 0.35), transparent 65%),
    linear-gradient(155deg, var(--onix) 0%, var(--zafiro-profundo) 60%, #0A4E7E 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px -12px rgba(8, 58, 104, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  color: #fff;
}

.hero-visual::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(245, 227, 179, 0.25);
  border-radius: 14px;
  pointer-events: none;
}

.hero-visual::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  top: -80px;
  right: -60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 145, 209, 0.35), transparent 70%);
  filter: blur(8px);
  z-index: -1;
}

.hero-orbit {
  position: absolute;
  border: 1px solid rgba(245, 227, 179, 0.2);
  border-radius: 50%;
  transform: rotate(-28deg);
  pointer-events: none;
}

.hero-orbit-one {
  width: 320px;
  height: 150px;
  top: 50px;
  left: -40px;
}

.hero-orbit-two {
  width: 240px;
  height: 100px;
  top: 86px;
  left: 16px;
  border-color: rgba(59, 145, 209, 0.3);
}

.hero-mark {
  position: relative;
  z-index: 1;
  width: 108px;
  height: 110px;
  object-fit: contain;
  margin: auto 0 20px;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.4));
  transition: transform 260ms var(--ease-spring);
}

.hero-visual:hover .hero-mark {
  transform: scale(1.05) translateY(-3px);
}

.hero-visual-kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 4px;
  color: var(--oro-claro);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.hero-visual-title {
  position: relative;
  z-index: 1;
  max-width: 280px;
  margin: 0 0 16px;
  text-align: center;
  font-size: 22px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.hero-code {
  position: relative;
  z-index: 1;
  padding: 6px 14px;
  border: 1px solid rgba(245, 227, 179, 0.3);
  border-radius: var(--radius-pill);
  background: rgba(11, 12, 14, 0.45);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 12px;
  font-family: var(--font-mono);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.hero-visual-line {
  width: 100%;
  max-width: 270px;
  height: 1px;
  margin: 18px 0 12px;
  background: linear-gradient(90deg, transparent, rgba(245, 227, 179, 0.6), transparent);
}

.hero-visual-note {
  position: relative;
  z-index: 1;
  color: rgba(250, 248, 245, 0.75);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

/* Cuadrícula de principios */
.principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 32px 0 12px;
  border-bottom: 1px solid var(--borde);
}

.principles > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--blanco);
  border: 1px solid var(--borde);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.principles > div:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  border-color: rgba(18, 104, 179, 0.25);
}

.principle-index {
  color: var(--oro);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.principles strong {
  color: var(--onix);
  font-size: 15px;
  font-weight: 750;
}

.principles div > span:last-child {
  color: var(--gris-600);
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================================================
   Contenido editorial (Prose)
   ========================================================================== */
.prose {
  max-width: 840px;
  min-width: 0;
  overflow-wrap: break-word;
}

.prose h2 {
  margin: 48px 0 16px;
  color: var(--onix);
  font-size: 28px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.04em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--borde-suave);
}

.prose h3 {
  margin: 36px 0 12px;
  color: var(--onix);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.prose h4 {
  margin: 28px 0 10px;
  color: var(--onix);
  font-size: 16px;
  font-weight: 800;
}

.prose p {
  margin: 0 0 18px;
  line-height: 1.68;
}

.prose ul, .prose ol {
  padding-left: 24px;
  margin: 0 0 20px;
}

.prose li {
  margin: 6px 0;
  line-height: 1.6;
}

.prose code {
  padding: 2px 7px;
  color: var(--zafiro-profundo);
  background: rgba(18, 104, 179, 0.08);
  border: 1px solid rgba(18, 104, 179, 0.14);
  border-radius: 6px;
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.prose a code {
  color: inherit;
}

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

/* Cajas de aviso editorial (Callouts) */
.prose blockquote {
  margin: 0 0 22px;
  padding: 16px 20px;
  border: 1px solid var(--borde);
  border-left: 4px solid var(--zafiro);
  background: var(--blanco);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose .callout-nota {
  border-left-color: var(--zafiro);
  background: rgba(18, 104, 179, 0.05);
  border-color: rgba(18, 104, 179, 0.15);
}

.prose .callout-consejo {
  border-left-color: #16A34A;
  background: rgba(22, 163, 74, 0.06);
  border-color: rgba(22, 163, 74, 0.18);
}

.prose .callout-importante {
  border-left-color: var(--oro);
  background: rgba(214, 179, 92, 0.09);
  border-color: rgba(214, 179, 92, 0.25);
}

.prose .callout-advertencia {
  border-left-color: #DC2626;
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.2);
}

/* Bloques de código (Terminal macOS / Linear) */
.code {
  position: relative;
  margin: 0 0 24px;
  border-radius: 14px;
  background: var(--grafito);
  color: #F8FAFC;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.code::after {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, var(--zafiro), var(--oro), transparent);
}

.code pre {
  margin: 0;
  padding: 22px 20px;
  overflow-x: auto;
  line-height: 1.6;
}

.code code {
  background: transparent;
  color: inherit;
  padding: 0;
  border: 0;
}

.code[data-lang]::before {
  content: attr(data-lang);
  position: absolute;
  top: 9px;
  left: 16px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 750;
  color: var(--gris-400);
}

.code[data-lang] pre {
  padding-top: 34px;
}

.copy {
  position: absolute;
  top: 8px;
  right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 140ms var(--ease-spring);
}

.copy:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.copy:active {
  transform: scale(0.96);
}

.copy.done {
  border-color: var(--oro);
  color: var(--oro-claro);
  background: rgba(214, 179, 92, 0.15);
}

/* Tablas estilizadas */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 24px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  background: var(--blanco);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--borde);
  vertical-align: top;
}

th {
  background: rgba(18, 104, 179, 0.06);
  color: var(--onix);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
}

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

code.wrap {
  word-break: break-all;
}

/* Pestañas por entorno (Tabs CSS puras) */
.tabs {
  margin: 0 0 28px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  background: var(--blanco);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
  overflow: hidden;
}

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--borde);
  background: rgba(18, 104, 179, 0.04);
}

.tab-bar input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tab-bar label {
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gris-600);
  border-bottom: 3px solid transparent;
  transition: color 160ms ease, background-color 160ms ease;
}

.tab-bar label:hover {
  color: var(--texto);
  background: rgba(255, 255, 255, 0.7);
}

.tab-bar input:checked + label {
  color: var(--zafiro-profundo);
  border-bottom-color: var(--zafiro);
  background: var(--blanco);
}

.tab-bar input:focus-visible + label {
  outline: 2px solid var(--faceta);
  outline-offset: -2px;
}

.tab-panel {
  padding: 22px 22px 6px;
}

@supports selector(:has(a)) {
  .tab-panel { display: none; }
  .tabs:has(input:nth-of-type(1):checked) > .tab-panel[data-tab="1"],
  .tabs:has(input:nth-of-type(2):checked) > .tab-panel[data-tab="2"],
  .tabs:has(input:nth-of-type(3):checked) > .tab-panel[data-tab="3"],
  .tabs:has(input:nth-of-type(4):checked) > .tab-panel[data-tab="4"],
  .tabs:has(input:nth-of-type(5):checked) > .tab-panel[data-tab="5"],
  .tabs:has(input:nth-of-type(6):checked) > .tab-panel[data-tab="6"] {
    display: block;
  }
}

/* ==========================================================================
   Paginador y Pies
   ========================================================================== */
.pager {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--borde);
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 15px 18px;
  border: 1px solid var(--borde);
  border-radius: var(--radius);
  min-width: 220px;
  color: var(--zafiro-profundo);
  font-weight: 750;
  background: var(--blanco);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms var(--ease-spring),
    box-shadow 160ms ease;
}

.pager a span {
  color: var(--gris-400);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.pager a.next {
  text-align: right;
  margin-left: auto;
}

.pager a:hover {
  border-color: rgba(18, 104, 179, 0.4);
  background: #fff;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(18, 104, 179, 0.1);
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 36px;
  color: var(--gris-400);
  font-size: 12px;
}

.site-footer {
  border-top: 1px solid rgba(214, 179, 92, 0.3);
  background: linear-gradient(110deg, var(--onix) 0%, var(--zafiro-profundo) 100%);
  color: #fff;
}

.site-footer-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  font-size: 13px;
  color: rgba(250, 248, 245, 0.7);
}

.site-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.site-footer-mark {
  display: block;
  object-fit: contain;
}

.site-footer-lockup {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer-lockup img {
  display: block;
  width: 112px;
  height: auto;
}

.site-footer-lockup span {
  color: rgba(250, 248, 245, 0.55);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.site-footer nav a {
  color: rgba(250, 248, 245, 0.8);
  text-decoration: none;
  transition: color 160ms ease;
}

.site-footer nav a:hover {
  color: var(--oro-claro);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.error-container {
  padding: 16px 0 48px;
  max-width: 640px;
}

.error-code {
  margin: 0 0 14px;
  font-size: clamp(64px, 10vw, 92px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  background: linear-gradient(135deg, var(--zafiro-profundo) 0%, var(--zafiro) 60%, var(--oro-bronce) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==========================================================================
   Adaptación Responsive
   ========================================================================== */
@media (max-width: 1240px) {
  .shell {
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    gap: 40px;
  }
  .toc {
    display: none;
  }
}

@media (max-width: 920px) {
  .topbar-inner {
    gap: 18px;
    padding: 0 20px;
  }
  .topnav {
    display: none;
  }
  .topbar-tools {
    margin-left: auto;
  }
  .shell {
    display: block;
    padding: 0 20px;
  }
  .sidebar {
    position: static;
    height: auto;
    border: 1px solid var(--borde);
    border-radius: var(--radius);
    padding: 16px 18px 8px;
    margin: 20px 0 0;
    display: none;
    background: var(--blanco);
  }
  .sidebar.open {
    display: block;
  }
  .sidebar-toggle {
    display: block;
    width: 100%;
    margin: 20px 0 0;
    padding: 12px 16px;
    color: var(--zafiro-profundo);
    font-weight: 800;
    background: rgba(18, 104, 179, 0.08);
    border: 1px solid rgba(18, 104, 179, 0.2);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
  }
  .content {
    padding-top: 32px;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    min-height: 340px;
    max-width: 560px;
    width: 100%;
  }
  .principles {
    gap: 16px;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    gap: 12px;
    padding-inline: 16px;
  }
  .topbar-tools {
    margin-left: auto;
    gap: 8px;
  }
  .version, .topbar-link {
    display: none;
  }
  .topbar-tools .button {
    white-space: nowrap;
  }
  .shell {
    width: 100%;
    max-width: 100%;
  }
  .content, .hero, .hero-copy, .hero-visual {
    min-width: 0;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: 64px;
  }
  .topbar-inner {
    padding: 0 16px;
  }
  .brand {
    font-size: 17px;
  }
  .brand-mark {
    width: 32px;
    height: 33px;
  }
  .brand-product, .brand-separator, .version, .topbar-link {
    display: none;
  }
  .topbar-tools .button {
    padding: 8px 14px;
    font-size: 13px;
  }
  .shell {
    padding: 0 16px;
  }
  .hero {
    padding-top: 14px;
    gap: 24px;
  }
  .hero-copy {
    padding-top: 10px;
  }
  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.04em;
    padding: 6px 12px;
    line-height: 1.4;
    white-space: normal;
  }
  .hero h1 {
    font-size: 38px;
  }
  .hero .lead {
    font-size: 16px;
  }
  .hero-actions {
    margin-top: 24px;
  }
  .hero-actions .button {
    width: 100%;
    text-align: center;
  }
  .hero-visual {
    min-height: 310px;
    border-radius: 18px;
    padding-inline: 22px;
  }
  .principles {
    grid-template-columns: 1fr;
    gap: 12px;
    padding-top: 20px;
  }
  .content > h1 {
    font-size: 34px;
  }
  .prose h2 {
    font-size: 24px;
  }
  .tab-bar label {
    padding: 10px 14px;
    font-size: 11px;
  }
  .tab-panel {
    padding: 18px 16px 4px;
  }
  .page-footer, .site-footer-inner {
    flex-direction: column;
    gap: 14px;
  }
  .pager {
    flex-direction: column;
  }
  .pager a, .pager a.next {
    min-width: 0;
    width: 100%;
    margin-left: 0;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .topnav a, .button, .copy, .tab-bar label, .pager a, .principles > div {
    transition: none;
  }
}

/* Preferencia compartida: superficies, controles y recetas editoriales. */
.topbar {
  background: var(--zfx-as-bg);
  background: color-mix(in srgb, var(--zfx-as-bg) 92%, transparent);
}
.topnav a:hover, .nav-section a:hover, .tab-bar label:hover {
  background: var(--zfx-as-surface-elevated);
}
.brand-product, .topnav a.current, .nav-section a.active, .eyebrow,
.sidebar-toggle, .prose code, .prose .callout-nota, th, .tab-bar {
  background: var(--zfx-as-selection-subtle);
  color: var(--zfx-as-text);
  border-color: var(--zfx-as-border);
}
.version { background: var(--zfx-as-accent-subtle); }
.button, .skip {
  background: var(--zfx-as-primary);
  color: var(--zfx-as-on-primary);
  border-color: var(--zfx-as-primary);
}
.button:hover {
  background: var(--zfx-as-primary-hover);
  color: var(--zfx-as-on-primary);
  border-color: var(--zfx-as-primary-hover);
}
/* The official dark primary-hover is decorative faceta; a white CTA uses deep. */
[data-zfx-theme="zafirox-dark"] .button:hover {
  background: var(--zfx-brand-zafiro-profundo);
  border-color: var(--zfx-brand-zafiro-profundo);
}
.button.secondary, .button.secondary:hover {
  color: var(--zfx-as-text);
  background: var(--zfx-as-surface);
  border-color: var(--zfx-as-border-strong);
}
.button.secondary:hover { background: var(--zfx-as-surface-elevated); }
.button:focus-visible, .theme-picker select:focus-visible {
  outline-color: var(--zfx-as-selection);
}
.principle-index { color: var(--zfx-as-selection); }
.prose .callout-consejo { background: var(--zfx-as-surface-subtle); }
.prose .callout-importante { background: var(--zfx-as-accent-subtle); }
.prose .callout-advertencia {
  background: var(--zfx-as-error-subtle);
  border-color: var(--zfx-as-error);
}
.pager a:hover { background: var(--zfx-as-surface-elevated); }
/* Brand illustrations and terminal blocks keep their intentional dark recipe. */
.hero-visual, .site-footer {
  --onix: var(--zfx-brand-onix);
  --zafiro-profundo: var(--zfx-brand-zafiro-profundo);
  --oro: var(--zfx-brand-oro-zafirox);
  color: var(--zfx-brand-blanco-diamante);
}
.hero-visual {
  background: linear-gradient(155deg, var(--onix), var(--zafiro-profundo));
}
.hero-visual-note, .site-footer-inner, .site-footer-lockup span, .site-footer nav a {
  color: var(--zfx-brand-marfil-zafirox);
}
.site-footer nav a:hover { color: var(--zfx-brand-champagne-gold); }
.code {
  --gris-400: var(--zfx-brand-marfil-zafirox);
  color: var(--zfx-brand-blanco-diamante);
}
.code code { background: transparent; color: inherit; border: 0; }
.code .copy { color: var(--zfx-brand-marfil-zafirox); }
.code .copy:hover { color: var(--zfx-brand-blanco-diamante); }
.code .copy.done { color: var(--zfx-brand-champagne-gold); }
.error-code { --oro-bronce: var(--zfx-as-selection); }
.theme-picker { display: inline-flex; align-items: center; flex-shrink: 0; }
.theme-picker[hidden] { display: none; }
.theme-picker select {
  max-width: 108px;
  min-height: 44px;
  padding: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--zfx-as-text);
  background: var(--zfx-as-surface);
  border: 1px solid var(--zfx-as-border-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  .topbar-inner { gap: 8px; padding-inline: 12px; }
  .topbar-tools { gap: 6px; }
  .theme-picker select { max-width: 85px; padding-inline: 4px; }
  .topbar-tools .button { min-height: 44px; padding-inline: 10px; }
}
