/* ═══════════════════════════════════════════════════════════════
   Palette tokens
   #161638  deep navy    — main background
   #1B435E  steel teal   — header / primary
   #38667E  slate        — mid-tone UI / borders
   #563457  dark plum    — accent source
   #3A2B50  deep violet  — secondary backgrounds
═══════════════════════════════════════════════════════════════ */

[data-md-color-scheme="slate"] {
  /* ── Backgrounds ───────────────────────────────────────── */
  --md-default-bg-color:           #161638;
  --md-default-bg-color--light:    #1c1c44;
  --md-default-bg-color--lighter:  #21214e;
  --md-default-bg-color--lightest: #26265a;

  /* ── Text ──────────────────────────────────────────────── */
  --md-default-fg-color:           hsla(0, 0%, 100%, 0.87);
  --md-default-fg-color--light:    hsla(0, 0%, 100%, 0.54);
  --md-default-fg-color--lighter:  hsla(0, 0%, 100%, 0.32);
  --md-default-fg-color--lightest: hsla(0, 0%, 100%, 0.07);

  /* ── Primary (header) ──────────────────────────────────── */
  --md-primary-fg-color:           #1B435E;
  --md-primary-fg-color--light:    #38667E;
  --md-primary-fg-color--dark:     #13304a;
  --md-primary-bg-color:           hsla(0, 0%, 100%, 0.87);
  --md-primary-bg-color--light:    hsla(0, 0%, 100%, 0.70);

  /* ── Accent (links, highlights, buttons) ──────────────── */
  --md-accent-fg-color:            #90ADB2;
  --md-accent-fg-color--transparent: rgba(198, 133, 208, 0.12);
  --md-accent-bg-color:            #fff;
  --md-accent-bg-color--light:     hsla(0, 0%, 100%, 0.70);

  /* ── Links ─────────────────────────────────────────────── */
  --md-typeset-a-color:            #7fcde8;

  /* ── Code ──────────────────────────────────────────────── */
  --md-code-bg-color:              #0e0e2c;
  --md-code-fg-color:              hsla(210, 40%, 88%, 0.92);

  /* ── Shadows (deeper for dark bg) ─────────────────────── */
  --md-shadow-z1: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.55),
                  0 0 0.05rem rgba(0, 0, 0, 0.4);
  --md-shadow-z2: 0 0.2rem 0.8rem rgba(0, 0, 0, 0.55),
                  0 0 0.05rem rgba(0, 0, 0, 0.4);
  --md-shadow-z3: 0 0.4rem 1.4rem rgba(0, 0, 0, 0.6),
                  0 0 0.05rem rgba(0, 0, 0, 0.4);
}

/* ── Full-width layout ─────────────────────────────────────── */
.md-grid {
  max-width: initial;
}

/* ════════════════════════════════════════════════════════════
   Header
════════════════════════════════════════════════════════════ */
.md-header {
  background: linear-gradient(120deg, #1B435E 0%, #2d2448 60%, #3A2B50 100%);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* Subtle iridescent bottom edge */
.md-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(56, 102, 126, 0.6) 25%,
    rgba(198, 133, 208, 0.7) 50%,
    rgba(56, 102, 126, 0.6) 75%,
    transparent 100%
  );
}

/* ════════════════════════════════════════════════════════════
   Sidebar
════════════════════════════════════════════════════════════ */
.md-sidebar--primary {
  height: unset;
  background-color: #141432;
  border-top: 1px solid rgba(56, 102, 126, 0.18);
  border-right: 1px solid rgba(56, 102, 126, 0.18);
  transition: width 0.25s ease, min-width 0.25s ease, opacity 0.2s ease;
}

.md-sidebar--secondary {
  height: unset;
  background-color: #141432;
  border-top: 1px solid rgba(56, 102, 126, 0.12);
  border-left: 1px solid rgba(56, 102, 126, 0.12);
}

.md-sidebar__scrollwrap {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 102, 126, 0.35) transparent;
}

