/* ============================================================
   BLYX DOCUMENTATION THEME
   Precision IDE Design System (VS Code / JetBrains Style)
   100% Sharp Rectangular Geometry • Zero Shadows • No AI Glow Lines
   Pure High-Contrast Dark & Light Modes
   ============================================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* === CSS VARIABLES (Blyx Dark Mode Default) === */
:root {
  --blyx-bg: #0A0A0A;
  --blyx-surface: #121212;
  --blyx-surface-hover: #181818;
  --blyx-border: #222222;
  --blyx-border-subtle: #181818;
  --blyx-accent: #E8734A;
  --blyx-accent-hover: #F28C67;
  --blyx-cream: #F5F0E8;
  --blyx-white: #FFFFFF;
  --blyx-muted: #8A8A8A;
  --blyx-muted-dark: #555555;
  --blyx-code-bg: #121212;
  --blyx-code-text: #D4D4D4;
  --blyx-sidebar-bg: #0D0D0D;
  --blyx-sidebar-width: 290px;
  --blyx-font-display: 'Playfair Display', Georgia, serif;
  --blyx-font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --blyx-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* === UNIVERSAL ZERO-SHADOW & ZERO-CURVE RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  box-shadow: none !important;
  text-shadow: none !important;
}

html, body {
  background: var(--blyx-bg) !important;
  color: var(--blyx-cream) !important;
  font-family: var(--blyx-font-body) !important;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

/* Modal Help Fix */
.hidden, #mdbook-help-container {
  display: none !important;
}

#mdbook-help-container.active {
  display: flex !important;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

#mdbook-help-popup {
  background: var(--blyx-surface) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 28px !important;
  color: var(--blyx-cream) !important;
  max-width: 480px;
  width: 90%;
}

/* === SIDEBAR (Flexbox Column to Eliminate Header Overlap) === */
.sidebar, #mdbook-sidebar {
  display: flex !important;
  flex-direction: column !important;
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  background: var(--blyx-sidebar-bg) !important;
  border-right: 1px solid var(--blyx-border) !important;
  width: var(--blyx-sidebar-width) !important;
  font-family: var(--blyx-font-body) !important;
  box-shadow: none !important;
  overflow: hidden !important;
  z-index: 100 !important;
}

/* Sidebar Brand Header: Fixed at top of sidebar */
.blyx-sidebar-brand {
  flex-shrink: 0 !important;
  display: flex !important;
  align-items: center !important;
  padding: 16px 14px 14px 14px !important;
  border-bottom: 1px solid var(--blyx-border) !important;
  background: var(--blyx-sidebar-bg) !important;
  position: relative !important;
  z-index: 10 !important;
}

.blyx-sidebar-brand a {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  text-decoration: none !important;
  border: none !important;
}

.blyx-logo-img {
  height: 32px !important;
  width: auto !important;
  object-fit: contain;
  border-radius: 0 !important;
  display: block !important;
}

.blyx-brand-name {
  font-family: var(--blyx-font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--blyx-cream);
  letter-spacing: 0.02em;
}

/* Sidebar Scrollbox: Proper Flex Child Scrolling Below Header */
.sidebar .sidebar-scrollbox,
#mdbook-sidebar .sidebar-scrollbox,
mdbook-sidebar-scrollbox {
  position: relative !important;
  top: auto !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  padding: 12px 10px 32px 10px !important;
}

/* Sidebar Chapter List: Zero decorative lines */
.chapter {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

.chapter ol,
.chapter ul,
.chapter li ol,
.chapter li ul {
  list-style: none !important;
  border-left: none !important;
  padding-left: 10px !important;
  margin: 0 !important;
}

.chapter li {
  border-left: none !important;
  margin-bottom: 2px !important;
}

/* Sidebar Links */
.chapter li a {
  color: var(--blyx-muted) !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
  padding: 6px 10px !important;
  border-radius: 0 !important;
  border: 1px solid transparent !important;
  transition: color 0.12s ease, background 0.12s ease !important;
  text-decoration: none !important;
  display: block !important;
  line-height: 1.4 !important;
}

.chapter li a:hover {
  color: var(--blyx-cream) !important;
  background: var(--blyx-surface) !important;
  border-color: var(--blyx-border-subtle) !important;
}

/* Active Sidebar Item: Sharp rectangle, no blue vertical bar */
.chapter li.chapter-item.expanded > a,
.chapter li a.active,
#mdbook-sidebar .chapter li.chapter-item a.active {
  color: var(--blyx-accent) !important;
  font-weight: 500 !important;
  background: var(--blyx-surface) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
}

/* Sidebar Section Headers */
.chapter li.part-title {
  color: var(--blyx-muted) !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase !important;
  padding: 16px 10px 4px 10px !important;
  border-left: none !important;
}

