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

:is(html.dark, html[data-theme="dark"]) {
  --notes-dark-accent: #f3c969;
  --notes-dark-accent-strong: #ffd978;
  --notes-dark-accent-soft: rgba(243, 201, 105, 0.16);
  --notes-dark-accent-border: rgba(243, 201, 105, 0.34);
  --notes-dark-activity: #d8bf7a;
  --notes-dark-activity-soft: rgba(216, 191, 122, 0.16);
  --notes-dark-activity-strong: #f0dca0;
  --notes-dark-nav-link: #f1ece3;
  --notes-dark-nav-link-muted: #d2c7b8;
  --notes-dark-nav-link-strong: #fff4d7;
  --notes-dark-surface: #221d18;
}

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

/* Keep article text consistently flush left throughout the book. */
article.article.content :is(h1, h2, h3, h4, h5, h6, p, li) {
    text-align: left !important;
}

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) */
:is(html.dark, html[data-theme="dark"]) .bd-main .bd-content a:not(.headerlink):not(.toclink),
:is(html.dark, html[data-theme="dark"]) .bd-main .bd-content article a:not(.headerlink):not(.toclink),
:is(html.dark, html[data-theme="dark"]) main.article article.content a[href]:not(nav a),
:is(html.dark, html[data-theme="dark"]) article.content a[href]:not(nav a),
:is(html.dark, html[data-theme="dark"]) .article.content a[href]:not(nav a) {
  color: var(--notes-dark-accent) !important;
}

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

/* Dark mode UI accents */
:is(html.dark, html[data-theme="dark"]) .bd-header,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar-primary,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar-secondary,
:is(html.dark, html[data-theme="dark"]) .bd-toc {
  --color-link: var(--notes-dark-accent);
  --color-link-hover: var(--notes-dark-accent-strong);
}

:is(html.dark, html[data-theme="dark"]) .bd-header a,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar a,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar summary,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .caption,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .sidebar-heading,
:is(html.dark, html[data-theme="dark"]) .bd-toc a,
:is(html.dark, html[data-theme="dark"]) .bd-toc summary,
:is(html.dark, html[data-theme="dark"]) .bd-toc .toc-title,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item a {
  color: var(--notes-dark-nav-link) !important;
}

:is(html.dark, html[data-theme="dark"]) .bd-sidebar summary,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .caption,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .sidebar-heading,
:is(html.dark, html[data-theme="dark"]) .bd-toc summary,
:is(html.dark, html[data-theme="dark"]) .bd-toc .toc-title {
  color: var(--notes-dark-nav-link-muted) !important;
}

:is(html.dark, html[data-theme="dark"]) .bd-header .navbar-nav > li > a:hover,
:is(html.dark, html[data-theme="dark"]) .bd-header .navbar-nav > li > a:focus,
:is(html.dark, html[data-theme="dark"]) .bd-header .navbar-nav > li.current > a,
:is(html.dark, html[data-theme="dark"]) .bd-header a:hover,
:is(html.dark, html[data-theme="dark"]) .bd-header a:focus,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar summary:hover,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar summary:focus,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar a:hover,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar a:focus,
:is(html.dark, html[data-theme="dark"]) .bd-toc summary:hover,
:is(html.dark, html[data-theme="dark"]) .bd-toc summary:focus,
:is(html.dark, html[data-theme="dark"]) .bd-toc a:hover,
:is(html.dark, html[data-theme="dark"]) .bd-toc a:focus {
  color: var(--notes-dark-nav-link-strong) !important;
}

:is(html.dark, html[data-theme="dark"]) .search-button,
:is(html.dark, html[data-theme="dark"]) .search-button__button,
:is(html.dark, html[data-theme="dark"]) .bd-search .form-control,
:is(html.dark, html[data-theme="dark"]) .bd-search input {
  border-color: var(--notes-dark-accent-border) !important;
}

:is(html.dark, html[data-theme="dark"]) .search-button:focus-within,
:is(html.dark, html[data-theme="dark"]) .search-button__button:hover,
:is(html.dark, html[data-theme="dark"]) .search-button__button:focus,
:is(html.dark, html[data-theme="dark"]) .bd-search .form-control:focus,
:is(html.dark, html[data-theme="dark"]) .bd-search input:focus {
  box-shadow: 0 0 0 0.18rem var(--notes-dark-accent-soft) !important;
  border-color: var(--notes-dark-accent) !important;
}

:is(html.dark, html[data-theme="dark"]) .bd-sidebar .active,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar a.active,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .current > a,
:is(html.dark, html[data-theme="dark"]) .bd-sidebar .current-page,
:is(html.dark, html[data-theme="dark"]) .bd-toc .active,
:is(html.dark, html[data-theme="dark"]) .bd-toc a.active,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item.myst-outline-item-active {
  color: var(--notes-dark-accent-strong) !important;
  background-color: var(--notes-dark-accent-soft) !important;
  border-left-color: var(--notes-dark-accent) !important;
}

