/* ============================================================
   Docsify Theme Switcher — inspired by herdr.dev built-in themes
   ============================================================ */

/* CSS variables mapped to Docsify's internal structure */
[data-theme] {
  --theme-color: var(--theme-heading);
  --base-color: var(--theme-text);
  --base-background-color: var(--theme-bg);
  --sidebar-background: var(--theme-sidebar-bg);
}

[data-theme] body {
  background: var(--theme-bg);
  color: var(--theme-text);
}

[data-theme] .sidebar {
  background: var(--theme-sidebar-bg);
  color: var(--theme-sidebar-text);
  border-right: 1px solid var(--theme-border);
}

[data-theme] .sidebar ul li a {
  color: var(--theme-sidebar-text);
  line-height: 1.4;
  padding: 4px 0;
  margin: 0;
  font-size: 15px;
}

[data-theme] .sidebar ul li {
  margin: 0;
  padding: 0;
}

[data-theme] .sidebar ul li a:hover,
[data-theme] .sidebar ul li.active > a {
  color: var(--theme-accent);
}

[data-theme] .sidebar .sidebar-nav > ul > li > a {
  color: var(--theme-sidebar-text);
  font-weight: 600;
}

[data-theme] .markdown-section {
  color: var(--theme-text);
}

[data-theme] .markdown-section a {
  color: var(--theme-accent) !important;
}

[data-theme] .markdown-section a:hover {
  color: var(--theme-accent-hover) !important;
}

[data-theme] .markdown-section code {
  color: var(--theme-code-inline) !important;
  background: var(--theme-code-bg) !important;
  border-radius: 3px;
  padding: 2px 5px;
}

[data-theme] .markdown-section pre {
  background: var(--theme-code-block-bg) !important;
  border-radius: 6px;
}

[data-theme] .markdown-section pre > code {
  color: var(--theme-code-text);
  background: transparent !important;
}

[data-theme] .markdown-section h1,
[data-theme] .markdown-section h2,
[data-theme] .markdown-section h3,
[data-theme] .markdown-section h4,
[data-theme] .markdown-section h5,
[data-theme] .markdown-section h6 {
  color: var(--theme-heading) !important;
}

[data-theme] .markdown-section h1 a,
[data-theme] .markdown-section h2 a,
[data-theme] .markdown-section h3 a,
[data-theme] .markdown-section h4 a,
[data-theme] .markdown-section h5 a,
[data-theme] .markdown-section h6 a {
  text-decoration: none !important;
  border-bottom: none !important;
  color: var(--theme-heading) !important;
}

[data-theme] .markdown-section strong {
  color: var(--theme-heading) !important;
}

[data-theme] .markdown-section h2 {
  border-bottom: 1px solid var(--theme-border);
}

[data-theme] .markdown-section blockquote {
  border-left: 4px solid var(--theme-accent);
  color: var(--theme-muted);
  background: var(--theme-code-bg);
}

[data-theme] .markdown-section table th {
  background: var(--theme-code-bg);
  color: var(--theme-heading);
}

[data-theme] .markdown-section table td,
[data-theme] .markdown-section table th {
  border-color: var(--theme-border);
}

[data-theme] .markdown-section table td {
  background: var(--theme-bg);
}

[data-theme] .markdown-section table tr:nth-child(2n) td {
  background: var(--theme-bg);
}

[data-theme] .markdown-section hr {
  border-color: var(--theme-border);
}

[data-theme] .search input {
  background: var(--theme-code-bg);
  color: var(--theme-text);
  border-color: var(--theme-border);
  border-width: 1px;
  border-style: solid;
}

[data-theme] .search input:focus {
  border-color: var(--theme-accent);
  box-shadow: none;
}

[data-theme] .search .matching-post {
  border-bottom-color: var(--theme-border);
}

[data-theme] .search {
  border-bottom: 1px solid var(--theme-border) !important;
}

[data-theme] .sidebar,
[data-theme] .sidebar:after {
  border-color: var(--theme-border);
}

[data-theme] .sidebar-toggle {
  background: var(--theme-sidebar-bg);
  border-color: var(--theme-border);
}

[data-theme] .sidebar-toggle span {
  background-color: var(--theme-sidebar-text);
}

[data-theme] .app-name-link {
  color: var(--theme-accent) !important;
  text-decoration: none !important;
}

[data-theme] .sidebar .app-name {
  padding: 20px 15px 10px;
  text-align: left;
}

/* ============================================================
   DARK THEMES
   ============================================================ */

