/* Dark Mode Theme for EECS 31L */

:root {
  --text-color: #e0e0e0;
  --border-color: #555;
  --secondary-text: #999;
}

html {
  overflow-x: hidden;
  width: 100%;
}

body {
  background-color: #1a1a1a;
  color: #e0e0e0;
  padding: 2rem;
  line-height: 1.6;
  max-width: 1180px;
  margin: 0 auto;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Headings */
h1 {
  color: #ccffcc;
  border-bottom: 3px solid #99ff99;
  padding-bottom: 0.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

h2 {
  color: #b3ffb3;
  border-bottom: 2px solid #77dd77;
  padding-bottom: 0.4rem;
  margin-top: 1.8rem;
  margin-bottom: 0.9rem;
  font-weight: 600;
}

h3 {
  color: #99ff99;
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

h4,
h5,
h6 {
  color: #88ee88;
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
}

h4 {
  font-size: 1.15rem;
  line-height: 1.4;
}

h5 {
  font-size: 1.05rem;
  line-height: 1.4;
}

h6 {
  font-size: 1rem;
  line-height: 1.4;
}

/* Strong/Bold */
strong, b {
  color: #ff9977;
  font-weight: 600;
}

/* Emphasis */
em, i {
  color: #aaddff;
  font-style: italic;
}

/* Links */
a {
  color: #66ccff;
  text-decoration: none;
  border-bottom: 1px solid #66ccff44;
  transition: all 0.2s ease;
}

a:hover {
  color: #88ddff;
  border-bottom-color: #88ddff;
}

/* Code */
code {
  background-color: #2a2a2a;
  color: #ff9977;
  padding: 0.1em 0.2em;
  border-radius: 4px;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  font-size: 0.8rem;
}

pre,
.highlight pre {
  background-color: #0d1117 !important;
  color: #c9d1d9 !important;
  border-left: 4px solid #ccffcc;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1rem 0;
}

pre code {
  background: none !important;
  color: #c9d1d9 !important;
  padding: 0;
  font-size: 0.8rem;
  font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
}

pre, code {
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: auto;
  text-rendering: optimizeSpeed;
}

/* Syntax highlighting */
.highlight .k  { color: #ff7b72 !important; }
.highlight .kt { color: #79c0ff !important; }
.highlight .o  { color: #79c0ff !important; }
.highlight .c  { color: #8b949e !important; }
.highlight .c1 { color: #8b949e !important; }
.highlight .s  { color: #a5d6ff !important; }
.highlight .mi { color: #f8c555 !important; }

/* Lists */
ul, ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

ul li, ol li {
  margin: 0;
}

ul li::marker, ol li::marker {
  color: #99ff99;
}

ul ul, ol ol, ul ol, ol ul {
  margin: 0.3rem 0;
}

p + ul, p + ol, li + ul, li + ol {
  margin-top: -1.0em;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 2px solid #444;
  margin: 2rem 0;
}

/* Blockquote */
blockquote {
  border-left: 4px solid #ff9977;
  padding: 1rem;
  margin: 1rem 0;
  color: #c0c0c0;
  font-style: italic;
  background-color: #222;
  border-radius: 4px;
}

/* Tables */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  /* background-color: #222; */
  overflow-x: auto;
  display: block;
}

table th,
table td {
  border: 1px solid #444;
  padding: 0.75rem;
  text-align: left;
}

table th {
  background-color: #2a2a2a;
  color: #ccffcc;
  font-weight: 600;
}

table tr:nth-child(even) {
  background-color: #252525;
}

table tr:hover {
  background-color: #2e2e2e;
}

/* Paragraphs */
p {
  margin: 1rem 0;
}

/* Bridge note */
p strong:first-child {
  color: #ff9977;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
  cursor: pointer;
  transition: opacity 0.2s;
}

img:hover {
  opacity: 0.9;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  background-color: #2a2a2a;
  color: #e0e0e0;
  border: 2px solid #99ff99;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  z-index: 1000;
}

.theme-toggle:hover {
  background-color: #99ff99;
  color: #1a1a1a;
}

/* Responsive */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  body {
    padding: 1rem;
    font-size: 0.95rem;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.3rem; }
  h3 { font-size: 1.1rem; }

  .theme-toggle {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  pre {
    padding: 0.75rem;
    font-size: 0.85rem;
  }

  table { font-size: 0.85rem; }

  table th,
  table td {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.15rem; }

  .theme-toggle {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
}

.invertable, .invertable p {
	filter: invert(1);
}