/* ============================================================
   CUESTIONES ECONÓMICAS — Estilos editoriales
   HTML editorial + galeras
   ============================================================ */


/* ── TABLAS MARKDOWN ──────────────────────────────────────── */

table:not(.gt_table) {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
  font-family: "Cambria", "Times New Roman", serif;
  font-size: 14px;
  border-top: 2px solid black;
  border-bottom: 2px solid black;
}

table:not(.gt_table) thead th {
  font-weight: bold;
  border-bottom: 1px solid black;
  padding: 4px 6px;
}

table:not(.gt_table) td {
  padding: 4px 6px;
  border: none;
}


/* ── TABLAS GT ────────────────────────────────────────────── */

.gt_container {
  border-top: 2px solid black !important;
  border-bottom: 2px solid black !important;
}

.gt_table {
  border: none !important;
  font-family: "Cambria", "Times New Roman", serif !important;
  font-size: 14px !important;
  border-collapse: collapse !important;
}

.gt_column_spanner {
  font-weight: bold !important;
  background-color: transparent !important;
  border: none !important;
}

.gt_col_heading {
  font-weight: bold !important;
  border-bottom: 1px solid black !important;
}

.gt_row,
.gt_table_body {
  border: none !important;
}

.gt_sourcenote {
  border-top: none !important;
  font-size: 13px !important;
}


/* ── FIGURAS ──────────────────────────────────────────────── */

figcaption,
.figure-caption {
  text-align: center;
}


/* ── ECUACIONES ───────────────────────────────────────────── */

.math.display {
  overflow-x: auto;
}


/* ── TABLA DE CONTENIDOS LATERAL ─────────────────────────── */

#TOC > ul.collapse {
  display: block;
  height: auto;
}


/* ── METADATOS DEL ARTÍCULO (.article-meta) ──────────────── */

.article-meta {
  font-size: 0.88rem;
  line-height: 1.55;
  color: #555;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  padding: 0.75rem 0;
  margin: 1.25rem 0 1.75rem 0;
}

.article-meta p {
  margin: 0.2rem 0;
}

/* Keywords: renderiza la lista de meta keywords como texto inline */
.article-meta ul {
  display: inline;
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-meta ul li {
  display: inline;
}

.article-meta ul li::after {
  content: ", ";
}

.article-meta ul li:last-child::after {
  content: "";
}


/* ── NOTAS DE TABLAS Y FIGURAS ────────────────────────────── */

.tbl-note,
.fig-note {
  font-size: 0.85em;
  text-align: left;
  color: #444;
  margin-top: 0.3em;
  margin-bottom: 1.25em;
}

/* Cada línea de la nota (Fuente, Elaboración, Nota…) sigue el interlineado del
   cuerpo, sin los huecos de párrafo por defecto que separaban demasiado los
   renglones. El line-height se hereda del documento para mantener coherencia. */
.tbl-note p,
.fig-note p {
  margin: 0;
}


/* ── MODO LANDSCAPE (tablas anchas) ──────────────────────── */
/* En HTML se muestra normal; en impresión Chrome puede usar página horizontal. */


/* ============================================================
   ESTILOS DE IMPRESIÓN — usados por Puppeteer / Chrome print
   ============================================================ */

@media print {

  /* Márgenes y tamaño de página */
  @page {
    size: A4;
    margin: 2.5cm 2cm 2.5cm 2cm;

    /* Encabezado fijo (sin contenido variable por página) */
    @top-left {
      content: "Cuestiones Económicas";
      font-family: "Cambria", "Times New Roman", serif;
      font-size: 8.5pt;
      color: #666;
      vertical-align: bottom;
      padding-bottom: 4pt;
    }

    @top-right {
      content: "Banco Central del Ecuador";
      font-family: "Cambria", "Times New Roman", serif;
      font-size: 8.5pt;
      color: #666;
      vertical-align: bottom;
      padding-bottom: 4pt;
    }

    /* Número de página */
    @bottom-center {
      content: counter(page);
      font-family: "Cambria", "Times New Roman", serif;
      font-size: 9pt;
      color: #444;
    }
  }

  /* Primera página de cada artículo: sin encabezado */
  @page :first {
    @top-left  { content: none; }
    @top-right { content: none; }
  }

  /* Página horizontal para tablas anchas */
  @page landscape-page {
    size: A4 landscape;
    margin: 2cm;
    @top-left  { content: none; }
    @top-right { content: none; }
  }

  .landscape {
    page: landscape-page;
  }

  /* Ocultar elementos de navegación en impresión */
  #quarto-sidebar,
  #quarto-toc-toggle,
  .navbar,
  .nav-page,
  .page-navigation,
  .breadcrumb,
  #quarto-search,
  .sidebar-navigation,
  .quarto-sidebar-toggle,
  #TOC {
    display: none !important;
  }

  /* El cuerpo ocupa todo el ancho */
  #quarto-content,
  .page-columns,
  #quarto-margin-sidebar {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Tipografía */
  body {
    font-family: "Cambria", "Times New Roman", serif;
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
    hyphens: auto;
    text-align: justify;
  }

  h1, h2, h3, h4 {
    color: #000;
    page-break-after: avoid;
  }

  /* Nueva página antes de cada artículo (chapter del book) */
  .chapter {
    page-break-before: always;
  }

  /* Bibliografía: nueva página */
  #refs,
  section#refs {
    page-break-before: always;
  }

  /* Tablas y figuras: no cortar internamente */
  figure,
  .gt_container,
  table {
    page-break-inside: avoid;
  }

  /* Metadatos del artículo: no cortar */
  .article-meta {
    page-break-inside: avoid;
    color: #333;
    font-size: 9.5pt;
  }

  /* URLs: no subrayar en impresión */
  a {
    text-decoration: none;
    color: #000;
  }

  /* Código: quitar fondo */
  pre, code {
    background: none !important;
    border: none !important;
    font-size: 9pt;
  }
}
