/* ==========================================================================
   Folio · estilos de documento (compartidos por la vista previa y el PDF)
   ========================================================================== */

.ico {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  vertical-align: -0.15em;
}

/* ---------- Temas ---------- */
[data-theme='editorial'] {
  --paper: #fbf7f0;
  --ink: #2a2118;
  --muted: #7a6d5c;
  --line: #e7dcc9;
  --soft: #f3ebdc;
  --code-bg: #f1e8d8;
  --code-ink: #3a2e22;
  --font-head: 'Fraunces Variable', Georgia, serif;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 600;
  --radius: 10px;
  --hl1: #b4441a; --hl2: #4d7c0f; --hl3: #9a6700; --hl4: #2563eb; --hl5: #a8a29e; --hl6: #7c3aed;
}
[data-theme='academic'] {
  --paper: #ffffff;
  --ink: #1c2433;
  --muted: #5b6678;
  --line: #d9dee8;
  --soft: #f3f5f9;
  --code-bg: #f4f6fa;
  --code-ink: #1c2433;
  --font-head: 'Inter Variable', system-ui, sans-serif;
  --font-body: 'Source Serif 4 Variable', Georgia, serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 4px;
  --hl1: #1d4ed8; --hl2: #047857; --hl3: #b45309; --hl4: #7e22ce; --hl5: #94a3b8; --hl6: #be123c;
}
[data-theme='midnight'] {
  --paper: #0f1220;
  --ink: #e6e8f5;
  --muted: #9aa0bf;
  --line: #262b45;
  --soft: #181c31;
  --code-bg: #0a0d19;
  --code-ink: #dfe3f7;
  --font-head: 'Space Grotesk Variable', system-ui, sans-serif;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 12px;
  --hl1: #c792ea; --hl2: #a5e075; --hl3: #ffcb6b; --hl4: #82aaff; --hl5: #5c6490; --hl6: #f78c6c;
}
[data-theme='notebook'] {
  --paper: #fffdf6;
  --paper-bg: repeating-linear-gradient(to bottom, transparent 0 31px, #dbe7f5 31px 32px), linear-gradient(to right, transparent 0 56px, #f5b5c8 56px 57px, transparent 57px), #fffdf6;
  --ink: #2b2b3a;
  --muted: #77778a;
  --line: #e4dfcc;
  --soft: #f7f2de;
  --code-bg: #f4efdb;
  --code-ink: #2b2b3a;
  --font-head: 'Caveat Variable', cursive;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 6px;
  --hl1: #c2185b; --hl2: #2e7d32; --hl3: #b26a00; --hl4: #1565c0; --hl5: #9e9e9e; --hl6: #6a1b9a;
}
[data-theme='aurora'] {
  --paper: #f6f4ff;
  --paper-bg: radial-gradient(900px 420px at 0% 0%, #e4dcff 0, transparent 60%) no-repeat, radial-gradient(700px 380px at 100% 10%, #cfe9ff 0, transparent 60%) no-repeat, #f6f4ff;
  --ink: #1e1b3a;
  --muted: #6b6890;
  --line: #e0dcf5;
  --soft: #ffffffaa;
  --code-bg: #1e1b3a;
  --code-ink: #ece9ff;
  --font-head: 'Inter Variable', system-ui, sans-serif;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 800;
  --radius: 16px;
  --hl1: #c4a7ff; --hl2: #8be9b0; --hl3: #ffd479; --hl4: #8ab4ff; --hl5: #7a77a8; --hl6: #ff9eb5;
}
[data-theme='magazine'] {
  --paper: #ffffff;
  --ink: #141414;
  --muted: #666666;
  --line: #e4e4e4;
  --soft: #f5f5f3;
  --code-bg: #f3f3f0;
  --code-ink: #141414;
  --font-head: 'Playfair Display Variable', Georgia, serif;
  --font-body: 'Source Serif 4 Variable', Georgia, serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 800;
  --radius: 0px;
  --hl1: #c4123f; --hl2: #1a7f37; --hl3: #9a6700; --hl4: #0550ae; --hl5: #8c8c8c; --hl6: #8250df;
}
[data-theme='blueprint'] {
  --paper: #0b3a66;
  --paper-bg: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 24px 24px, linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 24px 24px, #0b3a66;
  --ink: #e8f3ff;
  --muted: #9cc3e8;
  --line: #3a6ea5;
  --soft: #0f4678;
  --code-bg: #08294a;
  --code-ink: #e8f3ff;
  --font-head: 'JetBrains Mono Variable', ui-monospace, monospace;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 2px;
  --hl1: #ffd166; --hl2: #9be59b; --hl3: #ffb86b; --hl4: #8ecbff; --hl5: #6b95bf; --hl6: #ff9ec4;
}
[data-theme='policial'] {
  --paper: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --line: #c7cdd8;
  --soft: #f3f4f6;
  --gold: #b8892b;
  --code-bg: #f3f4f6;
  --code-ink: #111827;
  --font-head: 'Space Grotesk Variable', system-ui, sans-serif;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 3px;
  --hl1: #1e3a8a; --hl2: #166534; --hl3: #92400e; --hl4: #1d4ed8; --hl5: #6b7280; --hl6: #9d174d;
}

[data-theme='ficha'] {
  --paper: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --line: #d1d5db;
  --soft: #f3f4f6;
  --code-bg: #f3f4f6;
  --code-ink: #111827;
  --font-head: 'Space Grotesk Variable', system-ui, sans-serif;
  --font-body: 'Inter Variable', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 700;
  --radius: 4px;
  --hl1: #0f766e; --hl2: #166534; --hl3: #92400e; --hl4: #1d4ed8; --hl5: #6b7280; --hl6: #9d174d;
}
[data-theme='tinta'] {
  --paper: #ffffff;
  --ink: #000000;
  --muted: #444444;
  --line: #bdbdbd;
  --soft: #f4f4f4;
  --code-bg: #f4f4f4;
  --code-ink: #000000;
  --font-head: 'Inter Variable', system-ui, sans-serif;
  --font-body: 'Source Serif 4 Variable', Georgia, serif;
  --font-mono: 'JetBrains Mono Variable', ui-monospace, monospace;
  --head-weight: 800;
  --radius: 0px;
  --hl1: #000000; --hl2: #444444; --hl3: #666666; --hl4: #222222; --hl5: #888888; --hl6: #333333;
}

html[data-print] {
  background: var(--paper-bg, var(--paper));
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
html[data-print] body { margin: 0; }
table.page-frame { width: 100%; border-collapse: collapse; border: 0; }
table.page-frame td.frame-cell { padding: 0; border: 0; }
.frame-top { height: var(--pt, 0); }
.frame-bottom { height: var(--pb, 0); }
td.frame-body { padding: 0 var(--ps, 0) !important; }
@media screen {
  html[data-print] .doc { max-width: 860px; margin: 0 auto; padding: 40px 32px; }
  .frame-top, .frame-bottom { height: 0; }
  td.frame-body { padding: 0 !important; }
}

/* ---------- Base ---------- */
.doc {
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--paper));
  --accent-line: color-mix(in srgb, var(--accent) 35%, var(--paper));
  --fs: 16px;
  font-family: var(--font-body);
  font-size: var(--fs);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper-bg, var(--paper));
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga';
  overflow-wrap: break-word;
}
.doc[data-size='xs'] { --fs: 12.5px; }
.doc[data-size='sm'] { --fs: 14px; }
.doc[data-size='lg'] { --fs: 18px; }
.doc[data-size='xl'] { --fs: 21px; }
.doc[data-mode='print'] { background: transparent; }
.doc *, .doc *::before, .doc *::after { box-sizing: border-box; }

