@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Space+Mono&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box !important;
  word-break: break-word;
  overflow-wrap: break-word;
  word-wrap: break-word;
  -ms-word-break: break-word;
  word-break: break-word;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

:root {
  /* Font family variables */
  --pst-font-family-base: "Inter", sans-serif;
  --pst-font-family-heading: "Plus Jakarta Sans", system-ui, sans-serif;
  --pst-font-family-monospace: "Space Mono", monospace;

  font-family: var(--pst-font-family-base);
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: var(--color-sidebar-background-border) transparent;
}

/* Light theme with matching specificity */
html[data-theme="light"] {
  /* Primary colors and variants */
  --pst-color-primary: #0EA5E9;
  --pst-color-primary-text: #FFFFFF;
  --pst-color-primary-highlight: #0284C7;
  --pst-color-primary-highlight-text: #FFFFFF;
  --pst-color-primary-bg: #F5F7FA;

  /* Secondary colors */
  --pst-color-secondary: #0EA5E9;
  --pst-color-secondary-text: #FFFFFF;
  --pst-color-secondary-highlight: #0284C7;
  --pst-color-secondary-highlight-text: #FFFFFF;
  --pst-color-secondary-bg: #F5F7FA;

  /* Success colors */
  --pst-color-success: #059669;
  --pst-color-success-text: #FFFFFF;
  --pst-color-success-highlight: #047857;
  --pst-color-success-highlight-text: #FFFFFF;
  --pst-color-success-bg: #F2F4F8;

  /* Info colors */
  --pst-color-info: #0EA5E9;
  --pst-color-info-text: #FFFFFF;
  --pst-color-info-highlight: #0284C7;
  --pst-color-info-highlight-text: #FFFFFF;
  --pst-color-info-bg: #F2F4F8;

  /* Warning colors */
  --pst-color-warning: #bd910e;
  --pst-color-warning-text: #111827;
  --pst-color-warning-highlight: #8f6e0d;
  --pst-color-warning-highlight-text: #111827;
  --pst-color-warning-bg: #F8F9FC;

  /* Danger colors */
  --pst-color-danger: #DC2626;
  --pst-color-danger-text: #FFFFFF;
  --pst-color-danger-highlight: #B91C1C;
  --pst-color-danger-highlight-text: #FFFFFF;
  --pst-color-danger-bg: #F8F9FC;

  /* Accent colors */
  --pst-color-accent: #0EA5E9;
  --pst-color-accent-bg: #F5F7FA;

  /* Base colors */
  --pst-color-background: #FFFFFF;
  --pst-color-on-background: #FFFFFF;
  --pst-color-surface: #F5F7FA;
  --pst-color-on-surface: #111827;
  --pst-color-text-base: #111827;
  --pst-color-text-muted: #374151;
  --pst-color-heading: #111827;
  --pst-color-border: rgba(0, 0, 0, 0.1);
  --pst-color-border-muted: rgba(0, 0, 0, 0.1);
  --pst-color-shadow: rgba(0, 0, 0, 0.1);

  /* Link colors */
  --pst-color-link: #0EA5E9;
  --pst-color-link-hover: #0284C7;

  /* Other UI elements */
  --pst-color-inline-code: #0EA5E9;
  --pst-color-inline-code-links: #0284C7;
  --pst-color-target: #F5F7FA;
  --pst-color-blockquote-notch: #374151;

  /* Table colors */
  --pst-color-table: #111827;
  --pst-color-table-row-hover-bg: #EEF1F6;
  --pst-color-table-inner-border: rgba(0, 0, 0, 0.1);
  --pst-color-table-outer-border: var(--pst-color-surface);
  --pst-color-table-heading-bg: var(--pst-color-surface);
  --pst-color-table-row-zebra-high-bg: var(--pst-color-on-background);
  --pst-color-table-row-zebra-low-bg: var(--pst-color-surface);

  /* SD colors (Sphinx Design) */
  --sd-color-primary: var(--pst-color-primary);
  --sd-color-primary-text: var(--pst-color-primary-text);
  --sd-color-primary-highlight: var(--pst-color-primary-highlight);
  --sd-color-primary-bg: var(--pst-color-primary-bg);
  --sd-color-primary-bg-text: #111827;
  --sd-color-secondary: var(--pst-color-secondary);
  --sd-color-secondary-text: var(--pst-color-secondary-text);
  --sd-color-secondary-highlight: var(--pst-color-secondary-highlight);
  --sd-color-secondary-bg: var(--pst-color-secondary-bg);
  --sd-color-secondary-bg-text: #111827;
  --sd-color-card-border: var(--pst-color-border);

  color-scheme: light;
}

