@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

/* ==========================================================================
   1. VARIABLES GLOBALES — EDITORIAL ACADEMIA MODERNA
   ========================================================================== */
:root {
    --bg-color: #F4F6FA;
    --bg-body: #F4F6FA;
    --bg-content: #FFFFFF;
    --bg-elevated: #F8FAFC;

    --text-color: #1E293B;
    --text-main: #0F172A;
    --text-muted: #475569;

    --title-main: #090D16;
    --white: #FFFFFF;
    --border-light: #E2E8F0;
    --border-strong: #CBD5E1;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 24px -6px rgba(15, 23, 42, 0.09), 0 4px 10px -4px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.14);
    --transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);

    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-code: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;

    --width-reading: 820px;
    --width-wide: 980px;
    --radius: 10px;
    --radius-lg: 14px;

    /* Paleta Curricular por Módulo */
    --color-win: #0284C7;
    --color-word: #2563EB;
    --color-excel: #16A34A;
    --color-ppt: #DC2626;
    --color-pub: #0D9488;
    --color-net: #D97706;
    --color-ia: #7C3AED;
    --color-access: #B91C1C;
    --color-herramientas: #EA580C;
    --color-meca: #0EA5E9;

    --primary-color: #2563EB;
    --accent-color: #0EA5E9;

    --color-success: #16A34A;
    --color-warning: #D97706;
    --color-danger: #DC2626;
    --color-code-bg: #F1F5F9;

    --module-color: var(--primary-color);
    --module-tint: rgba(37, 99, 235, 0.08);
    --module-border: rgba(37, 99, 235, 0.25);
}

/* ==========================================================================
   1b. DARK MODE — DEEP SLATE OBSIDIAN
   ========================================================================== */
[data-theme="dark"] {
    --bg-color: #090D16;
    --bg-body: #090D16;
    --bg-content: #111827;
    --bg-elevated: #1E293B;

    --text-color: #CBD5E1;
    --text-main: #E2E8F0;
    --text-muted: #94A3B8;

    --title-main: #F8FAFC;
    --white: #111827;
    --border-light: #1F2937;
    --border-strong: #334155;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 12px 28px -6px rgba(0, 0, 0, 0.55), 0 4px 10px -4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 22px 44px -10px rgba(0, 0, 0, 0.7);

    --color-code-bg: #1E293B;

    --primary-color: #60A5FA;
    --accent-color: #38BDF8;

    --color-win: #38BDF8;
    --color-word: #60A5FA;
    --color-excel: #4ADE80;
    --color-ppt: #F87171;
    --color-pub: #2DD4BF;
    --color-net: #FBBF24;
    --color-ia: #A78BFA;
    --color-access: #FB7185;
    --color-herramientas: #FB923C;
    --color-meca: #38BDF8;
}

/* Mapeo de variables y tintes por módulo */
[data-module="win"]          { --module-color: var(--color-win);          --module-tint: rgba(2, 132, 199, 0.10);  --module-border: rgba(2, 132, 199, 0.30); }
[data-module="word"]         { --module-color: var(--color-word);         --module-tint: rgba(37, 99, 235, 0.10);  --module-border: rgba(37, 99, 235, 0.30); }
[data-module="ppt"]          { --module-color: var(--color-ppt);          --module-tint: rgba(220, 38, 38, 0.10);  --module-border: rgba(220, 38, 38, 0.30); }
[data-module="xls"]          { --module-color: var(--color-excel);        --module-tint: rgba(22, 163, 74, 0.10);  --module-border: rgba(22, 163, 74, 0.30); }
[data-module="pub"]          { --module-color: var(--color-pub);          --module-tint: rgba(13, 148, 136, 0.10); --module-border: rgba(13, 148, 136, 0.30); }
[data-module="net"]          { --module-color: var(--color-net);          --module-tint: rgba(217, 119, 6, 0.10);  --module-border: rgba(217, 119, 6, 0.30); }
[data-module="ia"]           { --module-color: var(--color-ia);           --module-tint: rgba(124, 58, 237, 0.10); --module-border: rgba(124, 58, 237, 0.30); }
[data-module="access"]       { --module-color: var(--color-access);       --module-tint: rgba(185, 28, 28, 0.10);  --module-border: rgba(185, 28, 28, 0.30); }
[data-module="herramientas"] { --module-color: var(--color-herramientas); --module-tint: rgba(234, 88, 12, 0.10);  --module-border: rgba(234, 88, 12, 0.30); }
[data-module="meca"]         { --module-color: var(--color-meca);         --module-tint: rgba(14, 165, 233, 0.10); --module-border: rgba(14, 165, 233, 0.30); }