/* --- Catppuccin Mocha --- */
[data-theme="catppuccin"] {
  --theme-bg: #1e1e2e;
  --theme-text: #cdd6f4;
  --theme-heading: #b4befe;
  --theme-muted: #a6adc8;
  --theme-accent: #89b4fa;
  --theme-accent-hover: #b4d0fb;
  --theme-sidebar-bg: #181825;
  --theme-sidebar-text: #bac2de;
  --theme-border: #313244;
  --theme-code-bg: #313244;
  --theme-code-block-bg: #181825;
  --theme-code-text: #cdd6f4;
  --theme-code-inline: #f38ba8;
}

/* --- Tokyo Night --- */
[data-theme="tokyo-night"] {
  --theme-bg: #1a1b26;
  --theme-text: #a9b1d6;
  --theme-heading: #7aa2f7;
  --theme-muted: #565f89;
  --theme-accent: #7aa2f7;
  --theme-accent-hover: #89ddff;
  --theme-sidebar-bg: #16161e;
  --theme-sidebar-text: #a9b1d6;
  --theme-border: #292e42;
  --theme-code-bg: #292e42;
  --theme-code-block-bg: #16161e;
  --theme-code-text: #a9b1d6;
  --theme-code-inline: #ff9e64;
}

/* --- Dracula --- */
[data-theme="dracula"] {
  --theme-bg: #282a36;
  --theme-text: #f8f8f2;
  --theme-heading: #bd93f9;
  --theme-muted: #6272a4;
  --theme-accent: #bd93f9;
  --theme-accent-hover: #ff79c6;
  --theme-sidebar-bg: #21222c;
  --theme-sidebar-text: #f8f8f2;
  --theme-border: #44475a;
  --theme-code-bg: #44475a;
  --theme-code-block-bg: #21222c;
  --theme-code-text: #f8f8f2;
  --theme-code-inline: #ff79c6;
}

/* --- Nord --- */
[data-theme="nord"] {
  --theme-bg: #2e3440;
  --theme-text: #d8dee9;
  --theme-heading: #88c0d0;
  --theme-muted: #4c566a;
  --theme-accent: #88c0d0;
  --theme-accent-hover: #8fbcbb;
  --theme-sidebar-bg: #272c36;
  --theme-sidebar-text: #d8dee9;
  --theme-border: #3b4252;
  --theme-code-bg: #3b4252;
  --theme-code-block-bg: #272c36;
  --theme-code-text: #d8dee9;
  --theme-code-inline: #bf616a;
}

/* --- Gruvbox Dark --- */
[data-theme="gruvbox"] {
  --theme-bg: #282828;
  --theme-text: #ebdbb2;
  --theme-heading: #fabd2f;
  --theme-muted: #928374;
  --theme-accent: #b8bb26;
  --theme-accent-hover: #fabd2f;
  --theme-sidebar-bg: #1d2021;
  --theme-sidebar-text: #ebdbb2;
  --theme-border: #3c3836;
  --theme-code-bg: #3c3836;
  --theme-code-block-bg: #1d2021;
  --theme-code-text: #ebdbb2;
  --theme-code-inline: #fe8019;
}

/* --- One Dark --- */
[data-theme="one-dark"] {
  --theme-bg: #282c34;
  --theme-text: #abb2bf;
  --theme-heading: #e5c07b;
  --theme-muted: #5c6370;
  --theme-accent: #61afef;
  --theme-accent-hover: #56b6c2;
  --theme-sidebar-bg: #21252b;
  --theme-sidebar-text: #abb2bf;
  --theme-border: #3e4451;
  --theme-code-bg: #3e4451;
  --theme-code-block-bg: #21252b;
  --theme-code-text: #abb2bf;
  --theme-code-inline: #e06c75;
}

/* --- Solarized Dark --- */
[data-theme="solarized"] {
  --theme-bg: #002b36;
  --theme-text: #839496;
  --theme-heading: #2aa198;
  --theme-muted: #586e75;
  --theme-accent: #268bd2;
  --theme-accent-hover: #2aa198;
  --theme-sidebar-bg: #001e26;
  --theme-sidebar-text: #839496;
  --theme-border: #073642;
  --theme-code-bg: #073642;
  --theme-code-block-bg: #001e26;
  --theme-code-text: #839496;
  --theme-code-inline: #cb4b16;
}

/* --- Kanagawa --- */
[data-theme="kanagawa"] {
  --theme-bg: #1f1f28;
  --theme-text: #dcd7ba;
  --theme-heading: #7e9cd8;
  --theme-muted: #727169;
  --theme-accent: #7e9cd8;
  --theme-accent-hover: #7fb4ca;
  --theme-sidebar-bg: #16161d;
  --theme-sidebar-text: #c8c093;
  --theme-border: #2a2a37;
  --theme-code-bg: #2a2a37;
  --theme-code-block-bg: #16161d;
  --theme-code-text: #dcd7ba;
  --theme-code-inline: #e46876;
}

