/* ============================================================================
   Fundamentos de Álgebra para Gente Normal — versión web
   Rediseño visual: misma gramática del PDF/libro
   ============================================================================ */

@font-face {
  font-family: 'KaTeX_Main';
  src: url('vendor/katex/fonts/KaTeX_Main-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'KaTeX_Main';
  src: url('vendor/katex/fonts/KaTeX_Main-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'KaTeX_Main';
  src: url('vendor/katex/fonts/KaTeX_Main-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'KaTeX_Main';
  src: url('vendor/katex/fonts/KaTeX_Main-BoldItalic.woff2') format('woff2');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --page: #ffffff;
  --outside: #e9e9e9;
  --ink: #050505;
  --ink-soft: #181818;
  --ink-mute: #505050;
  --ink-faint: #888888;
  --rule: #000000;
  --rule-soft: #d5d5d5;

  --book-blue: #0b008b;
  --book-blue-border: #1200a8;
  --book-blue-soft: #f3f3ff;
  --book-olive: #999744;
  --book-olive-border: #8d8b35;
  --book-olive-soft: #fffdf1;

  --good: #2e6f3e;
  --good-soft: #edf7ee;
  --bad: #9b231c;
  --bad-soft: #fff0ed;

  --serif: 'KaTeX_Main', 'Latin Modern Roman', 'Computer Modern Serif', Georgia, 'Times New Roman', serif;
  --sans: Arial, Helvetica, system-ui, -apple-system, sans-serif;
  --mono: 'KaTeX_Typewriter', 'Courier New', monospace;

  --sidebar-w: 318px;
  --reading-col: 820px;
  --radius-sm: 0;
  --radius: 0;
  --radius-lg: 0;
  --shadow-page: 0 16px 40px rgba(0, 0, 0, .18);
}

[data-theme='dark'] {
  --page: #101010;
  --outside: #050505;
  --ink: #f5f5f5;
  --ink-soft: #eeeeee;
  --ink-mute: #bdbdbd;
  --ink-faint: #868686;
  --rule: #f5f5f5;
  --rule-soft: #333333;
  --book-blue: #2c31ff;
  --book-blue-border: #3b40ff;
  --book-blue-soft: #10122a;
  --book-olive: #c4c071;
  --book-olive-border: #b3ae54;
  --book-olive-soft: #22200e;
  --good: #7fce8c;
  --good-soft: #102015;
  --bad: #ff8a7e;
  --bad-soft: #29110f;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.47;
  color: var(--ink);
  background: var(--outside);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before { display: none; }
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--book-blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
::selection { background: var(--book-blue); color: #fff; }

h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0;
  line-height: 1.14;
  letter-spacing: 0;
  font-weight: 700;
}
h1 { font-size: clamp(2.35rem, 4.3vw, 3.7rem); }
h2 { font-size: clamp(1.65rem, 2.8vw, 2.3rem); }
h3 { font-size: 1.42rem; }
h4 { font-size: 1.08rem; }
p { margin: 0 0 .85em; }
strong, b { font-weight: 700; color: var(--ink); }
em, i { font-style: italic; }
code, kbd {
  font-family: var(--mono);
  font-size: .92em;
  background: #f0f0f0;
  border: 1px solid var(--rule-soft);
  padding: .05em .25em;
}
[data-theme='dark'] code,
[data-theme='dark'] kbd { background: #1d1d1d; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
}
.reading { max-width: var(--reading-col); margin: 0 auto; }
.eyebrow {
  font-family: var(--serif);
  color: var(--ink);
  font-size: .95rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 700;
  margin: 0 0 .65em;
}
.muted { color: var(--ink-mute); }
.tiny { font-size: .85rem; }
.hide-on-mobile { display: inline; }

/* -------------------------------------------------------------------------
   Botones: rectos, de libro/manual, no SaaS
   ------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  padding: .64em 1.05em;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
  font-size: .98rem;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
  transition: background .1s ease, color .1s ease, border-color .1s ease;
}
.btn:hover { text-decoration: none; background: var(--ink); color: var(--page); }
.btn-primary { background: var(--ink); color: var(--page); border-color: var(--ink); }
.btn-primary:hover { background: var(--book-blue); border-color: var(--book-blue); color: #fff; }
.btn-secondary, .btn-ghost { background: var(--page); color: var(--ink); border-color: var(--rule); }
.btn-sm { padding: .44em .75em; font-size: .88rem; }

/* ============================================================================
   LANDING
   ============================================================================ */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(6px);
}
[data-theme='dark'] .landing-nav { background: rgba(16, 16, 16, .96); }
.landing-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.06rem;
}
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
}
.nav-links {
  display: flex;
  gap: 22px;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--serif);
}
.nav-links a { color: var(--ink); font-size: .95rem; }
.nav-links a:hover { color: var(--book-blue); text-decoration: none; }
@media (max-width: 760px) { .nav-links { display: none; } }

