:root {
  --paper: #f2f0e8;
  --paper-card: #ffffff;
  --paper-subtle: #eae8df;
  --ink: #191919;
  --ink-muted: #57574e;
  --ink-soft: #707067;
  --acid: #e7ff42;
  --blue: #2141eb;
  --blue-soft: #e0e5ff;
  --line: #bdbdb4;
  --line-soft: #dcdcd4;
  --code-bg: #121212;
  --code-text: #a9ffc5;
  --sidebar-w: 300px;
  --max: 1512px;
}

@media (max-width: 700px) {
  .docs-header:not(.release-header) { padding: 0 14px; gap: 8px; }
  .docs-header:not(.release-header) .docs-header-left { gap: 10px; }
  .docs-header:not(.release-header) .wordmark { font-size: 1.35rem; }
  .docs-header:not(.release-header) .docs-badge,
  .docs-header:not(.release-header) .docs-btn-app,
  .docs-header:not(.release-header) .docs-nav-link[href="../index.html"] { display: none; }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ==========================================================================
   HEADER DE DOCUMENTACIÓN
   ========================================================================== */
.docs-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  height: 72px;
  padding: 0 4%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.docs-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.wordmark {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.07em;
}

.brand-star {
  color: var(--blue);
  font-size: 1.3em;
  line-height: 1;
  margin-left: 3px;
}

.docs-badge {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
  padding: 3px 8px;
}

.docs-header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.875rem;
  font-weight: 700;
}

.docs-nav-link {
  color: var(--ink-muted);
  transition: color 0.2s;
}

.docs-nav-link:hover {
  color: var(--ink);
}

.docs-btn-app {
  border: 1px solid var(--ink);
  background: transparent;
  padding: 8px 18px;
  font-size: 0.8125rem;
  font-weight: 700;
  transition: background 0.2s;
}

.docs-btn-app:hover {
  background: var(--acid);
}

.btn-sidebar-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--ink);
  padding: 8px 12px;
  font-size: 1rem;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.docs-layout {
  display: flex;
  max-width: var(--max);
  margin: 0 auto;
  min-height: calc(100vh - 72px);
}

/* ==========================================================================
   SIDEBAR LATERAL
   ========================================================================== */
.docs-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: var(--paper);
  padding: 24px 20px 40px;
  height: calc(100vh - 72px);
  position: sticky;
  top: 72px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-search-box {
  position: relative;
}

.sidebar-search-box input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--ink);
  padding: 9px 12px 9px 34px;
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--ink);
  border-radius: 0;
}

.sidebar-search-box input:focus {
  outline: 2px solid var(--blue);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--ink-muted);
  pointer-events: none;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nav-group-title {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
}

.nav-group-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-link {
  display: block;
  padding: 7px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  border-left: 2px solid transparent;
  transition: all 0.15s;
  line-height: 1.35;
}

.nav-item-link:hover {
  color: var(--ink);
  background: var(--paper-subtle);
}

.nav-item-link.active {
  color: var(--ink);
  font-weight: 800;
  background: #fff;
  border-left-color: var(--blue);
  box-shadow: 2px 2px 0 var(--line);
}

/* ==========================================================================
   ÁREA DE CONTENIDO PRINCIPAL
   ========================================================================== */
.docs-main {
  flex-grow: 1;
  padding: 40px 5% 80px;
  max-width: 920px;
}

.docs-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.docs-breadcrumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.breadcrumbs-sep {
  color: var(--line);
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--ink);
}

.article-header h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 3.8vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 14px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-muted);
  flex-wrap: wrap;
}

.meta-pill {
  background: var(--acid);
  color: var(--ink);
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ==========================================================================
   TIPOGRAFÍA Y PROSE DEL ARTÍCULO
   ========================================================================== */
.article-prose {
  font-size: 1.05rem;
  line-height: 1.75;
  color: #222;
}

.article-prose p {
  margin: 0 0 1.35em;
}

.article-prose h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 2.2em 0 0.7em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}

