@font-face {
  font-family: "BerkeleyMono";
  src: url("/fonts/BerkeleyMono-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "BerkeleyMono";
  src: url("/fonts/BerkeleyMono-Bold.woff2") format("woff2");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "BerkeleyMono";
  src: url("/fonts/BerkeleyMono-Italic.woff2") format("woff2");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "BerkeleyMono";
  src: url("/fonts/BerkeleyMono-BoldItalic.woff2") format("woff2");
  font-weight: bold;
  font-style: italic;
  font-display: swap;
}

body {
  font-family: "BerkeleyMono", Arial, sans-serif;
  line-height: 1.6;
  padding: 0 20px;
  max-width: 900px;
  width: 95%;
  margin: 0 auto;
  overflow-x: hidden;
}

header {
  padding: 0.2rem;
  text-align: center;
}

header a {
  text-decoration: none;
  color: #333;
}

header a:hover {
  color: blue;
}

.centered a {
  text-decoration: none;
  color: #333;
}

.centered a:hover {
  color: blue;
}

.centered {
  text-align: center;
  margin: 0 auto;
  padding: 0.5em;
}

main {
  padding: 0.5rem 0;
  max-width: 95%;
  margin: 0 auto;
}

footer {
  padding: 1rem;
  text-align: center;
}

.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1em;
  position: relative;
}

table {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #aaa;
  table-layout: auto; /* Changed to auto to allow content-based sizing */
}

th,
td {
  border: 1px solid #aaa;
  padding: 8px;
  white-space: nowrap; /* Prevent word wrapping */
  overflow: hidden;
  text-overflow: ellipsis; /* Add ellipsis for overflowing text */
}

/* Ensure the table header stays visible */
thead {
  border: 1px solid #aaa;
  top: 0;
  z-index: 1;
}

/* Add some visual indication of scrollability */
.table-container::after {
  content: "➡️";
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  padding: 5px;
  background-color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  pointer-events: none;
}

/* Hide the arrow when not needed */
.table-container:not(.scrollable)::after {
  display: none;
}

/* Responsive adjustments with font size reduction */
@media screen and (max-width: 768px) {
  table {
    font-size: 14px; /* Base font size reduction for smaller screens */
  }
}

@media screen and (max-width: 480px) {
  table {
    font-size: 12px; /* Further font size reduction for very small screens */
  }

  th,
  td {
    padding: 6px 4px; /* Reduce padding for very small screens */
  }
}

/* Dynamic font size reduction */
.table-container.font-size-90 table {
  font-size: 90%;
}
.table-container.font-size-80 table {
  font-size: 80%;
}
.table-container.font-size-70 table {
  font-size: 70%;
}
.table-container.font-size-60 table {
  font-size: 60%;
}

img {
  max-width: 100%;
  margin: auto;
}

.subtitle {
  margin-top: 0.2em;
  font-size: 0.85em;
  color: #666;
}

.MathJax {
  width: 100%;
  overflow-x: auto;
  word-wrap: break-word;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

pre {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 2em;
  overflow-x: auto;
}

pre code {
  font-weight: normal;
}

/* Inline code */
p code,
li code {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0.2em 0.4em;
  font-size: 0.9em;
  font-family: "BerkeleyMono", Arial, sans-serif !important;
  color: #333;
  font-weight: normal;
}

a:has(code) {
  text-decoration: none;
}

a:has(code):hover {
  text-decoration: underline;
}

/* Container for the entire list */
.annotated-list {
  padding-left: 2em;
  list-style-type: none;
  counter-reset: list-counter;
}

.annotated-list li {
  margin-bottom: 1.5em;
  position: relative;
}

.annotated-list li::before {
  content: counter(list-counter) ".";
  counter-increment: list-counter;
  position: absolute;
  left: -1.5em;
  font-weight: bold;
}

.list-content {
  margin-bottom: 0.5em;
}

.annotation {
  background-color: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5em;
  font-size: 0.9em;
  overflow-x: auto;
}

.annotation code {
  white-space: pre-wrap;
  word-break: break-word;
}

/* Desktop styles */
@media (min-width: 768px) {
  .annotated-list {
    padding-left: 2.5em;
  }

  .annotated-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.2em;
  }

  .annotated-list li::before {
    left: -2.5em;
    width: 2em;
    text-align: right;
  }

  .list-content {
    flex: 1;
    padding-right: 1em;
    margin-bottom: 0;
  }

  .annotation {
    flex: 0 0 auto;
    background-color: transparent;
    border: none;
    padding: 0;
  }

  .annotation code {
    display: inline-block;
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.3em 0.5em;
    font-size: 0.9em;
    white-space: nowrap;
    overflow-x: visible;
  }
}

.toc-container {
  margin-bottom: 20px;
  margin-top: 20px;
}

.toc-toggle {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: 10px 15px;
  font-family: "BerkeleyMono", Arial, sans-serif;
  font-size: 1em;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color 0.3s;
}

.toc-toggle:hover {
  background-color: #e8e8e8;
}

.toc-toggle.active {
  background-color: #e0e0e0;
}

.toc-content {
  max-height: 1000px;
  overflow: hidden;
  background-color: #f8f8f8;
  transition: max-height 0.5s ease-out;
}

.toc-content.collapsed {
  max-height: 0;
}

.toc h2 {
  margin-top: 0;
  font-size: 1.2em;
}

.toc ul {
  list-style-type: none;
  padding-left: 15px;
  margin: 0;
}

.toc-content li {
  margin-bottom: 4px;
}

.toc-content a {
  text-decoration: none;
  color: #333;
}

.toc-content a:hover {
  text-decoration: underline;
  color: blue;
}
