/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #0a0a0a;
  color: #ededed;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:root {
  --bg: #0a0a0a;
  --bg-elev: #111111;
  --bg-code: #131313;
  --bg-soft: #141414;
  --border: #252525;
  --border-soft: #1c1c1c;
  --text: #ededed;
  --text-muted: #9a9a9a;
  --text-faint: #5a5a5a;
  --accent: #ff6b35;
  --accent-hover: #ff7e4d;
  --accent-soft: rgba(255, 107, 53, 0.10);
  --accent-border: rgba(255, 107, 53, 0.28);
  --success: #4ade80;
  --warn: #fbbf24;
  --err: #f87171;
  --font-mono: 'Fira Code', 'JetBrains Mono', ui-monospace, monospace;
  --max-w: 720px;
  --topbar-h: 56px;
}

code, pre { font-family: var(--font-mono); }
p code, li code, summary code, .note code, .equiv-row code, .success p code {
  background: #1a1a1a;
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.86em;
  color: #f0a37a;
  white-space: nowrap;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--accent-hover); }

/* ===== Topbar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  background: rgba(10, 10, 10, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.topbar.scrolled {
  border-bottom-color: var(--border-soft);
  background: rgba(10, 10, 10, 0.92);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  height: var(--topbar-h);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}
.brand-name { color: var(--text); }
.brand-faded { color: var(--text-muted); font-weight: 500; }

.logo-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulse 3s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 14px var(--accent); }
  50% { box-shadow: 0 0 22px var(--accent); }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

.toc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.toc-btn:hover { background: #181818; border-color: #333; }
.toc-btn svg { transition: transform 0.2s; }
.toc-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.progress-track {
  height: 2px;
  background: transparent;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #ff9466);
  transition: width 0.1s linear;
}

/* ===== TOC Drawer ===== */
.toc-drawer {
  position: fixed;
  top: var(--topbar-h);
  right: 24px;
  width: 320px;
  max-width: calc(100vw - 48px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  z-index: 28;
  padding: 16px;
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toc-drawer.open {
  opacity: 1;
  transform: translateY(4px) scale(1);
  pointer-events: auto;
}

.toc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 6px 10px;
  border-bottom: 1px solid var(--border-soft);
}
.toc-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.toc-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.15s;
}
.toc-close:hover { color: var(--text); }

.toc-links {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.toc-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
}
.toc-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.toc-link.active {
  color: var(--text);
  background: var(--accent-soft);
}
.toc-link.active .toc-num { color: var(--accent); }
.toc-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

.toc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 27;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
}
.toc-backdrop.show { opacity: 1; pointer-events: auto; }

/* ===== Content (centered column) ===== */
.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 24px) 28px 120px;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  text-align: center;
  padding: 60px 0 64px;
  margin: 0 -28px 24px;
  overflow: hidden;
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 107, 53, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 107, 53, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 65% 80% at center top, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 65% 80% at center top, black 0%, transparent 75%);
  pointer-events: none;
}
.hero-glow {
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, var(--accent-soft) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner {
  position: relative;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  padding: 5px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 20px;
}
.hero h1 .strike {
  position: relative;
  color: var(--text-faint);
  font-weight: 700;
}
.hero h1 .strike::after {
  content: '';
  position: absolute;
  left: -4px; right: -4px;
  top: 55%;
  height: 4px;
  background: var(--text-faint);
  border-radius: 2px;
  transform: rotate(-4deg);
}
.hero h1 .accent {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #ffaa7a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 auto 36px;
  max-width: 540px;
  line-height: 1.6;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 107, 53, 0.07), rgba(255, 107, 53, 0.02));
  border: 1px solid var(--accent-border);
  text-align: left;
  max-width: 540px;
  margin: 0 auto;
}
.notice-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  margin-top: 2px;
}
.notice strong { display: block; margin-bottom: 2px; font-size: 0.95rem; }
.notice p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ===== Quick path ===== */
.quickpath {
  margin: 24px 0 56px;
  padding: 28px 30px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 107, 53, 0.035), rgba(255, 107, 53, 0.005)),
    var(--bg-elev);
  position: relative;
  overflow: hidden;
}
.quickpath::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, var(--accent), transparent);
}

.quickpath-head { margin-bottom: 20px; }
.quickpath-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.quickpath h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.quickpath p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.quickpath-steps {
  list-style: none;
  padding: 0;
  margin: 18px 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  counter-reset: qp;
}
.quickpath-steps li {
  position: relative;
  padding: 10px 12px 10px 40px;
  font-size: 0.86rem;
  color: #c5c5c5;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  counter-increment: qp;
  transition: border-color 0.15s;
}
.quickpath-steps li:hover { border-color: var(--border); }
.quickpath-steps li::before {
  content: counter(qp);
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 50%;
}
.quickpath-steps li a {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent-border);
  font-weight: 500;
}
.quickpath-steps li a:hover { border-bottom-style: solid; }

