/* Overrides for RTD theme to persist UI tweaks */

/* Round the footer next button */
.rst-footer-buttons a[rel="next"].btn,
.rst-footer-buttons a[rel="next"].btn-neutral {
  border-radius: 20px !important;
}

/* Round the footer previous button (handle both rel="previous" and rel="prev") */
.rst-footer-buttons a[rel="previous"].btn,
.rst-footer-buttons a[rel="previous"].btn-neutral,
.rst-footer-buttons a[rel="prev"].btn,
.rst-footer-buttons a[rel="prev"].btn-neutral {
  border-radius: 20px !important;
}

/* Desktop-only bottom-right radius for main content panel */
@media screen and (min-width: 1100px) {
  .wy-nav-content {
    border-bottom-right-radius: 20px !important;
    border-bottom-left-radius: 20px !important;
  }
  /* Remove subtle overlay tint applied by the theme so the content appears crisp */
  .wy-nav-content-wrap { background: #ffffff !important; }
  /* Also ensure the inner nav content has an explicit white background (overrides any subtle tint) */
  .wy-nav-content { background: #ffffff !important; }
}

/* Ensure FontAwesome doesn't block rendering on slow networks: prefer swap */
/* (removed test @font-face for FontAwesome) */

/* Side nav search background */
.wy-side-nav-search {
  background-color: #202d2d!important;
}
.wy-side-nav-search img {
  background-color: #202d2d!important;
}

/* Fix: bot panel sizing and inner element box-sizing to prevent horizontal overflow */
#bot-panel, #bot-panel * {
  box-sizing: border-box !important;
}

/* Ensure the panel fits within the viewport and respects padding */
#bot-panel {
  /* Use left/right insets to avoid sub-pixel transform rounding issues that
     can cause a 1-2px visual overhang on some browsers. */
  left: 20px !important;
  right: 20px !important;
  transform: none !important;
  width: auto !important;
  max-width: 760px !important;
  margin: 0 auto !important;
  padding: 8px 16px !important;
  overflow: hidden !important; /* keep children clipped to rounded corners */
  box-sizing: border-box !important;
}

#bot-panel select,
#bot-panel textarea {
  /* Use a fixed inset so controls never touch the rounded panel edges.
     The calc accounts for inner padding/borders (see devtools width hint). */
  display: block !important;
  width: calc(100% - 18px) !important;
  max-width: calc(100% - 18px) !important;
  margin: 6px 0 !important;
  padding: 8px !important;
  border-radius: 8px !important;
  background-clip: padding-box !important;
  box-sizing: border-box !important;
}

#bot-panel textarea {
  min-height: 64px !important;
  max-width: 100% !important;
  overflow: auto !important;
  resize: vertical !important;
}

/* Buttons: keep inside the panel without pushing layout */
#bot-panel > div > div > button {
  box-sizing: border-box !important;
}

/* Small screens: ensure panel keeps horizontal padding */
@media screen and (max-width: 600px) {
  #bot-panel { width: calc(100% - 28px) !important; left: 50% !important; transform: translateX(-50%) !important; }
}

/* Additional fixes: ensure inner container doesn't allow children to overflow
  and make form controls block-level with a tiny inset so borders don't overlap
  the panel's rounded corners. */
#bot-panel > div { width: 100% !important; display: block !important; }
#bot-panel select, #bot-panel textarea {
  display: block !important;
  max-width: calc(100% - 24px) !important;
  margin: 4px 0 !important;
  padding: 8px !important;
  box-sizing: border-box !important;
  border-radius: 8px !important;
  background-clip: padding-box !important;
}
#bot-panel textarea { box-shadow: none !important; border: 1px solid rgba(0,0,0,0.06) !important; }

/* Strong clipping to ensure no child element can visually escape rounded corners */
#bot-panel { overflow: hidden !important; }

/* Ensure inner wrapper uses full width but doesn't allow its children to exceed it */
#bot-panel > div { width: 100% !important; padding: 0 !important; }

/* Defensive: cap any child element's max-width to the panel's inner width */
#bot-panel * { max-width: 100% !important; }

/* Make button row layout stable and prevent horizontal overflow */
#bot-panel .button-row, #bot-panel > div > div { display: flex !important; gap: 8px !important; flex-wrap: nowrap !important; }
#bot-panel .button-row button, #bot-panel > div > div > button { flex: 0 0 auto !important; }