[data-theme="dark"] [data-module="win"]          { --module-tint: rgba(56, 189, 248, 0.14); }
[data-theme="dark"] [data-module="word"]         { --module-tint: rgba(96, 165, 250, 0.14); }
[data-theme="dark"] [data-module="ppt"]          { --module-tint: rgba(248, 113, 113, 0.14); }
[data-theme="dark"] [data-module="xls"]          { --module-tint: rgba(74, 222, 128, 0.14); }
[data-theme="dark"] [data-module="pub"]          { --module-tint: rgba(45, 212, 191, 0.14); }
[data-theme="dark"] [data-module="net"]          { --module-tint: rgba(251, 191, 36, 0.14); }
[data-theme="dark"] [data-module="ia"]           { --module-tint: rgba(167, 139, 250, 0.14); }
[data-theme="dark"] [data-module="access"]       { --module-tint: rgba(251, 113, 133, 0.14); }
[data-theme="dark"] [data-module="herramientas"] { --module-tint: rgba(251, 146, 60, 0.14); }
[data-theme="dark"] [data-module="meca"]         { --module-tint: rgba(56, 189, 248, 0.14); }

/* ==========================================================================
   2. RESET Y BASE
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-color);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Ocultar elementos exclusivos de impresión en pantalla (Bug fix crítico) */
.print-header,
.print-footer {
    display: none;
}

/* Barra de progreso de lectura (inyectada opcionalmente por busqueda.js) */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 1200;
    transition: width 0.1s linear;
    pointer-events: none;
}

/* ==========================================================================
   3. HEADER, HERO PORTADA Y FOOTER
   ========================================================================== */
body > header {
    background: var(--bg-content);
    color: var(--title-main);
    padding: 1.5rem 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    width: 100%;
    position: relative;
}

body > header.hero-header {
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(37, 99, 235, 0.10), transparent 70%),
        radial-gradient(ellipse 60% 50% at 85% 15%, rgba(14, 165, 233, 0.08), transparent 65%),
        var(--bg-content);
    padding: 2.25rem 1.25rem 2rem;
}

[data-theme="dark"] body > header.hero-header {
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(56, 189, 248, 0.14), transparent 70%),
        radial-gradient(ellipse 60% 50% at 85% 15%, rgba(124, 58, 237, 0.12), transparent 65%),
        #0D1320;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1120px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.hero-header .header-row {
    align-items: flex-start;
}

.header-text {
    flex: 1;
    min-width: 240px;
    text-align: center;
}

.hero-header .header-text {
    text-align: left;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-code);
    font-size: 0.74rem;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.22);
    padding: 0.28rem 0.72rem;
    border-radius: 999px;
    margin-bottom: 0.85rem;
    letter-spacing: 0.2px;
}

[data-theme="dark"] .hero-pill {
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.28);
}

.hero-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

body > header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.55rem, 2.5vw, 2.25rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.3rem;
    color: var(--title-main);
}

body > header h2 {
    font-family: var(--font-sans);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.35rem;
}

body > header p {
    font-size: 0.94rem;
    color: var(--text-muted);
    max-width: 620px;
    margin: 0 auto;
}

