/* User Provided Stylesheet */

/* No-op: Removed highlight tag styling as it does not work */

/*
/* Development warning banner */

/* body::before {
    content: "These notes are under active development and may contain errors.";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0;
    background-color: #f39c12; /* orange */
    color: #ffffff;
    text-align: center;
    padding: 8px 12px;
    font-weight: bold;
    z-index: 9999;
    font-size: 16px;
/* } */ 

/* Offset page for fixed banner */
/* body { 
    padding-top: 48px; 
} */

/* If theme uses a sticky header, push it below the banner */
/* .bd-header, header, .navbar {
    top: 48px !important;
} */

/* Prefer CSS variables when supported by theme */
:root {
  --bd-sidebar-width: 240px;
  --bd-sidebar-secondary-width: 240px;
  --bd-page-width: 1400px;
  --content-max-width: 1120px;
}

/* Edward Tufte's font styles */
body {
    font-family: 'Avenir', 'Helvetica Neue', Helvetica, Arial, system-ui, serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Avenir', 'Helvetica Neue', Helvetica, Arial, system-ui, serif;
}

/* Hyperlink styles - override theme defaults for all links in main content, including headings and lists, but not in nav/sidebar */
main a:not(nav a):not(.sidebar a),
article a:not(nav a):not(.sidebar a),
.bd-article a:not(nav a):not(.sidebar a),
.bd-content a:not(nav a):not(.sidebar a),
div.bd-article a:not(nav a):not(.sidebar a),
div.bd-content a:not(nav a):not(.sidebar a) {
    color: #1d3faf !important;
    text-decoration: none !important;
    border-bottom: none !important;
    background: none !important;
    transition: background 0.15s;
}

main a:hover:not(nav a):not(.sidebar a),
article a:hover:not(nav a):not(.sidebar a),
.bd-article a:hover:not(nav a):not(.sidebar a),
.bd-content a:hover:not(nav a):not(.sidebar a),
div.bd-article a:hover:not(nav a):not(.sidebar a),
div.bd-content a:hover:not(nav a):not(.sidebar a) {
    color: #1d3faf !important;
    /* text-decoration: underline !important; */
    border-bottom: none !important;
    background: #ffcb05 !important;
    border-radius: 0.2em;
}

/* Remove navigation buttons */
footer {
    display: none !important;
}

/* Remove navigation buttons from content pages */
.content-container {
    padding-bottom: 0 !important;
}

/* Remove navigation buttons from sidebar */
.sidebar {
    padding-bottom: 0 !important;
    width: 240px !important;
    max-width: 240px !important;
}

.myst-footer {
    display: none;
}

/* Additional sidebar width controls */
.bd-sidebar,
.bd-sidebar-primary,
.bd-sidebar-secondary,
.sidebar-drawer {
    width: 240px !important;
    max-width: 240px !important;
}

/* Right-hand on-this-page TOC */
.bd-toc {
    width: 240px !important;
    max-width: 240px !important;
}

/* Widen reading column on large screens */
@media (min-width: 992px) {
  .bd-page-width {
    max-width: 1400px !important;
  }

  .bd-content .bd-article-container {
    max-width: 1120px !important;
  }
}

/* UM Gold text selection highlighting */
::selection {
    background-color: #ffcb05;
    color: #000;
}

::-moz-selection {
    background-color: #ffcb05;
    color: #000;
}

/* Keep the logo reasonable on smaller screens */
@media (max-width: 768px) {
  header.bd-header .navbar-brand img,
  header.bd-header .navbar-brand svg,
  .navbar .navbar-brand img,
  .navbar .navbar-brand svg,
  .bd-header .navbar-brand img,
  .bd-header .navbar-brand svg {
    height: 32px !important;
    max-height: 32px !important;
  }
}

/* Fix sidebar navigation expansion for Chapter 1 */
/* When on Chapter 1 pages, keep Chapter 1 section expanded */
body[data-page*="01-supervised-learning"] .bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) {
  display: block !important;
}

body[data-page*="01-supervised-learning"] .bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) summary::after {
  transform: rotate(90deg) !important;
}

/* Alternative approach: Force Chapter 1 to stay expanded when viewing Chapter 1 content */
.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) {
  display: block !important;
}

.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) summary::after {
  transform: rotate(90deg) !important;
}

/* Ensure the details element is open by default for Chapter 1 */
.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) {
  open: true !important;
}

/* Additional protection against JavaScript interference */
.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"])[open] {
  display: block !important;
}

.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"])[open] summary::after {
  transform: rotate(90deg) !important;
}

/* Force the content to be visible even if details is closed */
.bd-sidebar .bd-toc details:has(summary a[href*="01-supervised-learning/00-index"]) > * {
  display: block !important;
}

/* General fix for all chapter index pages - prevent TOC collapse when clicking chapter index */
.bd-sidebar .bd-toc details:has(summary a[href*="00-index"]) {
  open: true !important;
  display: block !important;
}

.bd-sidebar .bd-toc details:has(summary a[href*="00-index"]) summary::after {
  transform: rotate(90deg) !important;
}

/* Ensure chapter content is always visible when on chapter index pages */
.bd-sidebar .bd-toc details:has(summary a[href*="00-index"]) > * {
  display: block !important;
}
