/* Dark theme matching moeblogs.online */

:root {
  --bg: #0c0c0c;
  --bg-elevated: #111111;
  --fg: #e8e8e8;
  --fg-dim: #6b6b6b;
  --fg-muted: #404040;
  --accent: #ffffff;
  --border: #1a1a1a;
  --code-bg: #0d0d0d;
  --font-mono: "JetBrains Mono", "SF Mono", monospace;
  --font-sans: "Inter", -apple-system, sans-serif;
}

/* Force dark mode by default */
html[data-theme="light"],
html:not([data-theme]) {
  --pst-color-background: #0c0c0c !important;
  --pst-color-on-background: #111111 !important;
  --pst-color-surface: #141414 !important;
  --pst-color-on-surface: #e8e8e8 !important;
  --pst-color-text-base: #e8e8e8 !important;
  --pst-color-text-muted: #6b6b6b !important;
  --pst-color-border: #1a1a1a !important;
  --pst-color-primary: #ffffff !important;
  --pst-color-secondary: #6b6b6b !important;
  --pst-color-accent: #ffffff !important;
  --pst-color-link: #e8e8e8 !important;
  --pst-color-inline-code: #ffffff !important;
  --pst-color-target: #1a1a1a !important;
}

/* Override Jupyter Book light theme */
body {
  background: var(--bg) !important;
  color: var(--fg) !important;
  font-family: var(--font-sans) !important;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Main content area */
#main-content {
  background: var(--bg) !important;
}

.bd-content {
  background: var(--bg) !important;
}

/* Remove sidebar or style it */
.bd-sidebar {
  background: var(--bg-elevated) !important;
  border-right: 1px solid var(--border) !important;
}

.bd-sidebar .nav-link {
  color: var(--fg-dim) !important;
}

.bd-sidebar .nav-link.active {
  color: var(--accent) !important;
}

/* Top bar */
.bd-header {
  background: rgba(12, 12, 12, 0.95) !important;
  backdrop-filter: blur(10px) !important;
  border-bottom: 1px solid var(--border) !important;
}

.bd-header .navbar-brand {
  color: var(--fg) !important;
  font-family: var(--font-mono) !important;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--accent) !important;
  font-family: var(--font-mono) !important;
  font-weight: 500 !important;
  word-wrap: break-word;
}

h1 {
  border-bottom: 1px solid var(--border) !important;
  padding-bottom: 0.5rem !important;
  font-size: 1.6rem !important;
}

p, li {
  color: var(--fg) !important;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* First paragraph fix for mobile */
.bd-content p:first-of-type {
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

a {
  color: var(--fg) !important;
  transition: opacity 0.15s !important;
  word-wrap: break-word;
}

a:hover {
  opacity: 0.6 !important;
  color: var(--fg) !important;
}

/* Code cells */
.cell_input {
  background: var(--code-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  overflow-x: auto;
}

.cell_input pre {
  background: var(--code-bg) !important;
  color: var(--fg) !important;
  font-family: var(--font-mono) !important;
}

.cell_output {
  background: #0a0a0a !important;
  border: 1px solid var(--border) !important;
  border-top: none !important;
  overflow-x: auto;
}

.cell_output pre {
  background: #0a0a0a !important;
  color: var(--fg-dim) !important;
  font-family: var(--font-mono) !important;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Inline code */
code {
  background: var(--bg-elevated) !important;
  color: var(--accent) !important;
  font-family: var(--font-mono) !important;
  padding: 0.15rem 0.35rem !important;
  border-radius: 3px !important;
  font-size: 0.85em !important;
  word-wrap: break-word;
}

/* Tables */
table {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

table th {
  background: var(--code-bg) !important;
  color: var(--accent) !important;
  font-family: var(--font-mono) !important;
}

table td {
  color: var(--fg) !important;
  border-color: var(--border) !important;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

::-webkit-scrollbar-track {
  background: var(--bg) !important;
}

::-webkit-scrollbar-thumb {
  background: var(--fg-muted) !important;
  border-radius: 3px !important;
}

/* Selection */
::selection {
  background: var(--fg) !important;
  color: var(--bg) !important;
}

/* Remove Jupyter Book footer branding */
.footer {
  background: var(--bg) !important;
  border-top: 1px solid var(--border) !important;
}

/* Hide the launch button */
.dropdown-launch-buttons {
  display: none !important;
}

/* Style the prev/next buttons */
.prev-next-bottom a {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border) !important;
  color: var(--fg-dim) !important;
}

/* Blockquotes */
blockquote {
  border-left: 2px solid var(--fg-muted) !important;
  color: var(--fg-dim) !important;
}

/* Theme switcher - hide light option */
.theme-switch[data-mode="light"] {
  display: none !important;
}

/* Mobile responsive fixes */
@media (max-width: 768px) {
  .bd-sidebar {
    width: 100% !important;
  }
  
  h1 {
    font-size: 1.3rem !important;
  }
  
  h2 {
    font-size: 1.1rem !important;
  }
  
  .bd-content {
    padding: 0 1rem !important;
  }
  
  .cell_input pre,
  .cell_output pre {
    font-size: 0.75rem !important;
  }
  
  table {
    font-size: 0.8rem !important;
  }
}

/* Prevent horizontal overflow */
.bd-article-container {
  max-width: 100%;
  overflow-x: hidden;
}

.cell {
  max-width: 100%;
}