.quickpath-note {
  margin: 14px 0 0 !important;
  font-size: 0.82rem !important;
  color: var(--text-faint) !important;
  font-style: italic;
}

/* ===== Steps ===== */
.steps { margin-top: 8px; }

.step {
  padding: 56px 0;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
.step:first-child { border-top: 0; padding-top: 8px; }

.step-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.step-chip {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.step h2 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.2;
}

.step p {
  color: #c5c5c5;
  margin: 0 0 18px;
}
.step p + p { margin-top: -4px; }

/* ===== Code blocks ===== */
.code-block {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 20px 0;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.code-block::before {
  content: '';
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 53, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.code-block:hover {
  border-color: #333;
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.code-block:hover::before { opacity: 1; }

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.012);
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.copy-btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: #444; background: rgba(255, 255, 255, 0.04); }
.copy-btn.copied {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.code-block pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-size: 0.87rem;
  line-height: 1.75;
  color: #d4d4d4;
}
.code-block code { display: block; }

/* Syntax highlighting */
.cmd  { color: #8be9fd; font-weight: 500; }
.flag { color: #ffb86c; }
.str  { color: #a5d6a7; }
.key  { color: #ff79c6; }
.bool { color: #bd93f9; font-weight: 500; }
.comment { color: #5a5a5a; font-style: italic; }

/* ===== Note ===== */
.note {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
  color: #c5c5c5;
  margin: 16px 0;
  line-height: 1.6;
}
.note strong { color: var(--text); }

/* ===== Equivalencias table ===== */
.equiv-table {
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elev);
}
.equiv-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--border-soft);
}
.equiv-row:first-child { border-top: 0; }
.equiv-row > div {
  padding: 12px 16px;
  font-size: 0.88rem;
}
.equiv-row > div + div {
  border-left: 1px solid var(--border-soft);
}
.equiv-row.equiv-head > div {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(255, 255, 255, 0.015);
}
.equiv-row code {
  font-size: 0.85em;
}

/* ===== Success ===== */
.success {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 12px;
  background: rgba(74, 222, 128, 0.05);
  border: 1px solid rgba(74, 222, 128, 0.25);
  margin-top: 22px;
}
.success-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--success);
  color: #0a0a0a;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.success strong { display: block; }
.success p { margin: 4px 0 0 !important; color: var(--text-muted); font-size: 0.92rem; }

/* ===== Callouts (Troubleshooting) ===== */
.callout {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 10px 0;
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color 0.2s, background 0.2s;
}
.callout:hover { border-color: #333; }
.callout[open] { background: var(--bg-soft); }

.callout summary {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.94rem;
  list-style: none;
  user-select: none;
}
.callout summary::-webkit-details-marker { display: none; }
.callout summary::after {
  content: '+';
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  line-height: 1;
}
.callout[open] summary::after { transform: rotate(45deg); }

.callout-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}
.callout-tag.err  { background: rgba(248, 113, 113, 0.12); color: var(--err); border: 1px solid rgba(248, 113, 113, 0.3); }
.callout-tag.warn { background: rgba(251, 191, 36, 0.12); color: var(--warn); border: 1px solid rgba(251, 191, 36, 0.3); }

.callout-body {
  padding: 14px 18px 16px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
  border-top: 1px solid var(--border-soft);
}

/* ===== Footer ===== */
.footer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 0.84rem;
}
.footer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}
.footer p { margin: 0; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .topbar-inner { padding: 0 18px; }
  .topbar-date { display: none; }

  .content { padding: calc(var(--topbar-h) + 16px) 22px 80px; }

  .hero {
    padding: 40px 0 50px;
    margin: 0 -22px 16px;
  }
  .hero-inner { padding: 0 22px; }
  .hero h1 { font-size: 2.2rem; }
  .subtitle { font-size: 1rem; }

  .quickpath { padding: 22px 20px; }
  .quickpath-steps { grid-template-columns: 1fr; }

  .step { padding: 44px 0; }
  .step h2 { font-size: 1.35rem; }

  .equiv-row { grid-template-columns: 1fr; }
  .equiv-row > div + div { border-left: 0; border-top: 1px solid var(--border-soft); }

  .code-block pre { font-size: 0.8rem; padding: 14px; }

  .toc-drawer { right: 16px; left: 16px; width: auto; max-width: none; }
}
