/* ==========================================================================
   Custom Styles for Apuntes Matemáticas (BookML / GitBook)
   Matches apuntes.sty color scheme and typography
   ========================================================================== */

:root {
  --color-theorem: #1B3B6F;        /* Azul Oxford (PDF ocre) */
  --color-definition: #C05621;     /* Naranja terracota (PDF orng) */
  --color-lemma: #B84A39;          /* Terracota óxido (PDF dred) */
  --color-example: #5A6B7C;        /* Gris pizarra tenue (PDF Cerulean) */
  --color-note: #5C6773;           /* Gris grafito (PDF notegray) */
  --color-proof: #4B5563;          /* Gris oscuro neutro */

  --bg-theorem-light: rgba(27, 59, 111, 0.04);
  --bg-definition-light: rgba(192, 86, 33, 0.04);
  --bg-lemma-light: rgba(184, 74, 57, 0.04);
  --bg-example-light: rgba(90, 107, 124, 0.04);
  --bg-note-light: rgba(92, 103, 115, 0.04);
  --bg-proof-light: rgba(0, 0, 0, 0.02);

  --bg-theorem-dark: rgba(77, 130, 203, 0.12);
  --bg-definition-dark: rgba(224, 122, 72, 0.14);
  --bg-lemma-dark: rgba(226, 109, 92, 0.14);
  --bg-example-dark: rgba(139, 157, 175, 0.12);
  --bg-note-dark: rgba(157, 167, 179, 0.12);
  --bg-proof-dark: rgba(255, 255, 255, 0.03);

  --color-theorem-dark: #6CA2EA;
  --color-definition-dark: #F08C5A;
  --color-lemma-dark: #E26D5C;
  --color-example-dark: #8B9DAF;
  --color-note-dark: #9DA7B3;
  --color-proof-dark: #9CA3AF;
}