/* --- Rosé Pine --- */
[data-theme="rose-pine"] {
  --theme-bg: #191724;
  --theme-text: #e0def4;
  --theme-heading: #c4a7e7;
  --theme-muted: #6e6a86;
  --theme-accent: #c4a7e7;
  --theme-accent-hover: #ebbcba;
  --theme-sidebar-bg: #1f1d2e;
  --theme-sidebar-text: #e0def4;
  --theme-border: #26233a;
  --theme-code-bg: #26233a;
  --theme-code-block-bg: #1f1d2e;
  --theme-code-text: #e0def4;
  --theme-code-inline: #eb6f92;
}

/* --- Cursor --- */
[data-theme="cursor"] {
  --theme-bg: #f7f7f4;
  --theme-text: #14120b;
  --theme-heading: #14120b;
  --theme-muted: #6b6b5e;
  --theme-accent: #c14924;
  --theme-accent-hover: #a03d1e;
  --theme-sidebar-bg: #f7f7f4;
  --theme-sidebar-text: #14120b;
  --theme-border: #e5e5e0;
  --theme-code-bg: #eeeee9;
  --theme-code-block-bg: #eeeee9;
  --theme-code-text: #14120b;
  --theme-code-inline: #c14924;
}

/* --- Vesper --- */
[data-theme="vesper"] {
  --theme-bg: #101010;
  --theme-text: #d4d4d4;
  --theme-heading: #ffc799;
  --theme-muted: #7a7a7a;
  --theme-accent: #ffc799;
  --theme-accent-hover: #ffdfbf;
  --theme-sidebar-bg: #0a0a0a;
  --theme-sidebar-text: #d4d4d4;
  --theme-border: #2a2a2a;
  --theme-code-bg: #1a1a1a;
  --theme-code-block-bg: #0a0a0a;
  --theme-code-text: #d4d4d4;
  --theme-code-inline: #ffc799;
}

/* --- Batman --- */
[data-theme="batman"] {
  --theme-bg: #0a0a0a;
  --theme-text: #c8c8c8;
  --theme-heading: #f5d623;
  --theme-muted: #5a5a5a;
  --theme-accent: #f5d623;
  --theme-accent-hover: #ffe566;
  --theme-sidebar-bg: #050505;
  --theme-sidebar-text: #b0b0b0;
  --theme-border: #1c1c1c;
  --theme-code-bg: #141414;
  --theme-code-block-bg: #050505;
  --theme-code-text: #c8c8c8;
  --theme-code-inline: #f5d623;
}

/* --- Everforest Dark --- */
[data-theme="everforest"] {
  --theme-bg: #2d353b;
  --theme-text: #d3c6aa;
  --theme-heading: #a7c080;
  --theme-muted: #859289;
  --theme-accent: #a7c080;
  --theme-accent-hover: #83c092;
  --theme-sidebar-bg: #272e33;
  --theme-sidebar-text: #d3c6aa;
  --theme-border: #3d484d;
  --theme-code-bg: #343f44;
  --theme-code-block-bg: #272e33;
  --theme-code-text: #d3c6aa;
  --theme-code-inline: #e69875;
}

/* --- Green Phosphor (inspired by book.rymcg.tech terminal) --- */
[data-theme="green-phosphor"] {
  --theme-bg: #0a1208;
  --theme-text: #33cc33;
  --theme-heading: #66ff66;
  --theme-muted: #1a8c1a;
  --theme-accent: #66ff66;
  --theme-accent-hover: #99ff99;
  --theme-sidebar-bg: #060d04;
  --theme-sidebar-text: #2eb82e;
  --theme-border: #1a3d1a;
  --theme-code-bg: #0d1a0a;
  --theme-code-block-bg: #060d04;
  --theme-code-text: #33cc33;
  --theme-code-inline: #66ff66;
}

/* --- Green Mist (light, inspired by book.rymcg.tech) --- */
[data-theme="green-mist"] {
  --theme-bg: #c8cec4;
  --theme-text: #3a3f37;
  --theme-heading: #2e332b;
  --theme-muted: #6b7266;
  --theme-accent: #4a6741;
  --theme-accent-hover: #3a5432;
  --theme-sidebar-bg: #b8bfb3;
  --theme-sidebar-text: #3a3f37;
  --theme-border: #a3ab9e;
  --theme-code-bg: #bcc3b7;
  --theme-code-block-bg: #b3bab0;
  --theme-code-text: #2e332b;
  --theme-code-inline: #4a6741;
}

/* ============================================================
   LIGHT THEMES
   ============================================================ */

