body {
  display: flex;
  flex-direction: row; /* Align children in a row */
  flex-wrap: wrap; /* Allow wrapping for flexibility */
  background-color: #333; /* Dark background */
  background-image: linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 0
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 0);
  background-size: 4px 4px; /* Size of the grid cells */
  color: #f0f0f0; /* Light text color */
  font-family: "EB Garamond", serif;
  font-size: 18px; /* Adjust font size as needed */
  line-height: 1.4; /* Adjust line height for readability */
  border: 1px solid #555; /* Dark border */
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5); /* Deeper shadow for depth */
  margin: 0; /* Reset default margin */
  overflow-x: hidden; /* Prevent horizontal overflow */
  min-height: 100vh; /* Set minimum height to viewport height */
}

/* Prevent pixel overflow */
iframe,
img {
  max-width: 100%;
}

.codehilite {
  background: #222; /* Code block background */
  color: #f0f0f0; /* Code block text color */
  padding: 0.5em;
  border-radius: 4px;
  overflow: auto;
  font-family: "Courier New", monospace;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 400;
}

#menu-toggle-button {
  position: fixed;
  top: 1em;
  right: 1em;
  z-index: 1;
  background-color: #444;
  color: #f0f0f0; /* Button text color */
  border: none;
  padding: 0.5em 1em;
  cursor: pointer;
}

aside header .page_title {
  font-weight: bold;
  text-align: center;
}

/* Directory Label Style */
nav.toc ul li.directory > div.label {
  background-color: #4a4a4a; /* Slightly lighter than the aside background */
  color: #f0f0f0; /* Keeping the text color consistent with the body */
  padding: 0.3em 0.6em; /* Sufficient padding for visibility */
  margin-bottom: 0.5em; /* Spacing below the label */
  border-left: 4px solid #007bff; /* A colored border to indicate it's a label */
  font-weight: bold; /* Make the label text bold */
  display: flex; /* Use flexbox for alignment */
  align-items: center; /* Align items vertically center */
}

nav.toc ul li.directory > div.label a {
  color: #ccc;
}

nav.toc ul li.directory.active-dir > div.label a {
  color: #fff;
}

nav.toc ul li.directory.active-dir > div.label {
  border-left-color: #ff8c00; /* Active link color (orange) */
}

/* Icon for the directory label */
nav.toc ul li.directory > div.label::before {
  content: "📁"; /* You can replace this with an actual icon */
  margin-right: 0.5em; /* Space between icon and text */
  font-size: 1.2em; /* Adjust the size of the icon */
}

/* Adjust the padding for nested directories */
nav.toc ul ul li.directory > div.label {
  padding-left: 1em; /* Increase left padding for nested directories */
}

a {
  color: #007bff; /* Link color */
  text-decoration: none;

  user-select: none; /* Prevent text selection */
}

a:hover,
a:focus {
  color: #00bfff; /* Hover and focus color (bright blue) */
  text-decoration: inherit;
}

/* Only displays if there is no CSS support, such as a text-only browser */
.no-css {
  display: none;
}

/* Unlike form elements which have a :disabled psuedo-class, a has to be disabled w/ a class */
a.disabled {
  color: #cccccc; /* Light gray color */
  background-color: #363636; /* Light gray color */
  cursor: not-allowed; /* Cursor to indicate the link is not clickable */
  pointer-events: none; /* Prevents click events on the link */
  text-decoration: none; /* Optionally, remove underline */
}

.active a {
  color: #ff8c00; /* Active link color (orange) */
}

/* Hide aside scrollbar on WebKit */
aside::-webkit-scrollbar {
  display: none;
}

