/* --- Modern Monokai Syntax Highlighting Theme (Refactored by Cagatay & Gemini) --- */
/* Features:
  - Uses CSS Variables for easy customization.
  - Groups selectors for smaller file size and better maintenance.
  - Adds line wrapping for long code lines.
  - Includes general style improvements like padding and rounded corners.
*/

.highlight {
  /* --- Color Palette --- */
  --bg: #272822;
  --fg: #f8f8f2; /* Default text color (slightly off-white) */
  --grey: #75715e; /* Comments */
  --pink: #f92672; /* Keywords, Operators, Tags */
  --purple: #ae81ff; /* Numbers, Constants */
  --cyan: #66d9ef; /* Types, Built-ins */
  --green: #a6e22e; /* Function & Class names, Attributes */
  --yellow: #e6db74; /* Strings */
  --orange: #fd971f; /* Special variables, Constants */
  --error-fg: #f92672;
  --error-bg: #591b2f;

  /* --- Main Block Styling --- */
  background-color: var(--bg);
  color: var(--fg);
  padding: 1.2em 1.4em;
  margin: 1.5em 0;
  border-radius: 8px;
  overflow: hidden;

  /* --- LINE WRAPPING --- */
  /* This allows long lines of code to wrap to the next line */
  white-space: pre-wrap;
  word-break: break-word;
}

/* Reset styles for pre and code tags inside the highlight block */
.highlight pre, .highlight code {
  margin: 0;
  padding: 0;
  background: none;
  font-family: 'Fira Code', 'JetBrains Mono', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
  line-height: 1.6;
}

/* --- Token Color Rules using CSS Variables --- */

/* Comments (Grey) */
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf,
.highlight .cm, .highlight .cp, .highlight .c1, .highlight .cs {
  color: var(--grey);
  font-style: italic;
}

/* Errors */
.highlight .err, .highlight .gr, .highlight .gt {
  color: var(--error-fg);
  background-color: var(--error-bg);
}

/* Keywords & Operators (Pink) */
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kn, .highlight .kp, 
.highlight .kr, .highlight .kv, .highlight .o, .highlight .ow, .highlight .nt {
  color: var(--pink);
}

/* Numbers & Purple Literals */
.highlight .m, .highlight .mb, .highlight .mf, .highlight .mh, .highlight .mi, 
.highlight .mo, .highlight .il, .highlight .sc, .highlight .se, .highlight .ss {
  color: var(--purple);
}

/* Types & Built-ins (Cyan) */
.highlight .kt, .highlight .no {
  color: var(--cyan);
}

/* Function & Class Names, Attributes (Green) */
.highlight .n, .highlight .na, .highlight .nb, .highlight .nc, .highlight .nd, 
.highlight .ne, .highlight .nf, .highlight .nn, .highlight .nx, .highlight .py,
.highlight .fm {
  color: var(--green);
}

/* Strings (Yellow) */
.highlight .s, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .dl,
.highlight .sd, .highlight .s2, .highlight .sh, .highlight .si, .highlight .sx, 
.highlight .s1 {
  color: var(--yellow);
}

/* Variables & Special Constants (Orange) */
.highlight .bp, .highlight .gp, .highlight .gs, .highlight .gu,
.highlight .ni, .highlight .nl, .highlight .nv, .highlight .vc, 
.highlight .vg, .highlight .vi, .highlight .vm, .highlight .sr {
  color: var(--orange);
}

/* Fallback for general text */
.highlight .w {
  color: var(--fg);
}

/* Styles for line-numbered code tables */
.highlight table td { padding: 5px; }
.highlight table pre { margin: 0; }