/* ==========================================================================
   MASTER THESIS CUSTOM STYLES (Lamb Architecture)
   Catppuccin Mocha (Base Site) & Catppuccin Latte (Pre-highlighted Code Blocks)
   ========================================================================== */

.thesis-document {
  max-width: 100%;

  /* Catppuccin Latte Design Tokens for Pre-highlighted Code */
  --latte-bg: #eff1f5;
  --latte-bg-subtle: #e6e9ef;
  --latte-border: #ccd0da;
  --latte-border-hover: #bcc0cc;
  --latte-text: #4c4f69;
  --latte-muted: #8c8fa1;
  --latte-blue: #1e66f5;
}

/* Target jump highlights */
.thesis-document :target,
.thesis-document:target {
  animation: thesis-target-pulse 2.5s ease-out;
}

@keyframes thesis-target-pulse {
  0% {
    background-color: rgba(137, 180, 250, 0.28); /* Catppuccin Mocha Blue */
    border-radius: var(--radius-sm);
  }
  100% {
    background-color: transparent;
  }
}

/* Smooth anchor scrolling offsets for sticky navigation */
.thesis-document [id],
.thesis-document a[id],
.thesis-document span[id],
.thesis-document dt[id],
.thesis-document tr[id],
.thesis-document div[id],
.thesis-document .chapterHead,
.thesis-document .sectionHead,
.thesis-document .subsectionHead,
.thesis-document .subsubsectionHead,
.thesis-document .likesectionHead,
.thesis-document .likechapterHead,
.thesis-document .likeparagraphHead {
  scroll-margin-top: 5rem;
}

/* ==========================================================================
   1. ACADEMIC THESIS HEADER CARD & HERO BANNER
   ========================================================================== */

.thesis-document .thesis-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.thesis-document .thesis-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.thesis-document .thesis-header-badge {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(166, 227, 161, 0.12); /* Catppuccin Mocha Green */
  color: var(--accent-tech);
  border: 1px solid rgba(166, 227, 161, 0.25);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.thesis-document .thesis-github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(137, 180, 250, 0.12); /* Catppuccin Mocha Blue */
  border: 1px solid rgba(137, 180, 250, 0.28);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
}

.thesis-document .thesis-github-btn svg {
  color: var(--accent);
  flex-shrink: 0;
}

.thesis-document .thesis-github-btn:hover {
  background: rgba(137, 180, 250, 0.22);
  border-color: rgba(137, 180, 250, 0.45);
  color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}

.thesis-document .thesis-main-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.02em;
}

.thesis-document .thesis-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0;
}

