/* Base dark palette */
:root {
  --md-default-bg-color: #282828;
  --md-primary-bg-color: #1d2021;
  --md-footer-bg-color: #1d2021;

  --md-default-fg-color: #ebdbb2;
  --md-default-fg-color--light: #ebdbb2;
  --md-default-fg-color--lighter: #d5c4a1;
  --md-typeset-color: #ebdbb2;

  --md-primary-fg-color: #d79921;
  --md-accent-fg-color:  #d65d0e;
  --md-typeset-a-color:  #83a598;

  --md-code-bg-color: #3c3836;
  --md-code-fg-color: #ebdbb2;

  --tbl-header-bg: #1d2021;
  --tbl-header-fg: #d79921;
  --tbl-row-even:  #32302f;
  --tbl-row-odd:   #282828;
}

/* Distinct heading colors */
.md-typeset h1 { color: #fabd2f; }
.md-typeset h2 { color: #fe8019; }
.md-typeset h3 { color: #83a598; }
.md-typeset h4, .md-typeset h5, .md-typeset h6 { color: #b8bb26; }

/* Section dividers */
.md-typeset hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, #504945, #665c54, #504945);
  margin: 2rem 0;
}

/* Tables 
.md-typeset table { border: 1px solid #3c3836; }
.md-typeset thead th {
  background-color: var(--tbl-header-bg);
  color: var(--tbl-header-fg);
}
.md-typeset tbody tr:nth-child(even) { background-color: var(--tbl-row-even); }
.md-typeset tbody tr:nth-child(odd)  { background-color: var(--tbl-row-odd); }
*/

/* Admonitions */
.md-typeset .admonition.info,
.md-typeset details.info { border-color: #458588; }
.md-typeset .admonition.info > .admonition-title,
.md-typeset details.info > summary { background: #1d2021; color: #83a598; }

.md-typeset .admonition.tip,
.md-typeset details.tip { border-color: #d79921; }
.md-typeset .admonition.tip > .admonition-title,
.md-typeset details.tip > summary { background: #1d2021; color: #fabd2f; }

.md-typeset .admonition.warning,
.md-typeset details.warning { border-color: #fb4934; }
.md-typeset .admonition.warning > .admonition-title,
.md-typeset details.warning > summary { background: #1d2021; color: #fb4934; }

/* Images */
.md-typeset img {
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Cards */
.grid { display: grid; gap: 1rem; }
.cards > ul, .cards { list-style: none; padding: 0; margin: 0; }
.grid.cards > * { background: #1d2021; border: 1px solid #3c3836; border-radius: 10px; padding: 1rem; }
.grid.cards a { text-decoration: none; }
.grid.cards strong, .grid.cards b { color: #fabd2f; }
.grid.cards a:hover { color: #83a598; }

/* ---------- Algorithm admonition (custom) ---------- */

/* Default (light) scheme */
[data-md-color-scheme="default"] {
  --alg-border: #1e88e5;        /* blue */
  --alg-title-bg: #e3f2fd;      /* light blue bar */
  --alg-bg: #f7fbff;            /* subtle panel bg */
  --alg-icon: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231e88e5'>\
<path d='M7 8h2v8H7V8zm4 0h2v8h-2V8zm4 0h2v8h-2V8z'/></svg>");
}

/* Dark (slate / gruvbox) scheme */
[data-md-color-scheme="slate"] {
  --alg-border: #83a598;        /* gruvbox blue */
  --alg-title-bg: #1d2021;      /* title bar bg */
  --alg-bg: #2b2b2b;            /* panel bg */
  --alg-icon: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2383a598'>\
<path d='M7 8h2v8H7V8zm4 0h2v8h-2V8zm4 0h2v8h-2V8z'/></svg>");
}

/* Box + border */
.md-typeset .admonition.algorithm,
.md-typeset details.algorithm {
  border-color: var(--alg-border);
  background: var(--alg-bg);
}

/* Title bar */
.md-typeset .admonition.algorithm > .admonition-title,
.md-typeset details.algorithm > summary {
  background: var(--alg-title-bg);
  border-color: var(--alg-border);
  font-weight: 700;
}

/* Icon */
.md-typeset .admonition.algorithm > .admonition-title::before,
.md-typeset details.algorithm > summary::before {
  background-image: var(--alg-icon);
}

/* Inner spacing + typography */
.md-typeset .admonition.algorithm,
.md-typeset details.algorithm {
  border-width: 1px;
  border-radius: 10px;
}
.md-typeset .admonition.algorithm p,
.md-typeset .admonition.algorithm ol,
.md-typeset .admonition.algorithm ul {
  margin: 0.4rem 0;
}
.md-typeset .admonition.algorithm code,
.md-typeset .admonition.algorithm kbd {
  font-weight: 600;
}

/* Make math and code breathe a bit inside */
.md-typeset .admonition.algorithm mjx-container[display="true"] { margin: 0.6rem 0; }
.md-typeset .admonition.algorithm pre > code { padding: 0.8rem 1rem; }


/* ---------- Tables: dark (slate / gruvbox) ---------- */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  border-collapse: collapse;
  width: 100%;
  font-size: 1rem;          /* match body size */
  line-height: 1.6;         /* match body line-height */
  background: #282828;      /* base bg */
  border: 1px solid #3c3836;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

/* Header */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) thead {
  background: #1d2021;      /* header bar */
  color: #d79921;           /* gruvbox yellow */
  font-weight: 700;
}
[data-md-color-scheme="slate"] .md-typeset table:not([class]) thead th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 2px solid #3c3836;
}

/* Body rows */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tbody tr {
  background: #282828;
  border-bottom: 1px solid #3a3735;
}

/* Zebra striping with better contrast */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tbody tr:nth-child(even) {
  background: #32302f;
}

/* Cells */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) td {
  padding: 0.6rem 0.8rem;
  color: #ebdbb2;           /* gruvbox fg */
}

/* Emphasis (e.g., Baseline row) */
[data-md-color-scheme="slate"] .md-typeset table:not([class]) tbody tr strong {
  color: #fabd2f;           /* bright yellow */
}

/* Optional: subtle hover highlight */
@media (hover: hover) {
  [data-md-color-scheme="slate"] .md-typeset table:not([class]) tbody tr:hover {
    background: #3a3735;
  }
}

