
/* Avendar Reference theme - colors from Kate mprog.xml (One Dark base)
 * Trigger gold #e5c07b | Keyword purple #c678dd | Command blue #61afef
 * Ifcheck cyan #56b6c2 | Variable orange #d19a66 | String green #98c379
 * Comment #8b93a7 | Marker #636d83 | ValueGeneric #f8f8f2
 */
:root {
  --bg: #282c34;
  --bg-panel: #21252b;
  --bg-raised: #2c313a;
  --border: #3a3f4b;
  --text: #c8ccd4;
  --text-bright: #f8f8f2;
  --text-dim: #8b93a7;
  --trigger: #e5c07b;
  --keyword: #c678dd;
  --command: #61afef;
  --ifcheck: #56b6c2;
  --variable: #d19a66;
  --string: #98c379;
  --pastel-blue: #a6dcf5;
  --pastel-lilac: #b3bdf7;
  --_mobile-breakpoint: 768px;   /* required: docsify v5 JS reads this for isMobile() */
}
* { box-sizing: border-box; }
body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
}
::selection { background: #4746c9; color: #fff; }

/* headings follow the Kate itemData hierarchy */
.markdown-section h1 { color: var(--trigger); font-weight: 700; }
.markdown-section h2 { color: var(--ifcheck); border-bottom: 1px solid var(--border); padding-bottom: .2em; }
.markdown-section h3 { color: var(--string); }
.markdown-section h4 { color: var(--command); }          /* command entries, like Kate's Command blue */
.markdown-section h5 { color: var(--keyword); }
.markdown-section h6 { color: var(--text-dim); }
.markdown-section h1, .markdown-section h2, .markdown-section h3,
.markdown-section h4, .markdown-section h5, .markdown-section h6 { font-weight: 700; }
.markdown-section h1 .anchor span, .markdown-section h2 .anchor span { color: var(--command); }

.markdown-section strong { color: var(--text-bright); }
.markdown-section em { color: var(--pastel-lilac); }
.markdown-section a { color: var(--command); text-decoration: none; }
.markdown-section a:hover { color: var(--pastel-blue); text-decoration: underline; }
.markdown-section hr { border: none; border-top: 2px solid var(--border); margin: 2em 0; }

/* code: inline = String green chip, fenced = ValueGeneric bright on panel bg */
.markdown-section code {
  font-family: 'Fira Code', 'JetBrains Mono', Consolas, monospace;
  background: var(--bg-raised);
  color: var(--string);
  padding: .15em .35em;
  border-radius: 3px;
  font-size: .9em;
}
.markdown-section pre {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--keyword);
  border-radius: 4px;
  padding: 1em 1.2em;
  line-height: 1.5;
  overflow: auto;                    /* long prog lines scroll, never spill */
  -webkit-overflow-scrolling: touch;
}
.markdown-section pre code {
  background: none;
  color: var(--text-bright);
  padding: 0;
  font-size: .88em;
}
/* engine-literal characters: kill programming-ligature fonts merging >= into one glyph */
.markdown-section code, .markdown-section pre, .markdown-section pre code {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

/* blockquotes (epigraphs, status notes) */
.markdown-section blockquote {
  border-left: 4px solid var(--keyword);
  background: var(--bg-panel);
  color: var(--pastel-lilac);
  padding: .6em 1.2em;
  border-radius: 0 4px 4px 0;
}
.markdown-section blockquote strong { color: var(--trigger); }

/* tables */
.markdown-section table { display: table; width: 100%; border-collapse: collapse; }
.markdown-section th {
  background: var(--bg-panel);
  color: var(--trigger);
  border: 1px solid var(--border);
  padding: .45em .8em;
}
.markdown-section td { border: 1px solid var(--border); padding: .45em .8em; }
.markdown-section tr:nth-child(2n) { background: var(--bg-raised); }

/* lists */
.markdown-section li { margin: .3em 0; }

/* sidebar */
.sidebar {
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  color: var(--text-dim);
}
.sidebar .app-name a { color: var(--trigger); font-weight: 700; }
.sidebar ul li { color: var(--text-dim); }
.sidebar ul li a { color: var(--text); font-size: 14px; }
.sidebar ul li a:hover { color: var(--pastel-blue); }
.sidebar ul li.active > a { color: var(--command); font-weight: 700; border-right: 3px solid var(--command); }
.sidebar ul li:not(:has(a)) {           /* section labels: OLC Guide, Prog Guide, ... */
  color: var(--trigger);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .08em;
  margin-top: 1em;
}
.sidebar ul li:not(:has(a)) a { color: inherit; }
.sidebar .sb-desc { color: var(--text-dim); font-size: 12px; }
.sidebar .sb-note { color: var(--text-dim); font-size: 11px; font-weight: 400;
                    text-transform: none; letter-spacing: normal; }

/* search */
.search { border-bottom: 1px solid var(--border); background: var(--bg-panel); }
.search input {
  background: var(--bg-raised);
  color: var(--text-bright);
  border: 1px solid var(--border);
}
.search input::placeholder { color: var(--text-dim); }
.search .results-panel { background: var(--bg-panel); border: 1px solid var(--border); }
.search .results-panel a { color: var(--text); border-bottom: 1px solid var(--border); }
.search .results-panel a:hover, .search .results-panel .matching-post a { color: var(--command); }
.search .results-panel p.caption, .search .results-status { color: var(--text-dim); }
.search .results-panel .matching-post { background: var(--bg-raised); }
.search .matching-post mark, .search .results mark { color: #feca57; background: none; padding: 0; }

/* copy-code buttons (v2: .copy-code-button, v3: .docsify-copy-code-button) —
 * pinned to the code block's top-right corner (the plugin positions
 * absolutely; pre must be its positioning context) */
.markdown-section pre { position: relative; }
.copy-code-button, .docsify-copy-code-button {
  position: absolute; top: 8px; right: 8px;
  background: var(--bg-raised) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.copy-code-button:hover, .docsify-copy-code-button:hover { color: var(--command) !important; border-color: var(--command); }

/* sidebar toggle (mobile) */
.sidebar-toggle { background: var(--bg-panel); border: 1px solid var(--border); }
.sidebar-toggle-button { color: var(--command); }

/* scrollbars */
.markdown-section::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 8px; }
.markdown-section::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ============================================================
 * Docsify v5 LAYOUT (v5 semantics: the <aside class="sidebar">
 * itself carries .show; no body.close. Desktop initializes with
 * .show, mobile without; content expands via :has().)
 * ============================================================ */
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 300px;
  padding: 40px 0 0; z-index: 20;
  overflow: hidden;                 /* becomes auto on hover, docsify-style */
  transform: translateX(-100%);     /* hidden by default; .show reveals */
  transition: transform .25s ease-out;
}
.sidebar.show { transform: translateX(0); }
.sidebar:hover, .sidebar:active { overflow-y: auto; }
.app-name { margin: 0; padding: 0 16px 12px; font-size: 20px; }
.app-name-link { color: var(--trigger); font-weight: 700; text-decoration: none; }
.sidebar ul { margin: 0; padding: 0 0 0 15px; list-style: none; }
.sidebar ul li { margin: 6px 0; }
.sidebar ul, .sidebar ul li { position: relative; }
/* ordered sidebar lists: theme-drawn numbers (dim, small) instead of browser defaults */
.sidebar ol { margin: 0; padding: 0 0 0 15px; list-style: none; counter-reset: sb-item; }
.sidebar ol li { margin: 6px 0; position: relative; counter-increment: sb-item; padding-left: 20px; }
.sidebar ol li::before {
  content: counter(sb-item) ".";
  position: absolute; left: 0; top: 2px;
  color: var(--text-dim); font-size: 12px;
}
.sidebar ol li a { color: var(--text); font-size: 14px; }
.sidebar ol li a:hover { color: var(--pastel-blue); }
.sidebar ol li.active > a { color: var(--command); font-weight: 700; }
.content {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  transition: left .25s ease;
}
.markdown-section {
  position: relative; margin: 0 auto;
  max-width: min(1450px, calc(100% - 4vw));   /* grows with the window; caps line length on ultrawides */
  padding: 30px 30px 80px;
}
@media screen and (min-width: 769px) {
  /* desktop: content yields to a visible sidebar and reclaims the space when hidden */
  main:has(.sidebar.show) .content { left: 300px; }
}
@media screen and (max-width: 768px) {
  /* mobile: sidebar overlays content; .content stays full-width */
  .sidebar { box-shadow: 4px 0 16px rgba(0,0,0,.5); }
  .markdown-section { padding: 20px 20px 60px; }
}
/* skip-to-content: parked off-screen until keyboard focus (v5 a11y button) */
#skip-to-content {
  position: fixed; top: 8px; left: 8px; z-index: 100;
  padding: 8px 14px; border: none; border-radius: 4px;
  background: var(--command); color: #1b1f24; font-weight: 700; cursor: pointer;
  transform: translateY(-300%);
}
#skip-to-content:focus-visible { transform: none; }
.sidebar-toggle { cursor: pointer; }
.sidebar-toggle { position: fixed; bottom: 16px; left: 16px; z-index: 30;
  width: 30px; height: 30px; padding: 5px; border-radius: 4px;
  background: var(--bg-panel); border: 1px solid var(--border);
  transition: left .25s ease; }