/* === TOP MENU BAR === */
#menu-bar, .menu-bar, #mdbook-menu-bar {
  background: var(--blyx-sidebar-bg) !important;
  border-bottom: 1px solid var(--blyx-border) !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 0 16px !important;
}

#menu-bar .menu-title, .menu-bar .menu-title, #mdbook-menu-bar .menu-title {
  font-family: var(--blyx-font-display) !important;
  color: var(--blyx-cream) !important;
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em !important;
  text-align: center !important;
  margin: 0 !important;
}

#menu-bar button, #menu-bar a, .menu-bar button, .menu-bar a, #mdbook-menu-bar button, #mdbook-menu-bar a {
  color: var(--blyx-muted) !important;
  border: none !important;
  background: transparent !important;
  transition: color 0.12s ease !important;
}

#menu-bar button:hover, #menu-bar a:hover, .menu-bar button:hover, .menu-bar a:hover, #mdbook-menu-bar button:hover, #mdbook-menu-bar a:hover {
  color: var(--blyx-accent) !important;
}

/* === MAIN CONTENT AREA === */
.content, #mdbook-content {
  background: var(--blyx-bg) !important;
  color: var(--blyx-cream) !important;
  max-width: 820px !important;
  margin: 0 auto !important;
  padding: 44px 36px !important;
  font-family: var(--blyx-font-body) !important;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--blyx-font-display) !important;
  color: var(--blyx-cream) !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  margin-top: 2.2rem !important;
  margin-bottom: 0.9rem !important;
}

h1 { font-size: 2.3rem !important; border-bottom: 1px solid var(--blyx-border) !important; padding-bottom: 0.5rem !important; }
h2 { font-size: 1.65rem !important; border-bottom: none !important; }
h3 { font-size: 1.25rem !important; color: var(--blyx-cream) !important; }

h1 a, h2 a, h3 a, h4 a {
  color: inherit !important;
  text-decoration: none !important;
}
h1 a:hover, h2 a:hover { color: var(--blyx-accent) !important; }

p {
  font-family: var(--blyx-font-body) !important;
  color: #D4CFC8 !important;
  line-height: 1.8 !important;
  margin-bottom: 1.2rem !important;
}

a {
  color: var(--blyx-accent) !important;
  text-decoration: none !important;
  border-bottom: 1px solid rgba(232, 115, 74, 0.3) !important;
  transition: border-color 0.12s ease !important;
}

a:hover {
  border-bottom-color: var(--blyx-accent) !important;
}

/* === CONTENT IMAGES & DIAGRAMS === */
.content img:not(.blyx-logo-img):not(.blyx-explain) {
  display: block !important;
  max-width: 100% !important;
  height: auto !important;
  margin: 2rem auto !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
  background: var(--blyx-surface) !important;
}

html.blyx-light .content img:not(.blyx-logo-img):not(.blyx-explain),
.blyx-light .content img:not(.blyx-logo-img):not(.blyx-explain),
.light .content img:not(.blyx-logo-img):not(.blyx-explain) {
  border-color: #D0D7DE !important;
  background: #FFFFFF !important;
}

/* === VS CODE / IDE CODE BLOCKS (Zero Shadows, Sharp Rectangles) === */
pre {
  background: var(--blyx-code-bg) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
  padding: 16px 20px !important;
  overflow-x: auto !important;
  margin: 1.4rem 0 !important;
  position: relative !important;
}

pre code {
  font-family: var(--blyx-font-mono) !important;
  font-size: 0.875rem !important;
  line-height: 1.65 !important;
  color: var(--blyx-code-text) !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
}

/* Inline Code */
code:not(pre code) {
  font-family: var(--blyx-font-mono) !important;
  font-size: 0.85em !important;
  color: var(--blyx-accent) !important;
  background: #161616 !important;
  border: 1px solid #222222 !important;
  border-radius: 0 !important;
  padding: 2px 6px !important;
}

/* Copy Button */
.copy-button {
  background: var(--blyx-surface) !important;
  color: var(--blyx-muted) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
  font-family: var(--blyx-font-body) !important;
  font-size: 0.75rem !important;
  transition: all 0.12s ease !important;
}

.copy-button:hover {
  color: var(--blyx-cream) !important;
  border-color: var(--blyx-accent) !important;
}

/* === BLOCKQUOTES (Sharp Rectangle, Subtle Neutral Border) === */
blockquote {
  border: 1px solid var(--blyx-border) !important;
  border-left: 2px solid var(--blyx-muted) !important;
  background: var(--blyx-surface) !important;
  margin: 1.4rem 0 !important;
  padding: 14px 18px !important;
  border-radius: 0 !important;
  color: var(--blyx-cream) !important;
}