:is(html.dark, html[data-theme="dark"]) .bd-toc .toc-entry > .nav-link.active,
:is(html.dark, html[data-theme="dark"]) .bd-toc nav a.active,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item-active > a {
  color: var(--notes-dark-accent-strong) !important;
  border-left-color: var(--notes-dark-accent) !important;
  background-color: var(--notes-dark-accent-soft) !important;
}

/* MyST dark-mode navigation chrome */
:is(html.dark, html[data-theme="dark"]) .myst-top-nav a,
:is(html.dark, html[data-theme="dark"]) .myst-home-link,
:is(html.dark, html[data-theme="dark"]) .myst-theme-button,
:is(html.dark, html[data-theme="dark"]) .myst-search-bar,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc a,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc .cursor-pointer,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc button,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc svg,
:is(html.dark, html[data-theme="dark"]) .myst-fm-block-header a,
:is(html.dark, html[data-theme="dark"]) .myst-fm-block-header button {
  color: var(--notes-dark-nav-link) !important;
}

:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc [data-state="open"] > .myst-toc-item .cursor-pointer,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc .text-blue-800,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc .dark\:text-blue-200 {
  color: var(--notes-dark-accent-strong) !important;
}

:is(html.dark, html[data-theme="dark"]) .myst-top-nav a:hover,
:is(html.dark, html[data-theme="dark"]) .myst-home-link:hover,
:is(html.dark, html[data-theme="dark"]) .myst-theme-button:hover,
:is(html.dark, html[data-theme="dark"]) .myst-search-bar:hover,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc a:hover,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc .cursor-pointer:hover,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc button:hover,
:is(html.dark, html[data-theme="dark"]) .myst-fm-block-header a:hover,
:is(html.dark, html[data-theme="dark"]) .myst-fm-block-header button:hover {
  color: var(--notes-dark-nav-link-strong) !important;
}

:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc a.active,
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc a[aria-current="page"],
:is(html.dark, html[data-theme="dark"]) .myst-primary-sidebar .myst-toc .active {
  color: var(--notes-dark-accent-strong) !important;
  background-color: var(--notes-dark-accent-soft) !important;
}

/* 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.
 * Keep it in document flow so hash links scroll to the activity itself.
 */
.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) {
  display: block !important;
  position: relative !important;
  width: 100% !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
  font-size: 0 !important;
  line-height: 0 !important;
  white-space: nowrap !important;
  border: 0 !important;
  scroll-margin-top: 5rem !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 */
:is(html.dark, html[data-theme="dark"]) .bd-toc li a,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item a,
:is(html.dark, html[data-theme="dark"]) .bd-toc summary {
  color: var(--notes-dark-nav-link) !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;
}

:is(html.dark, html[data-theme="dark"]) .bd-toc li a[href^="#activity-"],
:is(html.dark, html[data-theme="dark"]) .bd-toc [data-activities-toc] a,
:is(html.dark, html[data-theme="dark"]) #activities-toc a,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item a[href^="#activity-"] {
  color: var(--notes-dark-activity) !important;
}

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

:is(html.dark, html[data-theme="dark"]) .bd-toc li a[href^="#activity-"]:hover,
:is(html.dark, html[data-theme="dark"]) .bd-toc li a[href^="#activity-"]:focus,
:is(html.dark, html[data-theme="dark"]) .bd-toc [data-activities-toc] a:hover,
:is(html.dark, html[data-theme="dark"]) .bd-toc [data-activities-toc] a:focus,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item a[href^="#activity-"]:hover,
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item a[href^="#activity-"]:focus {
  background-color: var(--notes-dark-activity-soft) !important;
  color: var(--notes-dark-activity-strong) !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;
}

:is(html.dark, html[data-theme="dark"]) li.myst-outline-item:has(a[href^="#activity-"]) {
  border-left-color: transparent !important;
}

:is(html.dark, html[data-theme="dark"]) li.myst-outline-item:has(a[href^="#activity-"]):hover {
  background-color: var(--notes-dark-activity-soft) !important;
  border-left-color: var(--notes-dark-activity) !important;
}

:is(html.dark, html[data-theme="dark"]) li.myst-outline-item.myst-outline-item-active:has(a[href^="#activity-"]),
:is(html.dark, html[data-theme="dark"]) li.myst-outline-item:has(a[href^="#activity-"]).myst-outline-item-active {
  background-color: rgba(216, 191, 122, 0.22) !important;
  border-left-color: var(--notes-dark-activity) !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_why_control_co_design"] .bd-sidebar .bd-toc details:has(summary a[href*="01_why_control_co_design/00-index"]) {
  display: block !important;
}

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

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

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

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