/* dock the toggle beside the OPEN sidebar on desktop instead of on top of it;
   hide it entirely in mobile overlay mode (tapping a link closes the menu) */
@media screen and (min-width: 769px) {
  body:has(.sidebar.show) .sidebar-toggle { left: 316px; }
}
@media screen and (max-width: 768px) {
  /* menu open on mobile: the toggle STAYS as the close control (bars -> X),
     sliding right along with the menu so it never sits over menu text */
  body:has(.sidebar.show) .sidebar-toggle {
    left: calc(100% - 46px);
    background: var(--bg-raised);
    box-shadow: 0 2px 10px rgba(0,0,0,.5);
  }
  body:has(.sidebar.show) .sidebar-toggle-button:before {
    top: 9px; transform: translateX(-50%) rotate(45deg);
  }
  body:has(.sidebar.show) .sidebar-toggle-button:after {
    bottom: auto; top: 9px; transform: translateX(-50%) rotate(-45deg);
  }
}
.sidebar-toggle-button { width: 100%; height: 100%; position: relative; }
.sidebar-toggle-button:before, .sidebar-toggle-button:after {
  content: ''; position: absolute; left: 50%; width: 12px; height: 2px;
  background: var(--command); transform: translateX(-50%);
}
.sidebar-toggle-button:before { top: 10px; }
.sidebar-toggle-button:after { bottom: 10px; }
@media print {
  .sidebar, .sidebar-toggle, .search { display: none; }
  .content, body .content { position: static; }
  body { overflow: visible; }
}