/* ════════════════════════════════════════════════════════════
   Navigation
════════════════════════════════════════════════════════════ */
.md-nav__title {
  color: rgba(56, 102, 126, 0.9);
  font-size: 0.65rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.md-nav__link {
  transition: color 0.15s ease, background-color 0.15s ease;
  border-radius: 4px;
  padding-left: 0.5rem;
  margin: 1px 0;
}

.md-nav__link:hover,
.md-nav__link:focus {
  color: #7fcde8 !important;
  background-color: rgba(56, 102, 126, 0.10);
}

.md-nav__item--active > .md-nav__link,
.md-nav__link--active {
  color: #90ADB2 !important;
  font-weight: 600;
}

/* Nav icon tint */
.md-nav__link .md-icon {
  color: rgba(56, 102, 126, 0.75);
  transition: color 0.15s ease;
}

.md-nav__link:hover .md-icon,
.md-nav__link:focus .md-icon {
  color: #7fcde8;
}

.md-nav__item--active > .md-nav__link .md-icon,
.md-nav__link--active .md-icon {
  color: #90ADB2;
}

/* ════════════════════════════════════════════════════════════
   Content
════════════════════════════════════════════════════════════ */
.md-content__inner {
  padding-top: 1.6rem;
}

/* Headings */
.md-typeset h1 {
  color: hsla(0, 0%, 100%, 0.95);
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid rgba(56, 102, 126, 0.3);
  margin-bottom: 1.2rem;
}

.md-typeset h2 {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(56, 102, 126, 0.18);
  color: hsla(0, 0%, 100%, 0.90);
}

.md-typeset h3 {
  color: hsla(0, 0%, 100%, 0.85);
}

/* Links */
.md-typeset a {
  color: #7fcde8;
  text-decoration: none;
}

.md-typeset a:hover {
  color: #a5ddf0;
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════
   Code
════════════════════════════════════════════════════════════ */
.md-typeset code:not(.highlight > *):not(pre > code) {
  background: #0e0e2c;
  border: 1px solid rgba(56, 102, 126, 0.28);
  border-radius: 3px;
  color: #b8e0f0;
  padding: 0.05em 0.3em;
}

.md-typeset pre {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(56, 102, 126, 0.25);
}

.md-typeset pre > code {
  background: #0e0e2c;
}

/* Code block title bar */
.md-typeset .highlight .filename {
  background: rgba(27, 67, 94, 0.6);
  border-bottom: 1px solid rgba(56, 102, 126, 0.3);
  color: rgba(127, 205, 232, 0.85);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* ════════════════════════════════════════════════════════════
   Tables
════════════════════════════════════════════════════════════ */
.md-typeset table:not([class]) {
  border-collapse: collapse;
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.78rem;
}

.md-typeset table:not([class]) th {
  background: rgba(27, 67, 94, 0.55);
  border-bottom: 2px solid rgba(56, 102, 126, 0.45);
  color: hsla(0, 0%, 100%, 0.87);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.md-typeset table:not([class]) td {
  border-bottom: 1px solid rgba(56, 102, 126, 0.12);
}

.md-typeset table:not([class]) tr:hover td {
  background: rgba(27, 67, 94, 0.18);
}

/* ════════════════════════════════════════════════════════════
   Admonitions
════════════════════════════════════════════════════════════ */
.md-typeset .admonition,
.md-typeset details {
  background: rgba(22, 22, 56, 0.7);
  border-left-width: 3px;
  border-radius: 0 4px 4px 0;
}

.md-typeset .admonition.note,
.md-typeset details.note {
  border-left-color: #38667E;
}
.md-typeset .admonition.note > .admonition-title,
.md-typeset details.note > summary {
  background: rgba(56, 102, 126, 0.15);
}

.md-typeset .admonition.tip,
.md-typeset details.tip {
  border-left-color: #90ADB2;
}
.md-typeset .admonition.tip > .admonition-title,
.md-typeset details.tip > summary {
  background: rgba(198, 133, 208, 0.12);
}

.md-typeset .admonition.warning,
.md-typeset details.warning {
  border-left-color: #e8a87c;
}
.md-typeset .admonition.warning > .admonition-title,
.md-typeset details.warning > summary {
  background: rgba(232, 168, 124, 0.12);
}

.md-typeset .admonition.danger,
.md-typeset details.danger,
.md-typeset .admonition.failure,
.md-typeset details.failure {
  border-left-color: #e87c7c;
}
.md-typeset .admonition.danger > .admonition-title,
.md-typeset details.danger > summary,
.md-typeset .admonition.failure > .admonition-title,
.md-typeset details.failure > summary {
  background: rgba(232, 124, 124, 0.12);
}

.md-typeset .admonition.info,
.md-typeset details.info,
.md-typeset .admonition.abstract,
.md-typeset details.abstract {
  border-left-color: #7fcde8;
}
.md-typeset .admonition.info > .admonition-title,
.md-typeset details.info > summary,
.md-typeset .admonition.abstract > .admonition-title,
.md-typeset details.abstract > summary {
  background: rgba(127, 205, 232, 0.10);
}

/* ════════════════════════════════════════════════════════════
   Footer
════════════════════════════════════════════════════════════ */
.md-footer {
  background: linear-gradient(120deg, #1B435E 0%, #2d2448 60%, #3A2B50 100%);
}

.md-footer-meta {
  background: rgba(0, 0, 0, 0.25);
}

/* ── SBE logo centered in footer bar ────────────────────── */
.md-footer-meta__inner {
  position: relative;
  display: flex;
  align-items: center;
}

.md-footer-sbe {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.md-footer-sbe img {
  height: 1.4rem;
  width: auto;
  filter: invert(1);
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.md-footer-sbe a:hover img,
.md-footer-sbe a:focus img {
  opacity: 1;
}

.md-footer-links {
  margin: auto 0;
  padding: 0 0.6rem;
  margin-left: auto;
  display: flex;
  gap: 0.8rem;
}

.md-footer-links a {
  color: inherit;
  opacity: 0.65;
  text-decoration: none;
  font-size: 0.7rem;
  transition: opacity 0.15s ease;
}

.md-footer-links a:hover,
.md-footer-links a:focus {
  opacity: 1;
  text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════
   Search
════════════════════════════════════════════════════════════ */
.md-search__button {
  width: 13.35rem;
}

/* ── Reading timer ───────────────────────────────────────── */
.reading-timer {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.6rem;
  color: var(--md-primary-bg-color--light);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  opacity: 0.7;
  white-space: nowrap;
  flex-shrink: 0;
  user-select: none;
  cursor: default;
}

.reading-timer:hover {
  opacity: 1;
}

.reading-timer svg {
  width: 1.3rem;
  height: 1.3rem;
  flex-shrink: 0;
}

.reading-timer__time {
  min-width: 2.2rem;
}

.md-search__form {
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  transition: background-color 0.2s;
}

.md-search__form:hover,
.md-search__form:focus-within {
  background-color: rgba(255, 255, 255, 0.13);
}

.md-search__output {
  background: #141432;
  border: 1px solid rgba(56, 102, 126, 0.25);
}

.md-search-result__meta {
  background: rgba(27, 67, 94, 0.4);
  color: rgba(127, 205, 232, 0.75);
}

.md-search-result__link:hover,
.md-search-result__link:focus {
  background: rgba(56, 102, 126, 0.15);
}

/* ════════════════════════════════════════════════════════════
   Back to top button
════════════════════════════════════════════════════════════ */
.md-top {
  background: linear-gradient(135deg, #1B435E, #3A2B50) !important;
  color: hsla(0, 0%, 100%, 0.87) !important;
  border: 1px solid rgba(198, 133, 208, 0.3) !important;
}

.md-top:hover,
.md-top:focus {
  background: linear-gradient(135deg, #38667E, #563457) !important;
  color: #fff !important;
}

/* ════════════════════════════════════════════════════════════
   Sidebar collapse — toggle button
════════════════════════════════════════════════════════════ */
body.nav-hidden .md-sidebar--primary {
  width: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  opacity: 0;
  pointer-events: none;
}

.nav-toggle {
  display: none;
}

@media screen and (min-width: 76.1875em) {
  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    margin: 0 0.4rem 0 0;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
  }

  .nav-toggle:hover {
    opacity: 1;
  }

  .nav-toggle svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: currentColor;
    transition: transform 0.2s ease;
  }

  body.nav-hidden .nav-toggle svg {
    transform: scaleX(-1);
  }
}

/* ════════════════════════════════════════════════════════════
   Horizontal rule
════════════════════════════════════════════════════════════ */
.md-typeset hr {
  border-color: rgba(56, 102, 126, 0.25);
}

/* ════════════════════════════════════════════════════════════
   Highlight / mark
════════════════════════════════════════════════════════════ */
.md-typeset mark {
  background: rgba(198, 133, 208, 0.28);
  color: inherit;
}

/* ════════════════════════════════════════════════════════════
   Table of contents (right sidebar)
════════════════════════════════════════════════════════════ */
.md-nav--secondary .md-nav__link {
  color: hsla(0, 0%, 100%, 0.45);
  font-size: 0.72rem;
}

.md-nav--secondary .md-nav__link:hover {
  color: #7fcde8 !important;
  background: none;
}

.md-nav--secondary .md-nav__link--active {
  color: #90ADB2 !important;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════════
   Keyboard tags
════════════════════════════════════════════════════════════ */
.md-typeset kbd {
  background: rgba(27, 67, 94, 0.5);
  border: 1px solid rgba(56, 102, 126, 0.4);
  border-bottom-color: rgba(56, 102, 126, 0.7);
  box-shadow: 0 1px 0 rgba(56, 102, 126, 0.5);
  color: hsla(0, 0%, 100%, 0.80);
}