/* Hide aside scrollbar on Firefox */
aside {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

aside {
  flex: 1; /* Allow aside to grow */
  font-family: "Arial", sans-serif;
  font-size: 1rem;
  max-width: 300px;
  min-width: 300px;
  background-color: #222; /* Dark aside background */
  color: #f0f0f0; /* Aside text color */
  overflow-y: auto;
  position: sticky;
  top: 0;
}

aside nav.toc ul {
  list-style: none;
  padding: 0em 0.5em;
}

aside nav.toc ul li {
  padding: 0.1em 0em;
}

/* Override word breaking for the TOC */
aside nav.toc, nav.toc ul li {
  word-wrap: normal;
  overflow-wrap: normal;
  word-break: keep-all; /* Prevent words from breaking */
}

/* Ensure links within the TOC also don't break words */
nav.toc a {
  word-break: keep-all;
}

aside footer {
  display: none;
}

/* Desktop viewport */
@media (min-width: 769px) {
  aside {
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Arrange children vertically */
    height: 100vh; /* Fill the height of its parent container */
  }

  aside nav.toc {
    padding-bottom: 2rem;
  }

  aside footer {
    display: block;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 300px;
    background-color: rgba(34, 34, 34, 0.8);
    padding: 10px;
    margin: 0;
    text-align: center;

    box-sizing: border-box;
  }
}

article {
  flex: 3; /* Allow article container to take the remaining space */
  padding: 1em;
  background: #2c2c2c; /* Slightly lighter background for articles */
  color: #f0f0f0; /* White text color for articles */
  border-left: 1px solid #555; /* Dark border */
  overflow-x: hidden; /* Prevent horizontal overflow in the article container */
  min-height: 100vh; /* Set minimum height to viewport height */

  max-width: 1024px;
}

/**
 * Addresses the issue where paragraphs with a drop cap, especially those
 * starting with the letter "I", could be improperly split across columns in
 * a multi-column layout. This splitting disrupts the visual integrity of the
 * drop cap by separating it from the rest of its paragraph. The following
 * CSS rules prevent such splits, ensuring that paragraphs with drop caps
 * remain cohesive within a single column. This fix is crucial for maintaining
 * the aesthetic appeal and readability of drop-capped paragraphs, particularly
 * in articles or text bodies where the first letter is "I", which tends to be
 * more visually isolated due to its narrow width.
 */
article p.has-drop-cap {
  -webkit-column-break-inside: avoid; /* Chrome, Safari, Opera */
  page-break-inside: avoid; /* Firefox */
  break-inside: avoid-column; /* New standard */
}

article p.has-drop-cap::first-letter {
  font-size: 4em; /* Increase font size for the first letter */
  line-height: 1; /* Adjust line height for the drop cap */
  position: relative;
  float: left; /* Float the drop cap to the left */
  margin-right: 8px; /* Add some spacing between the drop cap and the text */
  margin-top: -2px;
}

article .heading-link {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #007bff;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

article .heading-link:hover {
  background-color: #00bfff;
}

article .heading-link i.fa-link {
  color: #fff;
  text-decoration: none;

  font-size: 1rem;
}

article footer {
  margin-top: 4rem;
}

article footer nav {
  border-top: 1px #494949 solid;
}

article footer nav a,
article footer nav a:hover {
  background-color: #ccc;
  padding: 0.5rem;
  margin: 0.5rem;
  border-radius: 4px;
  color: #000;
  font-family: "Arial", sans-serif;
}

article footer nav a:hover {
  background-color: #a9a9a9;
}

article footer nav a.previous {
  float: left;
}

article footer nav a.next {
  float: right;
}

article footer div.build_datetime {
  clear: both;
  font-size: 0.8em;
}

/* Mobile viewport */
@media (max-width: 768px) {
  body {
    flex-direction: column; /* Stack children vertically on small screens */
  }

  aside,
  article {
    flex: 0 0 100%; /* Make both containers full width on small screens */
    max-width: none; /* Override any max-width set previously */
  }

  /* Change the position of the aside to 'absolute' when in mobile mode */
  aside {
    position: relative;
    width: 100%; /* Make it full-width */
    max-height: 100%; /* Allow it to occupy the entire viewport height */
    overflow-y: auto; /* Enable vertical scrolling for the aside */
  }

  #menu-toggle-button {
    display: block; /* Show the button on small screens */
  }
}

/* Desktop viewport */
@media (min-width: 1200px) {
  /* Adjust this breakpoint as needed */
  /* TODO: Only work w/ 2-column layout w/ JS-enabled */
  article {
    column-count: 2; /* Create two columns */
    column-gap: 40px; /* Space between columns */
    padding: 1em;
    max-width: 1024px; /* Adjust as needed */
    margin: 0 auto; /* Center the article */
    /* Other styles remain the same */
  }

  /* Other existing styles for article */
}

/* Style for the table */
table {
  border-collapse: collapse;
  width: 100%;
  border-radius: 8px;
  overflow: hidden; /* Hide overflowing borders */
}

/* Style for table header row */
th {
  background-color: #6d6d6d;
  border-top: 1px solid #434343; /* Add top border to header cells */
  border-bottom: 1px solid #434343; /* Add bottom border to header cells */
  border-left: 1px solid #434343; /* Add left border to header cells */
  border-right: 1px solid #434343; /* Add right border to header cells */
  padding: 8px;
  text-align: left;
}

/* Style for table header and data cells */
td {
  border: 1px solid #434343;
  padding: 8px;
  text-align: left;
}

/* Alternate row background color */
tr:nth-child(even) {
  background-color: #3e3e3e;
}

/* Enabled by JS only */
.js-only {
  display: none;
}

code {
  overflow-wrap: break-word;
  white-space: pre-wrap; /* Allows wrapping and preserves formatting */
  background-color: #000;
  padding: 1em;
  display: block;
  border-radius: 1em;
}

blockquote {
  margin-left: 20px;
  padding-left: 15px;
  border-left: 5px solid #ccc; /* Color and size of the left border */
  font-style: italic; /* Optional: style the text as italic */
  color: #666; /* Optional: different text color for blockquotes */
}

/* Word-wrap fixes */

* {
  word-wrap: break-word; /* Older browsers */
  overflow-wrap: break-word; /* Preferred for modern browsers */
}

a {
  word-break: break-all;
}
