/*
   Styles for code blocks: Pygments syntax highlighting (Monokai for
   dark mode, custom palette for light).
*/

/* ================================================================== */
/* Imported Monokai rules                                             */
/* ================================================================== */

[data-theme="dark"] .highlight          { color: #F8F8F2; }
[data-theme="dark"] .highlight .hll     { background-color: #49483e; }
[data-theme="dark"] .highlight .c       { color: #959077; }  /* Comment */
[data-theme="dark"] .highlight .err     { color: #ED007E; background-color: #1E0010; }  /* Error */
[data-theme="dark"] .highlight .esc     { color: #F8F8F2; }  /* Escape */
[data-theme="dark"] .highlight .g       { color: #F8F8F2; }  /* Generic */
[data-theme="dark"] .highlight .k       { color: #66D9EF; }  /* Keyword */
[data-theme="dark"] .highlight .l       { color: #AE81FF; }  /* Literal */
[data-theme="dark"] .highlight .n       { color: #F8F8F2; }  /* Name */
[data-theme="dark"] .highlight .o       { color: #F8F8F2; }  /* Operator */
[data-theme="dark"] .highlight .x       { color: #F8F8F2; }  /* Other */
[data-theme="dark"] .highlight .p       { color: #F8F8F2; }  /* Punctuation */
[data-theme="dark"] .highlight .ch      { color: #959077; }  /* Comment.Hashbang */
[data-theme="dark"] .highlight .cm      { color: #959077; }  /* Comment.Multiline */
[data-theme="dark"] .highlight .cp      { color: #959077; }  /* Comment.Preproc */
[data-theme="dark"] .highlight .cpf     { color: #959077; }  /* Comment.PreprocFile */
[data-theme="dark"] .highlight .c1      { color: #959077; }  /* Comment.Single */
[data-theme="dark"] .highlight .cs      { color: #959077; }  /* Comment.Special */
[data-theme="dark"] .highlight .gd      { color: #FF4689; }  /* Generic.Deleted */
[data-theme="dark"] .highlight .ge      { color: #F8F8F2; font-style: italic; }  /* Generic.Emph */
[data-theme="dark"] .highlight .ges     { color: #F8F8F2; font-weight: bold; font-style: italic; }  /* Generic.EmphStrong */
[data-theme="dark"] .highlight .gr      { color: #F8F8F2; }  /* Generic.Error */
[data-theme="dark"] .highlight .gh      { color: #F8F8F2; }  /* Generic.Heading */
[data-theme="dark"] .highlight .gi      { color: #9ccfa5; }  /* Generic.Inserted */
/* .go, .gp: overridden in the REPL theme sections below */
[data-theme="dark"] .highlight .gs      { color: #F8F8F2; font-weight: bold; }  /* Generic.Strong */
[data-theme="dark"] .highlight .gu      { color: #959077; }  /* Generic.Subheading */
[data-theme="dark"] .highlight .gt      { color: #F8F8F2; }  /* Generic.Traceback */
[data-theme="dark"] .highlight .kc      { color: #66D9EF; }  /* Keyword.Constant */
[data-theme="dark"] .highlight .kd      { color: #66D9EF; }  /* Keyword.Declaration */
[data-theme="dark"] .highlight .kn      { color: #FF4689; }  /* Keyword.Namespace */
[data-theme="dark"] .highlight .kp      { color: #66D9EF; }  /* Keyword.Pseudo */
[data-theme="dark"] .highlight .kr      { color: #66D9EF; }  /* Keyword.Reserved */
[data-theme="dark"] .highlight .kt      { color: #66D9EF; }  /* Keyword.Type */
[data-theme="dark"] .highlight .ld      { color: #d8c88a; }  /* Literal.Date */
[data-theme="dark"] .highlight .m       { color: #b9a5e0; }  /* Literal.Number */
[data-theme="dark"] .highlight .s       { color: #d8c88a; }  /* Literal.String */
[data-theme="dark"] .highlight .na      { color: #9ccfa5; }  /* Name.Attribute */
[data-theme="dark"] .highlight .nb      { color: #F8F8F2; }  /* Name.Builtin */
[data-theme="dark"] .highlight .nc      { color: #9ccfa5; }  /* Name.Class */
[data-theme="dark"] .highlight .no      { color: #66D9EF; }  /* Name.Constant */
[data-theme="dark"] .highlight .nd      { color: #9ccfa5; }  /* Name.Decorator */
[data-theme="dark"] .highlight .ni      { color: #F8F8F2; }  /* Name.Entity */
[data-theme="dark"] .highlight .ne      { color: #9ccfa5; }  /* Name.Exception */
[data-theme="dark"] .highlight .nf      { color: #9ccfa5; }  /* Name.Function */
[data-theme="dark"] .highlight .nl      { color: #F8F8F2; }  /* Name.Label */
[data-theme="dark"] .highlight .nn      { color: #F8F8F2; }  /* Name.Namespace */
[data-theme="dark"] .highlight .nx      { color: #9ccfa5; }  /* Name.Other */
[data-theme="dark"] .highlight .py      { color: #F8F8F2; }  /* Name.Property */
[data-theme="dark"] .highlight .nt      { color: #FF4689; }  /* Name.Tag */
[data-theme="dark"] .highlight .nv      { color: #F8F8F2; }  /* Name.Variable */
[data-theme="dark"] .highlight .ow      { color: #66D9EF; }  /* Operator.Word */
[data-theme="dark"] .highlight .pm      { color: #F8F8F2; }  /* Punctuation.Marker */
[data-theme="dark"] .highlight .w       { color: #F8F8F2; }  /* Text.Whitespace */
[data-theme="dark"] .highlight .mb      { color: #b9a5e0; }  /* Literal.Number.Bin */
[data-theme="dark"] .highlight .mf      { color: #b9a5e0; }  /* Literal.Number.Float */
[data-theme="dark"] .highlight .mh      { color: #b9a5e0; }  /* Literal.Number.Hex */
[data-theme="dark"] .highlight .mi      { color: #b9a5e0; }  /* Literal.Number.Integer */
[data-theme="dark"] .highlight .mo      { color: #b9a5e0; }  /* Literal.Number.Oct */
[data-theme="dark"] .highlight .sa      { color: #d8c88a; }  /* Literal.String.Affix */
[data-theme="dark"] .highlight .sb      { color: #d8c88a; }  /* Literal.String.Backtick */
[data-theme="dark"] .highlight .sc      { color: #d8c88a; }  /* Literal.String.Char */
[data-theme="dark"] .highlight .dl      { color: #d8c88a; }  /* Literal.String.Delimiter */
[data-theme="dark"] .highlight .sd      { color: #d8c88a; }  /* Literal.String.Doc */
[data-theme="dark"] .highlight .s2      { color: #d8c88a; }  /* Literal.String.Double */
[data-theme="dark"] .highlight .se      { color: #AE81FF; }  /* Literal.String.Escape */
[data-theme="dark"] .highlight .sh      { color: #d8c88a; }  /* Literal.String.Heredoc */
[data-theme="dark"] .highlight .si      { color: #d8c88a; }  /* Literal.String.Interpol */
[data-theme="dark"] .highlight .sx      { color: #d8c88a; }  /* Literal.String.Other */
[data-theme="dark"] .highlight .sr      { color: #d8c88a; }  /* Literal.String.Regex */
[data-theme="dark"] .highlight .s1      { color: #d8c88a; }  /* Literal.String.Single */
[data-theme="dark"] .highlight .ss      { color: #d8c88a; }  /* Literal.String.Symbol */
[data-theme="dark"] .highlight .bp      { color: #F8F8F2; }  /* Name.Builtin.Pseudo */
[data-theme="dark"] .highlight .fm      { color: #9ccfa5; }  /* Name.Function.Magic */
[data-theme="dark"] .highlight .vc      { color: #F8F8F2; }  /* Name.Variable.Class */
[data-theme="dark"] .highlight .vg      { color: #F8F8F2; }  /* Name.Variable.Global */
[data-theme="dark"] .highlight .vi      { color: #F8F8F2; }  /* Name.Variable.Instance */
[data-theme="dark"] .highlight .vm      { color: #F8F8F2; }  /* Name.Variable.Magic */
[data-theme="dark"] .highlight .il      { color: #b9a5e0; }  /* Literal.Number.Integer.Long */

/* layout */
div[class^="highlight-"] {
    border-radius: var(--border-radius-code);
    background: transparent;
}

/* Padding: applied to the wrapper, none on the inner pre so we don't
   double up margins or shrink the scrollbar area. */
.highlight {
    padding: 12px 14px;
    overflow-x: auto;
}

.highlight pre {
    padding: 0;
    margin: 0;
}

/* font */
.highlight,
.highlight pre {
    font-size: 13px !important;
    font-family: var(--code-font) !important;
}

/* REPL >>> prompt */
.highlight .gp {
    font-weight: normal;
    font-style: normal;
}

  /* REPL output */
.highlight .go {
    font-weight: normal;
    font-style: normal;
}

.highlight pre {
    line-height: var(--code-line-height) !important;
}

/* background */
[data-theme="light"] .highlight {
    background: #eef1f4 !important;
    border: 1px solid #c7ccd1;
    border-radius: var(--border-radius-code);
}

[data-theme="dark"]  .highlight {
    background: #262626 !important;
    border: 1px solid #3a3a3a;
    border-radius: var(--border-radius-code);
}

.highlight .k      { font-weight:normal; font-style: normal !important;}  /* keyword */
.highlight .p      { font-weight:normal; }  /* (, [, ], )*/
.highlight .mi     { font-weight:normal; }  /* numbers */
.highlight .mf     { font-weight:normal; }  /* floats */

/* Avoiod != → ≠, <= → ≤, etc.. */
.highlight,
.highlight pre,
code,
pre,
kbd,
samp,
tt {
    font-variant-ligatures: none;
}

/* ----------------- REPL light theme ---------------- */

[data-theme="light"] .highlight-pycon .pycon-number { color:  #204A87; }
[data-theme="light"] .highlight-pycon .pycon-string { color: #8a5a2d; }
[data-theme="light"] .highlight .s,
[data-theme="light"] .highlight .s1,
[data-theme="light"] .highlight .s2,
[data-theme="light"] .highlight .sa,
[data-theme="light"] .highlight .sb,
[data-theme="light"] .highlight .sc,
[data-theme="light"] .highlight .dl,
[data-theme="light"] .highlight .sd,
[data-theme="light"] .highlight .sh,
[data-theme="light"] .highlight .si,
[data-theme="light"] .highlight .sx,
[data-theme="light"] .highlight .sr,
[data-theme="light"] .highlight .ss,
[data-theme="light"] .highlight .se   { color: #4f6b39; }  /* strings: muted olive */
[data-theme="light"] .highlight-pycon .pycon-field  { color: #4d4d4d; background: #eff1f3}
[data-theme="light"] .highlight .gp                 { color: #6a6a6a; }  /* >>> prompt: muted */
[data-theme="light"] .highlight .c,
[data-theme="light"] .highlight .ch,
[data-theme="light"] .highlight .cm,
[data-theme="light"] .highlight .cp,
[data-theme="light"] .highlight .cpf,
[data-theme="light"] .highlight .c1,
[data-theme="light"] .highlight .cs  { color: #5b636d; font-style: normal; }  /* comments: muted gray */
[data-theme="light"] .highlight .go                 { color: #6a6a6a; }  /* output dimmer than code */

/* ----------------- REPL dark theme ---------------- */

[data-theme="dark"]  .highlight-pycon .pycon-number { color: #b9a5e0; }
[data-theme="dark"]  .highlight-pycon .pycon-string { color: #d8c88a; }
[data-theme="dark"]  .highlight-pycon .pycon-field  { color: #9ccfa5; }
[data-theme="dark"]  .highlight .gp                 { color: #888888; }  /* >>> prompt */
[data-theme="dark"]  .highlight .go                 { color: #6c7a88; }  /* output dimmer than code */

/* ----------------- syntax highlight ---------------- */

[data-theme="dark"] .highlight .k                 { color: #f56b8b}  /* keyword */
[data-theme="dark"] .highlight .kn                 { color: #f56b8b}  /* keyword.namespace */

/* --------------------------------------------------- */

[data-theme="light"] .highlight .mi                 { color: #204A87}  /* numbers */
[data-theme="light"] .highlight .nf                 { color: #A31515}  /* functions */
[data-theme="light"] .highlight .o                  { color: inherit; font-weight: normal; }  /* operators  */

/* ================================================================== */
/* sphinx-codeautolink (makes APIs in code blocks clickable)          */
/* ================================================================== */

a.sphinx-codeautolink-a,
a.sphinx-codeautolink-a:visited {
    color: inherit;
    text-decoration: none;
    border-bottom: none;
    border-radius: 3px;
    transition: background var(--theme-transition),
                color var(--theme-transition),
                box-shadow var(--theme-transition);
}

a.sphinx-codeautolink-a:hover {
    color: var(--links);
    background: color-mix(in srgb, var(--links) 18%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--links) 18%, transparent);
    text-decoration: none;
    border-bottom: none;
}

[data-theme="dark"] a.sphinx-codeautolink-a:hover {
    background: color-mix(in srgb, var(--links) 45%, transparent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--links) 45%, transparent);
}