/* Dark theme with matching specificity */
html[data-theme="dark"] {
  /* Primary colors and variants */
  --pst-color-primary: #4A7DFF;
  --pst-color-primary-text: #FFFFFF;
  --pst-color-primary-highlight: #185dbe;
  --pst-color-primary-highlight-text: #FFFFFF;
  --pst-color-primary-bg: #141414;

  /* Secondary colors */
  --pst-color-secondary: #4A7DFF;
  --pst-color-secondary-text: #FFFFFF;
  --pst-color-secondary-highlight: #185dbe;
  --pst-color-secondary-highlight-text: #FFFFFF;
  --pst-color-secondary-bg: #141414;

  /* Success colors */
  --pst-color-success: #28a745;
  --pst-color-success-text: #FFFFFF;
  --pst-color-success-highlight: #218838;
  --pst-color-success-highlight-text: #FFFFFF;
  --pst-color-success-bg: #141414;

  /* Info colors */
  --pst-color-info: #6eafeb;
  --pst-color-info-text: #FFFFFF;
  --pst-color-info-highlight: #4A7DFF;
  --pst-color-info-highlight-text: #FFFFFF;
  --pst-color-info-bg: #141414;

  /* Warning colors */
  --pst-color-warning: #ffc107;
  --pst-color-warning-text: #000000;
  --pst-color-warning-highlight: #e0a800;
  --pst-color-warning-highlight-text: #000000;
  --pst-color-warning-bg: #141414;

  /* Danger colors */
  --pst-color-danger: #dc3545;
  --pst-color-danger-text: #FFFFFF;
  --pst-color-danger-highlight: #c82333;
  --pst-color-danger-highlight-text: #FFFFFF;
  --pst-color-danger-bg: #141414;

  /* Accent colors */
  --pst-color-accent: #6eafeb;
  --pst-color-accent-bg: #141414;

  /* Attention colors */
  --pst-color-attention: var(--pst-color-warning);
  --pst-color-attention-bg: var(--pst-color-warning-bg);

  /* Base colors */
  --pst-color-background: #000000;
  --pst-color-on-background: #080808;
  --pst-color-surface: #0F0F0F;
  --pst-color-on-surface: #FFFFFF;
  --pst-color-text-base: #FFFFFF;
  --pst-color-text-muted: #E0E0E0;
  --pst-color-text-active: #6eafeb;
  --pst-color-heading: #FFFFFF;
  --pst-color-border: rgba(255, 255, 255, 0.1);
  --pst-color-border-muted: rgba(255, 255, 255, 0.1);
  --pst-color-shadow: rgba(0, 0, 0, 0.3);

  /* Link colors */
  --pst-color-link: #4A7DFF;
  --pst-color-link-hover: #185dbe;

  /* Other UI elements */
  --pst-color-inline-code: #6eafeb;
  --pst-color-inline-code-links: #4A7DFF;
  --pst-color-target: #141414;
  --pst-color-blockquote-notch: #E0E0E0;

  /* Table colors */
  --pst-color-table: #FFFFFF;
  --pst-color-table-row-hover-bg: #1A1A1A;
  --pst-color-table-inner-border: rgba(255, 255, 255, 0.1);
  --pst-color-table-outer-border: var(--pst-color-surface);
  --pst-color-table-heading-bg: var(--pst-color-surface);
  --pst-color-table-row-zebra-high-bg: var(--pst-color-on-background);
  --pst-color-table-row-zebra-low-bg: var(--pst-color-surface);

  /* Navigation colors */
  --pst-color-navbar-background: #0F0F0F;
  --pst-color-navbar-text: #FFFFFF;
  --pst-color-navbar-link: #FFFFFF;
  --pst-color-navbar-link-hover: #4A7DFF;
  --pst-color-navbar-link-active: #4A7DFF;

  /* Sidebar colors */
  --pst-color-sidebar-background: #0F0F0F;
  --pst-color-sidebar-text: #FFFFFF;
  --pst-color-sidebar-link: #E0E0E0;
  --pst-color-sidebar-link-hover: #6eafeb;
  --pst-color-sidebar-caption: #C0C0C0;

  /* TOC colors */
  --pst-color-toc-background: #0F0F0F;
  --pst-color-toc-text: #FFFFFF;
  --pst-color-toc-link: #E0E0E0;
  --pst-color-toc-link-hover: #6eafeb;
  --pst-color-toc-link-active: #4A7DFF;

  /* SD colors (Sphinx Design) */
  --sd-color-primary: var(--pst-color-primary);
  --sd-color-primary-text: var(--pst-color-primary-text);
  --sd-color-primary-highlight: var(--pst-color-primary-highlight);
  --sd-color-primary-bg: var(--pst-color-primary-bg);
  --sd-color-primary-bg-text: #FFFFFF;
  --sd-color-secondary: var(--pst-color-secondary);
  --sd-color-secondary-text: var(--pst-color-secondary-text);
  --sd-color-secondary-highlight: var(--pst-color-secondary-highlight);
  --sd-color-secondary-bg: var(--pst-color-secondary-bg);
  --sd-color-secondary-bg-text: #FFFFFF;
  --sd-color-card-border: var(--pst-color-border);

  color-scheme: dark;
}

