
/* ── Theme-aware logo switching ──────────────────────────────────────────── */

.logo-dark { display: none; }

html[data-theme=dark] .logo-light { display: none; }
html[data-theme=dark] .logo-dark  { display: block; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme=light]) .logo-light { display: none; }
  html:not([data-theme=light]) .logo-dark  { display: block; }
}

/* Override pydata-sphinx-theme's dark-mode rule that white-backgrounds all images.
   Our logos are transparent PNGs and must not receive the white card treatment. */
html[data-theme=dark] img.logo-light,
html[data-theme=dark] img.logo-dark {
  background-color: transparent !important;
  border-radius: 0 !important;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme=light]) img.logo-light,
  html:not([data-theme=light]) img.logo-dark {
    background-color: transparent !important;
    border-radius: 0 !important;
  }
}

/* ── Layout: 1:3:1 sidebar-to-content ratio ──────────────────────────────── */
/*
 * Primary sidebar:  20% of page
 * Content:          60% of page  (= 75% of the remaining 80% after left sidebar)
 * Secondary sidebar: 20% of page (= 25% of the 80% main area)
 */

@media (min-width: 960px) {
  .bd-sidebar-primary {
    width: 20% !important;
    flex: 0 0 20% !important;
  }

  .bd-main .bd-content {
    justify-content: flex-start !important;
  }

  .bd-main .bd-content .bd-article-container {
    max-width: none !important;
    width: 75% !important;
    flex: 0 0 75% !important;
  }

  .bd-main .bd-content .bd-sidebar-secondary {
    width: 25% !important;
    flex: 0 0 25% !important;
    min-width: 0 !important;
  }

  /* Pages without a right TOC: let content fill the full main area */
  .bd-main .bd-content:not(:has(.bd-sidebar-secondary)) .bd-article-container {
    width: 100% !important;
    flex: 1 !important;
  }
}

/* ── Link colours: black instead of primary blue ──────────────────────────── */

/* Override the theme's link colour variables.
   Using --pst-color-text-base (not a hard-coded #000) means dark mode
   automatically gets the right light colour instead of invisible black. */
:root {
  --pst-color-link:             var(--pst-color-text-base);
  --pst-color-link-hover:       var(--pst-color-text-muted);
  --pst-color-inline-code-links: var(--pst-color-text-base);
}

/* All anchor elements — broad override to catch anything the variable doesn't reach */
a,
a:visited {
  color: var(--pst-color-text-base) !important;
}
a:hover,
a:focus {
  color: var(--pst-color-text-muted) !important;
}

/* Content body links: add underline so they're still identifiable without colour */
.bd-article-container a:not(.headerlink):not(.sd-stretched-link):not(.nav-link):not([class*="sd-"]) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Prev/next page navigation links */
.prev-next-area a,
.prev-next-area a:visited,
.prev-next-subtitle,
.prev-next-title {
  color: var(--pst-color-text-base) !important;
}

/* Sidebar TOC nav links */
.bd-sidebar-primary a,
.bd-sidebar-primary a:visited,
.bd-sidebar-secondary a,
.bd-sidebar-secondary a:visited {
  color: var(--pst-color-text-base) !important;
}

/* ── Sidebar search bar: remove pink/primary colour ───────────────────────── */
.search-button-field {
  background: transparent !important;
  border-color: var(--pst-color-border, #dee2e6) !important;
  color: var(--pst-color-text-base) !important;
  box-shadow: none !important;
}
.search-button-field:hover,
.search-button-field:focus {
  background: var(--pst-color-surface, #f8f9fa) !important;
  border-color: var(--pst-color-text-muted) !important;
  color: var(--pst-color-text-base) !important;
  box-shadow: none !important;
}

/* ── Hide %%a> test assertion lines in Magma code blocks ─────────────────── */
.highlight-magma .cs {
    display: none;
}

/* ── Collapsible examples ─────────────────────────────────────────────────── */

/* Hide content when collapsed */
dl.magma.example.collapsed > dd {
  display: none !important;
}

/* Clickable heading */
dl.magma.example > dt {
  cursor: pointer;
  user-select: none;
}

/* Small inline arrow — no position/padding changes so layout is untouched */
dl.magma.example > dt::before {
  content: "▶";
  display: inline-block;
  font-size: 0.6em;
  margin-right: 0.5em;
  vertical-align: middle;
  transition: transform 0.15s ease;
  color: var(--pst-color-text-muted, #6c757d);
}

dl.magma.example:not(.collapsed) > dt::before {
  transform: rotate(90deg);
}

/* magma-param blocks: reducing the margins */
.magma-param {
    margin: 0.1em 0;
}

/* Inner code block */
.magma-param pre {
    padding: 2px 6px;
    margin: 0;
    font-size: 0.9em;
}

