/* =====================================================================
   Academia — plantilla de lección v2 (componentes comunes)
   Prefijo al- para no chocar con los estilos antiguos de cada lección.
   ===================================================================== */
:root {
  --al-bg: #060A12;
  --al-surface: #0F1828;
  --al-surface-2: #142036;
  --al-line: #26375A;
  --al-line-2: #31466D;
  --al-text: #ECEEF2;
  --al-body: #C9CED8;
  --al-muted: #8D95A5;
  --al-accent: #22D3EE;
  --al-accent-text: #67E8F9;
  --al-on-accent: #06222A;
  --al-amber: #F5B03A;
  --al-green: #3DDC97;
  --al-red: #F26D6D;
  --al-violet: #A78BFA;
  --al-title: 'Barlow Condensed', 'Inter', sans-serif;
  --al-mono: 'JetBrains Mono', ui-monospace, monospace;
  --al-card: linear-gradient(180deg, #132036 0%, #0E1726 55%, #0B1320 100%);
  --al-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 30px rgba(0, 0, 0, 0.45);
}

.al-lesson { max-width: 760px; margin: 0 auto; padding: 2rem 1.25rem 4rem; color: var(--al-body); font-size: 1.0625rem; line-height: 1.75; }
.al-lesson p { margin: 0 0 1.1rem; }
.al-lesson strong { color: var(--al-text); font-weight: 600; }

/* Encabezado */
.al-crumbs { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--al-muted); margin-bottom: 1.75rem; }
.al-crumbs a { color: var(--al-accent-text); text-decoration: none; }
.al-crumbs a:hover { text-decoration: underline; }
.al-kicker { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--al-accent-text); margin-bottom: 0.5rem; }
.al-lesson h1.al-title { font-family: var(--al-title); font-weight: 700; font-size: clamp(2.2rem, 5vw, 3.1rem); line-height: 1.02; letter-spacing: 0.01em; text-transform: uppercase; color: var(--al-text); margin: 0 0 1rem; }
.al-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 2rem; }
.al-chip { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--al-muted); padding: 4px 10px; background: var(--al-surface-2); border: 1px solid var(--al-line-2); border-radius: 2px; }
.al-chip.is-free { color: var(--al-green); border-color: rgba(61, 220, 151, 0.4); }

/* Lo que vas a aprender */
.al-learn { background: var(--al-card); border: 1px solid rgba(34, 211, 238, 0.22); box-shadow: var(--al-shadow); border-radius: 8px; padding: 1.25rem 1.5rem; margin: 0 0 2.75rem; }
.al-learn-title { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--al-accent-text); margin: 0 0 0.75rem; }
.al-learn ol { margin: 0; padding: 0; list-style: none; counter-reset: allearn; }
.al-learn li { counter-increment: allearn; position: relative; padding-left: 2.25rem; margin: 0.45rem 0; color: var(--al-text); }
.al-learn li::before { content: "0" counter(allearn); position: absolute; left: 0; top: 0.1rem; font-family: var(--al-mono); font-size: 13px; color: var(--al-accent); }

/* Secciones */
.al-section { margin: 3rem 0 0; }
.al-lesson h2.al-h2 { font-family: var(--al-title); font-weight: 700; font-size: 1.9rem; line-height: 1.1; letter-spacing: 0.02em; text-transform: uppercase; color: var(--al-text); margin: 0 0 1rem; display: flex; align-items: baseline; gap: 12px; }
.al-h2 .al-num { font-family: var(--al-mono); font-size: 13px; font-weight: 500; letter-spacing: 0.1em; color: var(--al-accent); }
.al-lesson h3.al-h3 { font-family: var(--al-title); font-weight: 600; font-size: 1.3rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--al-text); margin: 1.75rem 0 0.75rem; }

/* Notas */
.al-callout { position: relative; margin: 1.75rem 0; padding: 1rem 1.25rem 1rem 1.25rem; background: var(--al-surface); border: 1px solid var(--al-line); border-left: 3px solid var(--al-accent); border-radius: 6px; }
.al-callout-label { font-family: var(--al-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--al-accent-text); margin-bottom: 0.35rem; }
.al-callout p:last-child { margin-bottom: 0; }
.al-callout.is-error { border-left-color: var(--al-red); }
.al-callout.is-error .al-callout-label { color: var(--al-red); }
.al-callout.is-warn { border-left-color: var(--al-amber); }
.al-callout.is-warn .al-callout-label { color: var(--al-amber); }
.al-callout.is-app { border-left-color: var(--al-accent); background: linear-gradient(90deg, rgba(34, 211, 238, 0.08), var(--al-surface) 60%); }