blockquote p { color: var(--blyx-cream) !important; margin: 0 !important; }

/* === TABLES === */
table {
  border-collapse: collapse !important;
  width: 100% !important;
  margin: 1.4rem 0 !important;
  font-size: 0.9rem !important;
  border: 1px solid var(--blyx-border) !important;
}

th {
  background: var(--blyx-surface) !important;
  color: var(--blyx-accent) !important;
  font-family: var(--blyx-font-body) !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.08em !important;
  padding: 10px 14px !important;
  border: 1px solid var(--blyx-border) !important;
  text-align: left !important;
}

td {
  padding: 10px 14px !important;
  border: 1px solid var(--blyx-border) !important;
  color: #D4CFC8 !important;
}

tr:hover td { background: var(--blyx-surface) !important; }

/* === NAVIGATION ARROWS (100% Sharp Rectangular Buttons) === */
.nav-chapters,
.mobile-nav-chapters,
.nav-wide-wrapper a,
.nav-wrapper a {
  border-radius: 0 !important;
  color: var(--blyx-muted) !important;
  border: 1px solid var(--blyx-border) !important;
  background: var(--blyx-surface) !important;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease !important;
}

.mobile-nav-chapters {
  padding: 10px 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 48px !important;
  height: 42px !important;
  font-size: 1.1rem !important;
}

.mobile-nav-chapters:hover,
.nav-chapters:hover {
  color: var(--blyx-accent) !important;
  border-color: var(--blyx-accent) !important;
  background: var(--blyx-surface-hover) !important;
}

.nav-chapters {
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
}

/* === SEARCH === */
#searchbar, #mdbook-searchbar {
  background: var(--blyx-surface) !important;
  color: var(--blyx-cream) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
  font-family: var(--blyx-font-body) !important;
  font-size: 0.9rem !important;
  padding: 8px 14px !important;
}

#searchbar:focus, #mdbook-searchbar:focus {
  border-color: var(--blyx-accent) !important;
  outline: none !important;
}

#searchresults, #mdbook-searchresults {
  background: var(--blyx-surface) !important;
  border: 1px solid var(--blyx-border) !important;
  border-radius: 0 !important;
}

#searchresults a, #mdbook-searchresults a {
  color: var(--blyx-cream) !important;
  border: none !important;
  padding: 10px 16px !important;
  display: block !important;
}

#searchresults a:hover, #mdbook-searchresults a:hover { background: var(--blyx-surface-hover) !important; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--blyx-bg); }
::-webkit-scrollbar-thumb { background: var(--blyx-border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--blyx-muted); }

/* === SELECTION === */
::selection {
  background: rgba(232, 115, 74, 0.3);
  color: var(--blyx-white);
}

/* === FILENAME BADGE === */
span.filename {
  display: inline-block;
  font-family: var(--blyx-font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blyx-muted);
  background: var(--blyx-surface);
  border: 1px solid var(--blyx-border);
  padding: 2px 8px;
  border-radius: 0 !important;
  margin-bottom: 4px;
}

/* === BLYX FOOTER === */
.blyx-footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--blyx-muted);
  padding: 32px 0 16px;
  border-top: 1px solid var(--blyx-border);
  margin-top: 48px;
  font-family: var(--blyx-font-body);
}

.blyx-footer a {
  color: var(--blyx-accent) !important;
  border: none !important;
}

/* === THEME PICKER POPUP === */
.theme-popup .theme:not([id*="blyx"]) { display: none !important; }
.theme-popup {
  border-radius: 0 !important;
  border: 1px solid var(--blyx-border) !important;
  background: var(--blyx-surface) !important;
}

/* ============================================================
   LIGHT MODE: HIGH CONTRAST CLEAN WHITE & BLACK ONLY
   ============================================================ */
html.blyx-light,
.blyx-light,
.light {
  --blyx-bg: #FFFFFF !important;
  --blyx-surface: #F6F8FA !important;
  --blyx-surface-hover: #ECEFF2 !important;
  --blyx-border: #D0D7DE !important;
  --blyx-border-subtle: #E1E4E8 !important;
  --blyx-accent: #0969DA !important;
  --blyx-cream: #24292F !important;
  --blyx-white: #000000 !important;
  --blyx-muted: #57606A !important;
  --blyx-muted-dark: #8C959F !important;
  --blyx-code-bg: #F6F8FA !important;
  --blyx-code-text: #24292F !important;
  --blyx-sidebar-bg: #F6F8FA !important;
}

html.blyx-light body,
.blyx-light body,
.light body {
  background: #FFFFFF !important;
  color: #24292F !important;
}