/* search panel positioning (v5 structure: .input-wrap, .clear-button, .results-panel) */
.search { position: relative; margin: 0; padding: 10px 15px; }
.search input { width: 100%; padding: 6px 10px; outline: none; border-radius: 3px; }
.search .input-wrap { position: relative; }
/* one clear affordance: the browser's native input[type=search] X; hide the
 * plugin's custom button and the /, Ctrl+K hint keys. !important: the v5
 * search plugin injects its own <style> at runtime, AFTER this sheet —
 * equal-specificity rules from it would otherwise re-show these. */
.search .clear-button { display: none !important; }
.search .kbd-group { display: none !important; }
/* v5 utility the core theme normally provides */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
.search .results-panel {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  max-height: 50vh; overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.5);
}
.search .results-panel a { display: block; padding: 6px 15px; }
.search .results-status { padding: 4px 15px; color: var(--text-dim); font-size: 12px; }

/* ============================================================
 * mprog token colors (Kate mprog.xml v40 itemDatas)
 * ============================================================ */
.markdown-section pre code .token.comment    { color: #8b93a7; }
.markdown-section pre code .token.marker     { color: #636d83; }
.markdown-section pre code .token.trigger    { color: #e5c07b; font-weight: 700; }
.markdown-section pre code .token.keyword    { color: #c678dd; font-weight: 700; }
.markdown-section pre code .token.command    { color: #61afef; }
.markdown-section pre code .token.ifcheck    { color: #56b6c2; font-style: italic; }
.markdown-section pre code .token.variable   { color: #d19a66; }
.markdown-section pre code .token.string     { color: #98c379; }
.markdown-section pre code .token.valuegeneric { color: #f8f8f2; font-weight: 700; }
.markdown-section pre code .token.breaka { color: #ff3030; font-weight: 700; }
.markdown-section pre code .token.breakb { color: #ffd23d; font-weight: 700; }
.markdown-section pre code .token.breakc { color: #40e070; font-weight: 700; }
.markdown-section pre code .token.breakd { color: #3da2ff; font-weight: 700; }
.markdown-section pre code .token.breake { color: #bd53f5; font-weight: 700; }
.markdown-section pre code .token.strpastel0 { color: #f0a2a0; font-weight: 700; }
.markdown-section pre code .token.strpastel1 { color: #f2c088; font-weight: 700; }
.markdown-section pre code .token.strpastel2 { color: #f4d38f; font-weight: 700; }
.markdown-section pre code .token.strpastel3 { color: #e6e79a; font-weight: 700; }
.markdown-section pre code .token.strpastel4 { color: #a8e3b9; font-weight: 700; }
.markdown-section pre code .token.strpastel5 { color: #a4e5da; font-weight: 700; }
.markdown-section pre code .token.strpastel6 { color: #a6dcf5; font-weight: 700; }
.markdown-section pre code .token.strpastel7 { color: #b3bdf7; font-weight: 700; }
.markdown-section pre code .token.strpastel8 { color: #c9b6fb; font-weight: 700; }
.markdown-section pre code .token.strpastel9 { color: #f4a8cd; font-weight: 700; }
.markdown-section pre code .token.ifdepth1  { color: #a3403d; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth2  { color: #b57a2a; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth3  { color: #d1b03a; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth4  { color: #94a837; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth5  { color: #2e9e5b; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth6  { color: #38b8ac; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth7  { color: #3b82e6; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth8  { color: #4746c9; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth9  { color: #8a4fd0; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.ifdepth10 { color: #c2457e; font-weight: 700; font-style: italic; }
.markdown-section pre code .token.loopdepth0 { color: #c678dd; }
.markdown-section pre code .token.loopdepth1 { color: #f0a2a0; }
.markdown-section pre code .token.loopdepth2 { color: #f2c088; }
.markdown-section pre code .token.loopdepth3 { color: #f4d38f; }
.markdown-section pre code .token.loopdepth4 { color: #e6e79a; }
.markdown-section pre code .token.loopdepth5 { color: #a8e3b9; }
.markdown-section pre code .token.loopdepth6 { color: #a4e5da; }
.markdown-section pre code .token.loopdepth7 { color: #a6dcf5; }
.markdown-section pre code .token.loopdepth8 { color: #b3bdf7; }
.markdown-section pre code .token.loopdepth9 { color: #c9b6fb; }
.markdown-section pre code .token.loopdepth10 { color: #f4a8cd; }
.markdown-section pre code .token.slot0 { color: #ff6b6b; font-weight: 700; }
.markdown-section pre code .token.slot1 { color: #ff9f43; font-weight: 700; }
.markdown-section pre code .token.slot2 { color: #feca57; font-weight: 700; }
.markdown-section pre code .token.slot3 { color: #b5e853; font-weight: 700; }
.markdown-section pre code .token.slot4 { color: #52d273; font-weight: 700; }
.markdown-section pre code .token.slot5 { color: #2dd4bf; font-weight: 700; }
.markdown-section pre code .token.slot6 { color: #38bdf8; font-weight: 700; }
.markdown-section pre code .token.slot7 { color: #818cf8; font-weight: 700; }
.markdown-section pre code .token.slot8 { color: #a78bfa; font-weight: 700; }
.markdown-section pre code .token.slot9 { color: #ec4899; font-weight: 700; }