/* Tablas de cifras */
.al-table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 8px; overflow: hidden; font-size: 0.98rem; }
.al-table caption { caption-side: top; text-align: left; font-family: var(--al-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--al-muted); padding: 0 0 0.5rem; }
.al-table th, .al-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--al-line); text-align: left; }
.al-table td.al-num-cell, .al-table th.al-num-cell { text-align: right; font-family: var(--al-mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--al-text); }
.al-table tr:last-child td { border-bottom: 0; }
.al-table tr.al-total td { background: var(--al-surface-2); color: var(--al-text); font-weight: 600; }
.al-table tr.al-total td.al-num-cell { color: var(--al-accent-text); }
.al-table .al-sub { display: block; font-size: 0.85rem; color: var(--al-muted); }

/* Cifra destacada */
.al-stat { text-align: center; margin: 2rem 0; padding: 1.75rem 1rem; background: var(--al-card); border: 1px solid rgba(34, 211, 238, 0.22); box-shadow: var(--al-shadow); border-radius: 8px; }
.al-stat-value { font-family: var(--al-title); font-weight: 700; font-size: clamp(3rem, 9vw, 4.5rem); line-height: 1; color: var(--al-accent-text); }
.al-stat-label { margin-top: 0.5rem; color: var(--al-muted); font-size: 0.95rem; }

/* Barra apilada (reparto de costos) */
.al-stack { margin: 1.25rem 0 2rem; }
.al-stack-bar { display: flex; height: 18px; border-radius: 4px; overflow: hidden; background: var(--al-line); }
.al-stack-bar span { display: block; height: 100%; }
.al-stack-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 0.75rem; font-size: 0.9rem; color: var(--al-body); }
.al-stack-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: baseline; }
.al-c1 { background: var(--al-accent); } .al-c2 { background: #2DD4BF; } .al-c3 { background: var(--al-amber); } .al-c4 { background: var(--al-violet); }

/* Barras comparativas */
.al-bars { margin: 1rem 0 1.75rem; display: grid; gap: 10px; }
.al-bar-row { display: grid; grid-template-columns: 7.5rem 1fr 4.5rem; align-items: center; gap: 12px; font-size: 0.95rem; }
.al-bar-row .al-bar-label { color: var(--al-body); }
.al-bar-track { height: 12px; background: var(--al-line); border-radius: 3px; overflow: hidden; }
.al-bar-fill { height: 100%; background: var(--al-accent); border-radius: 3px; }
.al-bar-row .al-bar-value { font-family: var(--al-mono); text-align: right; color: var(--al-text); }

/* Diagrama */
.al-figure { margin: 1.75rem 0 2rem; padding: 1.25rem; background: var(--al-surface); border: 1px solid var(--al-line); border-radius: 8px; }
.al-figure svg { display: block; width: 100%; height: auto; }
.al-figure figcaption { margin-top: 0.75rem; font-size: 0.85rem; color: var(--al-muted); text-align: center; }

/* Captura de la app */
.al-shot { margin: 1.5rem 0 2rem; }
.al-shot-frame { border: 1px solid rgba(34, 211, 238, 0.35); border-radius: 10px; overflow: hidden; background: var(--al-bg); box-shadow: var(--al-shadow); }
.al-shot-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--al-surface-2); border-bottom: 1px solid var(--al-line); font-family: var(--al-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--al-muted); }
.al-shot-bar::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--al-accent); box-shadow: 14px 0 0 var(--al-line-2), 28px 0 0 var(--al-line-2); margin-right: 30px; }
.al-shot img { display: block; width: 100%; height: auto; }
.al-shot figcaption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--al-muted); }
.al-shot figcaption b { color: var(--al-text); font-weight: 600; }

/* Calculadora */
.al-calc { margin: 1.5rem 0 2rem; padding: 1.5rem; background: var(--al-card); border: 1px solid rgba(34, 211, 238, 0.22); box-shadow: var(--al-shadow); border-radius: 8px; }
.al-calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.al-calc-group { grid-column: 1 / -1; font-family: var(--al-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--al-muted); margin-top: 0.5rem; }
.al-field label { display: block; font-size: 0.85rem; color: var(--al-muted); margin-bottom: 4px; }
.al-field input { width: 100%; box-sizing: border-box; height: 44px; padding: 0 12px; background: var(--al-bg); border: 1px solid var(--al-line-2); border-radius: 6px; color: var(--al-text); font-family: var(--al-mono); font-size: 1rem; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45); }
.al-field input:focus { outline: none; border-color: var(--al-accent); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(34, 211, 238, 0.18); }
.al-calc-out { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--al-line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.al-out { font-size: 0.85rem; color: var(--al-muted); }
.al-out b { display: block; font-family: var(--al-title); font-size: 1.7rem; font-weight: 600; color: var(--al-text); }
.al-calc-total { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 1rem 1.25rem; background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.35); border-radius: 6px; }
.al-calc-total span { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--al-accent-text); }
.al-calc-total b { font-family: var(--al-title); font-size: 2.4rem; font-weight: 700; color: var(--al-accent-text); }