/* If the viewport is narrow, allow buttons to wrap but keep them within the panel */
@media screen and (max-width: 420px) {
  #bot-panel .button-row, #bot-panel > div > div { flex-wrap: wrap !important; }
}

/* Top nav background */
.wy-nav-top {
  background: #8017cd !important;
}
.wy-nav-top img {
  background-color: #8017cd !important;
}

/* Explorer / side navigation background */
.wy-nav-side, .wy-side-scroll, .wy-menu, .wy-menu-vertical {
  background-color: #202d2d!important;
}
.wy-nav-side a.icon.icon-home { color: #39fff9 !important; }

/* Logo / site title color in the side explorer */
.wy-nav-side .logo, .wy-nav-side .project, .wy-nav-side a.logo, .logo,
.wy-nav-top .logo, .wy-nav-top .project, .wy-nav-top a.logo {
  color: #39fff9 !important;
}

/* Breadcrumb / in-content small home icon: match the toctree plus color */
.wy-breadcrumbs .icon.icon-home,
.wy-breadcrumbs-aside .icon.icon-home,
.wy-nav-content .icon.icon-home,
.wy-breadcrumbs a.icon.icon-home {
  color: #39fff9 !important;
}

/* Force header/site-title color in the top nav (all states) */
.wy-nav-top .project,
.wy-nav-top a.logo,
.wy-nav-top .logo,
nav.wy-nav-top .project,
nav.wy-nav-top a.logo {
  color: #39fff9 !important;
}
.wy-nav-top .project:hover,
.wy-nav-top a.logo:hover,
.wy-nav-top .logo:hover,
nav.wy-nav-top .project:hover {
  color: #39fff9 !important;
}

/* Ensure any small icon inside the top header uses the same cyan */
.wy-nav-top .icon.icon-home,
.wy-nav-top .icon {
  color: #39fff9 !important;
}

/* Ensure FontAwesome bars icon in the top nav is visible (mobile) */
.wy-nav-top .fa {
  color: #39fff9 !important;
}

/* Make top navigation sticky on mobile devices (handsets) */
@media screen and (max-width: 900px) {
  .wy-nav-top {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
    width: 100% !important;
    display: block !important;
  }

  /* On mobile, make the top header match the explorer (dark) and use the
     bright cyan title color for the header text and primary headings */
  .wy-nav-top {
    background: #202d2d!important;
  }
  .wy-nav-top .logo, .wy-nav-top a, .wy-nav-top a.logo, nav.wy-nav-top a {
    color: #39fff9 !important;
  }
  .wy-nav-top .project { color: #39fff9 !important; }
  .rst-content h1 {
    color: #404040 !important;
  }
}

/* Mobile: ensure anchor scrolling doesn't hide headings behind the fixed topbar.
   Use scroll-padding-top for browsers and a fallback padding-top for content. */
@media screen and (max-width: 900px) {
  html { scroll-padding-top: calc(var(--topbar-height) + 10px); }
  /* apply a small extra padding so headings are visually separated from the sticky header */
  main.content, .content, .rst-content { padding-top: calc(var(--topbar-height) + 10px) !important; }
  /* Also ensure individual targets have adequate offset when using fragment links */
  .rst-content :target { scroll-margin-top: calc(var(--topbar-height) + 10px); }
}

/* Footer centering and mobile break rules */
.footer-contentinfo{
  text-align: center !important;
}
.footer-contentinfo p{
  margin: 0.25em 0 !important;
}
.break-mobile{ display: inline; }
@media screen and (max-width: 900px) {
  .break-mobile{ display: block !important; }
}

/* Hide any leftover theme attribution elements as a fallback */
.footer-meta { display: none !important; }

/* Hide "View page source" breadcrumb link (defensive fallback) */
.wy-breadcrumbs-aside a[href^="_sources"] { display: none !important; }

/* Fix: ensure main content stays inside its container and doesn't visually overflow
   (prevents elements appearing outside the text container on some viewports). */
.wy-nav-content {
  position: relative !important;
  z-index: 1 !important;
  background: #ffffff !important;
  /* allow sticky children (top nav) to escape clipping on mobile */
  overflow: visible !important;
}

.rst-content {
  position: relative !important;
  z-index: 2 !important;
  max-width: 100% !important;
}

/* Make images and wide elements respect the content width */
.rst-content img, .rst-content iframe, .rst-content table, .rst-content pre {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Limit content width for readability to match reference layout */
.rst-content {
  max-width: 800px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Improve toctree UX: icons, font sizes and indentation for parent/child entries
   Use higher specificity and !important to override theme rules reliably. */
.wy-nav-side .wy-menu-vertical li.sbt-has-children > a::before {
  display: none !important; /* hide legacy pseudo-icon; we use explicit toggle buttons */
}
.wy-nav-side .wy-menu-vertical li.sbt-has-children > a {
  font-weight: 500 !important;
  font-size: 100% !important;
}
.wy-nav-side .wy-menu-vertical li.sbt-has-children ul a {
  font-weight: 400 !important;
  font-size: 90% !important;
  padding-left: 0.6em !important;
  color: #d9d9d9 !important; /* lighter child links */
}
.wy-nav-side .wy-menu-vertical button.toctree-expand { display: none !important; }

/* ensure nested lists keep a clear indent */
.wy-nav-side .wy-menu-vertical li ul { padding-left: 1.0em !important; }

/* Sidebar fixed + visible scrollbars
   - Fix the side explorer so it stays in place while the main document scrolls.
   - Make the side-scroll area full viewport height and independently scrollable.
   - Provide wider, clearly visible scrollbars for both the side nav and main view. */
.wy-nav-side {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  width: var(--sidebar-width) !important;
  z-index: 200 !important;
}
.wy-side-scroll {
  height: 100vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 6px !important;
}
@media screen and (min-width: 901px) {
  /* Desktop: Content startet nach der Sidebar mit mindestens 5% (min 50px) Abstand */
  .wy-nav-content-wrap { 
    margin-left: var(--sidebar-width) !important; 
    padding-left: 0 !important;
  }
  
  /* Content-Bereich mit Mindestabstand zur Sidebar und zentriert */
  .wy-nav-content {
    padding-left: max(5%, 50px) !important;
    padding-right: max(5%, 50px) !important;
    display: flex !important;
    justify-content: center !important;
  }
  
  /* rst-content: zentriert mit max-width für Lesbarkeit */
  .wy-nav-content .rst-content { 
    transform: none !important;
    max-width: 800px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

/* Ensure main content still scrolls normally (page scroll) but show a clear thumb */
body, .rst-content {
  scrollbar-color: rgba(0,0,0,0.25) transparent !important;
  scrollbar-width: thin !important;
}

/* WebKit scrollbars: wider and visible */
.wy-side-scroll::-webkit-scrollbar { width: 3px !important; }
.wy-side-scroll::-webkit-scrollbar-track { background: transparent !important; }
.wy-side-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.25) !important; border-radius: 3px !important; }

body::-webkit-scrollbar, .rst-content::-webkit-scrollbar { width: 3px !important; }
body::-webkit-scrollbar-track, .rst-content::-webkit-scrollbar-track { background: transparent !important; }
body::-webkit-scrollbar-thumb, .rst-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18) !important; border-radius: 3px !important; }

/* Firefox: prefer normal width and visible color */
html, body, .wy-side-scroll { scrollbar-width: thin !important; }

/* Small UX helper: ensure the top mobile bar doesn't overlap scrollbar area */
.wy-nav-top { z-index: 9999 !important; }

/* --- Adjustments for the simplified static pages (simple_site) --- */
/* Provide a CSS variable for the topbar height so offsets stay consistent */
:root { --topbar-height: 56px; --sidebar-width: 300px; }

/* Make the simple header fixed and ensure it doesn't cover content */
header.topbar {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  z-index: 1200 !important;
  background: #202d2d!important; /* match explorer background */
  color: #39fff9 !important;
}

header.topbar { display: flex !important; align-items: center !important; padding: 0 12px !important; }
header.topbar #hamburger { background: transparent !important; border: none !important; color: #39fff9 !important; /* hide text glyph but keep accessible label */ font-size: 0 !important; line-height: 0 !important; margin-right: 8px !important; width:34px; height:34px; display:inline-flex; align-items:center; justify-content:center; }
header.topbar #hamburger::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  -webkit-mask-image: url('../icons/md_menu.svg');
  -webkit-mask-size: 22px 22px;
  -webkit-mask-repeat: no-repeat;
  mask-image: url('../icons/md_menu.svg');
  mask-size: 22px 22px;
  mask-repeat: no-repeat;
  background-color: #39fff9; /* cyan */
}
header.topbar #hamburger { color: inherit !important; }
header.topbar .logo { font-weight: 700 !important; margin-left: 4px !important; }

/* Layout container: leave room for the fixed header */
.layout {
  margin-top: calc(var(--topbar-height) + 8px) !important;
}

/* Desktop: topbar limited to explorer width and sidebar flush under it */
@media screen and (min-width: 901px) {
  header.topbar {
    left: 0 !important;
    right: auto !important;
    width: 300px !important;
    box-sizing: border-box !important;
  }
  /* ensure the sidebar sits directly below the topbar without extra gap */
  nav.sidebar, .sidebar { top: calc(var(--topbar-height)) !important; }
  /* Content zentriert im verfügbaren Bereich (nach Sidebar) */
  main.content, .content { 
    margin-left: var(--sidebar-width) !important;
    padding-left: max(5%, 50px) !important;
    padding-right: max(5%, 50px) !important;
  }
  /* Hide mobile hamburger icon on desktop widths */
  header.topbar #hamburger { display: none !important; }
}

/* Sidebar in the simple pages */
nav.sidebar, .sidebar {
  position: fixed !important;
  top: calc(var(--topbar-height)) !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 300px !important;
  z-index: 1000 !important;
  background: #202d2d!important;
  overflow: visible !important;
}

/* Make the menu inside the sidebar scrollable independently */
.sidebar .wy-menu,
.sidebar .wy-menu-vertical {
  height: calc(100vh - (var(--topbar-height) + 16px)) !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
  padding-right: 8px !important;
}

/* Main content should not sit underneath the sidebar - zentriert im verfügbaren Bereich */
main.content, .content {
  margin-left: var(--sidebar-width) !important;
  padding: 1.2rem max(5%, 50px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
}

/* Inner content max-width für Lesbarkeit, zentriert */
main.content > *, .content > * {
  max-width: 800px !important;
  width: 100% !important;
}

/* Ensure footer sits below content and not overlapped */
.site-footer { 
  margin-left: var(--sidebar-width) !important; 
  text-align: center !important;
}

/* Scrollbar styling for the simplified page elements */
.sidebar .wy-menu::-webkit-scrollbar { width: 10px; }
.sidebar .wy-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius:6px; }
main.content::-webkit-scrollbar { width: 10px; }
main.content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius:6px; }