/* Base theorem box styling */
.ltx_theorem {
  margin: 1.4rem 0 !important;
  padding: 0.9rem 1.25rem !important;
  border-radius: 0 4px 4px 0 !important;
  box-sizing: border-box !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.ltx_theorem p:last-child,
.ltx_theorem .ltx_para:last-child {
  margin-bottom: 0 !important;
}

.ltx_theorem .ltx_title_theorem {
  font-size: 1.02em !important;
  font-weight: 700 !important;
  margin-bottom: 0.45rem !important;
  display: block !important;
}

/* 1. Teoremas, Proposiciones, Conjeturas */
.ltx_theorem.ltx_theorem_theorem,
.ltx_theorem.ltx_theorem_proposition,
.ltx_theorem.ltx_theorem_conjetura,
.ltx_theorem.ltx_theorem_theoremeT,
.ltx_theorem.ltx_theorem_propositionT,
.ltx_theorem.ltx_theorem_conjeturaT {
  border-left: 3px solid var(--color-theorem) !important;
  background-color: var(--bg-theorem-light) !important;
}

.ltx_theorem.ltx_theorem_theorem .ltx_title_theorem,
.ltx_theorem.ltx_theorem_proposition .ltx_title_theorem,
.ltx_theorem.ltx_theorem_conjetura .ltx_title_theorem,
.ltx_theorem.ltx_theorem_theoremeT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_propositionT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_conjeturaT .ltx_title_theorem {
  color: var(--color-theorem) !important;
}

/* 2. Definiciones */
.ltx_theorem.ltx_theorem_definition,
.ltx_theorem.ltx_theorem_definitionT {
  border-left: 3px solid var(--color-definition) !important;
  background-color: var(--bg-definition-light) !important;
}

.ltx_theorem.ltx_theorem_definition .ltx_title_theorem,
.ltx_theorem.ltx_theorem_definitionT .ltx_title_theorem {
  color: var(--color-definition) !important;
}

/* 3. Lemas, Corolarios y Propiedades */
.ltx_theorem.ltx_theorem_lemma,
.ltx_theorem.ltx_theorem_corollary,
.ltx_theorem.ltx_theorem_cor,
.ltx_theorem.ltx_theorem_lemmaT,
.ltx_theorem.ltx_theorem_corollaryT,
.ltx_theorem.ltx_theorem_propiedad,
.ltx_theorem.ltx_theorem_propiedadT {
  border-left: 3px solid var(--color-lemma) !important;
  background-color: var(--bg-lemma-light) !important;
}

.ltx_theorem.ltx_theorem_lemma .ltx_title_theorem,
.ltx_theorem.ltx_theorem_corollary .ltx_title_theorem,
.ltx_theorem.ltx_theorem_cor .ltx_title_theorem,
.ltx_theorem.ltx_theorem_lemmaT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_corollaryT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_propiedad .ltx_title_theorem,
.ltx_theorem.ltx_theorem_propiedadT .ltx_title_theorem {
  color: var(--color-lemma) !important;
}

/* 4. Ejemplos, Observaciones, Ejercicios y Métodos */
.ltx_theorem.ltx_theorem_example,
.ltx_theorem.ltx_theorem_remark,
.ltx_theorem.ltx_theorem_exampleT,
.ltx_theorem.ltx_theorem_remarkT,
.ltx_theorem.ltx_theorem_ejercicio,
.ltx_theorem.ltx_theorem_metodo {
  border-left: 3px solid var(--color-example) !important;
  background-color: var(--bg-example-light) !important;
}

.ltx_theorem.ltx_theorem_example .ltx_title_theorem,
.ltx_theorem.ltx_theorem_remark .ltx_title_theorem,
.ltx_theorem.ltx_theorem_exampleT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_remarkT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_ejercicio .ltx_title_theorem,
.ltx_theorem.ltx_theorem_metodo .ltx_title_theorem {
  color: var(--color-example) !important;
}

/* 5. Notas */
.ltx_theorem.ltx_theorem_nota,
.ltx_theorem.ltx_theorem_notaT,
.ltx_theorem.ltx_theorem_note {
  border-left: 3px solid var(--color-note) !important;
  background-color: var(--bg-note-light) !important;
}

.ltx_theorem.ltx_theorem_nota .ltx_title_theorem,
.ltx_theorem.ltx_theorem_notaT .ltx_title_theorem,
.ltx_theorem.ltx_theorem_note .ltx_title_theorem {
  color: var(--color-note) !important;
}

/* 6. Demostraciones (Proof) */
.ltx_proof,
.ltx_theorem.ltx_theorem_proof,
.ltx_theorem.ltx_theorem_proofT {
  border-left: 2px solid var(--color-proof) !important;
  background-color: var(--bg-proof-light) !important;
  margin: 1rem 0 !important;
  padding: 0.8rem 1.2rem !important;
  border-radius: 0 4px 4px 0 !important;
}

.ltx_proof .ltx_title_proof,
.ltx_theorem.ltx_theorem_proof .ltx_title_theorem,
.ltx_theorem.ltx_theorem_proofT .ltx_title_theorem {
  color: var(--color-proof) !important;
  font-weight: 600 !important;
  font-style: italic !important;
  display: block !important;
  margin-bottom: 0.4rem !important;
}

/* Dark theme overrides (.book.color-theme-2) */
.book.color-theme-2 .ltx_theorem.ltx_theorem_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proposition,
.book.color-theme-2 .ltx_theorem.ltx_theorem_conjetura,
.book.color-theme-2 .ltx_theorem.ltx_theorem_theoremeT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propositionT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_conjeturaT {
  border-left-color: var(--color-theorem-dark) !important;
  background-color: var(--bg-theorem-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_theorem .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proposition .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_conjetura .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_theoremeT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propositionT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_conjeturaT .ltx_title_theorem {
  color: var(--color-theorem-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_definition,
.book.color-theme-2 .ltx_theorem.ltx_theorem_definitionT {
  border-left-color: var(--color-definition-dark) !important;
  background-color: var(--bg-definition-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_definition .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_definitionT .ltx_title_theorem {
  color: var(--color-definition-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_lemma,
.book.color-theme-2 .ltx_theorem.ltx_theorem_corollary,
.book.color-theme-2 .ltx_theorem.ltx_theorem_cor,
.book.color-theme-2 .ltx_theorem.ltx_theorem_lemmaT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_corollaryT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propiedad,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propiedadT {
  border-left-color: var(--color-lemma-dark) !important;
  background-color: var(--bg-lemma-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_lemma .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_corollary .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_cor .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_lemmaT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_corollaryT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propiedad .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_propiedadT .ltx_title_theorem {
  color: var(--color-lemma-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_example,
.book.color-theme-2 .ltx_theorem.ltx_theorem_remark,
.book.color-theme-2 .ltx_theorem.ltx_theorem_exampleT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_remarkT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_ejercicio,
.book.color-theme-2 .ltx_theorem.ltx_theorem_metodo {
  border-left-color: var(--color-example-dark) !important;
  background-color: var(--bg-example-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_example .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_remark .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_exampleT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_remarkT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_ejercicio .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_metodo .ltx_title_theorem {
  color: var(--color-example-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_nota,
.book.color-theme-2 .ltx_theorem.ltx_theorem_notaT,
.book.color-theme-2 .ltx_theorem.ltx_theorem_note {
  border-left-color: var(--color-note-dark) !important;
  background-color: var(--bg-note-dark) !important;
}

.book.color-theme-2 .ltx_theorem.ltx_theorem_nota .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_notaT .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_note .ltx_title_theorem {
  color: var(--color-note-dark) !important;
}

.book.color-theme-2 .ltx_proof,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proof,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proofT {
  border-left-color: var(--color-proof-dark) !important;
  background-color: var(--bg-proof-dark) !important;
}

.book.color-theme-2 .ltx_proof .ltx_title_proof,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proof .ltx_title_theorem,
.book.color-theme-2 .ltx_theorem.ltx_theorem_proofT .ltx_title_theorem {
  color: var(--color-proof-dark) !important;
}

/* Mathematical formulas and tables responsive handling */
.ltx_equation,
.ltx_equationgroup {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  max-width: 100% !important;
  padding: 0.2rem 0;
}

/* Figures and SVGs */
.ltx_figure {
  text-align: center;
  margin: 1.5rem 0;
}

.ltx_figure svg {
  max-width: 100%;
  height: auto;
}

/* Interactive details / accordion elements */
details {
  margin: 1.2rem 0 !important;
  padding: 0.8rem 1.2rem !important;
  border-radius: 6px !important;
  background-color: rgba(0, 0, 0, 0.02) !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.book.color-theme-2 details {
  background-color: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

details summary {
  cursor: pointer !important;
  font-weight: 600 !important;
  user-select: none !important;
  outline: none !important;
}

details summary:hover {
  opacity: 0.85 !important;
}

details[open] summary {
  margin-bottom: 0.75rem !important;
}

/* ==========================================================================
   Portada para LaTeXML / BookML (texto sobrio, sin tarjetas ni centrado)
   ========================================================================== */
.ltx_portada {
  margin: 1.5rem 0 2rem 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  text-align: left !important;
}

.ltx_portadaHeader {
  font-size: 0.82rem !important;
  letter-spacing: 0.03em !important;
  color: var(--color-theorem) !important;
  text-transform: uppercase !important;
  margin-bottom: 0.8rem !important;
}

.book.color-theme-2 .ltx_portadaHeader {
  color: var(--color-theorem-dark) !important;
}

.ltx_portada .ltx_font_huge,
.ltx_portada h1 {
  font-size: 2.2rem !important;
  font-weight: 700 !important;
  color: var(--color-theorem) !important;
  margin: 0.4rem 0 0.25rem 0 !important;
  line-height: 1.2 !important;
  letter-spacing: -0.01em !important;
}

.book.color-theme-2 .ltx_portada .ltx_font_huge,
.book.color-theme-2 .ltx_portada h1 {
  color: #f8fafc !important;
}

.ltx_portada .ltx_font_large {
  font-size: 1.1rem !important;
  color: #64748b !important;
  margin: 0.2rem 0 1.2rem 0 !important;
}

.book.color-theme-2 .ltx_portada .ltx_font_large {
  color: #94a3b8 !important;
}

.ltx_portadaMeta {
  font-size: 0.95rem !important;
  line-height: 1.65 !important;
  margin: 1.2rem 0 !important;
  color: inherit !important;
}

.ltx_portadaMeta a {
  color: var(--color-theorem) !important;
  text-decoration: none !important;
}

.ltx_portadaMeta a:hover {
  text-decoration: underline !important;
}

.book.color-theme-2 .ltx_portadaMeta a {
  color: var(--color-theorem-dark) !important;
}

.ltx_portadaLicense {
  font-size: 0.8rem !important;
  color: #64748b !important;
  margin-top: 1.2rem !important;
  line-height: 1.4 !important;
}

.book.color-theme-2 .ltx_portadaLicense {
  color: #94a3b8 !important;
}

