/* ============================================================
   Blue Nebula — Modern dark theme with neon blue & green accents
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg-page:         #0a0c10;
  --bg-sidebar:      #0d1017;
  --bg-content:      #0f1219;
  --bg-surface:      #151b27;
  --bg-surface-2:    #1c2436;
  --bg-code:         #111720;
  --bg-code-block:   #0d1117;

  --border:          #1e2d45;
  --border-bright:   #253550;

  --text-primary:    #d0dff5;
  --text-secondary:  #8899b5;
  --text-muted:      #4e6080;
  --text-inverse:    #060810;

  --neon-blue:       #00aaff;
  --neon-blue-dim:   #0077cc;
  --neon-blue-glow:  rgba(0, 170, 255, 0.18);
  --neon-blue-faint: rgba(0, 170, 255, 0.06);

  --neon-green:      #00e5a0;
  --neon-green-dim:  #00b07a;
  --neon-green-glow: rgba(0, 229, 160, 0.15);

  --accent-purple:   #7b5ea7;
  --accent-yellow:   #f0c040;
  --accent-red:      #ff4d6a;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}

/* ---------- Layout ---------- */
div.document {
  display: flex;
  min-height: 100vh;
}

div.sphinxsidebar {
  order: -1;
  width: 270px;
  min-width: 270px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
}

div.sphinxsidebar::-webkit-scrollbar {
  width: 4px;
}
div.sphinxsidebar::-webkit-scrollbar-track {
  background: transparent;
}
div.sphinxsidebar::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 2px;
}

div.bodywrapper {
  flex: 1;
  min-width: 0;
}

div.body {
  background: var(--bg-content);
  max-width: 900px;
  padding: 2.5rem 3rem;
  margin: 0 auto;
}

div.footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1rem 2rem;
  text-align: center;
}

/* ---------- Sidebar internals ---------- */
div.sphinxsidebarwrapper {
  padding: 1.5rem 1rem;
}

div.sphinxsidebar h1,
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
  color: var(--neon-blue);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  margin: 1.5rem 0 0.5rem;
  padding: 0;
}
div.sphinxsidebar h1:first-child,
div.sphinxsidebar h3:first-child {
  margin-top: 0;
}

div.sphinxsidebar p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0 0 0.75rem;
}

div.sphinxsidebar p.logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

div.sphinxsidebar ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

div.sphinxsidebar ul li {
  margin: 0;
}

div.sphinxsidebar ul li a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

div.sphinxsidebar ul li a:hover {
  color: var(--neon-blue);
  background: var(--neon-blue-faint);
  border-left-color: var(--neon-blue-dim);
}

div.sphinxsidebar ul li.current > a {
  color: var(--neon-blue);
  background: var(--neon-blue-faint);
  border-left-color: var(--neon-blue);
  font-weight: 600;
}

div.sphinxsidebar ul ul {
  margin-left: 0.75rem;
}