.hero-header .header-text p {
    margin: 0;
}

.hero-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1120px;
    margin: 1.35rem auto 0;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.hero-stat {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hero-stat strong {
    color: var(--title-main);
    font-family: var(--font-code);
    font-weight: 600;
}

.hero-search-wrap {
    position: relative;
    flex: 1 1 280px;
    max-width: 390px;
}

.hero-search-wrap svg {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.buscador-home {
    width: 100%;
    padding: 0.58rem 0.9rem 0.58rem 2.35rem;
    font-size: 0.86rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--bg-body);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

.buscador-home:focus {
    border-color: var(--primary-color);
    background: var(--bg-content);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.theme-btn {
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 0.95rem;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    flex-shrink: 0;
}

.theme-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.theme-btn:active {
    transform: translateY(0);
}

footer {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: auto;
    background: var(--bg-content);
    color: var(--text-muted);
    font-size: 0.82rem;
    border-top: 1px solid var(--border-light);
    width: 100%;
}

/* ==========================================================================
   4. CONTENEDOR Y GRID DE PORTADA
   ========================================================================== */
.container {
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 1.75rem 1.25rem 2.5rem;
    flex: 1;
    width: 100%;
    max-width: 1160px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
    gap: 1.15rem;
}

/* ==========================================================================
   5. TARJETAS DE MÓDULOS (CARDS)
   ========================================================================== */
.card {
    background: var(--bg-content);
    padding: 1.25rem;
    border: 1px solid var(--border-light);
    border-top: 3px solid var(--module-color, var(--primary-color));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--module-border);
    border-top-color: var(--module-color);
    transform: translateY(-3px);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: var(--module-tint);
    border: 1px solid var(--module-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.card:hover .card-icon-wrap {
    transform: scale(1.06);
}

.card-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    margin-bottom: 0;
    transition: var(--transition);
}

.module-num {
    font-family: var(--font-code);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--module-color);
    background: var(--module-tint);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    letter-spacing: 0.4px;
}

.card h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--title-main);
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    letter-spacing: -0.015em;
}

.card h2 .module-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--module-color);
}

.card-desc {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.48;
    margin: 0;
}

/* Hover wash sutil usando --module-tint */
[data-theme="dark"] .card:hover {
    background: linear-gradient(180deg, var(--bg-content) 0%, #161F30 100%);
}

/* ==========================================================================
   6. ENLACES DE NAVEGACIÓN EN TARJETAS
   ========================================================================== */
.links {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 0.35rem;
}

.links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.78rem;
    padding: 0.44rem 0.65rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: var(--transition);
    flex: 1 1 auto;
    text-align: center;
    background: var(--bg-elevated);
}

.links a:hover {
    background-color: var(--module-color);
    border-color: var(--module-color);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.links a:active {
    transform: scale(0.97);
}

.links a:visited {
    color: var(--text-main);
}

.links a:visited:hover {
    color: #FFFFFF;
}

/* Estado vacío de búsqueda */
.search-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 1rem;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 0.92rem;
}

/* ==========================================================================
   7. NAVEGACIÓN BREADCRUMB STICKY E ÍNDICES DE MÓDULO
   ========================================================================== */
.breadcrumb-nav {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: var(--font-sans);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

[data-theme="dark"] .breadcrumb-nav {
    background: rgba(17, 24, 39, 0.88);
}

.breadcrumb-nav .theme-btn {
    margin-left: auto;
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    background: var(--bg-body);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    color: var(--text-main);
}

.breadcrumb-nav .theme-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
}

.breadcrumb-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--transition);
}

.breadcrumb-nav a:hover {
    color: var(--primary-color);
}

.breadcrumb-nav span {
    color: var(--text-main);
    font-weight: 600;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 0.8rem;
}

.module-section {
    background: var(--bg-content);
    padding: 1.5rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.module-section h2 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    border-bottom: 2px solid var(--module-color, var(--border-light));
    padding-bottom: 0.6rem;
    margin-bottom: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--module-color, var(--title-main));
}

