/* SDW Docs — hoja de estilos del sitio de ayuda. Sin dependencias. Tema claro/oscuro con variables. */
@font-face { font-family: 'Plus Jakarta Sans'; src: url('fonts/plus-jakarta-sans-latin.woff2') format('woff2'); font-weight: 400 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'Sora'; src: url('fonts/sora-latin.woff2') format('woff2'); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  --brand: #10587e; --accent: #1e95bb; --on-brand: #fff;
  --bg: #f6f8fb; --surface: #fff; --surface-2: #eef3f8; --text: #0f1d2e; --muted: #536478; --border: #dde5ee; --border-strong: #c3cfdc;
  --link: #0e6a99; --code-bg: #eef3f8; --shadow: 0 1px 3px rgba(15,29,46,.07), 0 10px 28px -14px rgba(15,29,46,.18);
  --brand-soft: #e6f1f7; --ring: rgba(30,149,187,.45);
  --nota: #0e6a99; --nota-bg: #e8f3fa; --consejo: #067647; --consejo-bg: #e8f7ef; --atencion: #b54708; --atencion-bg: #fff4e5;
  --importante: #b42318; --importante-bg: #fdecea; --ejemplo: #5b3fb3; --ejemplo-bg: #f1ecfb;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --display: 'Sora', var(--font);
  --head: 60px; --side: 290px; --toc: 230px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0c1520; --surface: #121e2c; --surface-2: #182739; --text: #e6edf5; --muted: #98a9bd; --border: #22344a; --border-strong: #324a66;
  --link: #6cc4e8; --code-bg: #182739; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.6); --brand-soft: #132b3d; --ring: rgba(108,196,232,.5);
  --nota: #8dd0ee; --nota-bg: #12293a; --consejo: #5fd39a; --consejo-bg: #11291f; --atencion: #f5b86b; --atencion-bg: #2e2111;
  --importante: #f4968c; --importante-bg: #301816; --ejemplo: #b9a4f0; --ejemplo-bg: #221b36;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1520; --surface: #121e2c; --surface-2: #182739; --text: #e6edf5; --muted: #98a9bd; --border: #22344a; --border-strong: #324a66;
    --link: #6cc4e8; --code-bg: #182739; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.6); --brand-soft: #132b3d; --ring: rgba(108,196,232,.5);
    --nota: #8dd0ee; --nota-bg: #12293a; --consejo: #5fd39a; --consejo-bg: #11291f; --atencion: #f5b86b; --atencion-bg: #2e2111;
    --importante: #f4968c; --importante-bg: #301816; --ejemplo: #b9a4f0; --ejemplo-bg: #221b36;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--head) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--link); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex: none; } .icon.sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }

/* ───── Barra superior ───── */
.top { position: sticky; top: 0; z-index: 40; height: var(--head); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 16px var(--display); color: var(--text); text-decoration: none; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 1px solid transparent; background: transparent; color: var(--text); border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.theme-sun { display: none; } [data-theme="dark"] .theme-moon { display: none; } [data-theme="dark"] .theme-sun { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-moon { display: none; } :root:not([data-theme="light"]) .theme-sun { display: block; } }
.switch { position: relative; margin-left: 4px; }
.switch summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; font-size: 14.5px; background: var(--surface); }
.switch summary::-webkit-details-marker { display: none; }
.switch-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.switch-menu a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.switch-menu a:hover, .switch-menu a[aria-current] { background: var(--brand-soft); }
.switch-menu small { display: block; color: var(--muted); font-size: 13px; }
.search-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; min-width: 280px; padding: 8px 12px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); border-radius: 10px; font: inherit; font-size: 14.5px; cursor: pointer; }
.search-btn:hover { border-color: var(--accent); }
.search-btn span { flex: 1; text-align: left; }
kbd { font: 600 11.5px var(--font); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--surface-2); color: var(--muted); }

