/* Minimal directory & table supplements aligned with reader.css variables. */
.part-heading {
  margin: 44px 0 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 22px;
  font-weight: 600;
}
.part-intro {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--muted);
}
.module-heading {
  margin: 28px 0 12px;
  font: 600 13px/1.6 var(--sans);
  letter-spacing: 0.6px;
  color: var(--accent);
}
.chapter-card.planned {
  opacity: 0.56;
  cursor: default;
}
.chapter-card.planned:hover {
  background: transparent;
}
.chapter-card.planned .chapter-label {
  color: var(--muted);
}
.series-part-label {
  margin: 16px 10px 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font: 600 11px/1.5 var(--sans);
  letter-spacing: 0.8px;
  color: var(--accent);
}
.series-part-label:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.series-chapter.planned {
  opacity: 0.5;
  cursor: default;
}
.series-chapter.planned:hover {
  background: transparent;
}
.code-caption {
  margin: 20px 0 -10px;
  font: 600 12px/1.6 var(--sans);
  color: var(--muted);
}
.code-caption a {
  color: var(--accent);
}
.lab-readout {
  max-width: 100%;
  overflow-x: auto;
}

/* Scholarly textbook tables with clear separation, header tint, and full gridlines. */
.table-wrap {
  margin: 24px 0;
  overflow-x: auto;
}
.table-wrap > table {
  margin: 0;
}
main table {
  width: 100%;
  margin: 24px 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
  font-size: 15px;
  line-height: 1.75;
}
main table th,
main table td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
main table th:last-child,
main table td:last-child {
  border-right: 0;
}
main table tbody tr:last-child td {
  border-bottom: 0;
}
main table thead th {
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
main table tbody tr:nth-child(even) td {
  background: rgba(128, 148, 138, 0.05);
}
main table tbody tr:hover td {
  background: rgba(20, 108, 104, 0.06);
}
main table td:first-child {
  font-weight: 500;
  white-space: nowrap;
}
[data-theme="dark"] main table {
  background: rgba(255, 255, 255, 0.015);
  border-color: #364540;
}
[data-theme="dark"] main table th,
[data-theme="dark"] main table td {
  border-color: #2f3d38;
}
[data-theme="dark"] main table thead th {
  background: #1d2725;
  border-bottom-color: #3d4f49;
}
[data-theme="dark"] main table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}
[data-theme="dark"] main table tbody tr:hover td {
  background: rgba(121, 207, 195, 0.07);
}
@media (max-width: 720px) {
  main table {
    display: block;
    overflow-x: auto;
    font-size: 14px;
  }
  main table th,
  main table td {
    padding: 8px 11px;
  }
  main table td:first-child {
    white-space: normal;
  }
}

/* Move the visible select box border onto the wrapping <label> so Edge/macOS
   native dropdown chevrons always have generous, symmetrical right margin
   without triggering double-arrow bugs from appearance: none. */
.reading-preferences > label {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  padding: 0 8px 0 2px;
  cursor: pointer;
}
.reading-preferences > label:hover {
  background: var(--wash);
  border-color: #8eaaa2;
}
[data-theme="dark"] .reading-preferences > label:hover {
  border-color: #718e89;
}
.reading-preferences > label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.reading-preferences .appearance-control select,
.reading-preferences .math-font-control select {
  width: auto;
  max-width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 5px 4px 5px 8px;
  font: 13px/1.4 var(--sans);
  color: var(--ink);
  white-space: nowrap;
  outline: none;
}
.reading-preferences .appearance-control select:focus-visible,
.reading-preferences .math-font-control select:focus-visible {
  outline: none;
}
.reading-preferences select option {
  background: var(--paper);
  color: var(--ink);
}
@media (max-width: 600px) {
  .reading-preferences > label {
    height: 32px;
    padding: 0 6px 0 1px;
  }
  .reading-preferences .appearance-control select,
  .reading-preferences .math-font-control select {
    width: 100%;
    padding: 0 2px 0 6px;
    font-size: 12px;
  }
}

/* GPU-composited reading progress bar & layout containment to avoid scroll/telemetry reflows. */
#reading-progress {
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}
.mj-workbench,
.mj-inspector,
.lab-figure,
.equation {
  contain: layout style;
}

/* Safe horizontal scrolling & visible thin scrollbar for display equations on narrow screens. */
.math.display {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 140, 132, 0.55) transparent;
  padding: 8px 4px 10px;
}
.math.display > .katex-display {
  width: max-content;
  min-width: 100%;
  margin: 0.35em auto;
}
.math.display::-webkit-scrollbar {
  height: 7px;
}
.math.display::-webkit-scrollbar-track {
  background: rgba(128, 148, 138, 0.08);
  border-radius: 999px;
}
.math.display::-webkit-scrollbar-thumb {
  background: rgba(105, 136, 128, 0.45);
  border-radius: 999px;
}
.math.display::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 108, 104, 0.72);
}
[data-theme="dark"] .math.display {
  scrollbar-color: rgba(121, 207, 195, 0.45) rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .math.display::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .math.display::-webkit-scrollbar-thumb {
  background: rgba(121, 207, 195, 0.38);
}
[data-theme="dark"] .math.display::-webkit-scrollbar-thumb:hover {
  background: rgba(121, 207, 195, 0.72);
}