.module-section h3 {
    font-family: var(--font-heading);
    font-size: 0.98rem;
    font-weight: 700;
    border-bottom-color: var(--border-light) !important;
}

/* Listas de Ítems */
.item-list {
    list-style: none;
}

.item-list li {
    margin-bottom: 0.7rem;
}

.item-list a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    position: relative;
    padding: 0.95rem 2.2rem 0.95rem 1.1rem;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text-main);
    transition: var(--transition);
}

.item-list a::after {
    content: "›";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.item-list a:hover {
    background: var(--bg-content);
    border-color: var(--module-border);
    border-left: 4px solid var(--module-color, var(--primary-color));
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}

.item-list a:hover::after {
    color: var(--module-color, var(--primary-color));
    transform: translate(3px, -50%);
}

.item-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--title-main);
}

.badge {
    display: inline-block;
    background: var(--module-tint);
    border: 1px solid var(--module-border);
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    margin-right: 8px;
    color: var(--module-color, var(--text-muted));
    font-family: var(--font-code);
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.key-box {
    font-family: var(--font-code);
    background-color: var(--bg-elevated);
    padding: 0.14rem 0.48rem;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    box-shadow: 0 2px 0 var(--border-light);
    display: inline-block;
    color: var(--title-main);
    font-size: 0.83em;
    font-weight: 600;
}

/* Buscador en Índices */
.buscador-index {
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg-elevated);
    color: var(--text-main);
    margin-bottom: 1.25rem;
    outline: none;
    transition: var(--transition);
}

.buscador-index:focus {
    border-color: var(--module-color, var(--primary-color));
    box-shadow: 0 0 0 3px var(--module-tint);
    background: var(--bg-content);
}

/* ==========================================================================
   8. IMÁGENES Y MODAL DE ZOOM
   ========================================================================== */
.guide-img-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin: 2rem 0;
}

.guide-img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.shortcut-thumbnail {
    width: 120px;
    height: auto;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: block;
    margin: 0 auto;
}

.shortcut-thumbnail:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: scale(1.04);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 92%;
    max-height: 84vh;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    background: #fff;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #E2E8F0;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.close:hover {
    color: #FFFFFF;
    transform: rotate(90deg);
}

#caption {
    margin: 0.75rem auto 0;
    display: block;
    width: 85%;
    text-align: center;
    color: #E2E8F0;
    padding: 8px 0;
    font-size: 0.92rem;
}

/* ==========================================================================
   9. CONTENIDO DE CLASES, GUÍAS Y PRÁCTICAS
   ========================================================================== */
.content {
    margin: 1.4rem auto 2.5rem;
    background: var(--bg-content);
    padding: 2.2rem 2.4rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: var(--width-reading);
    width: calc(100% - 2rem);
    box-shadow: var(--shadow-sm);
}

.content.is-wide {
    max-width: var(--width-wide);
    padding: 2.2rem 2.4rem;
}

.breadcrumb {
    max-width: var(--width-reading);
    margin: 0 auto 1rem;
    padding: 0;
    font-size: 0.8rem;
    font-family: var(--font-code);
    color: var(--text-muted);
}

.content.is-wide + .breadcrumb,
.container-wide .breadcrumb {
    max-width: var(--width-wide);
}

.breadcrumb a {
    text-decoration: none;
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

.lesson-header {
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.2rem;
    margin-bottom: 1.75rem;
}

.lesson-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.45rem, 2.4vw, 1.95rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.25;
    color: var(--title-main);
    margin-bottom: 0.45rem;
}

.lesson-header .date {
    display: inline-block;
    font-size: 0.74rem;
    font-family: var(--font-code);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    margin-bottom: 0.65rem;
}

[data-theme="dark"] .lesson-header .date {
    background: rgba(96, 165, 250, 0.14);
}