/* ───── Estructura ───── */
.shell { display: flex; min-height: calc(100vh - var(--head) - 70px); }
.side { width: var(--side); flex: none; position: sticky; top: var(--head); align-self: flex-start; max-height: calc(100vh - var(--head)); overflow-y: auto; padding: 22px 14px 40px 20px; border-right: 1px solid var(--border); background: var(--surface); }
.side-title { display: flex; gap: 10px; align-items: center; font: 700 16px var(--display); color: var(--text); text-decoration: none; padding: 4px 8px 16px; }
.side-title small { display: block; font: 500 12px var(--font); color: var(--muted); }
.side-title .icon { color: var(--brand); width: 24px; height: 24px; }
.side-group { margin-bottom: 2px; }
.side-group summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14.5px; }
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover { background: var(--surface-2); }
.side-group summary .icon:first-child { color: var(--muted); }
.side-group summary span { flex: 1; }
.side-group .chev { transition: transform .15s; color: var(--muted); }
.side-group[open] .chev { transform: rotate(90deg); }
.side-group ul { list-style: none; margin: 2px 0 8px 18px; padding: 0 0 0 12px; border-left: 1px solid var(--border); }
.side-group li a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14.5px; line-height: 1.4; }
.side-group li a:hover { color: var(--text); background: var(--surface-2); }
.side-group li a[aria-current] { color: var(--brand); background: var(--brand-soft); font-weight: 700; }
[data-theme="dark"] .side-group li a[aria-current] { color: var(--link); }
.main { flex: 1; min-width: 0; padding: 0 28px 60px; outline: none; }
.doc { display: flex; gap: 40px; max-width: 1060px; margin: 0 auto; padding-top: 30px; }
.article { flex: 1; min-width: 0; max-width: 780px; }
.wrap { max-width: 1080px; margin: 0 auto; padding-top: 10px; }

