/* ==========================================================================
   Lector de Aprender: índice lateral, buscador, barra de lección
   ========================================================================== */
.la { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0 8px; max-width: 1320px; margin: 0 auto; padding: 0 12px; align-items: start; }
.la-main { min-width: 0; }
.la-main > .wrap { padding-top: 24px; }
.la-side { position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; padding: 18px 8px 40px 4px; border-right: 1px solid var(--border); scrollbar-width: thin; }
.la-open, .la-veil { display: none; }
kbd { font-family: var(--font); font-size: .72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); }

.la-search { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); margin-bottom: 14px; box-shadow: 0 8px 12px -10px var(--bg); color: var(--muted); transition: border-color .2s, box-shadow .2s; }
.la-search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px var(--ink-soft); }
.la-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: .92rem; color: var(--text); }
.la-search input::-webkit-search-cancel-button { cursor: pointer; }
.la-res { display: grid; gap: 6px; }
.la-rn { font-size: .78rem; color: var(--muted); font-weight: 600; margin: 0 4px 4px; }
.la-hit { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none !important; border-left: 3px solid var(--c); background: var(--surface); transition: background .2s, transform .2s var(--ease); animation: rise .3s var(--ease) both; }
.la-hit:hover { background: var(--surface-2); transform: translateX(2px); }
.la-hit b { font-size: .88rem; line-height: 1.3; }
.la-ht { font-size: .72rem; color: var(--c); font-weight: 700; }
.la-hit span { font-size: .8rem; color: var(--text-2); line-height: 1.4; }
mark { background: color-mix(in srgb, var(--primary) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

.la-toc { display: grid; gap: 2px; }
.la-top-link { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 600; font-size: .88rem; text-decoration: none !important; }
.la-top-link:hover { background: var(--surface-2); color: var(--text); }
.la-top-link.cur { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.la-t { border-radius: 12px; }
.la-t summary { list-style: none; display: flex; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 10px; cursor: pointer; font-weight: 650; font-size: .88rem; color: var(--text); user-select: none; }
.la-t summary::-webkit-details-marker { display: none; }
.la-t summary:hover { background: var(--surface-2); }
.la-t summary small { margin-left: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.la-t summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .25s var(--ease); margin-left: 4px; flex: none; }
.la-t[open] summary::after { transform: rotate(45deg); }
.la-ic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--ink)) 14%, transparent); color: var(--c, var(--ink)); flex: none; }
.la-tt { line-height: 1.25; }
.la-t ol { list-style: none; margin: 2px 0 8px; padding: 0 0 0 22px; position: relative; }
.la-t ol::before { content: ""; position: absolute; left: 22px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.la-l { display: flex; gap: 10px; align-items: flex-start; padding: 6px 8px 6px 0; border-radius: 9px; color: var(--text-2); font-size: .84rem; line-height: 1.35; text-decoration: none !important; position: relative; transition: color .2s; }
.la-l:hover { color: var(--text); }
.la-n { width: 18px; height: 18px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .65rem; font-weight: 700; background: var(--surface); border: 1.5px solid var(--border-2); color: var(--muted); margin-left: -8px; position: relative; z-index: 1; margin-top: 1px; }
.la-l.done .la-n { background: var(--c); border-color: var(--c); color: #fff; }
.la-l.cur { color: var(--text); font-weight: 650; }
.la-l.cur .la-n { border-color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.la-l.cur::after { content: ""; position: absolute; inset: 0 0 0 16px; border-radius: 9px; background: color-mix(in srgb, var(--c) 9%, transparent); z-index: -1; }
.la-x { font-style: italic; }

/* Portada de Aprender */
.la-continue { display: flex; gap: 18px; align-items: center; padding: 22px 24px; border-radius: 24px; background: var(--c); color: #fff; text-decoration: none !important; position: relative; overflow: hidden; transition: transform .3s var(--ease), box-shadow .3s; box-shadow: 0 18px 40px -22px var(--c); }
.la-continue:hover { transform: translateY(-2px); }
.la-continue::after { content: ""; position: absolute; right: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.la-continue b { display: block; font-family: var(--display); font-size: 1.45rem; line-height: 1.2; margin: 4px 0 2px; }
.la-continue small { display: block; opacity: .85; font-size: .85rem; }
.la-cic { width: 56px; height: 56px; border-radius: 18px; background: rgba(255,255,255,.16); display: grid; place-items: center; flex: none; }
.la-go { width: 54px; height: 54px; border-radius: 50%; background: #fff; color: var(--c); display: grid; place-items: center; flex: none; position: relative; z-index: 1; transition: transform .3s var(--spring); }
.la-continue:hover .la-go { transform: scale(1.1); }
.la-go .ic { fill: currentColor; }
.la-pbar { display: block; height: 6px; border-radius: 99px; background: rgba(255,255,255,.22); margin: 12px 0 6px; overflow: hidden; max-width: 420px; }
.la-pbar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width 1.1s var(--ease); }
.la-card h3 { margin: 4px 0 2px; }
.la-num { font-family: var(--display); font-weight: 800; font-size: 1.4rem; color: color-mix(in srgb, var(--c) 40%, var(--border)); }
.la-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); font-weight: 600; margin-top: auto; padding-top: 8px; }

/* Barra fija dentro de la lección */
.les-bar { position: sticky; top: 59px; z-index: 15; display: flex; gap: 10px; align-items: center; margin: 0 -8px 18px; padding: 10px 8px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.les-t { display: flex; gap: 8px; align-items: center; font-weight: 650; font-size: .88rem; color: var(--text); text-decoration: none !important; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.les-dots { display: flex; gap: 4px; flex: 1; min-width: 60px; }
.les-dots a { flex: 1; max-width: 46px; height: 6px; border-radius: 99px; background: var(--surface-3); transition: background .3s, transform .2s; }
.les-dots a:hover { transform: scaleY(1.6); }
.les-dots a.done { background: var(--c); }
.les-dots a.cur { background: var(--text); }
.les-n { font-size: .8rem; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.les-bar .icon-btn { width: 34px; height: 34px; border-radius: 10px; text-decoration: none !important; }
.les-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); }
.les-nx { display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none !important; transition: border-color .25s, transform .25s var(--ease); }
.les-nx:hover { border-color: var(--border-2); transform: translateY(-2px); }
.les-nx small { display: flex; gap: 6px; align-items: center; font-size: .76rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.les-nx b { font-size: .98rem; line-height: 1.3; }
.les-nx.next { text-align: right; background: var(--c, var(--primary)); border-color: transparent; color: #fff; }
.les-nx.next small { color: rgba(255,255,255,.85); justify-content: flex-end; }
@media (max-width: 600px) { .les-nav { grid-template-columns: 1fr; } .les-nav > span { display: none; } .les-t span:not(.la-ic) { display: none; } }

/* Móvil: el índice se abre como panel */
@media (max-width: 980px) {
  .la { grid-template-columns: 1fr; padding: 0; }
  .la-open { display: inline-flex; position: sticky; top: 66px; z-index: 30; margin: 12px 16px 0; justify-self: start; box-shadow: var(--shadow); }
  .la-side { position: fixed; z-index: 90; top: 0; left: 0; bottom: 0; height: auto; width: min(88vw, 340px); background: var(--bg); padding: 18px 14px 90px; border-right: 1px solid var(--border); transform: translateX(-105%); transition: transform .35s var(--ease); box-shadow: var(--shadow-lg); }
  .la.open .la-side { transform: none; }
  .la-veil { display: block; position: fixed; inset: 0; z-index: 85; background: rgba(20,16,10,.35); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .la.open .la-veil { opacity: 1; pointer-events: auto; }
  .la-main > .wrap { padding-top: 12px; }
  .les-bar { top: 59px; }
  .la-search kbd { display: none; }
}

.les-idx { display: none; }
@media (max-width: 980px) {
  .la:has(.les-bar) > .la-open { display: none; }
  .les-idx { display: grid; flex: none; }
  .les-bar { margin: 0 -16px 16px; padding: 8px 16px; }
}
@media (max-width: 600px) { .les-t { max-width: 38%; } .les-dots { min-width: 80px; } }

/* Al pasar de lección en lección el índice no parpadea: solo entra el contenido */
.la-suave .la-side { animation: none; }
.la-main > .wrap.page-enter { animation-duration: .28s; }
