@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..900&display=swap");
body {
  margin: 0;
  padding: 40px 20px;
  padding-left: 320px;
  font-family: "DM Sans", sans-serif;
  line-height: 1.6;
  color: #222;
  transition: padding-left 0.3s ease;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fffdfa url("images/library.jpg") repeat;
  z-index: -1;
  transition: filter 0.3s ease;
}

body.dark-mode::before {
  filter: invert(100%) hue-rotate(180deg);
}
body.sidebar-closed {
  padding-left: 20px;
}

#sidebar-toggle {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1002;
  background: #f4f4f4;
  border: 1px solid #ccc;
  color: #333;
  font-size: 24px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
#sidebar-toggle:hover {
  background: #ddd;
}
body.dark-mode #sidebar-toggle {
  background: #242729;
  border-color: #555;
  color: #e8e6e3;
}
body.dark-mode #sidebar-toggle:hover {
  background: #3b4043;
}

#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  background: #f4f4f4;
  border-right: 1px solid #ccc;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1001;
  padding: 70px 20px 20px 20px;
  box-sizing: border-box;
}
body.sidebar-closed #sidebar {
  transform: translateX(-100%);
}
body.dark-mode #sidebar {
  background: #242729;
  border-right-color: #444;
}

@media (max-width: 900px) {
  body {
    padding-left: 20px !important;
  }
  #sidebar {
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
  }
}

.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  background-color: rgba(255, 255, 255, 1);
  padding: 40px 50px;
  border: 1px solid #ccc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

h1,
h2,
h3,
h4 {
  font-family: "Fraunces", serif;
  color: #111;
}
h1 {
  border-bottom: 2px solid #111;
  padding-bottom: 10px;
  margin-top: 0;
  font-weight: 700;
}
h2 {
  margin-top: 40px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 5px;
  font-weight: 600;
}
h3 {
  margin-top: 30px;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 1.4em;
}
h4 {
  margin-top: 22px;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 1.2em;
}

.subsection {
  margin-left: 24px;
}
.sub-subsection {
  margin-left: 24px;
}
@media (max-width: 600px) {
  .subsection,
  .sub-subsection {
    margin-left: 12px;
  }
}

nav ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}
nav li {
  margin-bottom: 5px;
}
nav ul ul {
  padding-left: 20px;
  margin-top: 5px;
}
nav {
  background: transparent;
  padding: 0;
  margin-bottom: 0;
  border: none;
}
a {
  color: #0056b3;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
code {
  background: #eaecf0;
  padding: 2px 5px;
  font-family: Consolas, monospace;
  font-size: 0.9em;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9em;
}
th,
td {
  border: 1px solid #ccc;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #eee;
  font-family: "Fraunces", serif;
}
.example-card {
  background: #f5edd7;
  border: 1px solid #ccc;
  border-left: 4px solid rgb(54, 170, 116);
  margin: 16px 0;
  padding: 12px 16px;
}
.example-card p:last-child {
  margin-bottom: 0;
}

blockquote {
  background: #fffbe6;
  border-left: 4px solid #e5c02a;
  margin: 20px 0;
  padding: 10px 15px;
  font-style: italic;
}

button#theme-toggle {
  float: right;
  margin-top: 5px;
  background: none;
  border: 1px solid #333;
  color: #333;
  font-size: 20px;
  cursor: pointer;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}
button#theme-toggle:hover {
  background: #333;
  color: #fff;
}

body.dark-mode .content-wrapper {
  background-color: rgba(24, 26, 27);
  border-color: #444;
}
body.dark-mode {
  color: #e8e6e3;
}
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #ffffff;
}
body.dark-mode h1 {
  border-bottom-color: #666;
}
body.dark-mode h2 {
  border-bottom-color: #555;
}
body.dark-mode nav {
  background: transparent;
  border: none;
}
body.dark-mode a {
  color: #6da9e4;
}
body.dark-mode code {
  background: #2b2e31;
  color: #e8e6e3;
}
body.dark-mode blockquote {
  background: #1e2022;
  border-left-color: 4px #6da9e4;
}
body.dark-mode th,
body.dark-mode td {
  border-color: #444;
  color: #e8e6e3;
}
body.dark-mode th {
  background: #242729;
  color: #ffffff;
}
body.dark-mode h4 {
  color: #d8d8d8;
}
body.dark-mode .example-card {
  background: #202325;
  border-color: #444;
  border-left-color: #6da9e4;
}
body.dark-mode button#theme-toggle {
  border-color: #e8e6e3;
  color: #e8e6e3;
}
body.dark-mode button#theme-toggle:hover {
  background: #e8e6e3;
  color: #181a1b;
}

.nav-collapse-toggle {
  cursor: pointer;
  font-size: 1.15em;
  margin-left: 6px;
  color: #666;
  background: transparent;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  transition: color 0.2s ease;
}

.nav-collapse-toggle:hover {
  color: #111;
  background: transparent;
}

body.dark-mode .nav-collapse-toggle {
  background: transparent;
  border: none;
  color: #a0a0a0;
}

body.dark-mode .nav-collapse-toggle:hover {
  color: #fff;
  background: transparent;
}
.nav-sub-list {
  display: none;
}
.nav-sub-list.expanded {
  display: block;
}