/* Botones */
.al-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 6px; font-family: var(--al-title); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none; }
.al-btn-primary { background: var(--al-accent); color: var(--al-on-accent) !important; }
.al-btn-ghost { border: 1px solid var(--al-line-2); color: var(--al-text) !important; }

/* Lista de alertas */
.al-checklist { list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.al-checklist li { position: relative; padding: 0.7rem 0 0.7rem 1.75rem; border-bottom: 1px solid var(--al-line); }
.al-checklist li:last-child { border-bottom: 0; }
.al-checklist li::before { content: ""; position: absolute; left: 0.2rem; top: 1.25rem; width: 8px; height: 8px; border-radius: 50%; background: var(--al-amber); }

/* Resumen */
.al-summary { margin: 3rem 0 0; padding: 1.5rem; border: 1px solid var(--al-line); border-top: 3px solid var(--al-accent); border-radius: 8px; background: var(--al-surface); }
.al-summary h2 { font-family: var(--al-title) !important; font-size: 1.5rem !important; text-transform: uppercase; color: var(--al-text) !important; margin: 0 0 0.75rem !important; }
.al-summary ul { margin: 0; padding-left: 1.1rem; }
.al-summary li { margin: 0.4rem 0; color: var(--al-text); }

@media (max-width: 640px) {
  .al-lesson { font-size: 1rem; padding: 1.25rem 1rem 3rem; }
  .al-calc-grid { grid-template-columns: 1fr; }
  .al-calc-out { grid-template-columns: 1fr 1fr; }
  .al-bar-row { grid-template-columns: 6rem 1fr 4rem; gap: 8px; font-size: 0.9rem; }
  .al-table th, .al-table td { padding: 0.6rem 0.75rem; }
  .al-calc-total b { font-size: 2rem; }
}

/* Fórmula */
.al-formula { margin: 1rem 0 1.5rem; padding: 0.9rem 1.1rem; background: var(--al-bg); border: 1px solid var(--al-line); border-left: 3px solid var(--al-accent); border-radius: 6px; font-family: var(--al-mono); font-size: 0.98rem; color: var(--al-accent-text); overflow-x: auto; }
.al-formula.is-wrong { border-left-color: var(--al-red); color: var(--al-body); text-decoration: line-through; text-decoration-color: rgba(242, 109, 109, 0.6); }

/* Comparación en dos columnas */
.al-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 1rem 0 1.5rem; }
.al-compare .al-table { margin: 0; }
.al-compare .al-table caption { color: var(--al-text); font-size: 12px; }

/* Colores de estado en texto */
.al-red { color: var(--al-red) !important; }
.al-amber { color: var(--al-amber) !important; }
.al-green { color: var(--al-green) !important; }

/* Mensaje del resultado de una calculadora */
.al-calc-msg { grid-column: 1 / -1; padding: 0.75rem 1rem; border-radius: 6px; font-weight: 600; color: var(--al-text); background: var(--al-surface-2); border: 1px solid var(--al-line); }
.al-calc-msg.is-red { border-color: rgba(242, 109, 109, 0.5); color: var(--al-red); }
.al-calc-msg.is-amber { border-color: rgba(245, 176, 58, 0.5); color: var(--al-amber); }
.al-calc-msg.is-green { border-color: rgba(61, 220, 151, 0.5); color: var(--al-green); }

/* Cierre de módulo */
.al-done { margin: 3rem 0 0; padding: 1.5rem; text-align: center; border: 1px solid rgba(61, 220, 151, 0.4); border-radius: 8px; background: linear-gradient(180deg, rgba(61, 220, 151, 0.08), var(--al-surface)); }
.al-done h2 { font-family: var(--al-title) !important; text-transform: uppercase; color: var(--al-green) !important; margin: 0 0 0.5rem !important; }

@media (max-width: 640px) {
  .al-compare { grid-template-columns: 1fr; }
}

/* Bloqueo suave de lecciones de pago (AcademyGate, 2026-11-24) */
.al-gated .al-section ~ .al-section,
.al-gated .al-summary,
.al-gated .al-done,
.al-gated .lesson-quiz,
.al-gated #markCompleteBtn { display: none !important; }
.al-gate { margin: 1.5rem 0 2rem; padding: 1.5rem; border: 1px solid rgba(245, 176, 58, 0.45); border-radius: 8px; background: linear-gradient(180deg, rgba(245, 176, 58, 0.10), var(--al-surface)); }
.al-gate-label { font-family: var(--al-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--al-amber); margin-bottom: 0.5rem; }
.al-gate p { margin: 0 0 1rem; color: var(--al-body); }
.al-gate-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
