/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-inline: clamp(var(--space-sm), 4vw, 3rem);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo::first-letter { color: var(--accent); }
.topbar-actions { display: flex; gap: var(--space-xs); }
.toggle {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast);
}
.toggle:hover { color: var(--accent); border-color: var(--accent); }
.toggle:active { transform: translateY(1px); }
.menu-only { display: none; }

/* ===== SIDEBAR — índice numerado ===== */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: var(--space-lg) var(--space-sm) var(--space-lg) clamp(var(--space-sm), 3vw, 2.5rem);
}
.sidebar nav { display: flex; flex-direction: column; gap: 0.05rem; counter-reset: nav; }
.sidebar a {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  color: var(--text-muted);
  padding: 0.45rem 0.2rem;
  font-size: 0.95rem;
  border: none;
  transition: color var(--duration-fast);
}
.sidebar a::before {
  counter-increment: nav;
  content: counter(nav, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.55;
  min-width: 1.6em;
}
.sidebar a:hover { color: var(--text); text-decoration: none; }
.sidebar a.active { color: var(--accent); font-weight: 600; }
.sidebar a.active::before { opacity: 1; }

/* ===== HERO — tipográfico, asimétrico ===== */
#hero { padding-top: var(--space-lg); }
.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.92;
  margin-bottom: var(--space-md);
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-sub {
  font-size: 1.3rem;
  color: var(--text-muted);
  max-width: 44ch;
  margin-bottom: var(--space-md);
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: oklch(98% 0.01 350);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  transition: transform var(--duration-fast) var(--ease-out-quart), box-shadow var(--duration-fast);
}
.cta:hover {
  transform: translateY(-2px);
  text-decoration: none;
  box-shadow: 0 12px 28px -10px var(--accent);
}

/* ===== SECCIONES — número de índice grande ===== */
main section[id]:not(#hero) {
  position: relative;
  border-top: 1px solid var(--border);
}
main section[id]:not(#hero)::before {
  content: attr(data-num);
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-index);
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
  opacity: 0.18;
  margin-bottom: var(--space-xs);
}

/* ===== BADGE de nivel ===== */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-right: 0.5rem;
  border: 1px solid currentColor;
}
.badge-basic { color: var(--accent-2); }
.badge-adv { color: var(--accent); }

/* ===== CODE BLOCK — terminal refinado ===== */
.code {
  margin-block: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dots { width: 11px; height: 11px; border-radius: 50%; background: var(--text-muted); opacity: 0.5;
  box-shadow: 17px 0 0 var(--text-muted), 34px 0 0 var(--text-muted); margin-left: 5px; }
.copy {
  font: inherit; font-size: 0.78rem; font-family: var(--font-mono);
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.2rem 0.7rem; cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}
.copy:hover { color: var(--accent); border-color: var(--accent); }
.copy.copied { color: var(--accent-2); border-color: var(--accent-2); }
.code pre { margin: 0; padding: var(--space-sm) var(--space-md); overflow-x: auto; }
.code code { font-family: var(--font-mono); font-size: 0.9rem; color: var(--text); line-height: 1.7; }

/* ===== CALLOUTS — sin side-stripe; tint + etiqueta ===== */
.callout {
  margin-block: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
}
.callout strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  color: var(--accent);
}
.callout-note { background: color-mix(in oklch, var(--accent-2) 14%, transparent); border-color: color-mix(in oklch, var(--accent-2) 35%, transparent); }
.callout-note strong { color: var(--accent-2); }
.callout-warning { background: color-mix(in oklch, var(--warning) 16%, transparent); border-color: color-mix(in oklch, var(--warning) 38%, transparent); }
.callout-warning strong { color: var(--warning); }

/* ===== RECURSOS — lista editorial, no card-grid ===== */
.resources { list-style: none; padding: 0; display: flex; flex-direction: column; }
.resources li { border-top: 1px solid var(--border); }
.resources a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  transition: color var(--duration-fast), padding-left var(--duration-fast);
}
.resources a::after { content: "↗"; color: var(--accent); font-family: var(--font-mono); }
.resources a:hover { color: var(--accent); padding-left: 0.5rem; text-decoration: none; }

/* ===== FADE-IN ===== */
section { opacity: 1; }
section.reveal { opacity: 0; transform: translateY(20px); }
section.reveal.in { opacity: 1; transform: none; transition: opacity var(--duration-normal) var(--ease-out-expo), transform var(--duration-normal) var(--ease-out-expo); }

/* ===== RESPONSIVE — drawer ===== */
@media (max-width: 768px) {
  .menu-only { display: inline-block; }
  .sidebar {
    position: fixed; inset: var(--topbar-h) auto 0 0;
    width: 82%; max-width: 320px; height: calc(100vh - var(--topbar-h));
    background: var(--bg); z-index: 40;
    border-right: 1px solid var(--border);
    transform: translateX(-102%); transition: transform var(--duration-normal) var(--ease-out-quart);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .hero-sub { font-size: 1.1rem; }
}