.lesson-header .subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.55;
}

.lesson-body p {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1.15rem;
    color: var(--text-color);
}

.content.mode-tech .lesson-body p,
.content.is-wide .lesson-body p {
    font-size: 0.96rem;
}

.lesson-body h2 {
    font-family: var(--font-heading);
    margin-top: 2.2rem;
    margin-bottom: 0.9rem;
    font-size: 1.32rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--title-main);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 0.45rem;
}

.lesson-body h3 {
    font-family: var(--font-heading);
    margin-top: 1.65rem;
    margin-bottom: 0.65rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--title-main);
}

.lesson-body h4 {
    margin-top: 1.35rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    font-size: 0.84rem;
    font-family: var(--font-code);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.lesson-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.8rem auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.lesson-body ul, .lesson-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.35rem;
    font-family: var(--font-sans);
}

.lesson-body li {
    margin-bottom: 0.45rem;
}

/* Cajas de Información / Callouts */
.box {
    padding: 1.15rem 1.3rem;
    margin: 1.4rem 0;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--text-muted);
    border-radius: var(--radius);
    background-color: var(--bg-elevated);
}

.box > p:last-child,
.box > ul:last-child,
.box > ol:last-child {
    margin-bottom: 0;
}

.box-tip { border-left-color: var(--color-warning); background: rgba(217, 119, 6, 0.06); }
.box-practice { border-left-color: var(--color-success); background: rgba(22, 163, 74, 0.06); }
.box-publisher { border-left-color: var(--color-pub); background: rgba(13, 148, 136, 0.06); }
.box-excel { border-left-color: var(--color-excel); background: rgba(22, 163, 74, 0.06); }
.box-word { border-left-color: var(--color-word); background: rgba(37, 99, 235, 0.06); }
.box-win { border-left-color: var(--color-win); background: rgba(2, 132, 199, 0.06); }
.box-internet { border-left-color: var(--color-net); background: rgba(217, 119, 6, 0.06); }
.box-ppt { border-left-color: var(--color-ppt); background: rgba(220, 38, 38, 0.06); }
.box-ia { border-left-color: var(--color-ia); background: rgba(124, 58, 237, 0.06); }

/* Neutralizar estilos inline heredados con fondos claros en modo oscuro */
[data-theme="dark"] .box,
[data-theme="dark"] .tip {
    background-color: var(--bg-elevated) !important;
    color: var(--text-color) !important;
    border-color: var(--border-light);
}

[data-theme="dark"] .box-win { background-color: rgba(56, 189, 248, 0.09) !important; border-left-color: var(--color-win) !important; }
[data-theme="dark"] .box-internet { background-color: rgba(251, 191, 36, 0.09) !important; border-left-color: var(--color-net) !important; }
[data-theme="dark"] .box-ppt { background-color: rgba(248, 113, 113, 0.09) !important; border-left-color: var(--color-ppt) !important; }
[data-theme="dark"] .box-word { background-color: rgba(96, 165, 250, 0.09) !important; border-left-color: var(--color-word) !important; }
[data-theme="dark"] .box-excel { background-color: rgba(74, 222, 128, 0.09) !important; border-left-color: var(--color-excel) !important; }
[data-theme="dark"] .box-ia { background-color: rgba(167, 139, 250, 0.09) !important; border-left-color: var(--color-ia) !important; }
[data-theme="dark"] .box-tip { background-color: rgba(251, 191, 36, 0.09) !important; border-left-color: var(--color-warning) !important; }
[data-theme="dark"] .box-practice { background-color: rgba(74, 222, 128, 0.09) !important; border-left-color: var(--color-success) !important; }
[data-theme="dark"] .formula-box { background-color: var(--color-code-bg) !important; color: var(--text-main) !important; border-color: var(--border-strong) !important; }

.box-title {
    display: block;
    font-weight: 700;
    margin-bottom: 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--title-main);
}

