:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #5b636b;
  --border: #d8d8d2;
  --accent: #1a5fb4;
  --accent-soft: #e8f0fb;
  --code-bg: #1f2328;
  --code-text: #e9edf1;
  --inline-code-bg: #ecece6;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}

.guide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 56px 24px 80px;
}

.guide-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.guide-content {
  min-width: 0;
}

/* Cabecera */

.guide-header {
  padding-bottom: 28px;
  margin-bottom: 32px;
  border-bottom: 2px solid var(--border);
}

.guide-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-header h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.guide-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.guide-meta {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Controles: descarga y sistema operativo */

.guide-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  margin: 0 0 40px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.download-btn:hover {
  background: #154e94;
  transform: translateY(-1px);
}

.os-toggle {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.os-toggle-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.os-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  min-width: 190px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.os-switch-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--accent);
  border-radius: 999px;
  transition: transform 0.2s ease;
}

.os-switch[data-active="mac"] .os-switch-thumb {
  transform: translateX(100%);
}

.os-option {
  position: relative;
  z-index: 1;
  padding: 8px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
}

.os-option.active {
  color: #fff;
}

.os-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Índice */

.toc {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: 0;
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.toc-title {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 20px;
}

.toc li {
  margin: 6px 0;
}

.toc a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.toc a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.toc a.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* Secciones */

.guide-section {
  margin-bottom: 48px;
}

.guide-section h2 {
  margin: 0 0 16px;
  padding-bottom: 8px;
  font-size: 1.55rem;
  line-height: 1.3;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 24px;
}

.section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.section-toggle::after {
  content: "";
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.section-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

.section-toggle:hover {
  color: var(--accent);
}

.section-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.section-body[hidden] {
  display: none;
}

.section-body:not([hidden]) {
  animation: section-open 0.2s ease;
}

@keyframes section-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.guide-section h3 {
  margin: 28px 0 10px;
  font-size: 1.15rem;
}

.guide-section p {
  margin: 0 0 16px;
}

.guide-section ul,
.guide-section ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.guide-section li {
  margin: 6px 0;
}

a {
  color: var(--accent);
}

/* Código */

code {
  padding: 0.15em 0.4em;
  background: var(--inline-code-bg);
  border-radius: 4px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
}

pre {
  margin: 0 0 20px;
  padding: 18px 20px;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}

.code-copy-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.code-copy-wrapper pre {
  width: 100%;
  margin: 0;
}

.copy-code-btn {
  align-self: flex-end;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.copy-code-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.copy-code-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-code-btn:active {
  background: var(--accent-soft);
}

/* Tablas */

table {
  width: 100%;
  margin: 0 0 20px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border: 1px solid var(--border);
}

th {
  background: var(--surface);
  font-weight: 600;
}

/* Avisos */

.note {
  margin: 0 0 20px;
  padding: 14px 18px;
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

/* Navegación inferior */

.guide-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.guide-footer a {
  color: var(--accent);
  text-decoration: none;
}

.guide-footer a:hover {
  text-decoration: underline;
}

/* Impresión */

@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .guide {
    max-width: none;
    padding: 0;
  }

  .toc,
  .guide-footer,
  .copy-code-btn {
    display: none;
  }

  pre {
    background: #f2f2f2;
    color: #000;
    border: 1px solid #ccc;
  }
}

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

  .toc {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .guide {
    padding: 32px 18px 56px;
  }

  pre {
    padding: 14px;
    font-size: 0.82rem;
  }
}