/* small screens: collapse sidebar to top bar behaviour */
@media screen and (max-width: 900px) {
  /* Mobile: sidebar is off-canvas by default and slides in when `.open` is set */
  nav.sidebar, .sidebar {
    position: fixed !important;
    top: var(--topbar-height) !important;
    left: -100% !important;
    width: 85% !important;
    height: calc(100vh - var(--topbar-height)) !important;
    transition: left .2s ease-in-out !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4) !important;
  }
  nav.sidebar.open, .sidebar.open { left: 0 !important; }
  main.content, .content { margin-left: 0 !important; padding-top: 8px !important; }

  /* Fix: ensure the overall nav-content wrap does not keep a desktop margin on mobile
     (this previously pushed the content out of the viewport on narrow devices). */
  .wy-nav-content-wrap { margin-left: 0 !important; }
  /* Reduce any extra horizontal padding so the content fits neatly on small screens */
  .wy-nav-content, .wy-nav-content .rst-content, main.content, .content { padding-left: 0.6rem !important; padding-right: 0.6rem !important; }
}

/* Ensure heading anchor links appear as small rounded rectangles (fallback if icon fonts missing) */
.headerlink {
  display: inline-block !important;
  width: 20px !important;
  height: 20px !important;
  line-height: 20px !important;
  text-align: center !important;
  vertical-align: middle !important;
  margin-left: 0.4rem !important;
  margin-right: 0 !important;
  background: rgba(57,255,249,0.03) !important; /* subtle */
  border: 1px solid rgba(57,255,249,0.09) !important;
  color: #39fff9 !important;
  border-radius: 4px !important;
  text-decoration: none !important;
  font-size: 12px !important;
  font-family: ; /* keep user's font */
  overflow: hidden !important;
}
.headerlink::after {
  content: '\21AA'; /* rightwards arrow with hook as fallback symbol */
  display: inline-block !important;
  color: #39fff9 !important;
  font-size: 12px !important;
  line-height: 20px !important;
}