/* Tabla de atajos esenciales */
.essentials-note {
    display: block;
    margin-bottom: 1rem;
    padding: 0.7rem 1rem;
    background: rgba(217, 119, 6, 0.08);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-warning);
}

[data-theme="dark"] .essentials-note {
    background: rgba(251, 191, 36, 0.12);
    color: #FBBF24;
}

table.essentials-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.8rem;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

table.essentials-table thead th {
    background: var(--color-warning);
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table.essentials-table tbody tr {
    transition: var(--transition);
}

table.essentials-table tbody tr:hover {
    background: var(--bg-elevated);
}

table.essentials-table tbody td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-light);
}

table.essentials-table tbody td:first-child {
    font-family: var(--font-code);
    font-weight: 600;
    white-space: nowrap;
    color: var(--title-main);
}

table.essentials-table tbody td:last-child {
    color: var(--text-muted);
}

table.essentials-table + h2 {
    margin-top: 1.5rem;
}

/* Tablas Generales */
table.wiki-table, .guide-container table, .content table:not(.wiki-table):not(.essentials-table) {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4rem 0;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

table.wiki-table th, .guide-container th, .content table:not(.wiki-table):not(.essentials-table) th {
    background-color: var(--bg-elevated);
    color: var(--title-main);
    font-weight: 600;
    padding: 0.65rem 0.9rem;
    text-align: left;
    border-bottom: 2px solid var(--border-light);
}

table.wiki-table td, .guide-container td, .content table:not(.wiki-table):not(.essentials-table) td {
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid var(--border-light);
}

table.wiki-table tbody tr:hover,
.content table:not(.wiki-table):not(.essentials-table) tbody tr:hover {
    background-color: var(--bg-elevated);
}

[data-theme="dark"] table.wiki-table th,
[data-theme="dark"] .guide-container th,
[data-theme="dark"] .content table:not(.wiki-table):not(.essentials-table) th {
    background-color: #1E293B;
    color: #F8FAFC;
}

/* Código y Atajos */
code, .shortcut {
    font-family: var(--font-code);
    background: var(--color-code-bg);
    color: var(--title-main);
    padding: 0.16rem 0.42rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 0.84em;
}

pre code {
    display: block;
    padding: 1rem;
    overflow-x: auto;
    line-height: 1.55;
}

/* Alias de Compatibilidad (Legacy) */
.task-title {
    display: block;
    font-weight: 700;
    font-family: var(--font-heading);
    margin-bottom: 0.45rem;
    font-size: 0.96rem;
    color: var(--title-main);
}

.step-list li {
    margin-bottom: 0.6rem;
}

.guide-container {
    margin: 1.4rem auto 2.5rem;
    background: var(--bg-content);
    padding: 2.2rem 2.4rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    max-width: var(--width-wide);
    width: calc(100% - 2rem);
    font-family: var(--font-sans);
    box-shadow: var(--shadow-sm);
}

.guide-header {
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1.4rem;
    margin-bottom: 2rem;
}

.guide-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--title-main);
    margin-bottom: 0.5rem;
}

.tip {
    padding: 1.25rem 1.4rem;
    margin: 1.75rem 0;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--color-warning);
    border-radius: var(--radius);
    background-color: var(--bg-elevated);
}

/* Botón descarga */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.72rem 1.35rem;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius);
    color: #FFFFFF !important;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.download-btn:hover {
    filter: brightness(1.08);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Botón flotante Volver Arriba */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--bg-content);
    color: var(--title-main);
    box-shadow: var(--shadow-md);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 850;
}

.back-to-top.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #FFFFFF;
}

/* ==========================================================================
   10. RESPONSIVE (TABLETS Y MÓVILES)
   ========================================================================== */