html.blyx-light h1, html.blyx-light h2, html.blyx-light h3, html.blyx-light h4,
.blyx-light h1, .blyx-light h2, .blyx-light h3,
.light h1, .light h2, .light h3 {
  color: #000000 !important;
}

html.blyx-light p,
.blyx-light p,
.light p {
  color: #24292F !important;
}

html.blyx-light .sidebar,
.blyx-light .sidebar,
.light .sidebar {
  background: #F6F8FA !important;
  border-right-color: #D0D7DE !important;
}

html.blyx-light .blyx-sidebar-brand,
.blyx-light .blyx-sidebar-brand {
  background: #F6F8FA !important;
  border-bottom-color: #D0D7DE !important;
}

html.blyx-light .blyx-brand-name,
.blyx-light .blyx-brand-name {
  color: #000000 !important;
}

html.blyx-light .chapter li a,
.blyx-light .chapter li a {
  color: #57606A !important;
}

html.blyx-light .chapter li a:hover,
.blyx-light .chapter li a:hover {
  color: #000000 !important;
  background: #ECEFF2 !important;
}

html.blyx-light .chapter li a.active,
.blyx-light .chapter li a.active {
  color: #0969DA !important;
  background: #FFFFFF !important;
  border-color: #D0D7DE !important;
}

html.blyx-light pre,
.blyx-light pre,
.light pre {
  background: #F6F8FA !important;
  border-color: #D0D7DE !important;
}

html.blyx-light pre code,
.blyx-light pre code,
.light pre code {
  color: #24292F !important;
}

html.blyx-light code:not(pre code),
.blyx-light code:not(pre code),
.light code:not(pre code) {
  background: #F0F2F5 !important;
  border-color: #D0D7DE !important;
  color: #0969DA !important;
}

html.blyx-light blockquote,
.blyx-light blockquote,
.light blockquote {
  background: #F6F8FA !important;
  border-color: #D0D7DE !important;
  border-left-color: #57606A !important;
  color: #24292F !important;
}

html.blyx-light blockquote p,
.blyx-light blockquote p {
  color: #24292F !important;
}

html.blyx-light table,
html.blyx-light th,
html.blyx-light td {
  border-color: #D0D7DE !important;
}

html.blyx-light th {
  background: #F6F8FA !important;
  color: #000000 !important;
}

html.blyx-light td {
  color: #24292F !important;
}

html.blyx-light .menu-bar,
html.blyx-light #mdbook-menu-bar {
  background: #F6F8FA !important;
  border-bottom-color: #D0D7DE !important;
}

html.blyx-light #menu-bar .menu-title,
html.blyx-light .menu-bar .menu-title {
  color: #000000 !important;
}

html.blyx-light .mobile-nav-chapters,
.blyx-light .mobile-nav-chapters,
.light .mobile-nav-chapters {
  background: #F6F8FA !important;
  border-color: #D0D7DE !important;
  color: #24292F !important;
}

html.blyx-light .mobile-nav-chapters:hover,
.blyx-light .mobile-nav-chapters:hover,
.light .mobile-nav-chapters:hover {
  background: #FFFFFF !important;
  border-color: #0969DA !important;
  color: #0969DA !important;
}

html.blyx-light span.filename {
  background: #F6F8FA !important;
  border-color: #D0D7DE !important;
  color: #57606A !important;
}

html.blyx-light .blyx-footer {
  border-top-color: #D0D7DE !important;
  color: #57606A !important;
}

/* ============================================================
   RESPONSIVE DESIGN (Phone, Tablet, Laptop, Desktop)
   ============================================================ */

/* Phone / Small Mobile (< 640px) */
@media (max-width: 639px) {
  .content, #mdbook-content {
    padding: 20px 14px !important;
    max-width: 100% !important;
  }
  h1 { font-size: 1.7rem !important; }
  h2 { font-size: 1.35rem !important; }
  h3 { font-size: 1.1rem !important; }
  pre {
    padding: 12px 14px !important;
    font-size: 0.8rem !important;
    margin: 1rem -14px !important;
    border-left: none !important;
    border-right: none !important;
  }
  pre code {
    font-size: 0.8rem !important;
  }
  .blyx-sidebar-brand {
    padding: 14px 12px !important;
  }
  .blyx-brand-name {
    font-size: 1.05rem !important;
  }
}

/* Tablet (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
  .content, #mdbook-content {
    padding: 32px 24px !important;
    max-width: 100% !important;
  }
  h1 { font-size: 2rem !important; }
  h2 { font-size: 1.5rem !important; }
}

/* Laptop & Desktop (> 1024px) */
@media (min-width: 1025px) {
  .content, #mdbook-content {
    padding: 48px 40px !important;
    max-width: 840px !important;
  }
}