.hero {
  padding: 54px 0 46px;
  background: var(--outside);
}
.hero .container {
  background: var(--page);
  min-height: 770px;
  padding: 92px 68px 54px;
  box-shadow: var(--shadow-page);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 60px;
  align-items: start;
}
.hero h1 {
  font-size: clamp(2.4rem, 4.3vw, 4rem);
  text-align: left;
  margin: 0 0 .35em;
}
.hero h1 em { color: var(--ink); }
.hero-lead {
  max-width: 620px;
  font-size: 1.16rem;
  line-height: 1.56;
  color: var(--ink);
  margin-bottom: 1.5em;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 1.8em 0 1.1em; }
.hero-microproof { color: var(--ink-mute); font-size: .93rem; margin: 0; }
.hero-microproof::before { content: none; }
.book-mock { perspective: none; }
.book-card {
  background: var(--page);
  border: 1px solid var(--rule);
  padding: 42px 32px;
  min-height: 520px;
  transform: none;
  box-shadow: none;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.book-card::before { display: none; }
.book-card h3 {
  font-size: 2rem;
  line-height: 1.24;
  text-align: center;
  margin: 34px 0 10px;
}
.book-card .muted { text-align: center; color: var(--ink); }
.book-card .stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--rule);
  margin-top: 34px;
  padding-top: 16px;
}
.book-card .stat { text-align: center; border-right: 1px solid var(--rule-soft); }
.book-card .stat:last-child { border-right: 0; }
.book-card .stat .num { font-size: 1.55rem; font-weight: 700; }
.book-card .stat .lbl { font-size: .84rem; color: var(--ink-mute); }

