/* ============================================================
   Kelp · plantilla de lectura (revamp 2026)
   Blog, artículos y textos legales. Una rejilla de dos columnas
   dentro del marco: el margen (quién firma, qué documento, el
   índice fijo) y la columna de texto a medida de lectura. Barra
   de progreso bajo la nav y componentes para lo que el texto trae:
   comparaciones, pasos, fuentes, notas, fichas y tablas.
   Prefijo lx-. Lo usan blog/index, blog/<pieza>, privacy, cookies
   y 404. El comportamiento (progreso, índice) vive en lectura.js.
   ============================================================ */
:root { --lx-side: 280px; --lx-measure: 620px; --lx-wide: 808px;
        --lx-serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif; }

/* ---- Barra de progreso de lectura, sobre el filete de la nav ---- */
.lx-bar { position: fixed; left: 0; right: 0; top: 64px; height: 2px; z-index: 61; background: var(--deep); transform-origin: left; transform: scaleX(0); pointer-events: none; }

/* ---- Rejilla: margen + columna ---- */
.lx-grid { display: grid; grid-template-columns: var(--lx-side) minmax(0, 1fr); }
.lx-side { padding: 44px 32px; border-right: 1px solid var(--line); min-width: 0; }
.lx-main { padding: 44px clamp(24px, 5vw, 64px) 96px; min-width: 0; }

/* ---- Cabecera: título a la derecha, contexto en el margen ---- */
.lx-head .lx-side { display: flex; flex-direction: column; padding-top: 96px; padding-bottom: 52px; }
.lx-head .lx-by { margin-top: auto; }
.lx-head .lx-main { padding-top: 88px; padding-bottom: 52px; }
.lx-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-3); }
.lx-crumb a:hover { color: var(--ink); }
.lx-crumb i { font-style: normal; opacity: .5; }
.lx-title { margin-top: 20px; max-width: 21ch; font-size: clamp(34px, 3.8vw, 54px); line-height: 1.06; letter-spacing: var(--track); font-weight: var(--w-head); text-wrap: balance; }
.lx-upd { margin-top: 18px; font-size: 15px; color: var(--ink-3); }
.lx-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-3); }

/* Firma de una pieza: cara, nombre y fechas */
.lx-by { display: flex; align-items: center; gap: 12px; }
.lx-by img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.lx-by b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.lx-by b a:hover { color: var(--teal); }
.lx-by small { display: block; font-size: 13.5px; color: var(--ink-3); line-height: 1.4; }

/* Otros documentos del mismo tipo (legales) */
.lx-docs { display: grid; gap: 2px; margin-top: 10px; }
.lx-docs a { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; color: var(--ink-2); }
.lx-docs a:hover { color: var(--ink); }
.lx-docs a[aria-current] { color: var(--ink); font-weight: 600; }
.lx-docs a[aria-current]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--deep); margin-left: -14px; }
.lx-docs .ext { font-size: 12px; opacity: .55; }