@media (min-width: 481px) and (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .content, .guide-container {
        padding: 1.65rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.1rem 0.75rem 2rem;
    }

    .content, .content.is-wide, .guide-container {
        padding: 1.35rem 1.15rem;
        margin: 0.75rem auto 1.5rem;
        width: calc(100% - 1rem);
        border-radius: var(--radius);
    }

    body > header,
    body > header.hero-header {
        padding: 1.4rem 1rem;
    }

    .hero-header .header-text {
        text-align: center;
    }

    .hero-toolbar {
        justify-content: center;
    }

    .hero-search-wrap {
        max-width: 100%;
    }

    .lesson-header h1, .guide-header h1 {
        font-size: 1.45rem;
    }

    .lesson-body p {
        font-size: 0.96rem;
    }

    .lesson-body h2 {
        font-size: 1.2rem;
        margin-top: 1.75rem;
    }

    .box {
        padding: 1rem 1.05rem;
        margin: 1.25rem 0;
    }

    table.wiki-table, .guide-container table, .content table:not(.wiki-table):not(.essentials-table) {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .breadcrumb-nav {
        padding: 0.55rem 0.9rem;
        font-size: 0.78rem;
    }

    .modal-content {
        max-width: 96%;
        max-height: 88vh;
    }

    .grid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================================
   11. IMPRESIÓN INSTITUCIONAL
   ========================================================================== */
@media print {
    @page {
        size: letter;
        margin: 1.5cm 2cm;
    }

    body {
        font-size: 11pt;
        color: #000;
        background: #fff;
        line-height: 1.6;
    }

    nav,
    footer,
    .buscador-index,
    .buscador-home,
    .hero-toolbar,
    .theme-btn,
    .modal,
    .links,
    .card-icon,
    .badge,
    .step-list,
    .back-to-top,
    .reading-progress,
    script {
        display: none !important;
    }

    .content, .content.is-wide, .guide-container {
        margin: 0;
        padding: 0;
        width: 100%;
        border: none;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .lesson-header {
        border-bottom: 1px solid #ccc;
    }

    .lesson-header h1 {
        font-size: 18pt;
        margin: 0;
        padding: 0;
        color: #000;
    }

    .lesson-header .date,
    .lesson-header .subtitle {
        font-size: 10pt;
        background: none;
        color: #444;
        padding: 0;
    }

    .lesson-body p {
        font-size: 11pt;
        line-height: 1.7;
        color: #000;
    }

    .lesson-body h2 { font-size: 15pt; color: #000; }
    .lesson-body h3 { font-size: 12pt; color: #000; }

    .lesson-body img {
        max-width: 80% !important;
        margin: 1.5rem auto;
        border: 0.5px solid #ddd;
        box-shadow: none;
    }

    table.wiki-table, .guide-container table, .content table {
        font-size: 9.5pt;
    }

    table.wiki-table th, .guide-container th, .content th {
        background-color: #eee !important;
        color: #000 !important;
    }

    .box, .tip {
        border: 1px solid #ccc;
        background: #f9f9f9 !important;
        color: #000 !important;
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .box-title {
        font-size: 10pt;
        color: #000;
    }

    code, .shortcut, .key-box {
        border: 0.5px solid #ccc;
        background: #f4f4f4;
        color: #000;
        box-shadow: none;
    }

    .guide-img {
        border: 0.5px solid #ddd;
    }

    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 9pt;
        color: #444;
        border-bottom: 1px solid #999;
        padding-bottom: 0.3cm;
        margin-bottom: 1cm;
    }

    .print-header-left {
        text-align: left;
        width: 30%;
    }

    .print-header-center {
        text-align: center;
        width: 40%;
        font-weight: 600;
        font-size: 10pt;
    }

    .print-header-right {
        text-align: right;
        width: 30%;
        font-size: 8.5pt;
    }

    .print-footer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        text-align: center;
        font-size: 8pt;
        color: #888;
        border-top: 1px solid #ccc;
        padding-top: 0.2cm;
    }

    .print-footer::after {
        content: "Página " counter(page);
    }
}