/* Update background colors to match pst variables based on theme */
body[data-theme="light"] {
    background: #FFFFFF !important;
}

body[data-theme="dark"] {
    background: #000000 !important;
}

body {
  font-family: var(--pst-font-family-base);
  overflow-x: hidden;
  width: 100%;
  line-height: 1.5;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--pst-font-family-heading);
  font-weight: 500;
}

code {
  font-family: var(--pst-font-family-monospace) !important;
  text-wrap: wrap !important;
}

code span {
  background: var(--pst-color-surface);
}

kbd {
  all: unset;
  width: fit-content;
  text-wrap: nowrap;
}

/* Remove sidebar-specific styles that were for pydata theme */
.sidebar-primary-item:not(:last-child):not(:first-child) {
  position: static;
  margin-bottom: 0;
}

.sidebar-primary-item:not(:last-child):not(:first-child)::after {
  display: none;
}

/* Add some furo-specific customizations */
.sidebar-brand {
  font-family: var(--pst-font-family-heading);
}

.sidebar-search-container {
  margin: 1rem 0;
}

/* Add custom spacing and remove footer */
main {
  margin-top: 2rem !important;
}

.sidebar-drawer {
    padding-bottom: 2rem !important;
    width: 20em !important;
}

body[data-theme="dark"] .sidebar-drawer {
  background: #0F0F0F !important;
}

body[data-theme="light"] .sidebar-drawer {
  background: #F8F9FC !important;
}

.sidebar-container {
    width: 17.5em !important;
}

footer {
  width: 66em !important;
  display: block !important;
}

/* Reduce right margin */
.content {
    width: 66em !important;
  margin-right: 1rem !important;
}

/* More specific selectors to override Furo defaults */
.bd-main .bd-content .bd-article-container {
  margin-top: 5rem !important;
}

article, .sidebar-sticky, .toc-drawer {
  padding-right: 1rem !important;
  margin-top: 5rem !important;
}

/* Custom scrollbar styling */
.sidebar-tree {
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 1rem;
}

.sidebar-tree::-webkit-scrollbar {
  width: 8px;
}

body[data-theme="light"] .sidebar-tree::-webkit-scrollbar-track {
  background: #F8F9FC;
}

body[data-theme="light"] .sidebar-tree::-webkit-scrollbar-thumb {
  background-color: #0EA5E9;
  border-radius: 4px;
}

body[data-theme="dark"] .sidebar-tree::-webkit-scrollbar-track {
  background: #0F0F0F;
}

body[data-theme="dark"] .sidebar-tree::-webkit-scrollbar-thumb {
  background-color: #4A7DFF;
  border-radius: 4px;
}

/* Enhance topic collapsing behavior */
.toctree-wrapper .caption {
  cursor: pointer;
  user-select: none;
}

.toctree-wrapper .caption:hover {
  color: var(--pst-color-primary);
}

.toctree-wrapper ul {
  transition: max-height 0.3s ease-out;
}

/* Hide theme switcher completely */
.theme-toggle-header {
  display: none !important;
}

[data-theme-switch] {
  display: none !important;
}

.theme-toggle {
  display: none !important;
}

