Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-10-13 10:18:48 -03:00
parent 5612ad3eed
commit 5786e9cde0
4 changed files with 240 additions and 15 deletions
+126
View File
@@ -0,0 +1,126 @@
/* =====================================================================
print.css — Hoja de estilo canónica para los PDF del libro.
Usada por el MCP `md-to-pdf` (herramienta markdown_to_pdf) como `css`.
Reglas de diseño: ver AGENTS.md y .opencode/skills/book-pdf/SKILL.md
NO editar los colores/fuentes sin actualizar también esas referencias.
===================================================================== */
/* --- Garantiza que los colores de fondo se impriman --- */
html {
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
:root {
--ink: #1f2733;
--muted: #5b6673;
--accent: #2f6fb3; /* azul del libro */
--rule: #dfe4ea;
--note-bg: #eef4fb; /* fondo de las notas (resalta del blanco) */
--note-border: #2f6fb3;
--code-bg: #f4f6f8;
--code-border: #dfe4ea;
--code-accent: #2f6fb3;
}
/* --- Tipografía del cuerpo: SERIF (distinta de la mono del código) --- */
body {
font-family: "Georgia", "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
font-size: 11.5pt;
line-height: 1.6;
color: var(--ink);
}
/* --- Títulos: sans, para diferenciar de la prosa --- */
h1, h2, h3, h4 {
font-family: "Segoe UI", "Calibri", system-ui, sans-serif;
color: #16202b;
line-height: 1.25;
}
h1 { font-size: 22pt; border-bottom: 3px solid var(--accent); padding-bottom: .25em; }
h2 { font-size: 16pt; margin-top: 1.7em; border-bottom: 1px solid var(--rule); padding-bottom: .2em; }
h3 { font-size: 13pt; margin-top: 1.3em; }
h4 { font-size: 11.5pt; margin-top: 1.1em; }
/* --- Código inline: MONO, distinta de la serif del texto --- */
code {
font-family: "Cascadia Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
font-size: .88em;
background: var(--code-bg);
border: 1px solid var(--code-border);
border-radius: 4px;
padding: .08em .35em;
}
/* --- Bloques de código: MONO + resaltado de sintaxis (highlight.js) --- */
pre {
font-family: "Cascadia Code", "JetBrains Mono", "Consolas", "Courier New", monospace;
font-size: 9.5pt;
line-height: 1.5;
background: var(--code-bg);
border: 1px solid var(--code-border);
border-left: 4px solid var(--code-accent);
border-radius: 6px;
padding: .85em 1.1em;
white-space: pre-wrap; /* evita que el código se salga de la hoja */
word-break: break-word;
overflow-wrap: anywhere;
}
pre code {
background: none;
border: none;
padding: 0;
font-size: inherit;
color: inherit;
}
/* --- Paleta de resaltado de sintaxis (clases de highlight.js) --- */
pre code.hljs { background: transparent; }
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
.hljs-keyword, .hljs-selector-tag,
.hljs-built_in, .hljs-name { color: #c0392b; font-weight: 600; }
.hljs-string, .hljs-meta-string,
.hljs-regexp { color: #1a7f37; }
.hljs-number, .hljs-literal,
.hljs-boolean { color: #0550ae; }
.hljs-function, .hljs-title,
.hljs-title.function_, .hljs-params { color: #6f42c1; }
.hljs-type, .hljs-class .hljs-title { color: #953800; }
.hljs-meta, .hljs-preprocessor { color: #7a5af8; }
.hljs-variable, .hljs-attr,
.hljs-property, .hljs-template-variable { color: #0a3069; }
.hljs-symbol, .hljs-bullet,
.hljs-operator { color: #e36209; }
/* --- Notas: TODO blockquote se dibuja igual, con fondo que resalta --- */
blockquote {
margin: 1.2em 0;
padding: .8em 1.1em;
background: var(--note-bg);
border-left: 5px solid var(--note-border);
border-radius: 6px;
color: #24303d;
}
blockquote > :first-child { margin-top: 0; }
blockquote > :last-child { margin-bottom: 0; }
blockquote p { font-size: 10.5pt; }
/* --- Tablas (escenarios de prueba) --- */
table {
border-collapse: collapse;
width: 100%;
font-size: 10pt;
margin: 1em 0;
}
th, td {
border: 1px solid #d7dde3;
padding: .4em .6em;
text-align: left;
}
th { background: #eef1f4; font-family: "Segoe UI", "Calibri", sans-serif; }
/* --- Separadores y enlaces --- */
hr { border: none; border-top: 1px solid var(--rule); margin: 1.6em 0; }
a { color: var(--accent); text-decoration: none; }