/* ──────────────────────────────────────────────────────────────────────
   tv/custom.css — overrides for the HTML thesis build (LaTeXML)

   Loaded by  \lxRequireResource{custom.css}  in thesis.tex, so arxiv's
   own LaTeXML run will pick this up automatically when uploaded
   alongside the .tex sources.
   ────────────────────────────────────────────────────────────────────── */


/* 1.  Tabular header bolding ----------------------------------------- */
/* LaTeXML auto-promotes the first row of a tabular to <th>, which the
   default stylesheet bolds. For Latin squares and layout-only tabulars
   (no caption, not inside a <figure>) that's wrong — the cells are
   data, not headers. Strip the bold by default, then re-apply it only
   inside captioned tables. */
.ltx_tabular .ltx_th,
.ltx_tabular th { font-weight: normal; }
figure.ltx_table .ltx_tabular .ltx_th,
figure.ltx_table .ltx_tabular th { font-weight: bold; }


/* 2.  TOC: Appendix prefix ------------------------------------------- */
/* Appendix entries come out as "1 Examples ..." instead of
   "Appendix 1 Examples ..." — re-add the prefix LaTeXML omits. */
.ltx_tocentry_appendix > a .ltx_tag_ref::before { content: "Appendix "; }


/* 3.  LoT: stop \footnotesize from leaking into the LoT entry --------- */
/* Some \caption{...} calls live inside a \footnotesize group, which
   leaks an inline `font-size:80%` onto matching List-of-Tables entries
   (e.g. 6.2, 8.5, 8.7). PDF renders the LoT uniformly; do the same. */
.ltx_toclist .ltx_tocentry .ltx_text[style*="font-size"] { font-size: 100% !important; }


/* 4.  Latin-square cells -------------------------------------------- */
/* Latin squares come from two source forms:
     (a) raw \begin{tabular}{|c|c|...|} in app2.tex (HTML <table>)
     (b) our \iflatexml \hbox{\begin{tabular}{...}} replacement of the
         \begin{latinsq} macro (rendered as <span class="ltx_tabular">)
   In both forms LaTeXML emits cells with class `ltx_td` (and
   `ltx_border_l/_r/_t/_b` for the border-spec | columns).

   Without help, empty cells collapse to ~0 width, empty rows collapse
   to ~0 height, and digits sit flush against borders. Apply uniform
   sizing to any cell that has at least one of the border classes —
   that selector matches Latin-square cells but also legitimate header
   tables (Table 8.4 etc.). The latter already have content, so
   `min-width` doesn't shrink them; `height` only takes effect when
   the cell would otherwise be smaller. */
.ltx_tabular .ltx_td.ltx_border_l,
.ltx_tabular .ltx_td.ltx_border_r {
  min-width: 1.6em;
  height: 1.7em;
  padding: 0.15em 0.4em;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
/* Also catch the real <td>/<th> form (app2.tex tabulars) — same rules. */
table.ltx_tabular td.ltx_border_l,
table.ltx_tabular td.ltx_border_r,
table.ltx_tabular th.ltx_border_l,
table.ltx_tabular th.ltx_border_r {
  min-width: 1.6em;
  height: 1.7em;
  padding: 0.15em 0.4em;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
/* Empty cells need *something* in them to keep their column from
   collapsing. A non-breaking space, hidden, does the job. */
.ltx_tabular .ltx_td.ltx_border_l:empty::before,
.ltx_tabular .ltx_td.ltx_border_r:empty::before,
table.ltx_tabular td.ltx_border_l:empty::before,
table.ltx_tabular td.ltx_border_r:empty::before {
  content: "\00a0";
  visibility: hidden;
}

/* When a Latin square sits inside $...$ math mode (Ch 2, parts of Ch5,
   Ch6 inline ones), LaTeXML wraps our \hbox{\begin{tabular}} as a nested
   MathML <mtable> instead of an HTML tabular. Apply analogous sizing
   directly to <mtd> cells with border classes. */
math mtable mtd.ltx_border_l,
math mtable mtd.ltx_border_r {
  min-width: 1.6em;
  height: 1.7em;
  padding: 0.15em 0.4em;
  text-align: center;
  vertical-align: middle;
  box-sizing: border-box;
}
/* hline-pseudo-rows inside an mtable carry ltx_border_t/_b on all cells
   but no ltx_border_l or _r anywhere — flatten only those rows so
   consecutive data rows form a contiguous grid (no inter-row gap).
   We require a border_t cell so we don't accidentally flatten a row of
   plain (border-less) cells used elsewhere in the array (e.g. the
   "P, BC_3, L_1, L_2" label row in Table 2.1). */
math mtable mtr:has(mtd.ltx_border_t):not(:has(mtd.ltx_border_l)):not(:has(mtd.ltx_border_r)) > mtd {
  height: 0;
  padding: 0;
  line-height: 0;
  font-size: 0;
}
math mtable { border-spacing: 0; border-collapse: collapse; }