/* Reduce prominence on hover (keep subtle) */
.headerlink:hover { background: rgba(57,255,249,0.06) !important; }

/* Toctree parent markers (works with script.js which adds `has-children` and `sbt-open`) */
.sidebar .wy-menu-vertical li.has-children > a {
  position: relative !important;
  padding-left: 1.6em !important;
}
/* remove icon-in-::before approach; use explicit toggle button instead */

/* Explorer link weight: keep normal (not bold) like Sphinx default */
.sidebar .wy-menu-vertical a { font-weight: 400 !important; }

/* Toggle button inserted by script: visible, large, and colorized
   Uses inline SVG so color can inherit from `color` and match theme. */
.toc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border: none;
  padding: 0;
  vertical-align: middle;
  background: transparent;
  cursor: pointer;
  color: #39fff9; /* default cyan */
}
.toc-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}
.toc-toggle[data-state="open"] {
  color: #ff00f5; /* accent when open */
}
.toc-toggle:focus {
  outline: 2px solid rgba(255,0,245,0.14);
  outline-offset: 2px;
}
.toc-toggle:hover { transform: scale(1.03); }

/* Indent child lists for clarity */
.sidebar .wy-menu-vertical li > ul {
  margin-left: 0.6em !important;
  padding-left: 1.2em !important;
}

