/* User Provided Stylesheet */

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

/*
/* Development warning banner */

/* In your custom.css - Force TOC sections to stay expanded */
.bd-sidebar-primary .toctree-l1.current > ul,
.bd-sidebar-primary .toctree-l1.has-children > ul {
    display: block !important;
    height: auto !important;
    opacity: 1 !important;
}

/* Disable the collapse animation entirely */
.bd-sidebar-primary .toctree-l1 > ul {
    transition: none !important;
}

/* Keep expand arrows in expanded state */
.bd-sidebar-primary .toctree-expand {
    transform: rotate(90deg) !important;
}

/* 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;
}

/* Dark mode: content links only (pydata-sphinx-theme / Jupyter Book) */
html[data-theme="dark"] .bd-main .bd-content a:not(.headerlink):not(.toclink),
html[data-theme="dark"] .bd-main .bd-content article a:not(.headerlink):not(.toclink) {
  color: #ffcb05 !important;
}

/* Hover/focus */
html[data-theme="dark"] .bd-main .bd-content a:not(.headerlink):not(.toclink):hover,
html[data-theme="dark"] .bd-main .bd-content a:not(.headerlink):not(.toclink):focus {
  color: #000 !important;
  background: #ffcb05 !important;
  text-decoration: none;
}

/* 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;
}

.bd-toc details[data-activities-toc] {
  margin-top: 0.75rem;
}

/* Ghost heading for activity TOC entries - visually hidden but maintains anchor for TOC navigation */
.activity-toc-heading,
h1.activity-toc-heading,
h2.activity-toc-heading,
h3.activity-toc-heading,
h4.activity-toc-heading,
h5.activity-toc-heading,
h6.activity-toc-heading,
span.activity-toc-heading,
[id^="activity-"]:is(h1, h2, h3, h4, h5, h6, span):not(.admonition):not(.admonition-title) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Bold all TOC links and normalize color (prevent graying of deeper headings) */
.bd-toc li a,
li.myst-outline-item a {
  font-weight: 450 !important;
  color: #1e293b !important;
  opacity: 1 !important;
}

/* Dark mode TOC links */
html[data-theme="dark"] .bd-toc li a,
html[data-theme="dark"] li.myst-outline-item a {
  color: #e2e8f0 !important;
}

/* Activity TOC link styling - override Tailwind utility classes */
.bd-toc li a[href^="#activity-"],
.bd-toc [data-activities-toc] a,
#activities-toc a,
li.myst-outline-item a[href^="#activity-"] {
  color: #4a8f6b !important; /* A slightly grayer, muted green */
  font-weight: 500 !important;
  position: relative;
}

/* Add ✍️ after activity TOC links */
li.myst-outline-item a[href^="#activity-"]::after {
  content: ' ✍️';
  font-size: 0.5em;
  margin-left: 0.25em;
  vertical-align: middle;
}

.bd-toc li a[href^="#activity-"]:hover,
.bd-toc li a[href^="#activity-"]:focus,
li.myst-outline-item a[href^="#activity-"]:hover,
li.myst-outline-item a[href^="#activity-"]:focus {
  background-color: #d4edda !important;
  color: #155724 !important;
  border-radius: 0.2em;
  text-decoration: none !important;
}

/* Override Tailwind classes on the parent li for activity items */
li.myst-outline-item:has(a[href^="#activity-"]) {
  background-color: transparent !important;
  border-left-color: transparent !important;
}

li.myst-outline-item:has(a[href^="#activity-"]):hover {
  background-color: #d4edda !important;
  border-left-color: #155724 !important;
}

li.myst-outline-item.myst-outline-item-active:has(a[href^="#activity-"]),
li.myst-outline-item:has(a[href^="#activity-"]).myst-outline-item-active {
  background-color: #c3e6cb !important;
  border-left-color: #155724 !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_introduction_to_supervised_learning"] .bd-sidebar .bd-toc details:has(summary a[href*="01_introduction_to_supervised_learning/00-index"]) {
  display: block !important;
}

body[data-page*="01_introduction_to_supervised_learning"] .bd-sidebar .bd-toc details:has(summary a[href*="01_introduction_to_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_introduction_to_supervised_learning/00-index"]) {
  display: block !important;
}

.bd-sidebar .bd-toc details:has(summary a[href*="01_introduction_to_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_introduction_to_supervised_learning/00-index"]) {
  open: true !important;
}

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

.bd-sidebar .bd-toc details:has(summary a[href*="01_introduction_to_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_introduction_to_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;
}

/* Processing banner - orange banner at top of page */
.processing-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #ff9500; /* orange */
  color: #ffffff;
  text-align: center;
  padding: 12px 16px;
  font-weight: 500;
  font-size: 15px;
  z-index: 9999;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Offset page content when banner is active */
body.processing-banner-active {
  padding-top: 48px;
}

/* Adjust header position when banner is active */
body.processing-banner-active .bd-header,
body.processing-banner-active header,
body.processing-banner-active .navbar {
  top: 48px !important;
}

/* Light mode reminder banner */
.lightmode-banner {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  background-color: #ff9500;
  color: #ffffff;
  text-align: center;
  padding: 0 16px;
  font-weight: 500;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  box-sizing: border-box;
}

.lightmode-banner__close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 16px;
  width: 16px;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-size: 16px;
  line-height: 16px;
  cursor: pointer;
  padding: 0;
}

body.lightmode-banner-active .bd-header,
body.lightmode-banner-active header,
body.lightmode-banner-active .navbar {
  top: 20px !important;
}

body.lightmode-banner-active .processing-banner {
  top: 20px;
}

body.lightmode-banner-active.processing-banner-active {
  padding-top: 68px;
}

body.lightmode-banner-active.processing-banner-active .bd-header,
body.lightmode-banner-active.processing-banner-active header,
body.lightmode-banner-active.processing-banner-active .navbar {
  top: 68px !important;
}