/* ───── Portada y tarjetas ───── */
.hero { text-align: center; padding: 56px 12px 28px; max-width: 760px; margin: 0 auto; }
.hero.small { text-align: left; padding: 36px 0 14px; max-width: none; }
.hero h1 { font: 700 clamp(28px, 4vw, 42px)/1.15 var(--display); margin: 0 0 12px; letter-spacing: -.01em; }
.eyebrow { display: inline-block; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 6px; }
.lead { font-size: 18px; color: var(--muted); margin: 0 0 18px; line-height: 1.55; }
.hero-search { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 620px; margin: 22px auto 0; padding: 14px 18px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); color: var(--muted); font: inherit; font-size: 15.5px; cursor: pointer; text-align: left; }
.hero-search:hover { border-color: var(--accent); }
.section-h { font: 700 22px var(--display); margin: 34px 0 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
a.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card-icon { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); margin-bottom: 6px; }
[data-theme="dark"] .card-icon { color: var(--link); }
.card-head { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 16.5px; }
.card-head .card-icon { margin: 0; }
.card-link { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--link); font-size: 14.5px; }
.plain { list-style: none; margin: 6px 0 0; padding: 0; }
.plain li a { display: block; padding: 5px 0; color: var(--text); text-decoration: none; font-size: 15px; border-top: 1px solid var(--border); }
.plain li a:hover { color: var(--link); }
.sections { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.intro { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px 24px; margin: 8px 0 0; }

/* ───── Artículo ───── */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--link); }
.article h1 { font: 700 clamp(28px, 3.4vw, 36px)/1.2 var(--display); margin: 0 0 10px; letter-spacing: -.01em; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 22px; font-size: 13.5px; }
.meta-label { color: var(--muted); font-weight: 600; }
.role { display: inline-block; padding: 2px 10px; border-radius: 99px; font-weight: 700; font-size: 12.5px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.role-participante { background: #e6f6ef; color: #0b6b44; border-color: #b9e3cf; }
.role-instructor { background: #e6f1fb; color: #0e5a96; border-color: #b8d6ef; }
.role-administrador { background: #f0eafb; color: #5b3fb3; border-color: #d3c6f0; }
.role-empresa { background: #fff1e0; color: #a14a05; border-color: #f2d3a6; }
[data-theme="dark"] .role-participante { background: #11291f; color: #5fd39a; border-color: #1e4a37; }
[data-theme="dark"] .role-instructor { background: #12293a; color: #8dd0ee; border-color: #234b68; }
[data-theme="dark"] .role-administrador { background: #221b36; color: #b9a4f0; border-color: #3d3166; }
[data-theme="dark"] .role-empresa { background: #2e2111; color: #f5b86b; border-color: #5a4220; }
.module { display: inline-flex; gap: 6px; align-items: center; padding: 2px 10px; border-radius: 99px; background: var(--atencion-bg); color: var(--atencion); font-weight: 700; font-size: 12.5px; }
.updated { color: var(--muted); font-size: 13.5px; margin-top: 36px; }
.page-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.page-list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; }
.page-list a { text-decoration: none; color: var(--text); display: block; flex: 1; }
.page-list a:hover strong { color: var(--link); }
.page-list a span { display: block; color: var(--muted); font-size: 14.5px; }
.roles { display: flex; gap: 6px; flex-wrap: wrap; }

.prose > :first-child { margin-top: 0; }
.prose h2 { font: 700 24px/1.3 var(--display); margin: 42px 0 12px; padding-top: 6px; }
.prose h3 { font: 700 19px/1.35 var(--display); margin: 30px 0 8px; }
.prose h4 { font: 700 16.5px var(--font); margin: 22px 0 6px; }
.prose h2 .anchor, .prose h3 .anchor, .prose h4 .anchor { margin-left: 8px; color: var(--border-strong); text-decoration: none; opacity: 0; font-weight: 400; }
.prose h2:hover .anchor, .prose h3:hover .anchor, .prose h4:hover .anchor, .anchor:focus { opacity: 1; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose li > p { margin: 0 0 6px; }
.prose code { background: var(--code-bg); padding: 2px 6px; border-radius: 6px; font-size: .9em; border: 1px solid var(--border); }
.prose pre { background: var(--code-bg); padding: 14px 16px; border-radius: 12px; overflow-x: auto; border: 1px solid var(--border); } .prose pre code { background: none; border: 0; padding: 0; }
.prose blockquote { margin: 0 0 16px; padding: 6px 18px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 20px; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); font-weight: 700; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 30px 0; }
.prose figure { margin: 22px 0; }
.prose figure a.zoom { display: block; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface); cursor: zoom-in; }
.prose figure img { display: block; width: 100%; height: auto; }
.prose figcaption { margin-top: 8px; color: var(--muted); font-size: 14px; text-align: center; }
.prose kbd { font-size: 12.5px; }

.callout { margin: 20px 0; padding: 14px 18px 4px; border-radius: 12px; border-left: 5px solid var(--nota); background: var(--nota-bg); }
.callout-title { margin: 0 0 6px !important; font-weight: 800; font-size: 14px; letter-spacing: .02em; text-transform: uppercase; color: var(--nota); }
.callout-consejo { border-color: var(--consejo); background: var(--consejo-bg); } .callout-consejo .callout-title { color: var(--consejo); }
.callout-atencion { border-color: var(--atencion); background: var(--atencion-bg); } .callout-atencion .callout-title { color: var(--atencion); }
.callout-importante { border-color: var(--importante); background: var(--importante-bg); } .callout-importante .callout-title { color: var(--importante); }
.callout-ejemplo { border-color: var(--ejemplo); background: var(--ejemplo-bg); } .callout-ejemplo .callout-title { color: var(--ejemplo); }

.steps ol { list-style: none; counter-reset: step; padding: 0; margin: 18px 0; }
.steps ol > li { counter-increment: step; position: relative; padding: 2px 0 14px 46px; margin: 0; }
.steps ol > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font: 700 14px var(--display); }
.steps ol > li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: var(--border-strong); }
.steps ol ul, .steps ol ol { margin-top: 8px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 44px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--text); }
.pager a:hover { border-color: var(--accent); }
.pager small { color: var(--muted); font-weight: 600; } .pager span { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; }
.pager .next { text-align: right; align-items: flex-end; }

.toc { width: var(--toc); flex: none; position: sticky; top: calc(var(--head) + 24px); align-self: flex-start; max-height: calc(100vh - var(--head) - 48px); overflow-y: auto; font-size: 14px; }
.toc strong { display: block; margin-bottom: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc a { display: block; padding: 4px 12px; color: var(--muted); text-decoration: none; line-height: 1.4; border-left: 2px solid transparent; margin-left: -2px; }
.toc a:hover { color: var(--text); } .toc a.on { color: var(--link); border-left-color: var(--accent); font-weight: 600; }
.toc .l3 a { padding-left: 26px; font-size: 13.5px; }

.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; padding: 22px 28px; border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; }
.btn { display: inline-block; padding: 10px 18px; background: var(--brand); color: #fff; border-radius: 10px; text-decoration: none; font-weight: 700; }

/* ───── Búsqueda y zoom ───── */
.search-modal, .zoom-modal { position: fixed; inset: 0; z-index: 90; background: rgba(8, 16, 26, .6); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 8vh 16px 16px; }
.search-modal[hidden], .zoom-modal[hidden] { display: none; }
.search-box { width: 100%; max-width: 680px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 30px 70px -20px rgba(0,0,0,.5); overflow: hidden; max-height: 80vh; display: flex; flex-direction: column; }
.search-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); }
.search-head input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 17px; padding: 10px 4px; outline: none; }
.search-scope { display: flex; gap: 8px; align-items: center; padding: 8px 18px; font-size: 13.5px; color: var(--muted); border-bottom: 1px solid var(--border); }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results a { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.search-results li[aria-selected="true"] a, .search-results a:hover { background: var(--brand-soft); }
.search-results .path { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.search-results .title { display: block; font-weight: 700; }
.search-results .snip { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.search-results mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 22px; color: var(--muted); margin: 0; }
.zoom-modal { align-items: center; padding: 16px; background: rgba(8, 16, 26, .88); cursor: zoom-out; }
.zoom-modal img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 30px 70px -20px #000; background: #fff; }
.zoom-modal .icon-btn { position: absolute; top: 14px; right: 14px; color: #fff; background: rgba(255,255,255,.12); }

/* ───── Adaptación ───── */
@media (max-width: 1180px) { .toc { display: none; } }
@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .side { position: fixed; z-index: 60; top: var(--head); left: 0; bottom: 0; width: min(88vw, 340px); transform: translateX(-102%); transition: transform .2s; max-height: none; box-shadow: var(--shadow); }
  body.menu-open .side { transform: none; }
  .scrim { position: fixed; inset: var(--head) 0 0 0; z-index: 55; background: rgba(8,16,26,.5); }
  .scrim[hidden] { display: none; }
  .main { padding: 0 16px 48px; }
  .search-btn { min-width: 0; margin-left: auto; } .search-btn span, .search-btn kbd { display: none; }
  .brand span { display: none; }
  .switch-menu { min-width: 260px; max-width: 86vw; }
  .page-list li { flex-direction: column; align-items: flex-start; }
  .pager { grid-template-columns: 1fr; }
  .top { padding: 0 10px; gap: 6px; }
}
@media print {
  .top, .side, .toc, .pager, .foot, .search-modal, .zoom-modal, .scrim { display: none !important; }
  body { background: #fff; color: #000; } .main { padding: 0; } .doc { display: block; max-width: none; padding: 0; }
  .prose figure a.zoom { box-shadow: none; } a { color: #000; } .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; }
}