/* Ensure the logo/title in header has the cyan color */
header.topbar .logo, header.topbar a.logo { color: #39fff9 !important; text-decoration: none !important; }

/* When the sidebar is open on mobile, make sure body can't scroll beneath */
body.sidebar-open { overflow: hidden !important; }

/* Lighten general nav link colors for readability */
.wy-nav-side .wy-menu-vertical a {
  color: #e6e6e6 !important; /* parent links */
  display: block !important;
  padding: 6px 8px !important;
  box-sizing: border-box !important;
  border-radius: 10px !important;
  -webkit-background-clip: padding-box !important;
  background-clip: padding-box !important;
}
.wy-nav-side .wy-menu-vertical a:hover {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-radius: 10px !important;
  transition: background 140ms ease-in-out, color 120ms ease-in-out;
}

/* When we temporarily keep the sidebar open on mobile, force it visible
   to avoid browser UI reflow closing it and moving the viewport. */
@media screen and (max-width: 900px) {
  body.sbt-keep-open .wy-nav-side,
  body.sbt-keep-open .wy-side-scroll {
    display: block !important;
    visibility: visible !important;
    transform: none !important;
    -webkit-transform: none !important;
    left: 0 !important;
  }
  body.sbt-keep-open .wy-nav-content {
    /* do not shift content; keep layout stable while sidebar is visible */
    transform: none !important;
  }
}

/* Explorer tip box: subtle, rounded, sits at the bottom of the sidebar */
.sidebar .explorer-note {
  margin: 0.75rem 0.75rem 0.9rem 0.75rem !important;
  padding: 0.5rem 0.6rem !important;
  background: #232727 !important; /* very subtle on dark background */
  color: rgba(255,255,255,0.75) !important;
  border-radius: 10px !important;
  font-size: 0.85rem !important;
  line-height: 1.2 !important;
  text-align: center !important;
  box-shadow: none !important;
}
.sidebar .explorer-note small { display: block; color: rgba(255,255,255,0.72) !important; }

@media screen and (min-width: 901px) {
  /* keep the note aligned with the sidebar column on desktop */
  .sidebar .explorer-note { position: absolute; left: ; right: 12px; bottom: 30px; }
  /* Prevent the explorer hint from being selected or copied; hide while user selects text */
  .explorer-note, .copilot-tip { user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; }

  /* When user selects text, hide the hint to avoid interfering with selection and copying */
  body.selection-in-progress .explorer-note, body.selection-in-progress .copilot-tip { visibility: hidden !important; pointer-events: none !important; }
  /* Reserve space inside the TOC so the last link is scrolled above other badges */
  .sidebar .local-toc { padding-bottom: 80px !important; }
}

@media screen and (max-width: 900px) {
  /* on mobile the sidebar is sliding; place the note near the bottom inside the scroll area */
  .sidebar .explorer-note { position: relative !important; bottom: auto !important; }
  /* Keep the PDF badge non-sticky on small screens so it stays in-flow */
  .sidebar .sidebar-pdf { position: relative !important; top: auto !important; z-index: auto !important; }
  /* Also add extra spacing on small screens where the note is in-flow */
  .sidebar .local-toc { padding-bottom: 220px !important; }
}

/* Enforce content max width across common Sphinx containers so layout matches reference */
.wy-nav-content, main.content, .content, .document, .rst-content, .wy-nav-content .rst-content {
  max-width: 800px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
  /* Ensure at least 120px bottom space so the final section is not obscured by the sidebar note */
  padding-bottom: 140px !important;
}

/* Ensure the main content area keeps reasonable padding when sidebar present */
@media screen and (min-width: 901px) {
  main.content, .content { padding-top: 0.5rem !important; }
}

/* Global table styling to match Sphinx/RTD look and handle newly added tables.
   Apply both to wrapped tables (.wy-table-responsive) and raw Sphinx tables (table.docutils). */
.wy-table-responsive, table.docutils, .rst-content table {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 1rem 0 !important;
}
.wy-table-responsive table, table.docutils, .rst-content table {
  width: 100% !important;
  min-width: 420px !important;
  border-collapse: collapse !important;
  font-size: 0.95rem !important;
  table-layout: auto !important;
}
/* boxed table look like reference */
table.docutils {
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 4px !important;
  overflow: hidden !important;
}
table.docutils th, table.docutils td {
  border: none !important; /* use row borders for cleaner look */
}
.rst-content table thead th {
  background: #f4f6f7 !important;
  color: #222 !important;
  font-weight: 600 !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}
.rst-content table tbody tr:nth-child(even) { background: #fbfbfb !important; }
.rst-content table tbody tr:nth-child(odd) { background: #fff !important; }
.rst-content table td, .rst-content table th { padding: 0.6rem 0.9rem !important; vertical-align: middle !important; }
.wy-table-responsive th, .wy-table-responsive td,
table.docutils th, table.docutils td,
.rst-content table th, .rst-content table td {
  padding: 0.55rem 0.9rem !important;
  border-bottom: none !important; /* avoid double horizontal lines; use row separators */
  vertical-align: middle !important;
}
.wy-table-responsive thead th, table.docutils thead th, .rst-content table thead th {
  background: #f6f7f8 !important;
  color: #222222 !important;
  font-weight: 600 !important;
  text-align: left !important;
}
.wy-table-responsive tbody tr.row-odd,
.rst-content table tbody tr.row-odd,
table.docutils tbody tr.row-odd { background: #ffffff !important; }
.wy-table-responsive tbody tr.row-even,
.rst-content table tbody tr.row-even,
table.docutils tbody tr.row-even { background: #fbfbfb !important; }
.wy-table-responsive td.text-right, .wy-table-responsive th.text-right, .text-right,
table.docutils td.text-right, table.docutils th.text-right,
.rst-content table td.text-right, .rst-content table th.text-right { text-align: right !important; }
.wy-table-responsive table.docutils.align-default, table.docutils.align-default { border: none !important; }

/* Smaller padding on narrow viewports for wide tables */
@media screen and (max-width: 640px) {
  .wy-table-responsive th, .wy-table-responsive td, table.docutils th, table.docutils td, .rst-content table th, .rst-content table td { padding: 0.45rem 0.6rem !important; }
}

/* Utility classes for red/emphatic text used in examples */
.text-danger, .text-red, .danger, .error { color: #d32f2f !important; font-weight: 600 !important; }
.warn, .important { color: #ff6b00 !important; font-weight: 600 !important; }

/* Ensure inline code blocks inside tables remain legible */
.wy-table-responsive code, .wy-table-responsive .literal {
  background: rgba(0,0,0,0.03) !important;
  padding: 0.12rem 0.28rem !important;
  border-radius: 3px !important;
  font-family: monospace !important;
  font-size: 0.92em !important;
}

/* inline code small pill styling in content */
.rst-content code span.pre, .rst-content .literal span.pre {
  padding: 0.08rem 0.28rem !important;
  border-radius: 3px !important;
  background: rgba(0,0,0,0.03) !important;
}
.rst-content .pre-inline.numeric { background: rgba(255,0,0,0.04) !important; }
.rst-content .pre-inline.numeric.text-danger { color: #d32f2f !important; font-weight: 600 !important; }

/* --- Table visuals tuned to match the screenshot --- */
/* Boxed table, visible vertical separators, alternating rows, and rounded corners */
.wy-table-responsive table, table.docutils, .rst-content table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
  background: #ffffff !important;
}

table.docutils {
  border: 1px solid rgba(0,0,0,0.08) !important;
  border-radius: 6px !important;
  overflow: hidden !important;
}

/* Header styling: light grey background, stronger weight */
.rst-content table thead th {
  background: #f6f7f8 !important;
  color: #222 !important;
  font-weight: 800 !important;
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  padding-left: 0.8rem !important;
  padding-right: 0.8rem !important;
  line-height: 1.2 !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
}

/* Cell appearance: clear vertical separators between columns */
table.docutils td, table.docutils th {
  padding-top: 0.45rem !important; /* slightly tighter vertical spacing */
  padding-bottom: 0.45rem !important;
  padding-left: 0.8rem !important;
  padding-right: 0.8rem !important;
  border-right: 1px solid rgba(0,0,0,0.06) !important;
  vertical-align: middle !important;
  line-height: 1.25 !important; /* consistent row height control */
}

/* Force symmetric vertical padding for all table cell variants to override earlier rules */
.rst-content table td, .rst-content table th,
.wy-table-responsive td, .wy-table-responsive th,
table.docutils td, table.docutils th {
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
}
/* remove right border on the last column so outer table border shows */
table.docutils td:last-child, table.docutils th:last-child { border-right: none !important; }

/* Alternate row backgrounds */
.rst-content table tbody tr:nth-child(even) { background: #fbfbfb !important; }
.rst-content table tbody tr:nth-child(odd) { background: #fff !important; }

/* Use a single separator per row (avoids double lines under cells) */
.rst-content table tbody tr { border-bottom: 1px solid rgba(0,0,0,0.06) !important; }
.rst-content table tbody tr:last-child { border-bottom: none !important; }

/* Ensure no cell-level bottom borders remain (override theme.css and theme_pretty.css) */
.rst-content table.docutils td, .rst-content table.docutils th,
.rst-content table td, .rst-content table th,
.wy-table-responsive td, .wy-table-responsive th,
.wy-table td, .wy-table th {
  border-bottom: none !important;
}

/* Right-align the value (last) column for numeric/currency readability */
.rst-content table td:last-child, .rst-content table th:last-child {
  text-align: right !important;
  white-space: nowrap !important;
}

/* Rounded corners for the header cells to match the outer rounded box */
table.docutils thead th:first-child { border-top-left-radius: 6px !important; }
table.docutils thead th:last-child { border-top-right-radius: 6px !important; }
table.docutils tbody tr:last-child td:first-child { border-bottom-left-radius: 6px !important; }
table.docutils tbody tr:last-child td:last-child { border-bottom-right-radius: 6px !important; }

/* Slightly stronger separator for dense numeric columns on desktop */
@media screen and (min-width: 901px) {
  table.docutils td, table.docutils th { border-right: 1px solid rgba(0,0,0,0.06) !important; }
}

/* Slightly subtler outer border and separators to match screenshot */
table.docutils, .wy-table-responsive table { border-color: rgba(0,0,0,0.06) !important; }

/* Make header separators visually consistent with body */
.rst-content table thead th { border-right: 1px solid rgba(0,0,0,0.06) !important; }
.rst-content table thead th:last-child { border-right: none !important; }

/* Ensure inline code padding is applied and wins over other theme rules.
   This helps when older compiled theme sheets override the base theme.css.
   Use !important for quick testing; can be removed if cascade is fixed. */
.rst-content code, .rst-content tt, code {
  padding: 2px 5px !important;
}

/* Remove paragraph backgrounds and extra spacing inside table cells so
   row background (tr) is visible and no stray colored band appears. */
.rst-content table td, table.docutils td { background: transparent !important; }
.rst-content table td p, .rst-content table td div {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}

/* As a fallback, ensure direct children inside tds do not draw a background */
.rst-content table td > * { background: transparent !important; }

/* Aggressive reset: clear any remaining background/box-shadow on descendants
   so no stray colored band can appear under cell text. */
.rst-content table td, .rst-content table td * {
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
}

/* Fix for mobile footer being pushed to the right when sidebar margin exists.
   On narrow viewports the main content margin is removed but `.site-footer`
   previously kept `margin-left: 320px`. Make footer full-width and stack links.
*/
@media screen and (max-width: 900px) {
  .site-footer {
    margin-left: 0 !important;
    padding: 1rem 1rem !important;
    box-sizing: border-box !important;
    clear: both !important;
  }
  .site-footer p { margin: 0.25rem 0 !important; }
  .site-footer a { display: inline-block; margin-right: 0.4rem; }
  /* ensure link cluster wraps vertically if space is tight */
  .site-footer a { white-space: normal !important; }
}

/* In-content legal footer: separated by a visible line and styled for readability */
.content-sep {
  border: 0;
  border-top: 1px solid rgba(0,0,0,0.08) !important;
  margin: 2rem 0 0.6rem 0 !important;
}
.legal-footer {
  padding: 0.6rem 0 2rem 0 !important;
  color: #5a5a5a !important;
  font-size: 0.95rem !important;
  line-height: 1.4 !important;
}
.legal-footer p { margin: 0.2rem 0 !important; }
.legal-footer a { color: inherit !important; text-decoration: underline; }

@media screen and (min-width: 901px) {
  /* ensure legal footer aligns with content width and not sidebar */
  .legal-footer { max-width: 800px; margin-left: auto; margin-right: auto; }
}

/* Center legal footer text and links */
.legal-footer { text-align: center !important; }
.legal-footer p { text-align: center !important; margin-left: auto !important; margin-right: auto !important; }
.legal-footer a { display: inline-block !important; margin: 0 0.35rem !important; }

/* Ensure tables are horizontally scrollable on small screens and support smooth touch scrolling */
@media screen and (max-width: 900px) {
  .wy-table-responsive, table.docutils, .rst-content table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    -ms-overflow-style: -ms-autohiding-scrollbar !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: 0.25rem 0 !important;
    display: block !important; /* ensure container can scroll horizontally */
    width: 100% !important;
  }
  /* Keep the inner table layout but force a minimum width so horizontal scrolling is triggered
     on narrow viewports. Increase min-width to ensure long tables scroll instead of wrapping. */
  .wy-table-responsive table, table.docutils, .rst-content table {
    display: table !important;
    width: auto !important;
    min-width: 640px !important; /* wider than many phones to force scroll */
    max-width: none !important;
  }
  /* Prevent cells from wrapping so horizontal scroll remains meaningful */
  .wy-table-responsive td, .wy-table-responsive th, table.docutils td, table.docutils th, .rst-content table td, .rst-content table th {
    white-space: nowrap !important;
  }
  /* Slightly reduce cell padding on very small viewports to improve visible area */
  @media screen and (max-width: 480px) {
    .wy-table-responsive th, .wy-table-responsive td, table.docutils th, table.docutils td, .rst-content table th, .rst-content table td {
      padding: 0.35rem 0.45rem !important;
    }
  }
}

/* --- Flynn butterfly animation styles (appended) --- */
#flynn-butterfly{
  position:fixed;
  width:96px;
  height:auto;
  pointer-events:auto;
  z-index:1200;
  transform-origin:center center;
  will-change:transform, left, top;
  transition:transform 0.12s linear;
}

@media (max-width:480px){
  #flynn-butterfly{ width:64px; }
}

/* subtle idle hover when landed */
.flynn-landed{
  animation: flynn-hover 3s ease-in-out infinite;
}
@keyframes flynn-hover{
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* small wing-flap effect via scaleY */
.flynn-flap{ animation: flynn-flap-anim 180ms ease-in-out infinite; }
@keyframes flynn-flap-anim{ 0%{ transform: scaleY(1); } 50%{ transform: scaleY(0.92); } 100%{ transform: scaleY(1); } }

/* visually hide until JS attaches (avoid FOUT) */
#flynn-butterfly.hidden{ display:none !important; }

/* docked state: small, non-obtrusive, top-right */
.flynn-docked{
  pointer-events:auto;
  /* make docked butterfly static and non-animated so it doesn't obstruct reading */
  animation: none !important;
  transform: none !important;
}

/* Print styles: hide the explorer/sidebar and UI chrome when printing or rendering PDFs */
@media print {
  /* hide sidebar/explorer and topbar when printing */
  nav.sidebar, .sidebar, .wy-nav-side, .wy-side-scroll { display: none !important; }
  header.topbar, #bot-panel, #flynn-butterfly { display: none !important; }
  /* ensure content uses full width and white background for print */
  .wy-nav-content-wrap, .wy-nav-content, .rst-content, main.content, .content { margin: 0 !important; padding-left: 0 !important; padding-right: 0 !important; background: #ffffff !important; }
  /* remove any shadows or overlays from theme during print */
  * { box-shadow: none !important; background-image: none !important; }
  .rst-content { max-width: 100% !important; }
}


/* small icon next to Preamble heading */
.preamble-icon{ vertical-align: middle; margin-left: 6px; width: 20px; height: 20px; }

/* place a flower image behind the word 'Preamble' and allow easy size configuration
   Change the size by overriding the CSS variable `--preamble-flower-size` (e.g. in a page-specific stylesheet).
*/
/* preamble flower removed */

/* draggable cursor affordance removed (butterfly not draggable) */