.doc-body > :first-child { margin-top: 0; }

.doc p { margin: 0 0 1em; }
.doc a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
.doc a:hover { text-decoration-color: var(--accent); }
.doc strong { font-weight: 650; }
.doc mark { background: color-mix(in srgb, var(--accent) 28%, transparent); color: inherit; padding: 0.05em 0.25em; border-radius: 0.25em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.doc hr { border: 0; height: 1px; background: var(--line); margin: 2.2em 0; }
.doc ::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 {
  font-family: var(--font-head);
  font-weight: var(--head-weight);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 1.8em 0 0.6em;
  color: var(--ink);
  scroll-margin-top: 20px;
}
.doc h1 { font-size: 2em; }
.doc h2 { font-size: 1.5em; }
.doc h3 { font-size: 1.2em; }
.doc h4 { font-size: 1.05em; }
.doc h5, .doc h6 { font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.doc .hnum { color: var(--accent); margin-right: 0.55em; font-variant-numeric: tabular-nums; font-weight: 500; }

.doc ul, .doc ol { margin: 0 0 1em; padding-left: 1.5em; }
.doc li { margin: 0.25em 0; }
.doc li > ul, .doc li > ol { margin: 0.25em 0 0.25em; }
.doc li::marker { color: var(--accent); }
.doc ul.contains-task-list { list-style: none; padding-left: 0.2em; }
.doc ul.contains-task-list > li:not(.task-list-item) { list-style: disc; margin-left: 1.3em; }
.doc li.task-list-item { display: flex; gap: 0.6em; align-items: baseline; }
.doc li.task-list-item > p { margin: 0; }
.doc .task-list-item-checkbox {
  appearance: none; -webkit-appearance: none; flex: none;
  width: 1.05em; height: 1.05em; margin: 0; border: 1.6px solid var(--accent); border-radius: 0.3em; position: relative; top: 0.18em; background: transparent;
}
.doc .task-list-item-checkbox:checked { background: var(--accent); }
.doc .task-list-item-checkbox:checked::after { content: ''; position: absolute; left: 0.28em; top: 0.06em; width: 0.28em; height: 0.52em; border: solid var(--paper); border-width: 0 0.14em 0.14em 0; transform: rotate(45deg); }
.doc li.task-list-item:has(:checked) > label { color: var(--muted); text-decoration: line-through; }

.doc blockquote { margin: 1.4em 0; padding: 0.2em 1.2em; border-left: 3px solid var(--accent); color: color-mix(in srgb, var(--ink) 82%, var(--paper)); font-style: italic; }
.doc blockquote p:last-child { margin-bottom: 0; }

.doc code { font-family: var(--font-mono); font-size: 0.86em; background: var(--code-bg); color: var(--code-ink); padding: 0.15em 0.4em; border-radius: 0.35em; }
.doc figure.code { position: relative; margin: 1.4em 0; background: var(--code-bg); border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); overflow: hidden; }
.doc figure.code figcaption { font-family: var(--font-mono); font-size: 0.74em; color: var(--muted); padding: 0.6em 1em; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--code-bg) 80%, var(--ink) 4%); }
.doc figure.code[data-lang]:not([data-lang=''])::before { content: attr(data-lang); position: absolute; top: 0.5em; right: 0.8em; font-family: var(--font-mono); font-size: 0.68em; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); opacity: 0.8; }
.doc figure.code figcaption ~ pre { padding-top: 0.9em; }
.doc figure.code pre { margin: 0; padding: 1em 1.2em; overflow-x: auto; line-height: 1.55; }
.doc figure.code code { background: none; padding: 0; font-size: 0.84em; color: var(--code-ink); white-space: pre; }
.hljs-keyword, .hljs-selector-tag, .hljs-doctag, .hljs-type, .hljs-template-tag { color: var(--hl1); }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-meta .hljs-string { color: var(--hl2); }
.hljs-number, .hljs-literal, .hljs-symbol, .hljs-bullet { color: var(--hl3); }
.hljs-title, .hljs-section, .hljs-function .hljs-title, .hljs-class .hljs-title { color: var(--hl4); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--hl5); font-style: italic; }
.hljs-attr, .hljs-attribute, .hljs-built_in, .hljs-variable, .hljs-params, .hljs-name, .hljs-tag { color: var(--hl6); }
.hljs-deletion { color: #e5484d; }
.hljs-emphasis { font-style: italic; }
.hljs-strong { font-weight: 700; }

.doc .table-wrap { margin: 1.5em 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.93em; font-variant-numeric: tabular-nums; }
.doc th, .doc td { padding: 0.6em 0.9em; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc tr:last-child td { border-bottom: 0; }
.doc th { background: var(--accent-soft); font-weight: 650; font-family: var(--font-head); border-bottom: 2px solid var(--accent); }
.doc tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--soft) 55%, transparent); }