.thesis-document .thesis-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.thesis-document .thesis-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.thesis-document .thesis-meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.thesis-document .thesis-meta-val {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* Abstract & Acknowledgements Cards */
.thesis-document .abstract-card,
.thesis-document .acknowledgements-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.thesis-document .acknowledgements-card {
  border-left-color: var(--accent-dnd);
}

.thesis-document .card-badge-header {
  margin-bottom: 0.85rem;
}

.thesis-document .card-badge {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(137, 180, 250, 0.12); /* Catppuccin Mocha Blue */
  border: 1px solid rgba(137, 180, 250, 0.25);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.thesis-document .ack-badge {
  color: var(--accent-dnd);
  background: rgba(250, 179, 135, 0.12); /* Catppuccin Mocha Peach */
  border-color: rgba(250, 179, 135, 0.25);
}

.thesis-document .card-body-text {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-main);
}

/* ==========================================================================
   2. TYPOGRAPHY, HEADINGS & SECTIONS
   ========================================================================== */

.thesis-document .chapterHead,
.thesis-document .likechapterHead {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 3.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.thesis-document .chapterHead .titlemark,
.thesis-document .likechapterHead .titlemark {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-tech);
  margin-bottom: 0.25rem;
}

.thesis-document .sectionHead,
.thesis-document .likesectionHead {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--border);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.thesis-document .sectionHead .titlemark,
.thesis-document .likesectionHead .titlemark {
  color: var(--accent);
  margin-right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
}

.thesis-document .subsectionHead {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.thesis-document .subsectionHead .titlemark {
  color: var(--accent);
  margin-right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
}

.thesis-document .subsubsectionHead {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.thesis-document .subsubsectionHead .titlemark {
  color: var(--accent);
  margin-right: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
}

.thesis-document .likeparagraphHead {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

/* Paragraphs & Text Elements */
.thesis-document p {
  margin-top: 0;
  margin-bottom: 1.15rem;
  line-height: 1.75;
  color: var(--text-main);
}

.thesis-document p.noindent,
.thesis-document .noindent {
  text-indent: 0;
}

/* Reset TeX4ht inline font sizes & format nicely */
.thesis-document .rm-lmri-12,
.thesis-document .rm-lmri-10,
.thesis-document .rm-lmri-10x-x-109 {
  font-style: italic;
}

.thesis-document .rm-lmbx-12,
.thesis-document .rm-lmbx-10,
.thesis-document .rm-lmbxi-10x-x-109,
.thesis-document .rm-lmbxi-10x-x-120 {
  font-weight: 600;
}

.thesis-document .small-caps,
.thesis-document .rm-lmcsc-10x-x-120,
.thesis-document .rm-lmcsc-10x-x-144 {
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

.thesis-document .rm-lmr-12x-x-120,
.thesis-document .rm-lmr-10x-x-109,
.thesis-document .rm-lmr-10,
.thesis-document .rm-lmr-8 {
  font-size: inherit;
}

/* Monospace & Inline Code in Text (GitHub / Catppuccin Mocha Style) */
.thesis-document .ec-lmtt-12,
.thesis-document .ec-lmtt-10x-x-109,
.thesis-document code.verb,
.thesis-document tt,
.thesis-document code,
.thesis-document code.inline-code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--text-main);
  background: rgba(69, 71, 90, 0.45); /* Catppuccin Mocha Surface1 */
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

/* Ensure inner colored spans within inline code inherit correctly and don't create nested badges */
.thesis-document code span,
.thesis-document code.inline-code span,
.thesis-document .ec-lmtt-12 span,
.thesis-document tt span,
.thesis-document code.verb span {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  font-family: inherit;
  font-size: inherit;
}

.thesis-document span[style*="color"] .ec-lmtt-12,
.thesis-document span[style*="color"] .ec-lmtt-10x-x-109 {
  color: inherit;
  background: transparent;
  padding: 0;
  border: none;
  border-radius: 0;
}

/* Inside code listings, pre blocks, and algorithmic containers, strip inline badge styling */
.thesis-document pre .ec-lmtt-12,
.thesis-document pre .ec-lmtt-10x-x-109,
.thesis-document pre code.verb,
.thesis-document pre tt,
.thesis-document pre code,
.thesis-document .box-content .ec-lmtt-12,
.thesis-document .box-content .ec-lmtt-10x-x-109,
.thesis-document .box-content code.verb,
.thesis-document .box-content tt,
.thesis-document .box-content code,
.thesis-document .algorithmic .ec-lmtt-12,
.thesis-document .algorithmic .ec-lmtt-10x-x-109,
.thesis-document .algorithmic code.verb,
.thesis-document .algorithmic tt,
.thesis-document .algorithmic code {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  color: inherit;
  font-size: inherit;
}

/* ==========================================================================
   3. TABLE OF CONTENTS & QUICK OUTLINE
   ========================================================================== */

.thesis-document .tableofcontents {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0 3rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.thesis-document .tableofcontents span.chapterToc {
  display: block;
  font-weight: 600;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  color: var(--text-main);
  font-size: 0.98rem;
}

.thesis-document .tableofcontents span.chapterToc:first-of-type,
.thesis-document .tableofcontents span.likechapterToc:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.thesis-document .tableofcontents span.sectionToc {
  display: block;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  margin: 0.25rem 0;
  color: var(--text-secondary);
}

.thesis-document .tableofcontents span.subsectionToc {
  display: block;
  padding-left: 2.5rem;
  font-size: 0.85rem;
  margin: 0.15rem 0;
  color: var(--text-muted);
}

.thesis-document .tableofcontents span.subsubsectionToc {
  display: block;
  padding-left: 3.5rem;
  font-size: 0.82rem;
  margin: 0.15rem 0;
  color: var(--text-muted);
}

.thesis-document .tableofcontents a {
  color: inherit;
  text-decoration: none;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.thesis-document .tableofcontents a:hover {
  color: var(--accent);
  background: var(--surface-hover);
  text-decoration: none;
}

/* Lists of Figures / Tables */
.thesis-document .lofToc,
.thesis-document .lotToc {
  display: block;
  font-size: 0.9rem;
  margin: 0.4rem 0;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.thesis-document .lofToc:hover,
.thesis-document .lotToc:hover {
  background: var(--surface);
  color: var(--accent);
}

/* ==========================================================================
   4. CODE BLOCKS, LISTINGS & TRACE BOXES
   - Code Blocks (.codebox): Catppuccin Latte Bright Theme for syntax highlighting
   - Trace Boxes (.tracebox): Catppuccin Mocha Dark Terminal Theme for traces
   ========================================================================== */

/* Trace Boxes (Dark Terminal Execution Traces) */
.thesis-document .tracebox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-tag);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.75rem 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.thesis-document .tracebox .box-title {
  background: var(--bg-subtle);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-tag);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.thesis-document .tracebox .box-content {
  background: var(--bg-subtle);
  color: var(--text-main);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
}

.thesis-document .tracebox .box-content pre.fancyvrb,
.thesis-document .tracebox .box-content pre.verbatim,
.thesis-document .tracebox .box-content pre {
  display: block;
  white-space: pre;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: var(--text-main) !important;
}

.thesis-document .tracebox .box-content .fancyvrblineno {
  display: inline-block;
  min-width: 2.2rem;
  margin-right: 0.75rem;
  text-align: right;
  color: var(--text-muted) !important;
  user-select: none;
  font-size: 0.75rem;
}

/* Code Boxes (Bright Catppuccin Latte Theme for Pre-highlighted Code) */
.thesis-document .codebox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.75rem 0;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.thesis-document .codebox .box-title {
  background: var(--bg-subtle);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.thesis-document .codebox .box-content {
  background: var(--latte-bg);
  color: var(--latte-text);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  border-top: 1px solid var(--latte-border);
}

.thesis-document .codebox .box-content pre.fancyvrb,
.thesis-document .codebox .box-content pre.verbatim,
.thesis-document .codebox .box-content pre {
  display: block;
  white-space: pre;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: var(--latte-text) !important;
}

.thesis-document .codebox .box-content .fancyvrblineno {
  display: inline-block;
  min-width: 2.2rem;
  margin-right: 0.75rem;
  text-align: right;
  color: var(--latte-muted) !important;
  user-select: none;
  font-size: 0.75rem;
}

.thesis-document .codebox .box-content div.algorithmic,
.thesis-document .codebox .box-content .algorithmic {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: var(--latte-text) !important;
}

.thesis-document .box-content > p,
.thesis-document .box-content p {
  margin: 0 !important;
  padding: 0 !important;
}

.thesis-document .notebox {
  background: rgba(166, 227, 161, 0.08); /* Catppuccin Mocha Green */
  border: 1px solid rgba(166, 227, 161, 0.25);
  border-left: 4px solid var(--accent-tech);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
  margin: 1.75rem 0;
  color: var(--text-main);
}

/* Verbatim / Listings (Standalone with Catppuccin Latte Styling) */
.thesis-document pre.fancyvrb,
.thesis-document pre.verbatim {
  display: block;
  white-space: pre;
  background: var(--latte-bg);
  border: 1px solid var(--latte-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--latte-text);
  margin: 1.5rem 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.thesis-document .fancyvrblineno {
  display: inline-block;
  min-width: 2.2rem;
  margin-right: 0.75rem;
  text-align: right;
  color: var(--latte-muted);
  user-select: none;
  font-size: 0.75rem;
}

.thesis-document .fancyvrbline {
  display: inline;
}

/* ==========================================================================
   5. ALGORITHMS & PSEUDOCODE
   ========================================================================== */

.thesis-document .algorithmic {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: normal;
}

.thesis-document div.algorithmic,
.thesis-document div.minipage .algorithmic {
  background: var(--latte-bg);
  border: 1px solid var(--latte-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  color: var(--latte-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.thesis-document .algorithmic .line {
  display: flex;
  align-items: baseline;
  min-height: 1.55em;
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
}

.thesis-document .algorithmic .line > span.algorithmic {
  white-space: pre-wrap;
  flex: 1;
}

.thesis-document .algorithmic .label,
.thesis-document .algorithmic span.label {
  display: inline-block;
  min-width: 2.2rem;
  width: 2.2rem;
  margin-right: 0.75rem;
  text-align: right;
  color: var(--latte-muted);
  user-select: none;
  font-size: 0.75rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.thesis-document .algorithmic .label .rm-lmr-10 {
  font-size: 0.75rem;
  color: var(--latte-muted);
}

.thesis-document .algorithmic br.algorithmic {
  display: none !important;
}

.thesis-document .algorithmic span.empty {
  display: block;
  height: 0.5rem;
  margin: 0;
  padding: 0;
}

.thesis-document .algorithmic span.empty + span.empty {
  display: none !important;
}

.thesis-document .algorithmic > span.empty:first-child,
.thesis-document .algorithmic > span.empty:last-child {
  display: none !important;
}

.thesis-document .algorithmic strong {
  color: var(--latte-blue);
  font-weight: 600;
}

/* ==========================================================================
   6. THEOREMS, DEFINITIONS & PROOFS
   ========================================================================== */

.thesis-document div.newtheorem {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.15rem 1.35rem;
  margin: 1.75rem 0;
}

.thesis-document div.newtheorem .head {
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.thesis-document .proof {
  background: var(--surface);
  border-left: 3px solid var(--text-muted);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}

/* ==========================================================================
   7. MATHEMATICS & SVGs
   ========================================================================== */

.thesis-document img.math,
.thesis-document img.displaymath,
.thesis-document img.mapsto,
.thesis-document img.notin,
.thesis-document img[src*="Main1x.svg"],
.thesis-document img[src*="Main2x.svg"] {
  vertical-align: middle;
  filter: invert(0.92) hue-rotate(180deg) brightness(1.2);
  display: inline-block;
  margin: 0 0.15rem;
}

.thesis-document div.par-math-display,
.thesis-document div.math-display {
  text-align: center;
  margin: 1.5rem 0;
  overflow-x: auto;
  padding: 0.5rem 0;
}

/* Math alignment tables (LaTeX \begin{align}) - completely borderless */
.thesis-document table.align,
.thesis-document table.align-star,
.thesis-document table.equation,
.thesis-document table.equation-star {
  width: auto;
  max-width: 100%;
  margin: 1.5rem auto;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  border-collapse: collapse;
}

.thesis-document table.align td,
.thesis-document table.align-star td,
.thesis-document table.equation td,
.thesis-document table.equation-star td {
  border: none !important;
  background: transparent !important;
  padding: 0.25rem 0.5rem;
  color: var(--text-main);
  text-align: left;
}

.thesis-document table.equation td.eq-no {
  text-align: right;
  width: 50px;
  color: var(--text-muted);
}

.thesis-document .lmsy-10x-x-120,
.thesis-document .lmmi-12,
.thesis-document .lmmi-10x-x-109,
.thesis-document .lmsy-10x-x-109,
.thesis-document .lmmi-8,
.thesis-document .lmsy8- {
  font-family: inherit;
  font-style: normal;
}

/* ==========================================================================
   8. TABLES & TABULAR DATA
   ========================================================================== */

/* Clean reset for LaTeX table wrappers */
.thesis-document div.table,
.thesis-document div.table figure.float,
.thesis-document div.longtable {
  margin: 2.25rem 0;
  display: block;
  width: 100%;
  max-width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  box-shadow: none;
  overflow-x: auto;
}

.thesis-document div.table figure.float {
  margin: 0;
  width: 100%;
  max-width: 100%;
}

.thesis-document div.table figcaption.caption,
.thesis-document div.longtable caption,
.thesis-document caption.longtable {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  text-align: left;
  margin-bottom: 0.75rem;
  padding: 0;
}

.thesis-document div.table figcaption.caption span.id,
.thesis-document caption.longtable span.id {
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.35rem;
}

.thesis-document div.tabular {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0 2rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.thesis-document table.tabular,
.thesis-document table.longtable,
.thesis-document div.tabular table {
  display: table !important;
  width: 100% !important;
  min-width: 100% !important;
  table-layout: auto !important;
  border-collapse: collapse !important;
  background: var(--surface) !important;
  font-size: 0.88rem !important;
  margin: 0 !important;
}

.thesis-document table.tabular thead,
.thesis-document table.longtable thead,
.thesis-document div.tabular thead {
  display: table-header-group !important;
}

.thesis-document table.tabular tbody,
.thesis-document table.longtable tbody,
.thesis-document div.tabular tbody {
  display: table-row-group !important;
}

.thesis-document table.tabular tr,
.thesis-document table.longtable tr,
.thesis-document div.tabular tr {
  display: table-row !important;
}

/* Table Header Cells */
.thesis-document table.tabular th,
.thesis-document table.longtable th,
.thesis-document table.tabular thead th,
.thesis-document table.longtable thead th,
.thesis-document table.tabular thead td,
.thesis-document table.longtable thead td,
.thesis-document div.tabular th {
  display: table-cell !important;
  background: var(--bg-subtle) !important;
  font-weight: 600 !important;
  color: var(--accent) !important;
  padding: 0.85rem 1.25rem !important;
  border: 1px solid var(--border) !important;
  border-bottom: 2px solid var(--border-hover) !important;
  text-align: left !important;
  line-height: 1.4 !important;
}

.thesis-document table.tabular th strong,
.thesis-document table.longtable th strong,
.thesis-document div.tabular th strong {
  color: var(--accent) !important;
  font-weight: 600 !important;
}

/* Table Body Cells */
.thesis-document table.tabular tbody td,
.thesis-document table.longtable tbody td,
.thesis-document table.tabular td.td11,
.thesis-document table.longtable td.td11,
.thesis-document div.tabular tbody td {
  display: table-cell !important;
  padding: 0.75rem 1.25rem !important;
  border: 1px solid var(--border) !important;
  color: var(--text-main) !important;
  line-height: 1.5 !important;
  background: transparent !important;
  word-break: normal;
  overflow-wrap: break-word;
}

.thesis-document table.tabular tbody tr:nth-child(even) td,
.thesis-document table.longtable tbody tr:nth-child(even) td,
.thesis-document div.tabular tbody tr:nth-child(even) td {
  background: rgba(205, 214, 244, 0.03) !important; /* Catppuccin Mocha Text subtle row zebra */
}

.thesis-document table.tabular tbody tr:hover td,
.thesis-document table.longtable tbody tr:hover td,
.thesis-document table.tabular tr:hover td,
.thesis-document table.longtable tr:hover td,
.thesis-document div.tabular tbody tr:hover td {
  background: var(--surface-hover) !important;
}

/* Hide dummy TeX4ht hline rows */
.thesis-document tr.hline {
  display: none !important;
}

@media (max-width: 640px) {
  .thesis-document table.tabular th,
  .thesis-document table.longtable th,
  .thesis-document table.tabular thead th,
  .thesis-document table.longtable thead th,
  .thesis-document table.tabular thead td,
  .thesis-document table.longtable thead td,
  .thesis-document div.tabular th {
    padding: 0.5rem 0.65rem !important;
    font-size: 0.8rem !important;
  }

  .thesis-document table.tabular tbody td,
  .thesis-document table.longtable tbody td,
  .thesis-document table.tabular td.td11,
  .thesis-document table.longtable td.td11,
  .thesis-document div.tabular tbody td {
    padding: 0.5rem 0.65rem !important;
    font-size: 0.8rem !important;
  }
}

/* ==========================================================================
   9. FIGURES & CAPTIONS
   ========================================================================== */

.thesis-document figure.figure,
.thesis-document .wrapfig-r,
.thesis-document .wrapfig-l,
.thesis-document div.figure {
  margin: 2.5rem 0;
  text-align: center;
  width: 100%;
  max-width: 100%;
  float: none !important;
  clear: both;
  display: block;
}

.thesis-document figure.figure img,
.thesis-document .wrapfig-r img,
.thesis-document .wrapfig-l img,
.thesis-document div.figure img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background-color: #ffffff;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
}

.thesis-document figure.figure img[src*="Main0x.svg"],
.thesis-document .wrapfig-r img[src*="Main0x.svg"],
.thesis-document div.figure img[src*="Main0x.svg"] {
  filter: none !important;
  background-color: #ffffff !important;
  padding: 1.5rem !important;
  max-width: 540px !important;
  width: 100% !important;
}

.thesis-document figcaption.caption,
.thesis-document div.caption,
.thesis-document .caption {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.85rem;
  text-align: center;
  line-height: 1.45;
}

.thesis-document figcaption.caption strong,
.thesis-document div.caption strong,
.thesis-document .caption strong {
  color: var(--text-main);
  font-weight: 600;
}

/* ==========================================================================
   10. FOOTNOTES & BIBLIOGRAPHY
   ========================================================================== */

.thesis-document div.footnotes {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 3.5rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.thesis-document aside.footnotetext {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.thesis-document .footnote-mark,
.thesis-document sup.textsuperscript {
  color: var(--accent);
  font-weight: 600;
  margin-right: 0.25rem;
  font-size: 0.8rem;
}

.thesis-document dl.thebibliography,
.thesis-document .thebibliography {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 0.75rem;
  column-gap: 0.85rem;
  align-items: baseline;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 1.5rem 0;
}

.thesis-document dt.thebibliography {
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
  margin: 0;
  padding: 0;
}

.thesis-document dd.thebibliography {
  margin: 0;
  padding: 0;
  color: var(--text-secondary);
}

.thesis-document dd.thebibliography p,
.thesis-document dd.thebibliography p.noindent {
  margin: 0;
  padding: 0;
  display: inline;
}

.thesis-document dd.thebibliography a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.thesis-document dd.thebibliography a:hover {
  text-decoration: underline;
}

.thesis-document p.bibitem {
  margin-left: 2.2rem;
  text-indent: -2.2rem;
  margin-bottom: 0.85rem;
}

.thesis-document p.bibitem a {
  color: var(--accent);
  font-weight: 500;
}

/* Clean up unnecessary hr and empty breaks */
.thesis-document br.newline {
  display: block;
  content: "";
  margin-top: 0.25rem;
}