h1, h2 {
    background: linear-gradient(to right, #0284C7, #0EA5E9, #0284C7);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    width: fit-content;
    margin-top: 4rem;
    font-weight: 600;
}

h1 + p {
  font-size: 1.25rem !important;
}

h2 {
  margin-bottom: 1rem;
}

body[data-theme="dark"] h1,
body[data-theme="dark"] h2 {
    background: linear-gradient(to right, #97C4EE, #FFFFFF, #97C4EE);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h3, h4 {
    color: var(--pst-color-primary);
    margin-top: 2rem;
}

.toc-drawer {
    display: none !important;
}

/* markdown content styles from index.css */
.markdown-content {
  font-family: var(--pst-font-family-base);
}

.markdown-content a {
  color: var(--pst-color-link);
}

.markdown-content a:hover {
  color: var(--pst-color-link-hover);
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 1.25rem;
}

.markdown-content ul {
  list-style: disc !important;
  padding-left: 1.5rem;
  margin: 1em 0;
}

.markdown-content ol {
  list-style: decimal !important;
  padding-left: 1.5rem;
  margin: 1em 0;
}

.markdown-content li {
  display: list-item !important;
}

.markdown-content strong {
  color: var(--pst-color-text-base);
  text-decoration: underline;
}

/* Code block styling based on CodeBlock.css */
.highlight {
    position: relative !important;
    border-radius: 0.625rem !important;
    overflow: hidden !important;
    margin: 1.5rem 0 !important;
}

.highlight pre {
    margin: 0 !important;
    border-radius: 0.625rem !important;
    background: var(--pst-color-surface) !important;
    padding: 1.25rem !important;
    overflow-x: auto !important;
    font-family: var(--pst-font-family-monospace) !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
}

html[data-theme="light"] .highlight pre {
    background: #F5F7FA !important;
}

html[data-theme="dark"] .highlight pre {
    background: #0F0F0F !important;
}

.highlight code {
    word-wrap: nowrap !important;
    background: transparent !important;
    font-family: var(--pst-font-family-monospace) !important;
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
}

/* WebKit scrollbar styles */
.highlight pre::-webkit-scrollbar {
    height: 4px !important;
}

.highlight pre::-webkit-scrollbar-track {
    background: var(--pst-color-surface) !important;
    border-radius: 0.625rem !important;
}

.highlight pre::-webkit-scrollbar-thumb {
    background-color: var(--pst-color-primary) !important;
    border-radius: 0.625rem !important;
    border: 2px solid var(--pst-color-surface) !important;
}

/* Firefox scrollbar styles */
.highlight pre {
    scrollbar-width: thin !important;
    scrollbar-color: var(--pst-color-primary) var(--pst-color-surface) !important;
}

.highlight pre code {
    display: inline-block !important;
    min-width: 100% !important;
    font-family: var(--pst-font-family-monospace) !important;
}

/* Line numbers styling */
.highlight .linenos {
    background: transparent !important;
    padding-right: 0.75rem !important;
    user-select: none !important;
    border-right: 1px solid var(--pst-color-border) !important;
    margin-right: 0.75rem !important;
    font-family: var(--pst-font-family-monospace) !important;
    font-size: 0.9rem !important;
}

/* Inline code styling */
code.literal {
    background-color: var(--pst-color-surface) !important;
    padding: 0.2em 0.4em !important;
    border-radius: 0.25rem !important;
    font-size: 0.9em !important;
    border: 1px solid var(--pst-color-border) !important;
    font-family: var(--pst-font-family-monospace) !important;
}

/* Command line styling */
div.highlight-bash pre {
    background-color: var(--pst-color-surface) !important;
    font-family: var(--pst-font-family-monospace) !important;
    font-size: 0.9rem !important;
}

html[data-theme="dark"] div.highlight-bash pre {
    background-color: #0F0F0F !important;
}

html[data-theme="light"] div.highlight-bash pre {
    background-color: #F5F7FA !important;
}

/* Ensure all code elements use the monospace font */
pre, code, .highlight * {
    font-family: var(--pst-font-family-monospace) !important;
}

/* Adjust line height for better readability */
.highlight pre, .highlight code {
    line-height: 1.5 !important;
}

div[class*=" highlight-"] {
  margin: 0 !important;
}

/* Ensure code spans within pre blocks have consistent styling */
pre span {
    font-family: var(--pst-font-family-monospace) !important;
    font-size: 0.9rem !important;
    background: transparent !important;
}

.sidebar-drawer .toctree-l1 > a.reference.internal {
  color: var(--pst-color-text-quaternary, var(--pst-color-text-muted)) !important;
  border-radius: 0.5rem;
  transition: background 0.3s ease, color 0.3s ease;
  display: inline-block;
  text-decoration: none;
  font-size: 1.125rem;
  line-height: 1.25;
  margin-top: 1.5rem;
  position: relative;
}

.toctree-l1 > label[for="toctree-checkbox-1"] {
  margin-top: 1.5rem !important;
}

.sidebar-drawer .toctree-l1 > a.reference.internal::before {
  width: 100%;
  height: 1px;
  content: "";
  position: absolute;
  top: -0.75rem;
  left: 0;
  background: rgba(128, 128, 128, 0.5);
}

.sidebar-drawer .toctree-l1 > a.reference.internal:hover {
  background: var(--pst-color-surface);
  color: var(--pst-color-text-base) !important;
}

.sidebar-drawer .toctree-l1 > a.reference.internal.current {
  background: var(--pst-color-surface);
  color: var(--pst-color-text-base) !important;
}