/* Search box */
div.sphinxsidebar input[type="text"] {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  padding: 0.45rem 0.65rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
div.sphinxsidebar input[type="text"]:focus {
  border-color: var(--neon-blue);
  box-shadow: 0 0 0 2px var(--neon-blue-glow);
}

div.sphinxsidebar input[type="submit"] {
  background: var(--neon-blue-dim);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.4rem;
  padding: 0.35rem 0.8rem;
  transition: background 0.2s;
}
div.sphinxsidebar input[type="submit"]:hover {
  background: var(--neon-blue);
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}

h1 {
  font-size: 2rem;
  color: #e8f4ff;
  border-bottom: 1px solid var(--border-bright);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.4rem;
  color: var(--neon-blue);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}

h3 {
  font-size: 1.15rem;
  color: var(--neon-green);
}

h4 {
  font-size: 1rem;
  color: var(--text-primary);
}

/* Section anchor links */
a.headerlink {
  color: var(--border-bright);
  font-size: 0.75em;
  margin-left: 0.4em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
h1:hover a.headerlink,
h2:hover a.headerlink,
h3:hover a.headerlink,
h4:hover a.headerlink {
  opacity: 1;
  color: var(--neon-blue);
}

/* ---------- Links ---------- */
a {
  color: var(--neon-blue);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover {
  color: #33bbff;
  text-decoration: underline;
}
a:visited {
  color: var(--accent-purple);
}

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

/* ---------- Code & Pre ---------- */
code, kbd, samp {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--neon-green);
  padding: 0.1em 0.4em;
}

kbd {
  color: var(--accent-yellow);
  border-color: var(--accent-yellow);
}

pre {
  background: var(--bg-code-block);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  overflow-x: auto;
  padding: 1.25rem 1.5rem;
  position: relative;
}

pre code {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0;
}

div.highlight {
  border-radius: var(--radius-md);
  overflow: hidden;
}

div.highlight pre {
  border-radius: 0;
  border: none;
  margin: 0;
}

div.highlight-default {
  background: var(--bg-code-block);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
}

/* Syntax highlight — neon palette override */
.highlight .c, .highlight .c1, .highlight .cm { color: #4e6080; font-style: italic; } /* comments */
.highlight .k, .highlight .kn, .highlight .kp { color: var(--neon-blue); }            /* keywords */
.highlight .s, .highlight .s1, .highlight .s2 { color: var(--neon-green); }           /* strings */
.highlight .mi, .highlight .mf, .highlight .mh { color: #f0c040; }                    /* numbers */
.highlight .n  { color: var(--text-primary); }
.highlight .nf, .highlight .nc { color: #66d9ff; }                                    /* func/class names */
.highlight .o  { color: var(--neon-blue-dim); }                                        /* operators */
.highlight .p  { color: var(--text-secondary); }                                       /* punctuation */
.highlight .nb { color: #a78bfa; }                                                     /* builtins */
.highlight .nd { color: var(--neon-green-dim); }                                       /* decorators */
.highlight .na { color: var(--neon-green); }                                           /* attributes */
.highlight .err { background: var(--accent-red); color: #fff; border-radius: 2px; }

/* ---------- Tables ---------- */
table.docutils {
  background: var(--bg-surface);
  border-collapse: collapse;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-bright);
  font-size: 0.9rem;
  margin: 1.5rem 0;
  overflow: hidden;
  width: 100%;
}

table.docutils th {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-bright);
  color: var(--neon-blue);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0.65rem 1rem;
  text-align: left;
  text-transform: uppercase;
}

table.docutils td {
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.6rem 1rem;
  vertical-align: top;
}

table.docutils tr:nth-child(even) td {
  background: var(--neon-blue-faint);
}

table.docutils tr:hover td {
  background: var(--bg-surface-2);
}

/* ---------- Admonitions ---------- */
div.admonition {
  border-left: 3px solid var(--neon-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--neon-blue-faint);
  margin: 1.5rem 0;
  padding: 0.85rem 1.25rem;
}

div.admonition > .admonition-title {
  color: var(--neon-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

div.admonition > p:last-child {
  margin-bottom: 0;
}

div.note    { border-color: var(--neon-blue);  background: var(--neon-blue-faint); }
div.note    > .admonition-title { color: var(--neon-blue); }

div.tip     { border-color: var(--neon-green); background: var(--neon-green-glow); }
div.tip     > .admonition-title { color: var(--neon-green); }

div.warning { border-color: var(--accent-yellow); background: rgba(240,192,64,0.07); }
div.warning > .admonition-title { color: var(--accent-yellow); }

div.danger,
div.error   { border-color: var(--accent-red); background: rgba(255,77,106,0.07); }
div.danger  > .admonition-title,
div.error   > .admonition-title { color: var(--accent-red); }

div.important { border-color: var(--accent-purple); background: rgba(123,94,167,0.10); }
div.important > .admonition-title { color: var(--accent-purple); }

/* ---------- Blockquotes ---------- */
blockquote {
  border-left: 3px solid var(--border-bright);
  color: var(--text-secondary);
  font-style: italic;
  margin: 1rem 0 1rem 0;
  padding: 0.25rem 1.25rem;
}

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

li {
  margin-bottom: 0.3rem;
}

ul li::marker {
  color: var(--neon-blue-dim);
}

/* ---------- Definition lists ---------- */
dl {
  margin: 1rem 0;
}

dt {
  color: var(--neon-green);
  font-weight: 600;
  margin-top: 0.75rem;
}

dd {
  margin-left: 1.5rem;
  color: var(--text-primary);
}

/* ---------- Horizontal rule ---------- */
hr {
  border: none;
  border-top: 1px solid var(--border-bright);
  margin: 2rem 0;
}

/* ---------- Topic boxes (e.g. Table of Contents) ---------- */
div.topic {
  background: var(--bg-surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

div.topic > p.topic-title {
  color: var(--neon-blue);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
}

/* ---------- Breadcrumbs / Relations ---------- */
div.related {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.5rem 1.5rem;
}

div.related a {
  color: var(--text-secondary);
}

div.related a:hover {
  color: var(--neon-blue);
}

div.related ul {
  margin: 0;
  list-style: none;
  padding: 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Rubric ---------- */
p.rubric {
  color: var(--neon-green);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 1.5rem 0 0.5rem;
}

/* ---------- Field lists ---------- */
table.field-list {
  width: auto;
}

table.field-list th {
  background: transparent;
  color: var(--neon-green);
  font-size: 0.8rem;
  white-space: nowrap;
  padding: 0.25rem 0.75rem 0.25rem 0;
  border: none;
  text-transform: none;
  letter-spacing: 0;
}

table.field-list td {
  border: none;
  padding: 0.25rem 0;
}

/* ---------- Footnotes ---------- */
dl.footnote > dt {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ---------- Versioned changes ---------- */
div.versionchanged,
div.versionadded,
div.deprecated {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin: 0.75rem 0;
}

div.versionadded  { background: var(--neon-green-glow); border-left: 2px solid var(--neon-green); }
div.deprecated    { background: rgba(240,192,64,0.07);  border-left: 2px solid var(--accent-yellow); }
div.versionchanged{ background: var(--neon-blue-faint); border-left: 2px solid var(--neon-blue); }

/* ---------- Copy button (if sphinx-copybutton installed) ---------- */
button.copybtn {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  transition: color 0.15s, border-color 0.15s;
}
button.copybtn:hover {
  color: var(--neon-blue);
  border-color: var(--neon-blue);
}

/* ---------- Search results page ---------- */
div.context {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

ul.search li {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
}

ul.search li a {
  font-weight: 600;
}

span.highlighted {
  background: rgba(0, 229, 160, 0.25);
  border-radius: 2px;
  color: var(--neon-green);
  padding: 0 2px;
}

/* ---------- Header bar ---------- */
.bn-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-bright);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.bn-header-inner {
  align-items: center;
  display: flex;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
}

.bn-brand {
  align-items: center;
  color: var(--text-primary);
  display: flex;
  font-size: 1rem;
  font-weight: 700;
  gap: 0.45rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.bn-brand:hover {
  color: var(--neon-blue);
  text-decoration: none;
}

.bn-brand-dot {
  color: var(--neon-blue);
  filter: drop-shadow(0 0 6px var(--neon-blue));
  font-size: 0.8em;
}

.bn-header-nav {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  flex: 1;
  font-size: 0.8rem;
  gap: 0.3rem;
}

.bn-header-nav a {
  color: var(--text-secondary);
}
.bn-header-nav a:hover {
  color: var(--neon-blue);
  text-decoration: none;
}

.bn-sep {
  color: var(--text-muted);
}

.bn-header-right {
  margin-left: auto;
}

.bn-version-badge {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  color: var(--neon-green);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 0.15rem 0.65rem;
}

/* ---------- Footer ---------- */
.bn-footer {
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
}

.bn-footer-inner {
  align-items: center;
  color: var(--text-muted);
  display: flex;
  font-size: 0.78rem;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
}

.bn-footer-inner a {
  color: var(--text-secondary);
}
.bn-footer-inner a:hover {
  color: var(--neon-blue);
}

.bn-theme-credit {
  color: var(--neon-blue);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  div.document {
    flex-direction: column;
  }

  div.sphinxsidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  div.body {
    padding: 1.5rem 1.25rem;
  }
}