.section {
  padding: 54px 0;
  background: var(--outside);
}
.section .container,
.cta-final {
  background: var(--page);
  border: 0;
}
.section-rule { border-top: 0; }
.section-head {
  text-align: left;
  max-width: 820px;
  margin: 0 auto 28px;
}
.section-head h2 { margin-bottom: .45em; }
.section-head p { color: var(--ink); font-size: 1.05rem; }
.values, .method, .pricing, .testimonials, .curriculum, .dash-chap-grid {
  display: grid;
  gap: 14px;
}
.values { grid-template-columns: repeat(3, 1fr); }
.method { grid-template-columns: repeat(4, 1fr); }
.pricing { grid-template-columns: repeat(3, 1fr); }
.testimonials { grid-template-columns: repeat(3, 1fr); }
.curriculum { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.value-card, .method-step, .chap-chip, .price-card, .testi, .faq, .dash-chap, .stat-tile {
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
}
.value-card, .method-step, .price-card, .testi { padding: 20px; }
.value-card .icon {
  width: 36px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  background: var(--page);
  color: var(--ink);
  border-radius: 0;
  margin-bottom: 12px;
  font-weight: 700;
}
.value-card h3, .price-card h3 { font-size: 1.15rem; margin-bottom: .35em; }
.value-card p, .method-step p, .price-card p, .testi p { color: var(--ink); }
.method-step .num, .chap-chip .num, .dash-chap .num, .stat-tile .num { color: var(--book-blue); font-family: var(--serif); }
.method-step .num { font-size: 2rem; }
.chap-chip {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  transition: none;
}
.chap-chip:hover, .dash-chap:hover { transform: none; box-shadow: none; border-color: var(--book-blue); text-decoration: none; }
.chap-chip .num { width: 28px; font-weight: 700; text-align: center; }
.chap-chip .title, .dash-chap .title { font-weight: 700; color: var(--ink); }
.chap-chip .meta { font-size: .82rem; color: var(--ink-mute); }
.price-card.featured {
  background: var(--book-blue-soft);
  color: var(--ink);
  border-color: var(--book-blue-border);
  transform: none;
}
.price-card.featured h3,
.price-card.featured .price .num,
.price-card.featured strong { color: var(--ink); }
.price-tag {
  position: static;
  display: inline-block;
  width: fit-content;
  margin-bottom: 10px;
  padding: 2px 7px;
  background: var(--book-blue);
  color: #fff;
  border-radius: 0;
  font-family: var(--serif);
  font-size: .78rem;
}
.price .num { font-size: 2.2rem; font-weight: 700; }
.price-feat { padding-left: 1.2em; margin: 1em 0; }
.price-feat li { padding: 4px 0; border: 0; color: var(--ink); }
.price-feat li::before { content: none; }

.series-grid {
  display: grid;
  grid-template-columns: .86fr 1.14fr;
  gap: 14px;
}
.series-card,
.series-promo {
  background: var(--page);
  border: 1px solid var(--rule);
  border-radius: 0;
  box-shadow: none;
  padding: 22px;
}
.series-card.featured,
.series-promo {
  background: var(--book-blue-soft);
  border-color: var(--book-blue-border);
}
.series-card h3,
.series-promo h2 {
  margin-bottom: .45em;
}
.series-card p,
.series-promo p {
  color: var(--ink);
}
.book-links,
.series-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.book-links.center {
  justify-content: center;
}
.amazon-note {
  text-align: center;
  margin-top: 22px;
  color: var(--ink-mute);
  font-size: .9rem;
}
.amazon-topbar {
  align-self: center;
}
.series-sidebar {
  background: var(--book-blue-soft);
  border: 1px solid var(--book-blue-border);
  padding: 12px;
}
.series-sidebar .btn {
  width: 100%;
  margin-top: 8px;
}
.series-promo {
  margin: 30px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}
.series-promo.compact {
  margin-top: 32px;
  margin-bottom: 22px;
}
.series-promo .eyebrow {
  color: var(--book-blue);
}
.series-actions {
  justify-content: flex-end;
  min-width: 280px;
}

.faq { max-width: 820px; padding: 0 22px; }
.faq-item { border-bottom: 1px solid var(--rule-soft); }
.faq-item summary { padding: 15px 0; font-weight: 700; list-style: none; cursor: pointer; }
.faq-item summary::after { content: '+'; float: right; color: var(--book-blue); }
.faq-item[open] summary::after { content: '-'; }
.faq-item .answer { color: var(--ink); padding-bottom: 16px; }
.cta-final {
  max-width: 1040px;
  margin: 54px auto;
  padding: 44px 36px;
  border: 1px solid var(--rule);
  color: var(--ink);
  text-align: center;
  border-radius: 0;
}
.cta-final::before { display: none; }
.cta-final h2, .cta-final p { color: var(--ink); }
.footer {
  background: var(--outside);
  border-top: 1px solid var(--rule);
  padding: 24px 0;
  color: var(--ink-mute);
}
.footer .container { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }


/* ==========================================================================
   I18N / LANGUAGE SWITCHER
   ========================================================================== */
.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  line-height: 1;
  color: var(--ink-soft);
  white-space: nowrap;
}
.language-switcher span {
  letter-spacing: 0.02em;
}
.language-select {
  min-height: 36px;
  max-width: 170px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  cursor: pointer;
}
.language-select:focus {
  outline: 2px solid var(--book-blue);
  outline-offset: 2px;
}
.landing-language .language-select { max-width: 145px; }
.hero-language {
  margin-top: 14px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--page), var(--outside) 30%);
}
.language-note,
.content-language-note {
  margin-top: 12px;
  max-width: 680px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.content-language-note {
  margin: -16px auto 24px;
  padding: 10px 12px;
  border-left: 3px solid var(--book-blue);
  background: color-mix(in srgb, var(--book-blue), transparent 92%);
}
html[dir="rtl"] body { text-align: right; }
html[dir="rtl"] .app-shell { direction: rtl; }
html[dir="rtl"] .problem-input,
html[dir="rtl"] textarea.problem-input { text-align: right; }
html[dir="rtl"] .brand,
html[dir="rtl"] .topbar-left,
html[dir="rtl"] .topbar-actions,
html[dir="rtl"] .hero-cta,
html[dir="rtl"] .stat-row { direction: rtl; }
html[dir="rtl"] .chap-nav .next { text-align: left; }
html[dir="rtl"] .content-language-note { border-left: 0; border-right: 3px solid var(--book-blue); }

/* ============================================================================
   APP
   ============================================================================ */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: var(--outside);
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  grid-column: 1 / -1;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  background: var(--page);
  border-bottom: 1px solid var(--rule);
}
.topbar-left, .topbar-actions, .topbar-progress { display: flex; align-items: center; gap: 12px; }
.topbar-progress { font-size: .9rem; color: var(--ink); }
.topbar-progress .bar,
.problems-progress .bar,
.dash-chap .pbar {
  width: 150px;
  height: 7px;
  background: var(--page);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.topbar-progress .bar > span,
.problems-progress .bar > span,
.dash-chap .pbar span {
  display: block;
  height: 100%;
  background: var(--book-blue);
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 0;
  border: 1px solid var(--rule);
  background: var(--page);
  color: var(--ink);
  display: grid;
  place-items: center;
}
.icon-btn:hover { background: var(--ink); color: var(--page); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

.app-sidebar {
  background: var(--page);
  border-right: 1px solid var(--rule);
  height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
  overflow-y: auto;
  padding: 22px 18px 38px;
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-section h5 {
  margin: 0 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  font-size: .85rem;
  font-family: var(--serif);
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-weight: 700;
}
.path-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--rule);
  background: var(--page);
}
.path-toggle button {
  border: 0;
  border-right: 1px solid var(--rule);
  background: var(--page);
  color: var(--ink);
  padding: 8px 7px;
  font-size: .86rem;
}
.path-toggle button:last-child { border-right: 0; }
.path-toggle button.active { background: var(--book-blue); color: #fff; font-weight: 700; }
.path-hint { color: var(--ink-mute); font-size: .83rem; padding: 0; }
.chap-list { list-style: none; padding: 0; margin: 0; }
.chap-list li { margin: 0; border-bottom: 1px solid var(--rule-soft); }
.chap-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  gap: 9px;
  align-items: center;
  padding: 10px 4px;
  color: var(--ink);
  text-decoration: none;
}
.chap-link:hover { color: var(--book-blue); text-decoration: none; }
.chap-link.active { background: var(--book-blue-soft); color: var(--ink); }
.chap-num { font-weight: 700; color: var(--book-blue); text-align: center; }
.chap-link .body { min-width: 0; }
.chap-link .title {
  font-size: .9rem;
  line-height: 1.22;
  font-weight: 700;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
}
html[lang="en"] .app-sidebar .chap-link .title {
  font-size: .86rem;
}
.chap-link .chap-meta { font-size: .75rem; color: var(--ink-mute); }
.chap-status {
  width: 13px;
  height: 13px;
  border: 1px solid var(--rule);
  border-radius: 0;
}
.chap-status.partial { background: var(--book-olive); }
.chap-status.partial::after { content: none; }
.chap-status.done { background: var(--good); border-color: var(--good); }
.chap-status.done::after { content: none; }

.app-main {
  width: min(100% - 52px, 1010px);
  min-height: calc(100vh - 118px);
  margin: 30px auto 70px;
  padding: 106px 78px 78px;
  background: var(--page);
  color: var(--ink);
  box-shadow: var(--shadow-page);
  position: relative;
}
.crumb {
  display: none;
}
.chap-hero { margin-bottom: 36px; }
.chapter-number,
.chap-hero .eyebrow {
  font-family: var(--serif);
  color: var(--ink);
  font-size: 1.42rem;
  font-weight: 700;
  margin: 0 0 28px;
}
.chap-hero h1 {
  max-width: 850px;
  font-size: clamp(2.2rem, 4vw, 3.42rem);
  line-height: 1.16;
  margin-bottom: 36px;
}
.chap-hero .subtitle {
  display: none;
}

/* Cajas del libro: cabecera coloreada + cuerpo pálido */
.objective-box,
.book-box,
.block.idea,
.block.note,
.block.reallife,
.block.recipe,
.block.checklist {
  max-width: var(--reading-col);
  border-radius: 0;
  margin: 24px 0;
  padding: 0;
  overflow: hidden;
  box-shadow: none;
}
.objective-box,
.block.note,
.block.reallife,
.block.recipe,
.block.checklist {
  border: 1px solid var(--book-olive-border);
  background: var(--book-olive-soft);
}
.book-box,
.block.idea {
  border: 1px solid var(--book-blue-border);
  background: var(--book-blue-soft);
}
.objective-box h4,
.book-box h4,
.block.idea h4,
.block.note h4,
.block.reallife h4,
.block.recipe h4,
.block.checklist h4 {
  display: block;
  margin: 0;
  padding: 3px 18px 4px;
  font-family: var(--serif);
  font-size: 1.03rem;
  line-height: 1.1;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
  text-transform: none;
}
.objective-box h4,
.block.note h4,
.block.reallife h4,
.block.recipe h4,
.block.checklist h4 { background: var(--book-olive); }
.book-box h4,
.block.idea h4 { background: var(--book-blue); }
.objective-box .box-body,
.book-box .body,
.block.idea .body,
.block.note .box-body,
.block.note > p,
.block.reallife .box-body,
.block.reallife > p,
.block.recipe .box-body,
.block.checklist .box-body {
  padding: 16px 20px 17px;
}
.objective-box p { margin: 0 0 .65em; }
.objective-box ul,
.block.checklist ul { margin: .45em 0 0; padding-left: 1.1em; list-style-type: square; }
.objective-box li,
.block.checklist li {
  padding: 3px 0;
  color: var(--ink);
  font-size: 1rem;
  position: static;
}
.block.checklist li::before { content: none; }

.block { max-width: var(--reading-col); margin: 26px 0; }
.block.text p,
.block.idea .body,
.block.note,
.block.reallife,
.block.recipe,
.book-box .body {
  font-size: 1.03rem;
  color: var(--ink);
  line-height: 1.47;
}
.block.idea .body p,
.book-box .body p { margin: 0 0 .72em; }
.block.idea .body p:last-child,
.book-box .body p:last-child { margin-bottom: 0; }
.block.idea .body strong { color: var(--ink); }
.block.why-section {
  margin-top: 34px;
}
.block.why-section > h3 {
  font-size: 1.72rem;
  margin: 0 0 16px;
}
.block.subheading {
  margin: 34px 0 12px;
  padding: 0;
  border: 0;
}
.block.subheading h3 {
  font-size: 1.32rem;
  font-weight: 700;
  display: block;
}
.block.subheading h3::before { content: none; }
.block.note p,
.block.reallife p { margin: 0; }
.block.recipe h4::before { content: none; }
.block.recipe ol {
  margin: 0;
  padding-left: 1.4em;
  counter-reset: none;
  list-style: decimal;
}
.block.recipe ol li {
  padding: 3px 0;
  color: var(--ink);
  position: static;
}
.block.recipe ol li::before { content: none; }

/* Ejemplos: menos tarjeta SaaS, más bloque de página */
.block.example {
  max-width: var(--reading-col);
  margin: 28px 0;
  background: var(--page);
  border: 0;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}
.block.example .ex-head {
  display: block;
  background: transparent;
  border: 0;
  padding: 0;
}
.block.example .ex-head .label {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--ink);
  margin-bottom: .42em;
  letter-spacing: 0;
  text-transform: none;
}
.block.example .ex-head .prompt {
  display: block;
  font-family: var(--serif);
  font-size: 1.03rem;
  color: var(--ink);
  margin-bottom: .65em;
}
.block.example .ex-body {
  padding: 0 0 0 18px;
  border-left: 2px solid var(--rule-soft);
}
.block.example .step {
  padding: 6px 0;
  border-bottom: 0;
}
.block.example .step-text {
  color: var(--ink);
  font-size: 1.01rem;
  line-height: 1.47;
  margin: 0 0 2px;
}
.block.example .step-math {
  margin: 4px 0 6px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 1.05rem;
  color: var(--ink);
}
.block.example .ex-answer {
  display: inline-block;
  margin-top: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.block.bridge {
  max-width: var(--reading-col);
  background: var(--book-olive-soft);
  border: 1px solid var(--book-olive-border);
  border-radius: 0;
  padding: 18px 20px;
  margin-top: 34px;
}
.block.bridge h4 {
  color: var(--ink);
  font-size: 1.12rem;
  margin-bottom: 8px;
  font-style: normal;
}
.block.bridge p { color: var(--ink); }

/* Problemas */
.problems-section {
  max-width: var(--reading-col);
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--rule);
}
.problems-section .eyebrow { display: none; }
.problems-section h2 {
  font-size: 1.55rem;
  margin-bottom: .35em;
}
.problems-section .lead { color: var(--ink); max-width: 680px; margin-bottom: 18px; }
.problems-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--page);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  margin-bottom: 16px;
}
.problems-progress { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.problem {
  border: 1px solid var(--rule);
  background: var(--page);
  border-radius: 0;
  padding: 16px 18px;
  margin-bottom: 12px;
}
.problem.solved { background: var(--good-soft); border-color: var(--good); }
.problem.failed { border-color: var(--bad); }
.problem-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.problem-num {
  flex-shrink: 0;
  min-width: 42px;
  height: auto;
  padding: 2px 4px;
  border-radius: 0;
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.problem.solved .problem-num { background: var(--good); color: #fff; border-color: var(--good); }
.problem-prompt {
  flex: 1;
  color: var(--ink);
  font-size: 1.03rem;
  line-height: 1.45;
  padding-top: 2px;
}
.problem-input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: stretch;
}
.problem-input {
  flex: 1;
  min-width: 210px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  font-size: .95rem;
}
.problem-input:focus { outline: 2px solid var(--book-blue); outline-offset: 0; }
.problem-input::placeholder { font-family: var(--serif); color: var(--ink-faint); font-style: italic; }
.problem .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-check { background: var(--book-blue); border-color: var(--book-blue); color: #fff; }
.btn-check:hover { background: var(--ink); border-color: var(--ink); color: var(--page); }
.feedback {
  display: none;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  font-size: .95rem;
}
.feedback.show { display: block; }
.feedback.good { background: var(--good-soft); color: var(--ink); border-color: var(--good); }
.feedback.bad { background: var(--bad-soft); color: var(--ink); border-color: var(--bad); }
.feedback.neutral { background: var(--book-blue-soft); color: var(--ink); border-color: var(--book-blue-border); }
.solution-box {
  display: none;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--book-blue-soft);
  border: 1px solid var(--book-blue-border);
  color: var(--ink);
  line-height: 1.48;
}
.solution-box.show { display: block; }
.solution-box .sol-label {
  display: block;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.chap-complete {
  max-width: var(--reading-col);
  margin-top: 44px;
  padding: 20px 22px;
  background: var(--page);
  border: 1px solid var(--rule);
  text-align: left;
  border-radius: 0;
}
.chap-complete.done { background: var(--good-soft); border-color: var(--good); }
.chap-complete h3 { font-size: 1.25rem; margin-bottom: 6px; }
.chap-complete p { color: var(--ink); margin-bottom: 12px; }
.chap-nav {
  max-width: var(--reading-col);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}
.chap-nav a {
  display: block;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  background: var(--page);
  color: var(--ink);
  text-decoration: none;
}
.chap-nav a:hover { border-color: var(--book-blue); color: var(--book-blue); }
.chap-nav .dir { font-size: .82rem; color: var(--ink-mute); margin-bottom: 3px; }
.chap-nav .lbl { font-weight: 700; }
.chap-nav .next { text-align: right; }

/* Dashboard */
.dashboard { padding: 0; }
.dashboard h1 { font-size: clamp(2.2rem, 4vw, 3.4rem); margin-bottom: .45em; }
.dashboard-lead { max-width: 780px; color: var(--ink); font-size: 1.12rem; margin-bottom: 26px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.stat-tile { padding: 14px 16px; }
.stat-tile .num { font-size: 2rem; font-weight: 700; }
.stat-tile .lbl { color: var(--ink-mute); font-size: .88rem; }
.stat-tile.accent { background: var(--book-blue-soft); border-color: var(--book-blue-border); }
.continue-card {
  border: 1px solid var(--book-blue-border);
  background: var(--book-blue-soft);
  padding: 20px 22px;
  margin-bottom: 34px;
  color: var(--ink);
  border-radius: 0;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.continue-card::before { display: none; }
.continue-card .eyebrow, .continue-card h2, .continue-card p { color: var(--ink); }
.continue-card h2 { font-size: 1.55rem; }
.dash-section { margin-bottom: 30px; }
.dash-section h2 { font-size: 1.35rem; margin-bottom: 12px; display: flex; justify-content: space-between; gap: 10px; }
.dash-section h2 .meta { font-size: .9rem; color: var(--ink-mute); font-weight: 400; }
.dash-chap-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.dash-chap { display: block; padding: 13px 14px; color: var(--ink); text-decoration: none; }
.dash-chap .row1 { display: flex; justify-content: space-between; margin-bottom: 7px; }
.dash-chap .pct { color: var(--ink-mute); }
.dash-chap .title { margin-bottom: 8px; }
.dash-chap.done .pbar span { background: var(--good); }

/* KaTeX */
.katex { font-size: 1.04em !important; }
.block.example .step-math .katex { font-size: 1.07em !important; }
.problem-prompt .katex { font-size: 1.06em !important; }
.katex-display { margin: .65em 0; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 24; }
.sidebar-backdrop.show { display: block; }

@media (max-width: 1100px) {
  .app-main { width: calc(100% - 32px); padding-left: 56px; padding-right: 56px; }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .menu-btn { display: grid; }
  .app-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 86%;
    max-width: 340px;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-page);
  }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin: 18px auto 44px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero .container { min-height: auto; }
  .values, .pricing, .testimonials { grid-template-columns: 1fr; }
  .method { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .landing-nav .language-switcher { display: none; }
  .hero-language { display: inline-flex; }
}

@media (min-width: 761px) {
  .hero-language { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .container { padding: 0 18px; }
  .hero .container { padding: 54px 28px 38px; box-shadow: none; }
  .hero { padding: 0; }
  .app-main { width: 100%; margin: 0; padding: 56px 22px 48px; box-shadow: none; }
  .topbar-progress .bar { width: 78px; }
  .hide-on-mobile { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .method { grid-template-columns: 1fr; }
  .chap-nav { grid-template-columns: 1fr; }
  .chap-nav .next { text-align: left; }
  .chapter-number, .chap-hero .eyebrow { font-size: 1.2rem; margin-bottom: 18px; }
  .chap-hero h1 { font-size: 2rem; }
}
@media (max-width: 480px) {
  .topbar-progress span { display: none; }
  .book-card { min-height: auto; }
  .problem-head { flex-direction: column; gap: 7px; }
  .problem-num { width: fit-content; }
}
@media print {
  body { background: #fff; }
  .app-sidebar, .app-topbar, .problems-toolbar, .chap-nav, .chap-complete { display: none !important; }
  .app-shell { grid-template-columns: 1fr; }
  .app-main { width: auto; margin: 0; box-shadow: none; padding: 0; }
}
.block.recipe li p,
.block.checklist li p,
.objective-box li p { margin: 0; }

/* ============================================================================
   Ajustes mobile-first para estudio en celular
   ============================================================================ */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app-main,
.app-sidebar,
.block,
.objective-box,
.book-box,
.problem,
.solution-box,
.continue-card,
.stat-tile,
.dash-chap,
.chap-nav a,
.btn,
.icon-btn,
.problem-input {
  min-width: 0;
}

.btn,
.icon-btn,
.path-toggle button,
.chap-link,
.problem-input,
.faq-item summary {
  touch-action: manipulation;
}

.katex-display,
.step-math,
.problem-prompt,
.solution-box {
  max-width: 100%;
}

.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.block.example .step-math,
.problem-prompt,
.solution-box,
.block.text p,
.block.idea .body,
.book-box .body {
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  body.sidebar-open {
    overflow: hidden;
    touch-action: none;
  }

  .app-sidebar {
    height: calc(100dvh - 64px);
    padding-bottom: calc(38px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  .sidebar-backdrop.show {
    display: block;
    backdrop-filter: blur(1px);
  }

  .chap-link {
    min-height: 48px;
    padding: 11px 6px;
  }
}

@media (max-width: 720px) {
  :root {
    --reading-col: 100%;
  }

  body {
    font-size: 16.5px;
    line-height: 1.52;
    background: var(--page);
  }

  .app-shell {
    min-height: 100dvh;
    background: var(--page);
  }

  .app-topbar {
    height: 58px;
    padding: 7px max(10px, env(safe-area-inset-left)) 7px max(10px, env(safe-area-inset-right));
    gap: 8px;
  }

  .topbar-left,
  .topbar-actions {
    gap: 7px;
  }

  .topbar-actions .language-switcher span {
    display: none;
  }

  .amazon-topbar {
    display: none;
  }

  .topbar-actions .language-select {
    width: 82px;
    min-height: 42px;
    padding-left: 7px;
    padding-right: 20px;
    font-size: 0.78rem;
  }

  .topbar-progress {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 72px;
    gap: 7px;
  }

  .topbar-progress .bar {
    width: min(27vw, 116px);
    height: 8px;
  }

  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .icon-btn svg {
    width: 19px;
    height: 19px;
  }

  .app-sidebar {
    top: 58px;
    width: min(92vw, 390px);
    max-width: none;
    height: calc(100dvh - 58px);
    padding: 18px 16px calc(30px + env(safe-area-inset-bottom));
  }

  .sidebar-section {
    margin-bottom: 24px;
  }

  .sidebar-section h5 {
    font-size: .95rem;
  }

  .path-toggle button {
    min-height: 44px;
    font-size: .92rem;
  }

  .chap-link {
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    gap: 8px;
    padding: 12px 4px;
  }

  .chap-link .title {
    font-size: .97rem;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: initial;
  }

  .chap-link .chap-meta {
    font-size: .8rem;
  }

  .app-main {
    width: 100%;
    min-height: calc(100dvh - 58px);
    margin: 0;
    padding: 34px 18px calc(52px + env(safe-area-inset-bottom));
    box-shadow: none;
  }

  .chap-hero {
    margin-bottom: 26px;
  }

  .chapter-number,
  .chap-hero .eyebrow {
    font-size: 1.08rem;
    margin-bottom: 14px;
  }

  .chap-hero h1,
  .dashboard h1,
  .hero h1 {
    font-size: clamp(1.9rem, 8.4vw, 2.45rem);
    line-height: 1.14;
    overflow-wrap: balance;
  }

  .chap-hero h1 {
    margin-bottom: 24px;
  }

  .objective-box,
  .book-box,
  .block.idea,
  .block.note,
  .block.reallife,
  .block.recipe,
  .block.checklist,
  .block.bridge {
    margin: 18px 0;
  }

  .objective-box h4,
  .book-box h4,
  .block.idea h4,
  .block.note h4,
  .block.reallife h4,
  .block.recipe h4,
  .block.checklist h4 {
    padding: 5px 12px 6px;
    font-size: .98rem;
  }

  .objective-box .box-body,
  .book-box .body,
  .block.idea .body,
  .block.note .box-body,
  .block.note > p,
  .block.reallife .box-body,
  .block.reallife > p,
  .block.recipe .box-body,
  .block.checklist .box-body {
    padding: 13px 14px 14px;
  }

  .objective-box ul,
  .block.checklist ul,
  .block.recipe ol {
    padding-left: 1.25em;
  }

  .block {
    margin: 22px 0;
  }

  .block.why-section {
    margin-top: 28px;
  }

  .block.why-section > h3 {
    font-size: 1.42rem;
    line-height: 1.18;
  }

  .block.subheading {
    margin: 28px 0 10px;
  }

  .block.subheading h3 {
    font-size: 1.18rem;
  }

  .block.example {
    margin: 24px 0;
  }

  .block.example .ex-head .label {
    font-size: 1.02rem;
  }

  .block.example .ex-body {
    padding-left: 12px;
  }

  .block.example .step {
    padding: 5px 0;
  }

  .problems-section {
    margin-top: 38px;
    padding-top: 22px;
  }

  .problems-section h2 {
    font-size: 1.38rem;
  }

  .problems-toolbar {
    align-items: stretch;
    padding: 12px;
  }

  .problems-progress {
    width: 100%;
    justify-content: space-between;
  }

  .problems-progress .bar {
    flex: 1 1 auto;
    min-width: 92px;
    max-width: 180px;
  }

  .problems-actions,
  .problems-actions .btn {
    width: 100%;
  }

  .problem {
    padding: 14px 13px;
    margin-bottom: 12px;
  }

  .problem-head {
    gap: 10px;
  }

  .problem-num {
    min-width: 38px;
    font-size: .95rem;
  }

  .problem-prompt {
    font-size: 1rem;
  }

  .problem-input-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .problem-input {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    font-size: 16px;
    padding: 10px 11px;
  }

  textarea.problem-input {
    min-height: 92px;
  }

  .problem .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .problem .actions .btn {
    width: 100%;
    min-height: 44px;
    padding-left: .7em;
    padding-right: .7em;
    white-space: normal;
  }

  .feedback,
  .solution-box {
    font-size: .98rem;
  }

  .chap-complete {
    margin-top: 36px;
    padding: 17px 15px;
  }

  .chap-complete .btn {
    width: 100%;
    min-height: 46px;
  }

  .chap-nav {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 16px;
  }

  .chap-nav a {
    padding: 13px 14px;
  }

  .chap-nav .next {
    text-align: left;
  }

  .dashboard-lead {
    font-size: 1rem;
    margin-bottom: 22px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-tile {
    padding: 13px 12px;
  }

  .stat-tile .num {
    font-size: 1.55rem;
  }

  .continue-card {
    padding: 16px 14px;
    margin-bottom: 28px;
  }

  .continue-card .btn {
    width: 100%;
  }

  .dash-section h2 {
    display: block;
    font-size: 1.22rem;
  }

  .dash-section h2 .meta {
    display: block;
    margin-top: 3px;
  }

  .dash-chap-grid {
    grid-template-columns: 1fr;
  }

  .dash-chap {
    padding: 14px 13px;
  }

  .dash-chap .pbar {
    width: 100%;
  }

  .katex {
    font-size: 1em !important;
  }

  .katex-display > .katex {
    white-space: nowrap;
  }

  /* Landing en celular */
  .landing-nav .container {
    padding: 10px 14px;
  }

  .landing-nav .brand {
    font-size: .98rem;
    line-height: 1.1;
  }

  .hero {
    padding: 0;
    background: var(--page);
  }

  .hero .container {
    padding: 34px 18px 30px;
    box-shadow: none;
    min-height: auto;
  }

  .hero-grid {
    gap: 28px;
  }

  .hero-lead {
    font-size: 1rem;
    line-height: 1.52;
  }

  .hero-cta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .hero-cta .btn {
    width: 100%;
    min-height: 46px;
    white-space: normal;
  }

  .book-card {
    min-height: 0;
    padding: 28px 18px 22px;
  }

  .book-card h3 {
    font-size: 1.55rem;
    margin: 22px 0 8px;
  }

  .book-card .stat-row {
    margin-top: 24px;
  }

  .book-card .stat .num {
    font-size: 1.25rem;
  }

  .section {
    padding: 34px 0;
    background: var(--page);
  }

  .section .container,
  .cta-final {
    padding-left: 18px;
    padding-right: 18px;
  }

  .section-head {
    margin-bottom: 20px;
  }

  .section-head h2 {
    font-size: 1.45rem;
  }

  .values,
  .method,
  .pricing,
  .testimonials,
  .curriculum,
  .series-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .value-card,
  .method-step,
  .price-card,
  .testi,
  .series-card,
  .series-promo {
    padding: 16px 15px;
  }

  .series-promo {
    display: block;
  }

  .series-actions,
  .book-links {
    display: grid;
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .series-actions .btn,
  .book-links .btn {
    width: 100%;
    white-space: normal;
    min-height: 46px;
  }

  .chap-chip {
    padding: 12px 11px;
  }

  .cta-final {
    margin: 30px 18px;
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .footer .container {
    display: block;
  }
}

@media (max-width: 430px) {
  body {
    font-size: 16px;
  }

  .app-topbar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .brand-mark {
    width: 30px !important;
    height: 30px !important;
  }

  .topbar-progress .bar {
    width: 22vw;
    min-width: 52px;
  }

  .topbar-actions .language-select {
    width: 70px;
  }

  .app-main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chap-hero h1,
  .dashboard h1,
  .hero h1 {
    font-size: clamp(1.72rem, 8.7vw, 2.05rem);
  }

  .objective-box .box-body,
  .book-box .body,
  .block.idea .body,
  .block.note .box-body,
  .block.note > p,
  .block.reallife .box-body,
  .block.reallife > p,
  .block.recipe .box-body,
  .block.checklist .box-body,
  .block.bridge,
  .solution-box {
    padding-left: 12px;
    padding-right: 12px;
  }

  .problem {
    padding-left: 11px;
    padding-right: 11px;
  }

  .problem .actions {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .chap-chip {
    grid-template-columns: 26px 1fr;
    gap: 9px;
  }
}


/* SEO article pages */
.article-container { max-width: 860px; }
.article-container h1 { font-family: var(--font-display); font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: .95; letter-spacing: -0.045em; margin: 0 0 22px; color: var(--ink); }
.article-container h2 { font-family: var(--font-display); font-size: clamp(1.55rem, 3vw, 2.35rem); margin: 42px 0 12px; color: var(--ink); }
.article-container p, .article-container li { font-size: 1.08rem; line-height: 1.72; color: var(--ink-soft); }
.article-container ul { margin: 18px 0 0 1.2rem; padding: 0; }
.mini-cta { margin-top: 44px; }
.mini-cta .btn { margin: 8px 8px 0 0; }