.article-prose h3 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 1.8em 0 0.6em;
  color: var(--ink);
}

.article-prose ul,
.article-prose ol {
  margin: 0 0 1.5em;
  padding-left: 24px;
}

.article-prose li {
  margin-bottom: 0.5em;
}

.article-prose strong {
  font-weight: 800;
  color: var(--ink);
}

.article-prose code {
  background: #e8e6dc;
  padding: 2px 6px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.88em;
  border-radius: 2px;
  color: #111;
}

/* Bloques de código */
.code-container {
  margin: 1.6em 0;
  background: var(--code-bg);
  border: 1px solid #333;
  box-shadow: 4px 4px 0 var(--ink);
  position: relative;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1c1c1c;
  padding: 8px 16px;
  border-bottom: 1px solid #333;
  font-size: 0.72rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-copy-code {
  background: transparent;
  border: 1px solid #444;
  color: #bbb;
  padding: 4px 10px;
  font-size: 0.6875rem;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-copy-code:hover {
  background: #333;
  color: #fff;
}

.code-container pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--code-text);
}

.code-container pre code {
  background: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
}

/* Callouts / Avisos */
.callout {
  margin: 1.8em 0;
  padding: 18px 22px;
  border-left: 4px solid var(--ink);
  background: var(--paper-card);
  box-shadow: 3px 3px 0 var(--line);
}

.callout-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout.info {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.callout.info .callout-title {
  color: var(--blue);
}

.callout.warning {
  border-left-color: #d97706;
  background: #fffbeb;
}

.callout.warning .callout-title {
  color: #b45309;
}

.callout.tip {
  border-left-color: #059669;
  background: #ecfdf5;
}

.callout.tip .callout-title {
  color: #047857;
}

/* Tablas */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  margin: 1.8em 0;
}

.article-prose table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--ink);
  font-size: 0.9375rem;
}

.article-prose th,
.article-prose td {
  padding: 12px 16px;
  border: 1px solid var(--line-soft);
  text-align: left;
}

.article-prose th {
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-prose tr:nth-child(even) td {
  background: #fafaf7;
}

/* Tarjetas y Rebranding Grid */
.docs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 1.8em 0;
}

.docs-card {
  background: #fff;
  border: 1px solid var(--ink);
  padding: 18px 20px;
  box-shadow: 4px 4px 0 var(--line);
  display: flex;
  flex-direction: column;
}

.docs-card h4 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.docs-card p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 0;
}

.docs-card .card-badge {
  align-self: flex-start;
  font-size: 0.625rem;
  font-weight: 800;
  background: var(--acid);
  padding: 2px 6px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* Navegación anterior / siguiente */
.docs-nav-footer {
  margin-top: 50px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.nav-footer-btn {
  display: flex;
  flex-direction: column;
  padding: 14px 20px;
  background: #fff;
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  min-width: 220px;
  transition: transform 0.2s;
}

.nav-footer-btn:hover {
  transform: translateY(-2px);
}

.nav-footer-btn.next {
  text-align: right;
  margin-left: auto;
}

.nav-footer-label {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.nav-footer-title {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--blue);
  margin-top: 4px;
}

/* ==========================================================================
   RESPONSIVE (MÓVIL & TABLET)
   ========================================================================== */
@media (max-width: 960px) {
  .btn-sidebar-toggle {
    display: inline-block;
  }

  .docs-sidebar {
    position: fixed;
    top: 72px;
    left: -100%;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    z-index: 40;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
    transition: left 0.25s ease-in-out;
  }

  .docs-sidebar.open {
    left: 0;
  }

  .docs-layout {
    flex-direction: column;
  }

  .docs-main {
    padding: 30px 5% 60px;
  }

  .docs-grid {
    grid-template-columns: 1fr;
  }

  .docs-nav-footer {
    flex-direction: column;
  }

  .nav-footer-btn {
    width: 100%;
  }
}
