/* Sección «Aprende» (aprende.py). Sólo se carga en /aprende/ y sus explainers:
   landing.css no crece. Reutiliza sus tokens (--brand, --ink, --muted, --rule, --card).
   Regla de color: el verde de marca es SÓLO para el resultado favorable. */
.ap { max-width: 880px; padding-top: 40px; }
.ap h1 { font-size: clamp(30px, 5vw, 46px); line-height: 1.1; letter-spacing: -.02em; margin: 12px 0 14px; }
.ap .lead { font-size: 19px; color: var(--muted); max-width: 34em; margin: 0 0 22px; }
.ap-sec { margin-top: 48px; }
.ap-sec > h2 { font-size: 24px; margin: 0 0 18px; }

/* Índice */
.ap-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ap-card a { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 22px; color: var(--fg);
    background: var(--card); border: 1px solid var(--rule); border-radius: 18px; box-shadow: var(--shadow-sm); }
.ap-card a:hover { text-decoration: none; border-color: var(--ink); }
.ap-card h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.ap-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.ap-card-go { margin-top: auto; padding-top: 6px; font-weight: 600; color: var(--ink); font-size: 15px; }

/* Piezas de un explainer */
.ap-formula { display: block; margin: 18px 0; padding: 14px 18px; border-radius: 12px; background: var(--bg-soft);
    border: 1px solid var(--rule); font: 600 16px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; }
.ap-fig { margin: 24px 0; }
.ap-fig svg { display: block; width: 100%; height: auto; }
.ap-bridge { margin: 28px 0; padding: 24px; border-radius: 18px; background: var(--bg-soft); border: 1px solid var(--rule); }
.ap-bridge h2 { font-size: 21px; margin: 0 0 8px; }
.ap-bridge p { margin: 0 0 16px; color: var(--muted); }
.ap-verdict { margin: 18px 0; padding: 18px 20px; border-radius: 14px; border: 2px solid var(--ink); color: var(--ink); }
.ap-verdict b { display: block; font-size: 26px; line-height: 1.15; letter-spacing: -.01em; }
.ap-verdict.is-good { border-color: var(--brand); color: var(--brand-deep); }
.ap-num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.ap-note { font-size: 14px; color: var(--muted); }
.ap-calc { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 18px 0; }
.ap-calc label { display: grid; gap: 6px; align-content: start; min-width: 0; font-size: 14px; line-height: 1.3; color: var(--muted); }
.ap-calc input { width: 100%; min-width: 0; box-sizing: border-box; font: inherit; font-size: 17px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rule); background: var(--card); color: var(--fg); }
.ap-calc input:focus-visible, .ap-copy:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.ap-copy { font: inherit; font-size: 14px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--card); color: var(--fg); cursor: pointer; }

/* Animación: sólo con JS (la clase la pone aprende.js). Sin JS (o con reduced-motion) se ve el estado final. */
.ap-js [data-ap-draw] .ap-grow { transform: scaleX(0); transform-origin: left center; transform-box: fill-box; }
.ap-js [data-ap-draw].is-in .ap-grow { transform: scaleX(1); transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.ap-js [data-ap-draw] .ap-trace { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ap-js [data-ap-draw].is-in .ap-trace { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .ap-js [data-ap-draw] .ap-grow { transform: none; }
    .ap-js [data-ap-draw] .ap-trace { stroke-dashoffset: 0; }
    .ap-js [data-ap-draw].is-in .ap-grow, .ap-js [data-ap-draw].is-in .ap-trace { transition: none; }
}
@media (max-width: 640px) { .ap .lead { font-size: 17px; } .ap-sec { margin-top: 36px; } }

/* Explainer «desvío» */
.ap-fig text { fill: var(--fg); font: 600 15px/1 var(--font); }
.ap-fig .ap-small { font-size: 13px; font-weight: 500; fill: var(--muted); }
.ap-b-track { fill: var(--bg-soft); }
.ap-b-save { fill: var(--ink); }
.ap-b-cost { fill: var(--muted); }
.ap-ruler { stroke: var(--rule); stroke-width: 3; stroke-linecap: round; }
.ap-m-be { stroke: var(--ink); stroke-width: 3; }
.ap-m-km { fill: var(--card); stroke: var(--ink); stroke-width: 3; }
.ap-formula pre { margin: 0; font: inherit; white-space: pre; }
/* La fórmula no cabe en un móvil y se cortaba sin pista de que sigue: sombras
   de desplazamiento (se ven sólo en el lado por el que queda contenido; la
   capa `local` las tapa al llegar al borde) y letra algo menor. */
.ap-formula {
    background:
        linear-gradient(90deg, var(--bg-soft) 30%, transparent) left / 28px 100% no-repeat local,
        linear-gradient(270deg, var(--bg-soft) 30%, transparent) right / 28px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(10,20,19,.32), transparent) left / 16px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(10,20,19,.32), transparent) right / 16px 100% no-repeat scroll,
        var(--bg-soft);
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) { .ap-formula { font-size: 14px; padding: 12px 14px; } }
/* Gráfico del desvío con los colores de la marca (antes negro y gris): el
   ahorro en verde, el coste en salvia, «tu desvío» como punto de marca y el
   equilibrio como umbral discontinuo. Acotado a esta figura: `.ap-b-save` y
   `.ap-b-cost` los comparten otros explainers con otro significado. */
.ap-fig-desvio .ap-b-save { fill: var(--brand); }
.ap-fig-desvio .ap-b-cost { fill: #a9bdb6; }
.ap-fig-desvio .ap-m-be { stroke: var(--muted); stroke-width: 3; stroke-dasharray: 5 4; }
.ap-fig-desvio .ap-m-km { fill: var(--green-text, #0a6f6e); stroke: var(--card); stroke-width: 3; }
@media (prefers-color-scheme: dark) { .ap-fig-desvio .ap-b-cost { fill: #4d605a; } }
.ap-res dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 14px 0; }
.ap-res dt { font-size: 13px; color: var(--muted); }
.ap-res dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; }
.ap-verdict span { display: block; margin-top: 6px; font-size: 16px; color: var(--fg); font-weight: 400; }
.ap-method { padding-left: 20px; color: var(--muted); }
.ap-method li { margin: 6px 0; }
.ap-surprise { font-size: 20px; line-height: 1.4; font-weight: 600; margin: 0; max-width: 28em; }

/* Explainer «velocidad» */
.ap-curve { fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.ap-l-time { stroke: var(--ink); stroke-width: 3.5; }
.ap-l-fuel { stroke: var(--muted); stroke-width: 3.5; stroke-linecap: round; }
.ap-fig .ap-small { paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.ap-vm { stroke: var(--rule); stroke-width: 2; stroke-dasharray: 4 5; }
.ap-ab { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 18px 0; }
.ap-tile { padding: 18px 20px; border-radius: 14px; background: var(--bg-soft); border: 1px solid var(--rule); }
.ap-tile h3 { margin: 0 0 8px; font-size: 17px; }
.ap-tile dl { display: grid; gap: 8px; margin: 0; }
.ap-tile dl div { display: flex; justify-content: space-between; gap: 12px; }
.ap-tile dt { color: var(--muted); font-size: 14px; }
.ap-tile dd { margin: 0; font-weight: 700; }
/* En móvil el SVG se encoge con el ancho: se sube el texto para que siga legible (~12 px). */
@media (max-width: 640px) { .ap-fig text { font-size: 24px; } .ap-fig .ap-small { font-size: 21px; } }
.ap-eq { padding: 10px 14px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--rule); color: var(--fg); }
.ap-eq[hidden] { display: none; }