.doc img { max-width: 100%; height: auto; border-radius: var(--radius); }
.doc figure.figure { margin: 1.6em 0; text-align: center; }
.doc figure.figure img { display: inline-block; box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.35); }
.doc figure.figure figcaption { margin-top: 0.7em; font-size: 0.85em; color: var(--muted); font-style: italic; }

.doc kbd { font-family: var(--font-mono); font-size: 0.78em; padding: 0.15em 0.5em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 0.4em; background: var(--soft); color: var(--ink); white-space: nowrap; }
.doc .kbd-plus { margin: 0 0.2em; color: var(--muted); font-size: 0.8em; }
.doc .badge { display: inline-block; font-family: var(--font-body); font-size: 0.72em; font-weight: 650; letter-spacing: 0.03em; padding: 0.15em 0.7em; border-radius: 999px; color: var(--b); background: color-mix(in srgb, var(--b) 15%, var(--paper)); border: 1px solid color-mix(in srgb, var(--b) 35%, transparent); vertical-align: 0.08em; }
.doc .badge-accent { --b: var(--accent); }
.doc .badge-red { --b: #dc2626; } .doc .badge-green { --b: #16a34a; } .doc .badge-blue { --b: #2563eb; }
.doc .badge-yellow { --b: #ca8a04; } .doc .badge-purple { --b: #9333ea; } .doc .badge-gray { --b: #6b7280; }
.doc .badge-orange { --b: #ea580c; } .doc .badge-pink { --b: #db2777; } .doc .badge-teal { --b: #0d9488; }
.doc a.wikilink { text-decoration-style: dashed; }

.doc dl { margin: 1em 0; }
.doc dt { font-weight: 650; margin-top: 0.8em; }
.doc dd { margin: 0.2em 0 0 1.2em; color: color-mix(in srgb, var(--ink) 85%, var(--paper)); }
.doc abbr[title] { text-decoration: underline dotted; cursor: help; }
.doc .footnotes { font-size: 0.88em; color: var(--muted); margin-top: 3em; }
.doc .footnotes-sep { margin-bottom: 1em; }
.doc .footnote-ref a, .doc a.footnote-backref { text-decoration: none; }
.doc .math-block { margin: 1.2em 0; overflow-x: auto; overflow-y: hidden; }
.doc .math-error { color: #e5484d; }
.doc .katex { font-size: 1.08em; }

/* ---------- Color de texto ---------- */
.doc {
  --tc-gray: #787774; --tc-brown: #9f6b53; --tc-orange: #d9730d; --tc-yellow: #cb912f; --tc-green: #448361; --tc-blue: #337ea9; --tc-purple: #9065b0; --tc-pink: #c14c8a; --tc-red: #d44c47;
  --tb-gray: #ebeced; --tb-brown: #f1e9e4; --tb-orange: #fbecdd; --tb-yellow: #fbf3db; --tb-green: #e3f1e8; --tb-blue: #e0f0f8; --tb-purple: #efe6f6; --tb-pink: #f9e4ee; --tb-red: #fbe4e4;
}
.doc[data-theme='midnight'], .doc[data-theme='blueprint'] {
  --tc-gray: #a3a3a0; --tc-brown: #d1a089; --tc-orange: #f5a25a; --tc-yellow: #f0c76a; --tc-green: #7fcfa0; --tc-blue: #7cc4ec; --tc-purple: #c4a0e6; --tc-pink: #f08fc0; --tc-red: #ff8a84;
  --tb-gray: rgba(163, 163, 160, 0.25); --tb-brown: rgba(209, 160, 137, 0.25); --tb-orange: rgba(245, 162, 90, 0.25); --tb-yellow: rgba(240, 199, 106, 0.25); --tb-green: rgba(127, 207, 160, 0.25); --tb-blue: rgba(124, 196, 236, 0.25); --tb-purple: rgba(196, 160, 230, 0.25); --tb-pink: rgba(240, 143, 192, 0.25); --tb-red: rgba(255, 138, 132, 0.25);
}
.doc .tbg { padding: 0.05em 0.28em; border-radius: 0.25em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.doc u { text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
.doc .right { text-align: right; }

/* ---------- Mermaid ---------- */
.doc .mermaid-wrap { margin: 1.5em 0; padding: 1.2em; background: color-mix(in srgb, var(--soft) 70%, transparent); border: 1px solid var(--line); border-radius: var(--radius); text-align: center; overflow-x: auto; }
.doc pre.mermaid { margin: 0; font-family: var(--font-mono); font-size: 0.8em; color: var(--muted); white-space: pre; text-align: left; }
.doc pre.mermaid[data-done]:not(.mermaid-error) { font-family: inherit; color: inherit; text-align: center; }
.doc pre.mermaid svg { max-width: 100%; height: auto; }
.doc pre.mermaid.mermaid-error { color: #e5484d; white-space: normal; }

/* ---------- Callouts ---------- */
.doc .callout {
  --c: #5b7bd5;
  margin: 1.4em 0;
  padding: 0.95em 1.2em 0.4em;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--paper));
  border-left: 4px solid var(--c);
  background: color-mix(in srgb, var(--c) 9%, var(--paper));
}
.doc .callout-title { display: flex; align-items: center; gap: 0.55em; font-family: var(--font-head); font-weight: 650; font-size: 0.95em; margin-bottom: 0.5em; color: color-mix(in srgb, var(--c) 72%, var(--ink)); }
.doc .callout-title .ico { color: var(--c); }
.doc .callout > p:last-child, .doc .callout > ul:last-child, .doc .callout > ol:last-child { margin-bottom: 0.6em; }
.doc .callout-note { --c: #5b7bd5; } .doc .callout-info { --c: #0ea5e9; } .doc .callout-tip { --c: #10b981; }
.doc .callout-success { --c: #22c55e; } .doc .callout-warning { --c: #f59e0b; } .doc .callout-danger { --c: #ef4444; }
.doc .callout-important { --c: #a855f7; } .doc .callout-example { --c: #14b8a6; } .doc .callout-definition { --c: #6366f1; }
.doc .callout-theorem { --c: #8b5cf6; } .doc .callout-question { --c: #ec4899; }
.doc .callout-article { --c: #1e3a8a; } .doc .callout-case { --c: #0f766e; }
.doc .callout-theorem { border-style: double; border-left-style: solid; }
.doc .callout-definition .callout-title, .doc .callout-theorem .callout-title { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8em; }

/* ---------- Layout ---------- */
.doc .columns { display: flex; gap: 1.6em; margin: 1.4em 0; align-items: flex-start; }
.doc .columns > .col { flex: 1 1 0; min-width: 0; }
.doc .col > :first-child { margin-top: 0; }
.doc .col > :last-child { margin-bottom: 0; }
.doc .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1em; margin: 1.4em 0; }
.doc .card { padding: 1.1em 1.2em; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 26px -18px rgba(0, 0, 0, 0.35); }
.doc .card-title { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 1.05em; margin-bottom: 0.4em; color: var(--accent); }
.doc .card > :last-child { margin-bottom: 0; }
.doc .box { padding: 1em 1.3em; border: 1.5px solid var(--accent); border-radius: var(--radius); margin: 1.4em 0; }
.doc .box > :last-child { margin-bottom: 0; }
.doc .center { text-align: center; }
.doc .small { font-size: 0.86em; color: var(--muted); }
.doc .hero { margin: 1.6em 0 2em; padding: 1.8em 2em; border-radius: calc(var(--radius) * 1.6); background: linear-gradient(135deg, var(--accent-soft), transparent 80%); border: 1px solid var(--accent-line); font-size: 1.12em; }
.doc .hero > :first-child { margin-top: 0; }
.doc .hero > :last-child { margin-bottom: 0; }
.doc .steps { counter-reset: step; margin: 1.6em 0; position: relative; }
.doc .steps > ol, .doc .steps > ul { list-style: none; padding: 0; margin: 0; }
.doc .steps > ol > li, .doc .steps > ul > li { counter-increment: step; position: relative; padding: 0 0 1.4em 3em; margin: 0; }
.doc .steps > ol > li::before, .doc .steps > ul > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2em; height: 2em; border-radius: 50%; background: var(--accent); color: var(--paper); font-family: var(--font-head); font-weight: 700; font-size: 0.9em; display: grid; place-items: center; z-index: 1; }
.doc .steps > ol > li::after, .doc .steps > ul > li::after { content: ''; position: absolute; left: 0.9em; top: 2em; bottom: 0.2em; width: 2px; background: var(--accent-line); }
.doc .steps > ol > li:last-child::after, .doc .steps > ul > li:last-child::after { display: none; }
.doc .steps li > p:first-child { margin-top: 0; }
.doc details.details { margin: 1.2em 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); padding: 0 1.2em; }
.doc details.details > summary { cursor: pointer; padding: 0.8em 0; font-weight: 600; font-family: var(--font-head); list-style: none; display: flex; align-items: center; gap: 0.6em; }
.doc details.details > summary::before { content: ''; width: 0.5em; height: 0.5em; border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.15s; margin-right: 0.2em; }
.doc details.details[open] > summary::before { transform: rotate(45deg); }
.doc details.details[open] { padding-bottom: 0.3em; }
.doc figure.pullquote { margin: 2em 0; padding: 0.4em 0 0.4em 1.6em; border-left: 4px solid var(--accent); }
.doc figure.pullquote blockquote { border: 0; padding: 0; margin: 0; font-family: var(--font-head); font-size: 1.45em; line-height: 1.35; font-style: italic; font-weight: 500; }
.doc figure.pullquote figcaption { margin-top: 0.8em; color: var(--muted); font-size: 0.9em; }
.doc figure.pullquote figcaption::before { content: '— '; }
.doc .pagebreak { break-after: page; height: 0; }
@media screen { .doc .pagebreak { height: 0; margin: 2.5em 0; border-top: 2px dashed var(--line); position: relative; } .doc .pagebreak::after { content: 'salto de página'; position: absolute; top: -0.8em; left: 50%; transform: translateX(-50%); background: var(--paper); padding: 0 0.8em; font-size: 0.7em; color: var(--muted); } }

/* ---------- Índice ---------- */
.doc .toc { margin: 1.6em 0; padding: 1.2em 1.5em; border: 1px solid var(--line); border-radius: var(--radius); background: var(--soft); break-inside: avoid; }
.doc .toc-title { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); margin-bottom: 0.7em; }
.doc .toc ul { list-style: none; margin: 0; padding: 0; }
.doc .toc li { margin: 0.18em 0; }
.doc .toc li.lvl-2 { padding-left: 1.4em; font-size: 0.94em; }
.doc .toc li.lvl-3 { padding-left: 2.8em; font-size: 0.88em; color: var(--muted); }
.doc .toc a { color: inherit; text-decoration: none; }
.doc .toc a:hover { color: var(--accent); }
.doc .doc-toc { margin: 0 0 2em; }

/* ---------- Cabecera ---------- */
.doc-head { margin-bottom: 1.6em; }
.doc-banner { height: 11em; border-radius: calc(var(--radius) * 1.4); background: var(--banner); margin-bottom: -2.2em; }
.doc-icon { font-size: 3.6em; line-height: 1; position: relative; margin: 0 0 0.12em; }
.doc-banner ~ .doc-icon { margin-left: 0.25em; text-shadow: 0 6px 20px rgba(0, 0, 0, 0.18); }
.doc .doc-title { font-size: 2.7em; line-height: 1.08; margin: 0 0 0.2em; letter-spacing: -0.025em; }
.doc-subtitle { font-size: 1.2em; color: var(--muted); margin: 0 0 0.8em; line-height: 1.45; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 0.5em 0.8em; align-items: center; font-size: 0.82em; color: var(--muted); }
.doc-tag { padding: 0.1em 0.7em; border-radius: 999px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 80%, var(--ink)); font-weight: 600; font-size: 0.95em; }
.doc-head::after { content: ''; display: block; height: 1px; background: var(--line); margin-top: 1.4em; }

/* Portada de PDF */
.doc-cover { display: flex; flex-direction: column; min-height: calc(100vh - var(--pt, 0mm) - var(--pb, 0mm) - 3mm); break-after: page; padding-bottom: 6mm; }
.doc-cover::before { content: ''; flex: 1 1 auto; min-height: 40%; margin-bottom: 14mm; border-radius: calc(var(--radius) * 2); background: var(--banner, linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 35%, var(--ink)))); }
.doc-cover .doc-icon { font-size: 4em; }
.doc-cover .doc-title { font-size: 3.6em; }
.doc-cover .doc-subtitle { font-size: 1.4em; }

/* ---------- Detalles por tema ---------- */
[data-theme='editorial'] .doc-title, .doc[data-theme='editorial'] .doc-title { font-weight: 650; font-variation-settings: 'opsz' 144; }
.doc[data-theme='editorial'] h2 { padding-top: 0.5em; border-top: 1px solid var(--line); }
.doc[data-theme='editorial'] h2::before { content: ''; display: block; width: 2.2em; height: 3px; background: var(--accent); margin: -0.55em 0 0.5em; }
.doc[data-theme='editorial'] .doc-body > p:first-of-type { font-size: 1.1em; }

.doc[data-theme='academic'] .doc-body p { text-align: justify; hyphens: auto; -webkit-hyphens: auto; }
.doc[data-theme='academic'] .doc-title { font-family: var(--font-head); border-bottom: 3px double var(--ink); padding-bottom: 0.3em; }
.doc[data-theme='academic'] h2 { border-bottom: 1px solid var(--line); padding-bottom: 0.2em; }
.doc[data-theme='academic'] .doc-head::after { display: none; }
.doc[data-theme='academic'] .callout { border-left-width: 3px; }

.doc[data-theme='midnight'] a { text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.doc[data-theme='midnight'] .doc-title, .doc[data-theme='midnight'] h1 { background: linear-gradient(90deg, #fff, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc[data-theme='midnight'] .card, .doc[data-theme='midnight'] .callout { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent), 0 14px 40px -20px color-mix(in srgb, var(--accent) 50%, transparent); }
.doc[data-theme='midnight'] .doc-banner { opacity: 0.9; }
.doc[data-theme='midnight'] .doc-icon { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 60%, transparent)); }

.doc[data-theme='notebook'] { --fs: 16px; line-height: 2; }
.doc[data-theme='notebook'][data-size='xs'] { --fs: 12.5px; }
.doc[data-theme='notebook'][data-size='sm'] { --fs: 14px; }
.doc[data-theme='notebook'][data-size='lg'] { --fs: 18px; }
.doc[data-theme='notebook'][data-size='xl'] { --fs: 21px; }
.doc[data-theme='notebook'] .doc-body, .doc[data-theme='notebook'] .doc-head { padding-left: 2.2em; }
.doc[data-theme='notebook'] h1, .doc[data-theme='notebook'] h2, .doc[data-theme='notebook'] h3, .doc[data-theme='notebook'] .doc-title { line-height: 1.1; letter-spacing: 0; }
.doc[data-theme='notebook'] .doc-title { font-size: 3.6em; color: var(--accent); transform: rotate(-0.6deg); transform-origin: left; }
.doc[data-theme='notebook'] h1 { font-size: 2.6em; } .doc[data-theme='notebook'] h2 { font-size: 2em; } .doc[data-theme='notebook'] h3 { font-size: 1.6em; }
.doc[data-theme='notebook'] h2 { text-decoration: underline wavy color-mix(in srgb, var(--accent) 55%, transparent); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
.doc[data-theme='notebook'] .doc-head::after { display: none; }
.doc[data-theme='notebook'] .callout, .doc[data-theme='notebook'] .card, .doc[data-theme='notebook'] .box, .doc[data-theme='notebook'] .hero { line-height: 1.7; }
.doc[data-theme='notebook'] .callout { border-radius: 4px 14px 6px 12px; box-shadow: 3px 4px 0 color-mix(in srgb, var(--c) 25%, transparent); }
.doc[data-theme='notebook'] .card { transform: rotate(-0.5deg); box-shadow: 3px 4px 0 var(--line); }
.doc[data-theme='notebook'] .card:nth-child(even) { transform: rotate(0.6deg); }
.doc[data-theme='notebook'] mark { background: linear-gradient(transparent 40%, color-mix(in srgb, #facc15 70%, transparent) 40%); border-radius: 0; }
.doc[data-theme='notebook'] .doc-icon { transform: rotate(-6deg); }

.doc[data-theme='aurora'] .doc-title, .doc[data-theme='aurora'] h1 { background: linear-gradient(90deg, var(--accent), #38bdf8 80%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc[data-theme='aurora'] h2 { font-size: 1.55em; }
.doc[data-theme='aurora'] .card, .doc[data-theme='aurora'] .toc, .doc[data-theme='aurora'] .table-wrap, .doc[data-theme='aurora'] details.details { background: rgba(255, 255, 255, 0.65); border-color: rgba(255, 255, 255, 0.9); box-shadow: 0 18px 40px -22px color-mix(in srgb, var(--accent) 55%, transparent); }
.doc[data-theme='aurora'] .callout { background: color-mix(in srgb, var(--c) 8%, #ffffffc0); border-left-width: 1px; box-shadow: 0 14px 34px -22px var(--c); }
.doc[data-theme='aurora'] .doc-banner { box-shadow: 0 24px 50px -24px color-mix(in srgb, var(--accent) 60%, transparent); }
.doc[data-theme='aurora'] .doc-head::after { background: linear-gradient(90deg, var(--accent), transparent); height: 2px; }

.doc[data-theme='magazine'] .doc-title { font-size: 3.4em; line-height: 1; letter-spacing: -0.035em; font-weight: 900; }
.doc[data-theme='magazine'] .doc-subtitle { font-family: var(--font-head); font-style: italic; font-size: 1.35em; color: var(--ink); }
.doc[data-theme='magazine'] .doc-meta { text-transform: uppercase; letter-spacing: 0.14em; font-family: 'Inter Variable', sans-serif; font-size: 0.7em; }
.doc[data-theme='magazine'] .doc-head::after { height: 4px; background: var(--ink); }
.doc[data-theme='magazine'] h2 { font-family: 'Inter Variable', sans-serif; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.18em; font-weight: 800; color: var(--accent); border-top: 2px solid var(--ink); padding-top: 0.7em; margin-top: 2.4em; }
.doc[data-theme='magazine'] h3 { font-size: 1.5em; }
.doc[data-theme='magazine'] .doc-body > p:first-of-type::first-letter { float: left; font-family: var(--font-head); font-weight: 900; font-size: 4.4em; line-height: 0.82; padding: 0.06em 0.1em 0 0; color: var(--accent); }
.doc[data-theme='magazine'] .doc-tag { border-radius: 0; background: var(--ink); color: #fff; letter-spacing: 0.1em; text-transform: uppercase; }
.doc[data-theme='magazine'] .callout { border: 0; border-top: 3px solid var(--c); border-radius: 0; background: var(--soft); }
.doc[data-theme='magazine'] .card { border-radius: 0; box-shadow: none; border: 0; border-top: 3px solid var(--accent); }
.doc[data-theme='magazine'] figure.pullquote blockquote { font-size: 1.9em; font-weight: 700; }

.doc[data-theme='blueprint'] { font-size: calc(var(--fs) * 0.98); }
.doc[data-theme='blueprint'] h1, .doc[data-theme='blueprint'] h2, .doc[data-theme='blueprint'] h3 { color: var(--accent); text-transform: uppercase; letter-spacing: 0.04em; }
.doc[data-theme='blueprint'] .doc-title { text-transform: uppercase; color: var(--accent); font-size: 2.3em; letter-spacing: 0; }
.doc[data-theme='blueprint'] h2 { border-bottom: 1px dashed var(--line); padding-bottom: 0.25em; }
.doc[data-theme='blueprint'] .callout, .doc[data-theme='blueprint'] .card, .doc[data-theme='blueprint'] .box, .doc[data-theme='blueprint'] .toc, .doc[data-theme='blueprint'] .table-wrap, .doc[data-theme='blueprint'] figure.code, .doc[data-theme='blueprint'] details.details { border-style: dashed; border-color: var(--line); }
.doc[data-theme='blueprint'] .callout { border-left-style: solid; border-left-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--paper)); }
.doc[data-theme='blueprint'] .callout-title { color: color-mix(in srgb, var(--c) 60%, white); }
.doc[data-theme='blueprint'] .doc-head::after { background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 14px); }
.doc[data-theme='blueprint'] th { color: var(--accent); }

/* Policial: papel blanco, poca tinta, jerarquía clara y legible incluso en blanco y negro */
.doc[data-theme='policial'] { line-height: 1.6; --fs: 15px; }
.doc[data-theme='policial'][data-size='xs'] { --fs: 12px; }
.doc[data-theme='policial'][data-size='sm'] { --fs: 13.5px; }
.doc[data-theme='policial'][data-size='lg'] { --fs: 17px; }
.doc[data-theme='policial'][data-size='xl'] { --fs: 19.5px; }
.doc[data-theme='policial'] .doc-head { padding-left: 0.9em; border-left: 6px solid var(--accent); }
.doc[data-theme='policial'] .doc-head::after { height: 3px; background: linear-gradient(90deg, var(--accent) 0 70%, var(--gold) 70% 100%); margin-top: 1em; }
.doc[data-theme='policial'] .doc-banner { height: 8em; border-radius: 0; margin: 0 0 1em -0.9em; width: calc(100% + 0.9em); margin-bottom: 1em; }
.doc[data-theme='policial'] .doc-banner ~ .doc-icon { margin-left: 0; }
.doc[data-theme='policial'] .doc-title { font-size: 2.1em; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.1; }
.doc[data-theme='policial'] .doc-subtitle { font-size: 1.05em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.doc[data-theme='policial'] .doc-tag { background: none; border: 1px solid var(--accent); color: var(--accent); border-radius: 2px; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8em; }
.doc[data-theme='policial'] h1, .doc[data-theme='policial'] h2, .doc[data-theme='policial'] h3 { letter-spacing: 0; }
.doc[data-theme='policial'] h1 { font-size: 1.6em; text-transform: uppercase; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 0.2em; }
.doc[data-theme='policial'] h2 { font-size: 1.25em; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 1.7em; padding: 0.15em 0 0.15em 0.6em; border-left: 5px solid var(--gold); border-bottom: 1px solid var(--line); color: var(--accent); }
.doc[data-theme='policial'] h3 { font-size: 1.05em; color: var(--ink); border-bottom: 1px dotted var(--muted); padding-bottom: 0.1em; }
.doc[data-theme='policial'] h4 { color: var(--accent); }
.doc[data-theme='policial'] .callout { background: #fff; border: 1.5px solid var(--c); border-left-width: 6px; border-radius: 2px; padding: 0.7em 1em 0.2em; }
.doc[data-theme='policial'] .callout-title { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8em; color: var(--c); padding-bottom: 0.35em; border-bottom: 1px solid var(--line); }
.doc[data-theme='policial'] .callout-title span { color: var(--ink); }
.doc[data-theme='policial'] .table-wrap { border: 0; border-radius: 0; }
.doc[data-theme='policial'] table { border: 1px solid var(--ink); }
.doc[data-theme='policial'] th, .doc[data-theme='policial'] td { border: 1px solid var(--line); }
.doc[data-theme='policial'] th { background: #e5e7eb; border-bottom: 2px solid var(--ink); text-transform: uppercase; font-size: 0.85em; letter-spacing: 0.03em; }
.doc[data-theme='policial'] tbody tr:nth-child(even) td { background: #f9fafb; }
.doc[data-theme='policial'] blockquote { border-left: 3px solid var(--ink); background: none; color: var(--ink); }
.doc[data-theme='policial'] figure.code, .doc[data-theme='policial'] .card, .doc[data-theme='policial'] .toc, .doc[data-theme='policial'] details.details, .doc[data-theme='policial'] .mermaid-wrap { background: #fff; border: 1px solid var(--ink); box-shadow: none; }
.doc[data-theme='policial'] .toc-title { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 0.4em; }
.doc[data-theme='policial'] .hero { background: #fff; border: 0; border-left: 6px solid var(--gold); border-radius: 0; padding: 0.6em 1.2em; }
.doc[data-theme='policial'] mark { background: #fde68a; }
.doc[data-theme='policial'] .steps > ol > li::before, .doc[data-theme='policial'] .steps > ul > li::before { border-radius: 2px; }
.doc[data-theme='policial'] .doc-cover { justify-content: center; }
.doc[data-theme='policial'] .doc-cover::before { flex: 0 0 22mm; min-height: 0; border-radius: 0; border-bottom: 3mm solid var(--gold); background: var(--accent); margin-bottom: 18mm; }
.doc[data-theme='policial'] .doc-cover.has-banner::before { flex: 1 1 auto; min-height: 40%; background: var(--banner); border-bottom: 3mm solid var(--gold); }
.doc[data-theme='policial'] .doc-cover .doc-title { font-size: 2.6em; }

/* Ficha de repaso: compacta y a dos columnas, para tener mucho en poco papel */
.doc[data-theme='ficha'] { --fs: 12.5px; line-height: 1.42; }
.doc[data-theme='ficha'][data-size='xs'] { --fs: 10.5px; }
.doc[data-theme='ficha'][data-size='sm'] { --fs: 11.5px; }
.doc[data-theme='ficha'][data-size='lg'] { --fs: 14px; }
.doc[data-theme='ficha'][data-size='xl'] { --fs: 15.5px; }
.doc[data-theme='ficha'] .doc-head { margin-bottom: 0.9em; padding-bottom: 0.5em; border-bottom: 3px solid var(--accent); }
.doc[data-theme='ficha'] .doc-head::after { display: none; }
.doc[data-theme='ficha'] .doc-banner { height: 3.2em; margin-bottom: 0.6em; border-radius: 3px; }
.doc[data-theme='ficha'] .doc-icon { font-size: 2em; margin-bottom: 0.1em; }
.doc[data-theme='ficha'] .doc-title { font-size: 1.9em; text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 0.1em; }
.doc[data-theme='ficha'] .doc-subtitle { font-size: 1em; margin-bottom: 0.4em; }
.doc[data-theme='ficha'] .doc-body { column-count: 2; column-gap: 8mm; column-rule: 1px solid var(--line); }
.doc[data-theme='ficha'] .doc-body > h1:first-child, .doc[data-theme='ficha'] .doc-body > h2:first-child { margin-top: 0; }
.doc[data-theme='ficha'] p { margin: 0 0 0.55em; }
.doc[data-theme='ficha'] ul, .doc[data-theme='ficha'] ol { margin-bottom: 0.55em; padding-left: 1.25em; }
.doc[data-theme='ficha'] li { margin: 0.1em 0; }
.doc[data-theme='ficha'] h1, .doc[data-theme='ficha'] h2, .doc[data-theme='ficha'] h3, .doc[data-theme='ficha'] h4 { break-after: avoid; letter-spacing: 0; }
.doc[data-theme='ficha'] h1 { font-size: 1.4em; text-transform: uppercase; color: var(--accent); margin: 0.9em 0 0.4em; }
.doc[data-theme='ficha'] h2 { font-size: 1.05em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 0.12em; margin: 1em 0 0.4em; }
.doc[data-theme='ficha'] h3 { font-size: 1em; background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 0.1em 0.5em; margin: 0.8em 0 0.35em; }
.doc[data-theme='ficha'] h4 { font-size: 0.95em; color: var(--accent); margin: 0.6em 0 0.25em; }
.doc[data-theme='ficha'] .callout { margin: 0.7em 0; padding: 0.5em 0.8em 0.1em; border-left-width: 4px; }
.doc[data-theme='ficha'] .callout-title { font-size: 0.82em; margin-bottom: 0.3em; text-transform: uppercase; letter-spacing: 0.05em; }
.doc[data-theme='ficha'] .table-wrap, .doc[data-theme='ficha'] figure.code { margin: 0.7em 0; }
.doc[data-theme='ficha'] table { font-size: 0.92em; }
.doc[data-theme='ficha'] th, .doc[data-theme='ficha'] td { padding: 0.3em 0.5em; border: 1px solid var(--line); }
.doc[data-theme='ficha'] .toc { margin: 0 0 0.9em; padding: 0.6em 0.9em; }
.doc[data-theme='ficha'] .columns, .doc[data-theme='ficha'] .cards { column-span: none; }
.doc[data-theme='ficha'] .cards { grid-template-columns: 1fr; }
.doc[data-theme='ficha'] .doc-cover .doc-title { font-size: 3em; }

/* Solo tinta: blanco y negro puro, sin rellenos ni degradados */
.doc[data-theme='tinta'] { line-height: 1.65; }
.doc[data-theme='tinta'] a { color: #000; text-decoration-color: #000; }
.doc[data-theme='tinta'] .doc-banner { display: none; }
.doc[data-theme='tinta'] .doc-head::after { height: 2px; background: #000; }
.doc[data-theme='tinta'] .doc-tag { background: none; border: 1px solid #000; color: #000; border-radius: 0; }
.doc[data-theme='tinta'] h1 { border-bottom: 2px solid #000; padding-bottom: 0.15em; }
.doc[data-theme='tinta'] h2 { border-bottom: 1px solid #000; padding-bottom: 0.1em; }
.doc[data-theme='tinta'] .callout { --c: #000; background: #fff; border: 1.5px solid #000; border-left-width: 6px; border-radius: 0; }
.doc[data-theme='tinta'] .callout-title { color: #000; text-transform: uppercase; letter-spacing: 0.05em; font-size: 0.82em; }
.doc[data-theme='tinta'] .table-wrap, .doc[data-theme='tinta'] figure.code, .doc[data-theme='tinta'] .card, .doc[data-theme='tinta'] .toc, .doc[data-theme='tinta'] details.details, .doc[data-theme='tinta'] .mermaid-wrap, .doc[data-theme='tinta'] .box { background: #fff; border: 1px solid #000; box-shadow: none; }
.doc[data-theme='tinta'] th { background: #fff; border-bottom: 2px solid #000; }
.doc[data-theme='tinta'] tbody tr:nth-child(even) td { background: #fff; }
.doc[data-theme='tinta'] th, .doc[data-theme='tinta'] td { border: 1px solid var(--line); }
.doc[data-theme='tinta'] mark { background: none; text-decoration: underline; text-decoration-thickness: 0.15em; }
.doc[data-theme='tinta'] .hero { background: #fff; border: 0; border-left: 5px solid #000; border-radius: 0; }
.doc[data-theme='tinta'] .card-title, .doc[data-theme='tinta'] .toc-title { color: #000; }
.doc[data-theme='tinta'] blockquote { border-left-color: #000; }
.doc[data-theme='tinta'] .steps > ol > li::before, .doc[data-theme='tinta'] .steps > ul > li::before { background: #000; color: #fff; border-radius: 0; }
.doc[data-theme='tinta'] .doc-cover::before { background: none; border: 2px solid #000; border-radius: 0; min-height: 25%; flex: 0 0 25%; }
.doc[data-theme='tinta'] .hl-keyword, .doc[data-theme='tinta'] .hljs-keyword { font-weight: 700; }

/* ---------- Índice general de un PDF de carpeta ---------- */
.doc .toc-pages { list-style: none; margin: 0.5em 0 0; padding: 0; }
.doc .toc-pages li { display: flex; align-items: baseline; gap: 0.5em; margin: 0.4em 0; break-inside: avoid; }
.doc .toc-pages .lead { flex: 1; border-bottom: 1.5px dotted var(--muted); transform: translateY(-0.25em); min-width: 1em; }
.doc .toc-pages b { font-variant-numeric: tabular-nums; font-weight: 650; }
.doc .toc-pages li.grp { margin-top: 1.3em; padding-bottom: 0.2em; border-bottom: 1px solid var(--line); color: var(--accent); font-family: var(--font-head); font-weight: 700; font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.08em; }
.doc .toc-pages li.grp:first-child { margin-top: 0; }
.doc .toc-pages .sub { color: var(--muted); font-size: 0.85em; }

/* ---------- Opciones de impresión: margen para anotar y marca de agua ---------- */
.notes-col { position: fixed; top: 0; bottom: 0; right: 0; width: calc(var(--ps, 0mm) + var(--pn, 0mm)); z-index: -1; border-left: 1px solid rgba(127, 127, 127, 0.55); background: rgba(127, 127, 127, 0.05); }
.notes-col.lines { background: repeating-linear-gradient(to bottom, transparent 0 7.2mm, rgba(127, 127, 127, 0.4) 7.2mm 7.45mm), rgba(127, 127, 127, 0.04); }
html[data-notes] td.frame-body { padding-right: calc(var(--ps, 0mm) + var(--pn, 0mm)) !important; }
.watermark { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; pointer-events: none; overflow: hidden; }
.watermark span { transform: rotate(-32deg); white-space: nowrap; font: 800 30mm/1 'Inter Variable', system-ui, sans-serif; text-transform: uppercase; letter-spacing: 0.04em; color: rgba(127, 127, 127, 0.17); }

/* ---------- Página compartida (solo lectura) ---------- */
.share-bar { max-width: 860px; margin: 0 auto; padding: 14px 32px 0; display: flex; gap: 12px; align-items: center; justify-content: space-between; font: 500 12.5px 'Inter Variable', system-ui, sans-serif; color: var(--muted); }
.share-bar button { font: 600 12.5px 'Inter Variable', system-ui, sans-serif; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
@media print { .share-bar { display: none; } }

/* ---------- Impresión ---------- */
@media print {
  /* Skia PDF rasteriza mal las sombras con desenfoque: fuera en papel */
  .doc [class] { box-shadow: none !important; filter: none !important; text-shadow: none !important; }
  .doc[data-theme='notebook'] .callout { box-shadow: 3px 4px 0 color-mix(in srgb, var(--c) 25%, transparent) !important; }
  .doc[data-theme='notebook'] .card { box-shadow: 3px 4px 0 var(--line) !important; }
  .doc[data-theme='midnight'] .doc-title, .doc[data-theme='midnight'] h1, .doc[data-theme='aurora'] .doc-title, .doc[data-theme='aurora'] h1 { background: none; color: var(--accent); -webkit-text-fill-color: currentColor; }
  .doc h1, .doc h2, .doc h3, .doc h4 { break-after: avoid; }
  .doc figure, .doc pre, .doc .table-wrap, .doc .callout, .doc .card, .doc blockquote, .doc .mermaid-wrap, .doc .math-block, .doc tr, .doc .steps > ol > li, .doc details.details { break-inside: avoid; }
  .doc p { orphans: 3; widows: 3; }
  .doc .table-wrap { overflow: visible; }
  .doc a { text-decoration: none; }
  .doc .doc-body a[href^='http']:not(.wikilink)::after { content: none; }
}