/* Ficha de datos clave bajo el título (legales) */
.lx-facts { margin-top: 36px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.lx-facts > div { padding: 16px 18px 18px; border-right: 1px solid var(--line); min-width: 0; }
.lx-facts > div:last-child { border-right: 0; }
.lx-facts dt { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.lx-facts dd { margin-top: 4px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.lx-facts dd a { color: var(--teal); }

/* ---- Portada de una pieza ---- */
.lx-cover { margin: 0 24px 24px; border-radius: 18px; overflow: hidden; background: #03211F; aspect-ratio: 1200 / 540; }
.lx-cover img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Índice fijo con el apartado en curso ---- */
.lx-toc { position: sticky; top: 104px; }
.lx-toc summary { display: none; }
.lx-toc ol { margin-top: 14px; list-style: none; border-left: 1px solid var(--line); display: grid; }
.lx-toc a { display: block; margin-left: -1px; padding: 6px 0 6px 16px; font-size: 14px; line-height: 1.42; color: var(--ink-3); border-left: 2px solid transparent; transition: color .25s, border-color .25s; text-wrap: pretty; }
.lx-toc a:hover { color: var(--ink); }
.lx-toc a.done { color: var(--ink-2); }
.lx-toc a.on { color: var(--ink); border-left-color: var(--deep); }

/* ---- Texto ---- */
.lx-prose { font-size: 17px; line-height: 1.7; color: var(--ink); }
.lx-prose > * { max-width: var(--lx-measure); }
.lx-prose > * + * { margin-top: 1.05em; }
.lx-prose h2 { position: relative; margin-top: 60px; font-size: 24px; line-height: 1.22; letter-spacing: -0.02em; font-weight: var(--w-head); text-wrap: balance; scroll-margin-top: 96px; }
.lx-prose > h2:first-child { margin-top: 0; }
.lx-prose h3 { font-size: 17px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; }
.lx-prose > h3 { margin-top: 32px; }
.lx-prose h2 + *, .lx-prose h3 + * { margin-top: .6em; }
.lx-prose strong { font-weight: 600; }
.lx-prose a { color: var(--teal); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: rgb(0 74 72 / .4); }
.lx-prose a:hover { text-decoration-color: var(--teal); }
/* los enlaces de la plantilla cambian de color con un fundido corto, no de golpe */
.lx-crumb a, .lx-by b a, .lx-docs a, .lx-src a, .lx-author b a { transition: color .2s; }
.lx-prose a { transition: text-decoration-color .2s; }
.lx-prose > ul:not([class]) { display: grid; gap: .45em; }
.lx-prose > ul:not([class]) > li { position: relative; padding-left: 24px; }
.lx-prose > ul:not([class]) > li::before { content: ""; position: absolute; left: 3px; top: .82em; width: 9px; height: 1.5px; border-radius: 1px; background: var(--teal); }
.lx-prose hr { border: 0; border-top: 1px solid var(--line); margin-top: 48px; }
/* Número de apartado colgado en el margen de la columna */
.lx-n { position: absolute; right: calc(100% + 14px); top: 0; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.lx-upd-end { color: var(--ink-3); font-size: 15px; }
.lx-upd-end em { font-style: italic; }

/* Cuerpo de artículo: serif de lectura (la variante D aprobada), titulares del sistema */
.lx-serif { font-family: var(--lx-serif); font-size: clamp(18.5px, 1.05rem + .32vw, 20px); line-height: 1.68; font-variant-numeric: lining-nums; }
.lx-serif > * { max-width: 664px; }
.lx-serif > * + * { margin-top: 1.3em; }
.lx-serif h2 { margin-top: 68px; padding-top: 28px; border-top: 1px solid var(--line); font-family: var(--font); font-size: clamp(24px, 2.1vw, 29px); line-height: 1.18; }
.lx-serif h2 + * { margin-top: .75em; }
.lx-lead { font-size: 1.08em; line-height: 1.6; }

/* Comparación: dos listas separadas físicamente (dentro / fuera) */
.lx-prose > .lx-pair { max-width: var(--lx-wide); margin-top: 1.5em; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lx-pair > div { padding: 20px 22px 22px; border-radius: 14px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.lx-pair > div.lx-in { background: var(--foam-2); box-shadow: inset 0 0 0 1px rgb(0 74 72 / .14); }
.lx-pair p { font-family: var(--font); font-size: 15px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
.lx-pair ul { margin-top: 12px; display: grid; gap: .7em; font-size: 16.5px; line-height: 1.52; }
.lx-pair li { position: relative; padding-left: 22px; }
.lx-pair li::before { content: ""; position: absolute; left: 1px; top: .5em; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.lx-pair .lx-in li::before { background: var(--teal); box-shadow: none; }

/* Pasos numerados (lista de acciones) */
.lx-prose > .lx-steps { margin-top: 1.4em; list-style: none; counter-reset: lxs; border-top: 1px solid var(--line); }
.lx-steps > li { counter-increment: lxs; position: relative; padding: 15px 0 16px 50px; border-bottom: 1px solid var(--line); line-height: 1.55; }
.lx-steps > li::before { content: counter(lxs); position: absolute; left: 0; top: 15px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--foam-2); color: var(--teal); font-family: var(--font); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Fuentes y notas, a la vista al final del texto */
.lx-prose > .lx-src { margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); font-family: var(--font); }
.lx-src h2 { margin: 0; padding: 0; border: 0; font-size: 20px; }
.lx-src ol { margin-top: 14px; list-style: none; display: grid; gap: 0; border-top: 1px solid var(--line); }
.lx-src li { border-bottom: 1px solid var(--line); }
.lx-src a { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; align-items: baseline; padding: 13px 0; font-size: 15.5px; line-height: 1.45; color: var(--ink); text-decoration: none; }
.lx-src a:hover { color: var(--teal); }
.lx-src a span { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.lx-prose > .lx-note { margin-top: 28px; display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-radius: 12px; background: var(--ember-2); font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.lx-note .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--ember-ink); }
.lx-ai { display: flex; align-items: center; gap: 10px; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.lx-ai .kbot { width: 24px; height: 24px; border-radius: 7px; }
.lx-prose > .lx-ai { margin-top: 18px; }

/* ---- Bloques de texto legal ---- */
.lx-prose > .lx-addr { padding: 18px 22px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); line-height: 1.75; }
.lx-prose > .lx-purp { margin-top: 18px; padding: 20px 22px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); }
.lx-purp p { margin-top: 6px; }
.lx-purp .lx-basis { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 15px; color: var(--ink-2); }
.lx-purp .lx-basis strong { color: var(--ink); }
.lx-purp + p { margin-top: 22px; }
.lx-prose > .lx-cells { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.lx-cells > li { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 500; line-height: 1.4; }
.lx-cells > li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.lx-cells > li:nth-child(3n) { border-right: 0; }
.lx-cells > li:nth-last-child(-n+3) { border-bottom: 0; }
.lx-cells.two { --n: 2; }
.lx-cells.two > li:nth-child(3n) { border-right: 1px solid var(--line); }
.lx-cells.two > li:nth-child(2n) { border-right: 0; }
.lx-cells.two > li:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
.lx-cells.two > li:nth-last-child(-n+2) { border-bottom: 0; }
.lx-prose > .lx-defs { border-top: 1px solid var(--line); }
.lx-defs > li { padding: 14px 0 15px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.lx-defs strong { display: block; color: var(--ink); }
.lx-prose > .lx-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lx-links > li { padding: 14px 18px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); line-height: 1.45; }
.lx-links strong { display: block; font-size: 14px; color: var(--ink-3); }
.lx-links a { text-decoration: none; font-weight: 600; }
.lx-prose > .lx-table { max-width: var(--lx-wide); margin-top: 1.4em; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }
.lx-table table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.lx-table th { padding: 12px 18px; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: var(--tint); border-bottom: 1px solid var(--line); }
.lx-table td { padding: 16px 18px; text-align: left; vertical-align: top; }
.lx-table td:first-child { font-weight: 600; }
.lx-table + p { margin-top: 1.4em; }

/* ---- Cierre de una pieza: firma y aviso de piezas nuevas ---- */
.lx-end { display: grid; grid-template-columns: 1fr 1fr; }
.lx-end > div { padding: 48px clamp(24px, 4.5vw, 56px) 56px; }
.lx-end > div + div { border-left: 1px solid var(--line); }
.lx-author { display: flex; gap: 18px; align-items: flex-start; }
.lx-author img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: none; }
.lx-author b { display: block; font-size: 17px; font-weight: 600; }
.lx-author b a:hover { color: var(--teal); }
.lx-author p { margin-top: 4px; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); max-width: 42ch; }
.lx-author small { display: block; margin-top: 8px; font-size: 13.5px; color: var(--ink-3); }
.lx-end .lx-ai { margin-top: 28px; }
.lx-sub h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
.lx-sub > p { margin-top: 6px; font-size: 15.5px; line-height: 1.55; color: var(--ink-2); max-width: 44ch; }
.lx-form { margin-top: 18px; display: flex; gap: 8px; max-width: 440px; }
.lx-form input { flex: 1; min-width: 0; height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); font: inherit; font-size: 15px; color: var(--ink); }
.lx-form input::placeholder { color: rgb(1 33 32 / .5); }
.lx-form input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.lx-sub small { display: block; margin-top: 10px; font-size: 13px; color: var(--ink-3); }
.lx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- Pantallas medianas y móvil ---- */
@media (max-width: 1100px) {
  :root { --lx-side: 240px; }
  .lx-prose > .lx-pair { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .lx-grid { grid-template-columns: minmax(0, 1fr); }
  .lx-side { border-right: 0; padding: 0 24px; }
  .lx-head .lx-side { order: 2; padding: 0 24px 40px; justify-content: flex-start; }
  .lx-head .lx-main { padding: 56px 24px 28px; }
  .lx-body .lx-side { padding: 20px 24px 0; }
  .lx-main { padding: 28px 24px 72px; }
  .lx-toc { position: static; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .lx-toc summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; padding: 14px 16px; font-size: 14.5px; font-weight: 600; }
  .lx-toc summary::-webkit-details-marker { display: none; }
  .lx-toc summary .ic { transition: rotate .2s; }
  .lx-toc[open] summary .ic { rotate: 180deg; }
  .lx-toc > .lx-label { display: none; }
  .lx-toc ol { margin: 0 16px 14px; }
  .lx-n { position: static; margin-right: 6px; }
  .lx-cover { margin: 0 16px 16px; border-radius: 14px; aspect-ratio: 1200 / 630; }
  .lx-docs { display: flex; flex-wrap: wrap; gap: 0 18px; }
  .lx-docs a[aria-current]::before { margin-left: 0; }
  .lx-facts { grid-template-columns: 1fr 1fr; }
  .lx-facts > div:nth-child(2n) { border-right: 0; }
  .lx-facts > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .lx-end { grid-template-columns: 1fr; }
  .lx-end > div + div { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .lx-prose > .lx-cells, .lx-prose > .lx-links { grid-template-columns: 1fr; }
  .lx-prose > .lx-cells > li { border-right: 0; border-bottom: 1px solid var(--line); }
  .lx-prose > .lx-cells > li:last-child { border-bottom: 0; }
  .lx-src a { grid-template-columns: 1fr; }
  .lx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lx-table table, .lx-table tbody, .lx-table tr, .lx-table td { display: block; width: 100%; }
  .lx-table td { padding: 6px 18px; }
  .lx-table td:first-child { padding-top: 16px; font-size: 16px; }
  .lx-table td:last-child { padding-bottom: 16px; }
  .lx-table td::before { content: attr(data-col); display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
  .lx-table td:first-child::before { content: none; }
  .lx-form { flex-wrap: wrap; }
  .lx-facts { grid-template-columns: 1fr; }
  .lx-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .lx-facts > div:last-child { border-bottom: 0; }
  .lx-facts dd { margin-top: 0; text-align: right; }
  /* toque: los enlaces pequeños del margen, el índice y el aviso de piezas nuevas llegan a ~44 px
     de alto sin cambiar cómo se ven (el relleno de las migas lo compensa un margen negativo) */
  .lx-docs a { min-height: 40px; padding: 0; }
  .lx-toc a { padding-block: 10px; }
  .lx-crumb a { padding-block: 12px; margin-block: -12px; }
  .lx-form input, .lx-form .btn { height: 44px; }
}