/* --- Catppuccin Latte --- */
[data-theme="catppuccin-latte"] {
  --theme-bg: #eff1f5;
  --theme-text: #4c4f69;
  --theme-heading: #4c4f69;
  --theme-muted: #8c8fa1;
  --theme-accent: #1e66f5;
  --theme-accent-hover: #7287fd;
  --theme-sidebar-bg: #e6e9ef;
  --theme-sidebar-text: #4c4f69;
  --theme-border: #ccd0da;
  --theme-code-bg: #e6e9ef;
  --theme-code-block-bg: #dce0e8;
  --theme-code-text: #4c4f69;
  --theme-code-inline: #d20f39;
}

/* --- Tokyo Night Day --- */
[data-theme="tokyo-night-day"] {
  --theme-bg: #e1e2e7;
  --theme-text: #3760bf;
  --theme-heading: #343b58;
  --theme-muted: #6172b0;
  --theme-accent: #2e7de9;
  --theme-accent-hover: #166775;
  --theme-sidebar-bg: #d5d6db;
  --theme-sidebar-text: #3760bf;
  --theme-border: #c4c8da;
  --theme-code-bg: #d5d6db;
  --theme-code-block-bg: #c9cad4;
  --theme-code-text: #3760bf;
  --theme-code-inline: #b15c00;
}

/* --- Gruvbox Light --- */
[data-theme="gruvbox-light"] {
  --theme-bg: #fbf1c7;
  --theme-text: #3c3836;
  --theme-heading: #282828;
  --theme-muted: #7c6f64;
  --theme-accent: #79740e;
  --theme-accent-hover: #b57614;
  --theme-sidebar-bg: #f2e5bc;
  --theme-sidebar-text: #3c3836;
  --theme-border: #d5c4a1;
  --theme-code-bg: #f2e5bc;
  --theme-code-block-bg: #ebdbb2;
  --theme-code-text: #3c3836;
  --theme-code-inline: #9d0006;
}

/* --- One Light --- */
[data-theme="one-light"] {
  --theme-bg: #fafafa;
  --theme-text: #383a42;
  --theme-heading: #383a42;
  --theme-muted: #a0a1a7;
  --theme-accent: #4078f2;
  --theme-accent-hover: #0184bc;
  --theme-sidebar-bg: #f0f0f0;
  --theme-sidebar-text: #383a42;
  --theme-border: #d3d3d3;
  --theme-code-bg: #f0f0f0;
  --theme-code-block-bg: #e8e8e8;
  --theme-code-text: #383a42;
  --theme-code-inline: #e45649;
}

/* --- Solarized Light --- */
[data-theme="solarized-light"] {
  --theme-bg: #fdf6e3;
  --theme-text: #657b83;
  --theme-heading: #586e75;
  --theme-muted: #93a1a1;
  --theme-accent: #268bd2;
  --theme-accent-hover: #2aa198;
  --theme-sidebar-bg: #eee8d5;
  --theme-sidebar-text: #657b83;
  --theme-border: #eee8d5;
  --theme-code-bg: #eee8d5;
  --theme-code-block-bg: #eee8d5;
  --theme-code-text: #657b83;
  --theme-code-inline: #cb4b16;
}

/* --- Kanagawa Lotus --- */
[data-theme="kanagawa-lotus"] {
  --theme-bg: #f2ecbc;
  --theme-text: #545464;
  --theme-heading: #43436c;
  --theme-muted: #8a8980;
  --theme-accent: #4d699b;
  --theme-accent-hover: #597b75;
  --theme-sidebar-bg: #e7dba0;
  --theme-sidebar-text: #545464;
  --theme-border: #d7c87e;
  --theme-code-bg: #e7dba0;
  --theme-code-block-bg: #dcd5ac;
  --theme-code-text: #545464;
  --theme-code-inline: #c84053;
}

/* --- Rosé Pine Dawn --- */
[data-theme="rose-pine-dawn"] {
  --theme-bg: #faf4ed;
  --theme-text: #575279;
  --theme-heading: #575279;
  --theme-muted: #9893a5;
  --theme-accent: #907aa9;
  --theme-accent-hover: #d7827e;
  --theme-sidebar-bg: #fffaf3;
  --theme-sidebar-text: #575279;
  --theme-border: #dfdad9;
  --theme-code-bg: #f2e9e1;
  --theme-code-block-bg: #fffaf3;
  --theme-code-text: #575279;
  --theme-code-inline: #b4637a;
}

/* --- Docsify Default --- */
[data-theme="default"] {
  --theme-bg: #ffffff;
  --theme-text: #34495e;
  --theme-heading: #2c3e50;
  --theme-muted: #7f8c8d;
  --theme-accent: #42b983;
  --theme-accent-hover: #33a06f;
  --theme-sidebar-bg: #fff;
  --theme-sidebar-text: #364149;
  --theme-border: #e8e8e8;
  --theme-code-bg: #f8f8f8;
  --theme-code-block-bg: #f8f8f8;
  --theme-code-text: #525252;
  --theme-code-inline: #e96900;
}
