/* =====================================================================
   course.css · Diseño del curso al estilo de exercisesjava.com (paleta Python)
   Se carga desde _Layout. Solo afecta a páginas con .course-layout y a la
   cabecera en escritorio.
   ===================================================================== */
:root {
    --c-bg: #edf1f5;
    --c-panel: #ffffff;
    --c-text: #1f2937;
    --c-muted: #667085;
    --c-border: #dfe5ec;
    --c-primary: #4f46e5;
    --c-primary-dark: #3730a3;
    --c-primary-soft: #eef2ff;
    --c-accent: #4f46e5;
    --c-badge: #4f46e5;
    --c-radius: 8px;
    --c-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

/* Fondo gris azulado solo en las páginas del curso */
body:has(.course-layout) { background: var(--c-bg); color: var(--c-text); }

/* ---------- cabecera: horizontal en escritorio, cajón lateral en móvil ---------- */
.main-header { position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 6px rgba(16, 24, 40, .08); }
@media (min-width: 901px) {
    .main-header .menu-toggle, .main-header #menuOverlay { display: none; }
    .main-header .nav-links {
        position: static; width: auto; height: auto; right: auto; background: transparent; box-shadow: none;
        padding: 0; flex-direction: row; align-items: center; gap: 1.75rem; border: 0; border-radius: 0; transition: none;
    }
    .main-header .nav-links::before { content: none; }
    .main-header .nav-links a {
        font-size: .95rem; color: #475467; font-weight: 500; padding: .5rem 0; border-radius: 0;
        border-bottom: 2px solid transparent; transform: none;
    }
    .main-header .nav-links a:hover { background: none; transform: none; color: var(--c-primary); }
    .main-header .nav-links a.active { color: var(--c-text); font-weight: 600; border-bottom-color: var(--c-badge); }
}

/* ---------- estructura de dos columnas ---------- */
.course-layout { max-width: 1120px; margin: 1rem auto 3rem; padding: 0 1rem; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.panel { background: var(--c-panel); border: 1px solid var(--c-border); border-radius: var(--c-radius); box-shadow: var(--c-shadow); padding: 1.5rem; }
.panel + .panel { margin-top: 1rem; }
.course-main > .panel { padding: 1.5rem 1.75rem; }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 1rem; padding: 0; font-size: .82rem; color: var(--c-muted); }
.breadcrumbs li + li::before { content: "›"; margin: 0 .55rem; color: #98a2b3; }
.breadcrumbs a { color: var(--c-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--c-primary); text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--c-text); }


.page-title { font-size: 1.9rem; line-height: 1.2; margin: 0 0 .5rem; color: #111827; }
.page-lead { color: #475467; margin: .25rem 0 0; line-height: 1.6; }
.meta-line { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-size: .85rem; color: var(--c-muted); margin: .25rem 0 1.25rem; }
.section-heading { display: flex; align-items: center; gap: .6rem; font-size: 1.4rem; margin: 1.75rem 0 .75rem; color: #111827; }
.section-heading::before { content: ""; width: 6px; height: 1.3rem; border-radius: 3px; background: var(--c-primary); }

/* ---------- mapa de lecciones ---------- */
.course-hero { text-align: center; }
.course-hero .breadcrumbs ol { justify-content: flex-start; text-align: left; }
.course-hero .page-title { font-size: 2rem; }
.course-hero hr { border: 0; border-top: 1px solid var(--c-border); margin: 1rem 0; }
.course-hero .page-lead { max-width: 640px; margin: 0 auto; }
.btn-primary-pill { display: inline-block; margin-top: 1rem; padding: .55rem 1.25rem; background: var(--c-primary); color: #fff; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: .9rem; }
.btn-primary-pill:hover { background: var(--c-primary-dark); }

.roadmap { position: relative; margin: 2.5rem 0 1rem; display: flex; flex-direction: column; gap: 3rem; }
.roadmap-row { position: relative; display: flex; justify-content: center; }
.roadmap-row.pair { justify-content: space-between; padding: 0 12%; }
.roadmap-row + .roadmap-row::before { content: ""; position: absolute; left: 50%; top: -2.6rem; height: 2.2rem; border-left: 3px dotted #c5d0dc; }

.lesson-node { display: flex; flex-direction: column; align-items: center; width: 170px; text-decoration: none; color: var(--c-text); text-align: center; }
.lesson-bubble { position: relative; width: 104px; height: 104px; border-radius: 50%; background: var(--c, #3776ab); display: grid; place-items: center; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), 0 6px 14px rgba(16, 24, 40, .18); transition: transform .15s ease; }
.lesson-bubble::before { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: rgba(255, 255, 255, .92); }
.lesson-bubble img { position: relative; width: 52px; height: 52px; }
.lesson-node:hover .lesson-bubble { transform: translateY(-3px) scale(1.04); }
.count-badge { position: absolute; right: -2px; bottom: 2px; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: var(--c-badge); color: #fff; font-weight: 700; font-size: .8rem; display: grid; place-items: center; border: 2px solid #fff; }
.lesson-node-title { margin-top: .6rem; font-weight: 700; font-size: .98rem; line-height: 1.25; }
.lesson-node:hover .lesson-node-title { color: var(--c-primary); }

/* ---------- barra lateral ---------- */
.side-card { padding: 1.1rem; }
.side-card h2, .side-card h3 { margin: 0 0 .75rem; text-align: center; font-size: 1rem; color: #111827; }
.side-card .side-subtitle { font-size: .9rem; font-weight: 700; margin: 1.1rem 0 .4rem; text-align: left; color: #111827; }
.side-card .side-text { font-size: .8rem; color: var(--c-muted); text-align: center; line-height: 1.5; margin: .5rem 0 1rem; }
.side-art { display: block; margin: .25rem auto; width: 150px; height: auto; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; font-size: .84rem; color: #344054; text-decoration: none; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; }
.side-list a:hover { background: #f5f8fb; }
.side-list a.active { background: var(--c-primary-soft); border-left-color: var(--c-primary); font-weight: 600; color: var(--c-primary-dark); }
.num { flex: 0 0 auto; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #3b4252; color: #fff; font-size: .68rem; font-weight: 700; }
.side-lesson { display: flex; flex-direction: column; align-items: center; text-align: center; }
.side-lesson .lesson-bubble { width: 84px; height: 84px; }
.side-lesson .lesson-bubble::before { inset: 16px; }
.side-lesson .lesson-bubble img { width: 42px; height: 42px; }
.side-lesson .count-badge { min-width: 24px; height: 24px; font-size: .7rem; }

/* ---------- tarjetas de teoría y ejercicios ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.ex-card { display: flex; flex-direction: column; border: 1px solid var(--c-border); border-radius: 6px; padding: 1rem 1.1rem; background: #fff; transition: box-shadow .15s ease, border-color .15s ease; }
.ex-card:hover { border-color: #b8cfe4; box-shadow: 0 4px 14px rgba(55, 118, 171, .14); }
.ex-card h3 { display: flex; gap: .55rem; align-items: flex-start; margin: 0 0 .6rem; font-size: 1.02rem; line-height: 1.3; color: #111827; }
.ex-card h3 .num { margin-top: .12rem; }
.ex-card-meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .78rem; color: var(--c-muted); padding-bottom: .8rem; border-bottom: 1px solid var(--c-border); }
.ex-card-footer { margin-top: auto; padding-top: .8rem; }
.btn-read { display: inline-block; padding: .38rem 1.1rem; background: var(--c-badge); color: #fff; border-radius: 999px; font-weight: 700; font-size: .78rem; text-decoration: none; }
.btn-read:hover { filter: brightness(.92); }

.chip { display: inline-block; padding: .08rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.chip-theory { background: #e0ecff; color: #1d4ed8; }
.chip-practice { background: #dcfce7; color: #15803d; }
.chip-d1 { background: #ecfdf3; color: #067647; }
.chip-d2 { background: #fffaeb; color: #b54708; }
.chip-d3 { background: #fef3f2; color: #b42318; }

/* ---------- ejercicio ---------- */
.exercise-section h2 { font-size: 1.5rem; margin: 1.5rem 0 .6rem; color: #111827; }
.exercise-problem { line-height: 1.65; color: #1f2937; overflow-wrap: anywhere; }
.exercise-problem img { max-width: 100%; height: auto; }
.exercise-problem pre { background: #f4f7fa; border: 1px solid var(--c-border); border-radius: 6px; padding: .9rem 1rem; overflow-x: auto; }
.code-block { margin: 0; padding: .9rem 1rem; background: #f4f7fa; border: 1px solid var(--c-border); border-radius: 6px; font-family: 'Fira Code', ui-monospace, monospace; font-size: .86rem; line-height: 1.55; overflow-x: auto; color: #1d3557; }
.solution-box { margin-top: 1.5rem; border: 1px solid var(--c-border); border-radius: 6px; overflow: hidden; }
.solution-box summary { cursor: pointer; padding: .8rem 1rem; font-weight: 700; background: var(--c-primary-soft); color: var(--c-primary-dark); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.solution-box summary::-webkit-details-marker { display: none; }
.solution-box summary::after { content: "▾"; }
.solution-box[open] summary::after { content: "▴"; }
.solution-box .code-block { border: 0; border-top: 1px solid var(--c-border); border-radius: 0; background: #0f172a; color: #e2e8f0; }

.pager { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; margin-top: 1.75rem; }
.btn-ghost, .btn-solid { display: inline-block; padding: .6rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .88rem; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--c-primary-dark); border: 1px solid #c6d6e6; }
.btn-ghost:hover { background: var(--c-primary-soft); }
.btn-solid { background: var(--c-primary); color: #fff; border: 1px solid var(--c-primary); }
.btn-solid:hover { background: var(--c-primary-dark); }
.course-page .muted { color: var(--c-muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .course-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
    .course-main > .panel { padding: 1.1rem; }
    .page-title, .course-hero .page-title { font-size: 1.5rem; }
    .roadmap { gap: 2rem; }
    .roadmap-row.pair { padding: 0; }
    .roadmap-row + .roadmap-row::before { display: none; }
    .lesson-node { width: 46%; }
    .lesson-bubble { width: 88px; height: 88px; }
    .lesson-bubble::before { inset: 16px; }
    .lesson-bubble img { width: 44px; height: 44px; }
    .pager a { flex: 1 1 100%; text-align: center; }
}

/* ---------- selector de idioma en el footer (como exercisesjava.com) ---------- */
.site-footer .language-switch { align-self: stretch; display: flex; justify-content: flex-end; margin: -2rem 0 -1rem; }
.lang-dropdown { position: relative; text-align: left; }
.lang-dropdown summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; color: #808080; font-size: .95rem; padding: .3rem .5rem; user-select: none; }
.lang-dropdown summary::-webkit-details-marker { display: none; }
.lang-dropdown summary::after { content: ""; border: 4px solid transparent; border-top-color: #808080; margin-top: 4px; }
.lang-dropdown[open] summary::after { margin-top: -4px; transform: rotate(180deg); }
.lang-dropdown summary:hover { color: var(--c-primary); }
.lang-menu { position: absolute; right: 0; bottom: calc(100% + 4px); min-width: 160px; margin: 0; padding: .25rem 0; list-style: none; background: #fff; border: 1px solid rgba(0, 0, 0, .2); border-radius: 4px; box-shadow: 0 6px 24px rgba(16, 24, 40, .22); z-index: 40; }
.lang-menu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; color: #344054; text-decoration: none; font-size: .9rem; font-weight: 400; }
.lang-menu a:hover { background: #f2f6fa; }
.lang-flag { width: 18px; height: 13px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); object-fit: cover; }


/* =====================================================================
   Pagina de leccion (rediseno): banner con el color de la leccion, tarjetas y paginador
   ===================================================================== */
.lesson-hero {
    position: relative;
    margin-bottom: 1rem;
    padding: 1.5rem 1.75rem 1.75rem;
    border-radius: 14px;
    color: #fff;
    background:
        radial-gradient(28rem 14rem at 100% 0%, rgba(255, 255, 255, .16), transparent 60%),
        linear-gradient(135deg, color-mix(in srgb, var(--c) 72%, #0f172a), color-mix(in srgb, var(--c) 42%, #0f172a));
    box-shadow: 0 10px 28px rgba(16, 24, 40, .18);
    overflow: hidden;
}
.lesson-hero .breadcrumbs ol, .lesson-hero .breadcrumbs a, .lesson-hero .breadcrumbs [aria-current] { color: rgba(255, 255, 255, .85); }
.lesson-hero .breadcrumbs li + li::before { color: rgba(255, 255, 255, .55); }
.lesson-hero .breadcrumbs a:hover { color: #fff; }
.lesson-hero-body { display: flex; align-items: center; gap: 1.75rem; }
.lesson-hero-icon { flex: 0 0 auto; }
.lesson-hero-icon .lesson-bubble { width: 124px; height: 124px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15), 0 10px 24px rgba(0, 0, 0, .3); border: 4px solid rgba(255, 255, 255, .85); }
.lesson-hero-icon .lesson-bubble::before { inset: 22px; }
.lesson-hero-icon .lesson-bubble img { width: 60px; height: 60px; }
.lesson-hero-icon .count-badge { border-color: #fff; right: -6px; bottom: -2px; }
.lesson-kicker { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: .2rem .7rem; border-radius: 999px; background: rgba(255, 255, 255, .18); }
.lesson-hero .page-title { color: #fff; font-size: 2.1rem; margin: .6rem 0 .4rem; }
.lesson-hero .page-lead { color: rgba(255, 255, 255, .92); max-width: 60ch; }
.lesson-stats { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin: 1rem 0 0; padding: 0; font-size: .9rem; color: rgba(255, 255, 255, .9); }
.lesson-stats strong { font-size: 1.15rem; color: #fff; margin-right: .15rem; }
.lesson-start { display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.1rem; padding: .65rem 1.4rem; border-radius: 999px; background: #fff; color: #1f2937; font-weight: 700; font-size: .92rem; text-decoration: none; box-shadow: 0 6px 16px rgba(0, 0, 0, .22); transition: transform .15s ease, box-shadow .15s ease; }
.lesson-start:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0, 0, 0, .3); }

.section-count { margin-left: .2rem; padding: .1rem .6rem; border-radius: 999px; background: var(--c-primary-soft); color: var(--c-primary-dark); font-size: .8rem; font-weight: 700; }
.lesson-content .section-heading:first-child { margin-top: .25rem; }
.lesson-content .section-heading::before { background: var(--c, var(--c-primary)); }

/* Tarjetas: toda la tarjeta es clicable */
.ex-card { position: relative; border-top: 3px solid transparent; border-radius: 10px; padding: 1.1rem 1.15rem; }
.ex-practice { border-top-color: var(--c, var(--c-primary)); }
.ex-theory { border-top-color: #93b4ff; }
.ex-card:hover { transform: translateY(-3px); }
.ex-card .num { width: 26px; height: 26px; font-size: .75rem; }
.ex-practice .num { background: var(--c, #3b4252); }
.ex-card h3 { margin-bottom: .75rem; }
.btn-read::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.btn-read { background: var(--c, var(--c-badge)); position: static; }
.ex-theory .btn-read { background: #3b6fd4; }
.btn-read span { display: inline-block; transition: transform .15s ease; }
.ex-card:hover .btn-read span { transform: translateX(3px); }

/* Paginador entre lecciones */
.lesson-pager { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: 2rem; }
.pager-link { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; border: 1px solid var(--c-border); border-radius: 10px; text-decoration: none; color: var(--c-text); transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.pager-link:hover { border-color: var(--c-primary); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(16, 24, 40, .1); }
.pager-link small { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-muted); }
.pager-link span { font-weight: 700; line-height: 1.3; }
.pager-link.next { text-align: right; grid-column: 2; }
.pager-link.prev:only-child { grid-column: 1; }

/* Barra lateral: fija al hacer scroll en escritorio; en la leccion no repite la descripcion */
@media (min-width: 901px) {
    .course-side { position: sticky; top: 4.75rem; max-height: calc(100vh - 5.75rem); overflow-y: auto; scrollbar-width: thin; }
}
body:has(.lesson-hero) .side-lesson .side-text { display: none; }

@media (max-width: 700px) {
    .lesson-hero { padding: 1.1rem; }
    .lesson-hero-body { flex-direction: column; text-align: center; gap: 1rem; }
    .lesson-hero .page-title { font-size: 1.6rem; }
    .lesson-stats { justify-content: center; }
    .lesson-pager { grid-template-columns: 1fr; }
    .pager-link.next { grid-column: 1; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .ex-card, .pager-link, .lesson-start { transition: none; } }


/* =====================================================================
   Pagina de ejercicio (rediseno)
   ===================================================================== */
.exercise-hero {
    margin-bottom: 1rem;
    padding: 1.25rem 1.6rem 1.5rem;
    border-radius: 14px;
    color: #fff;
    background:
        radial-gradient(24rem 12rem at 100% 0%, rgba(255, 255, 255, .15), transparent 60%),
        linear-gradient(135deg, color-mix(in srgb, var(--c) 72%, #0f172a), color-mix(in srgb, var(--c) 42%, #0f172a));
    box-shadow: 0 8px 22px rgba(16, 24, 40, .16);
}
.exercise-hero .breadcrumbs ol, .exercise-hero .breadcrumbs a, .exercise-hero .breadcrumbs [aria-current] { color: rgba(255, 255, 255, .85); }
.exercise-hero .breadcrumbs li + li::before { color: rgba(255, 255, 255, .55); }
.exercise-hero .breadcrumbs a:hover { color: #fff; }
.exercise-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.exercise-hero .page-title { color: #fff; font-size: 2rem; margin: .7rem 0 0; }
.exercise-hero .lesson-kicker { max-width: 100%; }

.exercise-panel { padding: 1.5rem 1.75rem; }
.exercise-section:first-child h2 { margin-top: 0; }
.exercise-section h2 { display: flex; align-items: center; gap: .6rem; }
.exercise-section h2::before { content: ""; width: 6px; height: 1.2rem; border-radius: 3px; background: var(--c, var(--c-primary)); }
.exercise-problem { font-size: 1.02rem; }
.exercise-problem p { margin: .6rem 0; }
.exercise-problem h2, .exercise-problem h3 { margin: 1.4rem 0 .6rem; color: var(--c-text); font-size: 1.2rem; }
.exercise-problem :not(pre) > code { padding: .1rem .4rem; border-radius: 5px; background: var(--c-primary-soft); color: var(--c-primary-dark); font-family: 'Fira Code', ui-monospace, monospace; font-size: .88em; }
.exercise-problem ul { padding-left: 1.3rem; }
.exercise-problem li { margin: .3rem 0; }
.exercise-problem ul.lead { padding: .8rem 1.1rem .8rem 2.2rem; background: var(--c-primary-soft); border-left: 4px solid var(--c, var(--c-primary)); border-radius: 0 8px 8px 0; }
.exercise-problem ol.instructions-exercise { list-style: none; counter-reset: step; padding: 0; }
.exercise-problem ol.instructions-exercise > li { counter-increment: step; position: relative; margin: .5rem 0; padding: .65rem .9rem .65rem 3rem; border: 1px solid var(--c-border); border-radius: 8px; }
.exercise-problem ol.instructions-exercise > li::before { content: counter(step); position: absolute; left: .8rem; top: .6rem; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--c, var(--c-primary)); color: #fff; font-weight: 700; font-size: .8rem; }
.exercise-problem table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: .92rem; }
.exercise-problem th, .exercise-problem td { border: 1px solid var(--c-border); padding: .45rem .7rem; text-align: left; }
.exercise-problem th { background: var(--c-primary-soft); }

/* Entrada / salida como pequenas terminales */
.io-grid { display: grid; gap: 1rem; margin-top: 1.5rem; }
.io-grid.two { grid-template-columns: 1fr 1fr; }
.io-card { border: 1px solid var(--c-border); border-radius: 10px; overflow: hidden; background: var(--c-panel); min-width: 0; }
.io-card header { padding: .45rem .9rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: color-mix(in srgb, var(--c-text) 6%, var(--c-panel)); color: var(--c-muted); border-bottom: 1px solid var(--c-border); }
.io-card .code-block { margin: 0; border: 0; border-radius: 0; background: var(--c-panel); color: var(--c-text); white-space: pre-wrap; overflow-wrap: anywhere; min-height: 3rem; }

/* Solucion */
.solution-box { margin-top: 1.5rem; border-radius: 10px; }
.solution-box summary { padding: .9rem 1.1rem; transition: background .15s ease; }
.solution-box summary:hover { background: color-mix(in srgb, var(--c-primary-soft) 70%, var(--c-primary) 30%); }
.solution-bar { display: flex; justify-content: space-between; align-items: center; padding: .4rem .6rem .4rem 1rem; background: #1e293b; }
.solution-lang { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.copy-btn { cursor: pointer; padding: .3rem .8rem; border: 1px solid #475569; border-radius: 6px; background: transparent; color: #e2e8f0; font: inherit; font-size: .8rem; transition: background .15s ease; }
.copy-btn:hover { background: rgba(255, 255, 255, .1); }
.solution-box .code-block { border-top: 0; font-size: .9rem; line-height: 1.65; }

@media (max-width: 700px) {
    .exercise-hero { padding: 1rem; }
    .exercise-hero .page-title { font-size: 1.5rem; }
    .exercise-panel { padding: 1.1rem; }
    .io-grid.two { grid-template-columns: 1fr; }
}


/* =====================================================================
   Indice del curso (rediseno): banner + mapa de lecciones
   ===================================================================== */
.course-banner {
    margin-bottom: 1rem;
    padding: 1.5rem 1.9rem 2rem;
    border-radius: 14px;
    color: #fff;
    background:
        radial-gradient(30rem 16rem at 100% 0%, rgba(255, 212, 59, .22), transparent 60%),
        radial-gradient(26rem 14rem at 0% 100%, rgba(255, 255, 255, .10), transparent 60%),
        linear-gradient(135deg, #2b5b84, #3776ab 55%, #4b8bbe);
    box-shadow: 0 10px 28px rgba(16, 24, 40, .18);
}
.course-banner .breadcrumbs ol, .course-banner .breadcrumbs a, .course-banner .breadcrumbs [aria-current] { color: rgba(255, 255, 255, .85); }
.course-banner .breadcrumbs li + li::before { color: rgba(255, 255, 255, .55); }
.course-banner .page-title { color: #fff; font-size: 2.3rem; letter-spacing: -.01em; margin: .5rem 0 .6rem; max-width: 22ch; }
.course-banner .page-lead { color: rgba(255, 255, 255, .92); max-width: 58ch; font-size: 1.05rem; }
.course-stats { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem 1.75rem; margin: 1.25rem 0 0; padding: 0; color: rgba(255, 255, 255, .9); font-size: .9rem; }
.course-stats strong { font-size: 1.5rem; margin-right: .25rem; color: #ffd43b; }

.course-path { padding: 1.5rem 1.75rem 2rem; }
.course-path .roadmap { margin-top: .5rem; }
.roadmap-row + .roadmap-row::before { border-left: 3px dotted color-mix(in srgb, var(--c-primary) 45%, transparent); }

.lesson-node { position: relative; width: 210px; padding: 1.1rem .9rem 1rem; border-radius: 14px; border: 1px solid transparent; transition: background .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.lesson-node:hover { background: var(--c-panel); border-color: var(--c-border); box-shadow: 0 10px 24px rgba(16, 24, 40, .12); transform: translateY(-3px); }
.lesson-node-num { margin-top: .75rem; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c, var(--c-primary)); }
.lesson-node-title { margin-top: .2rem; }
.lesson-node-counts { margin-top: .35rem; font-size: .76rem; color: var(--c-muted); }
.lesson-node:focus-visible { outline: 3px solid var(--c, var(--c-primary)); outline-offset: 2px; }

@media (max-width: 700px) {
    .course-banner { padding: 1.1rem 1.1rem 1.5rem; }
    .course-banner .page-title { font-size: 1.6rem; }
    .lesson-node { width: 48%; padding: .8rem .4rem; }
    .roadmap-row { flex-wrap: wrap; justify-content: center; gap: 1rem 0; }
}


/* =====================================================================
   Marca de la cabecera / pie: logo + nombre
   ===================================================================== */
.logo-container { gap: .6rem; padding: .3rem .5rem .3rem .25rem; border-radius: 10px; }
.logo-img { width: 40px; height: 40px; border-radius: 0; box-shadow: none; filter: drop-shadow(0 2px 3px rgba(55, 118, 171, .25)); }
.logo-container:hover { background: var(--c-primary-soft); transform: none; }
.logo-container:hover .logo-img { transform: rotate(-6deg) scale(1.08); }
.logo-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; color: var(--c-text); }
.logo-title .logo-accent { background: linear-gradient(90deg, #3776ab, #4b8bbe 55%, #e0a800); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer-brand .logo-title { font-size: 1.4rem; }
@media (max-width: 420px) { .logo-title { font-size: 1.1rem; } .logo-img { width: 34px; height: 34px; } }


/* =====================================================================
   Tarjetas de la leccion (segunda version): mismo lenguaje visual que las tarjetas de la home
   ===================================================================== */
.card-grid { gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ex-card {
    position: relative; display: flex; flex-direction: column; gap: .15rem;
    padding: 1.15rem 1.2rem 1.1rem; border: 1px solid var(--c-border); border-top-width: 1px; border-radius: 16px;
    background: var(--c-panel); box-shadow: 0 6px 16px rgba(16, 24, 40, .05);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.ex-card::before { content: ""; position: absolute; left: 1.2rem; right: 1.2rem; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--ex, var(--c-primary)); opacity: .9; }
.ex-practice { --ex: var(--c, #3776ab); }
.ex-theory { --ex: #5b7fd6; }
.ex-card:hover { transform: translateY(-4px); border-color: var(--ex); box-shadow: 0 14px 28px rgba(16, 24, 40, .12); }
.ex-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .7rem; }
.ex-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: color-mix(in srgb, var(--ex) 14%, transparent); color: var(--ex); }
.ex-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ex-number { font-size: 1.5rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: color-mix(in srgb, var(--ex) 35%, transparent); transition: color .2s ease; }
.ex-card:hover .ex-number { color: var(--ex); }
.ex-card h3 { margin: 0 0 .7rem; font-size: 1.02rem; line-height: 1.35; font-weight: 700; }
.ex-card-meta { padding-bottom: .9rem; border-bottom: 1px dashed var(--c-border); }
.ex-card-footer { padding-top: .85rem; }
.btn-read, .ex-theory .btn-read { padding: 0; background: none; border-radius: 0; color: var(--ex); font-size: .86rem; font-weight: 700; }
.btn-read:hover { filter: none; text-decoration: underline; text-underline-offset: 3px; }
.btn-read::after { border-radius: 16px; }
.btn-read:focus-visible::after { outline: 3px solid var(--ex); outline-offset: 2px; }


/* =====================================================================
   Paleta unificada del curso: un unico acento (indigo, el mismo de la home) + neutros
   ===================================================================== */
.lesson-hero, .exercise-hero, .course-banner {
    background:
        radial-gradient(28rem 14rem at 100% 0%, rgba(255, 255, 255, .14), transparent 60%),
        linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
}
.course-stats strong { color: #fff; }
.lesson-start { color: #3730a3; }

.ex-practice, .ex-theory { --ex: #4f46e5; }
.ex-card::before { opacity: 1; }
.lesson-content .section-heading::before, .exercise-section h2::before { background: #4f46e5; }
.exercise-problem ul.lead { border-left-color: #4f46e5; }
.exercise-problem ol.instructions-exercise > li::before { background: #4f46e5; }
.lesson-node-num { color: #4f46e5; }
.ex-practice .num { background: #4f46e5; }
.count-badge { background: #4f46e5; }
.lesson-hero-icon .count-badge { background: #fff; color: #4f46e5; border-color: #4f46e5; }

/* Etiquetas neutras: solo la teoria lleva el acento; la dificultad es un punto de color */
.chip { background: transparent; border: 1px solid var(--c-border); color: var(--c-muted); font-weight: 600; }
.chip-theory { background: var(--c-primary-soft); border-color: transparent; color: var(--c-primary-dark); }
.chip-practice { background: transparent; color: var(--c-text); }
.chip-d1, .chip-d2, .chip-d3 { background: transparent; color: var(--c-muted); }
.chip-d1::before, .chip-d2::before, .chip-d3::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: .4rem; border-radius: 50%; background: #16a34a; vertical-align: 1px; }
.chip-d2::before { background: #f59e0b; }
.chip-d3::before { background: #ef4444; }
.lesson-hero .chip, .exercise-hero .chip { background: rgba(255, 255, 255, .16); border-color: transparent; color: #fff; }
.lesson-hero .chip::before, .exercise-hero .chip::before { box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }


/* Resumen del enunciado en las tarjetas (recortado a 3 lineas) */
.ex-summary { margin: -.25rem 0 .8rem; font-size: .86rem; line-height: 1.5; color: var(--c-muted); display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ex-card h3 { margin-bottom: .55rem; }
.ex-card-meta { margin-top: auto; }
.ex-card-footer { margin-top: 0; }

/* ---- Menu lateral izquierdo de la leccion (sustituye al panel derecho) ---- */
.ld-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-right: .25rem; border: 1px solid var(--c-border, #e5e7eb); border-radius: 10px; background: transparent; color: inherit; cursor: pointer; flex: 0 0 auto; }
.ld-toggle:hover { background: var(--c-primary-soft, #eef2ff); color: var(--c-primary-dark, #4f46e5); }
.course-shell { display: flex; align-items: flex-start; }
.course-shell > .course-layout { flex: 1 1 0; min-width: 0; grid-template-columns: minmax(0, 1fr); max-width: 1200px; width: 100%; }
.lesson-drawer { flex: 0 0 0; width: 0; overflow: hidden; position: sticky; top: 4.75rem; height: calc(100vh - 4.75rem); transition: flex-basis .2s ease, width .2s ease; }
.ld-open .lesson-drawer { flex-basis: 290px; width: 290px; }
.ld-inner { width: 290px; height: 100%; overflow-y: auto; padding: 1rem .75rem 2rem 1rem; border-right: 1px solid var(--c-border, #e5e7eb); background: var(--c-card, #fff); scrollbar-width: thin; box-sizing: border-box; }
.ld-lesson { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; margin-bottom: .5rem; }
.ld-lesson .lesson-bubble { width: 44px; height: 44px; flex: 0 0 auto; }
.ld-lesson .lesson-bubble::before { inset: 8px; }
.ld-lesson .lesson-bubble img, .ld-lesson .lesson-bubble .li { width: 22px; height: 22px; }
.ld-lesson .count-badge { display: none; }
.ld-lesson strong { font-size: .95rem; line-height: 1.3; }
.ld-inner .side-subtitle { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted, #667085); margin: 1.1rem 0 .4rem; }
.ld-backdrop { display: none; }
@media (max-width: 900px) {
    .lesson-drawer { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: 290px; flex: none; z-index: 1200; transform: translateX(-100%); transition: transform .2s ease; overflow: visible; }
    .ld-open .lesson-drawer { transform: none; }
    .ld-open .ld-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1100; }
    .ld-inner { box-shadow: 0 0 30px rgba(0, 0, 0, .25); }
}
html[data-theme="dark"] .ld-inner { background: #111936; border-right-color: #243056; }
html[data-theme="dark"] .ld-toggle { border-color: #243056; }
html[data-theme="dark"] .ld-toggle:hover { background: #1a2340; color: #818cf8; }
.header-left { display: flex; align-items: center; gap: .5rem; min-width: 0; }

/* Variante superpuesta (editor): siempre fuera del flujo, cerrada por defecto */
.lesson-drawer.ld-overlay { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: 290px; flex: none; z-index: 1200; transform: translateX(-100%); transition: transform .2s ease; overflow: visible; }
html.ld-open .lesson-drawer.ld-overlay { width: 290px; transform: none; }
.ld-overlay .ld-inner { box-shadow: 0 0 30px rgba(0, 0, 0, .25); }
html.ld-open .ld-backdrop.ld-overlay:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1100; }

/* Barra de migas a todo el ancho, bajo el header (lecciones y ejercicios de teoria) */
.crumb-bar { width: 100%; border-bottom: 1px solid var(--c-border, #e5e7eb); background: var(--c-panel, #fff); }
.crumb-bar-in { padding: .55rem 1.25rem; }
.crumb-bar .breadcrumbs ol { margin: 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.crumb-bar .breadcrumbs li + li::before { content: "›"; margin: 0 .55rem; color: #98a2b3; }
.crumb-bar .breadcrumbs [aria-current] { font-weight: 600; }

/* Grupos plegables del menu lateral */
.ld-group > summary { display: flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none; user-select: none; }
.ld-group > summary::-webkit-details-marker { display: none; }
.ld-group > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; flex: 0 0 auto; }
.ld-group[open] > summary::before { transform: rotate(45deg); }
.ld-group > summary > span:first-child { flex: 1 1 auto; }
.ld-count { padding: .05rem .5rem; border-radius: 999px; background: var(--c-primary-soft, #eef2ff); color: var(--c-primary-dark, #4338ca); font-size: .72rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.ld-group:not([open]):has(a.active) > summary > span:first-child::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: .5rem; border-radius: 50%; background: var(--c-primary, #4f46e5); vertical-align: middle; }
.ld-group .side-list { margin-bottom: .4rem; }

/* ---- Menu lateral estilo documentacion: iconos de estado, sin numeros ni cajas ---- */
.lesson-drawer .ld-name { display: flex; flex-direction: column; min-width: 0; }
.lesson-drawer .ld-name strong { font-size: .95rem; line-height: 1.25; }
.lesson-drawer .ld-prog { margin-top: .1rem; font-size: .74rem; font-weight: 400; color: var(--c-muted, #667085); }
.lesson-drawer .ld-group > summary.side-subtitle { margin: 1.1rem 0 .3rem; padding: 0 .5rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted, #667085); }
.lesson-drawer .side-list a { position: relative; display: flex; align-items: center; gap: .65rem; padding: .42rem .5rem; border-left: 0; border-radius: 8px; font-size: .86rem; line-height: 1.3; color: var(--c-text, #111827); background: transparent; }
.lesson-drawer .side-list a:hover { background: color-mix(in srgb, var(--c-text, #111827) 6%, transparent); }
.lesson-drawer .side-list a.active { background: var(--c-primary-soft, #eef2ff); font-weight: 600; color: var(--c-primary-dark, #4338ca); }
.lesson-drawer .side-list a.active::before { content: ""; position: absolute; left: -1rem; top: 20%; bottom: 20%; width: 4px; border-radius: 0 4px 4px 0; background: var(--c-primary, #4f46e5); }
.lesson-drawer .st { flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--c-text, #111827) 22%, transparent); display: grid; place-items: center; }
.lesson-drawer a.active .st { background: var(--c-primary, #4f46e5); border-color: var(--c-primary, #4f46e5); box-shadow: inset 0 0 0 3px var(--c-panel, #fff); }
.lesson-drawer a.is-solved .st { background: #16a34a; border-color: #16a34a; box-shadow: none; }
.lesson-drawer a.is-solved .st::after { content: "✓"; color: #fff; font-size: .6rem; font-weight: 800; line-height: 1; }
.lesson-drawer .ld-t { min-width: 0; }
.lesson-drawer .solved-mark { display: none; }
.lesson-drawer .dd { margin-left: auto; flex: 0 0 auto; display: inline-flex; gap: 2px; }
.lesson-drawer .dd i { width: 5px; height: 5px; border-radius: 50%; background: color-mix(in srgb, var(--c-text, #111827) 18%, transparent); }
.lesson-drawer .dd.l1 i:nth-child(-n+1) { background: #16a34a; }
.lesson-drawer .dd.l2 i:nth-child(-n+2) { background: #d97706; }
.lesson-drawer .dd.l3 i:nth-child(-n+3) { background: #dc2626; }
html[data-theme="dark"] .lesson-drawer .side-list a { color: #d5dcec; }
html[data-theme="dark"] .lesson-drawer .side-list a.active { background: var(--c-primary-soft); color: var(--c-primary-dark); }
html[data-theme="dark"] .lesson-drawer a.active .st { box-shadow: inset 0 0 0 3px #111936; }
html[data-theme="dark"] .lesson-drawer a.is-solved .st { background: #22c55e; border-color: #22c55e; }

/* Boton flotante de copiar codigo (enunciados y teoria) */
.code-wrap { position: relative; }
.code-wrap > pre { margin-top: 0; margin-bottom: 0; }
.exercise-problem .code-wrap { margin: 1rem 0; }
.code-tools { position: absolute; top: .45rem; right: .45rem; display: flex; gap: .3rem; }
.code-copy { width: 32px; height: 32px; padding: 0; display: grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--c-border); background: var(--c-panel); color: var(--c-muted); cursor: pointer; opacity: .55; transition: opacity .15s, color .15s, border-color .15s; }
.code-wrap:hover .code-copy, .code-copy:focus-visible, .code-copy.is-ok { opacity: 1; }
@media (hover: none) { .code-copy { opacity: .85; } }
.code-copy:hover { color: var(--c-primary); border-color: var(--c-primary); }
.code-copy.is-ok { color: #16a34a; border-color: #16a34a; }
.code-copy:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.code-wrap > pre { padding-right: 5.2rem; }
html[data-theme="dark"] .code-copy { background: #131a2e; border-color: #26304f; color: #9aa6bf; }
html[data-theme="dark"] .code-copy:hover { color: #c7d2fe; border-color: #818cf8; }
html[data-theme="dark"] .code-copy.is-ok { color: #4ade80; border-color: #4ade80; }
