/* User Provided Stylesheet */

/* ============================================================
   Detector Provenance: custom theming on top of MyST book-theme.
   Loaded via `site.options.style` in myst.yml.

   Accent: dark red rgb(204,0,0) (matching the quantEM docs). Dark mode
   uses rgb(255,30,30): the least-washed red that keeps 4.5:1 contrast
   on the dark background (pure #ff0000 gives 4.37:1).
   ============================================================ */

:root {
  --dp-accent: rgb(204, 0, 0);
  --dp-accent-soft: rgba(204, 0, 0, 0.12);
}
html.dark {
  --dp-accent: rgb(255, 30, 30);
  --dp-accent-soft: rgba(255, 30, 30, 0.18);
}

/* ---------- Site title (upper-left) ---------- */
.myst-home-link,
.myst-home-link span {
  color: var(--dp-accent) !important;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.myst-home-link:hover span {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

/* ---------- Top-nav links ---------- */
.myst-top-nav-item {
  font-weight: 500;
}

/* ---------- Article links ----------
   Scoped to <article> so the home-link and navbar controls keep
   their own colors. */
article a:not(.myst-home-link),
article .link,
article .hover-link {
  color: var(--dp-accent) !important;
  text-decoration-color: var(--dp-accent) !important;
}

/* Cards: accent title, neutral body text */
article a.myst-card {
  color: inherit !important;
}
article a.myst-card .myst-card-title {
  color: var(--dp-accent);
}
article a.myst-card:hover {
  border-color: var(--dp-accent) !important;
}

/* ---------- Places book-theme still uses Tailwind blue ---------- */
.myst-tab-item-header-active {
  color: var(--dp-accent) !important;
  border-bottom-color: var(--dp-accent) !important;
}
.myst-toc-item.active,
.myst-toc-item-exact {
  background-color: var(--dp-accent-soft) !important;
}
.myst-toc-item:focus,
.myst-toc-item:focus-visible {
  outline-color: var(--dp-accent) !important;
}
.myst-code-copy-icon {
  color: var(--dp-accent) !important;
}
.myst-code-copy-icon:hover {
  opacity: 0.7;
}
.outline-blue-200 {
  outline-color: var(--dp-accent-soft) !important;
}
button.myst-search-bar:hover {
  border-color: var(--dp-accent) !important;
  --tw-ring-color: var(--dp-accent) !important;
}

/* ---------- Code blocks ----------
   book-theme leaves `pre` at overflow-x: visible, so one long line pushes
   the whole page sideways on narrow screens. Scroll inside the block
   instead, and never let it widen the article. */
article pre {
  max-width: 100%;
  overflow-x: auto;
}

/* ---------- Inline code spans ---------- */
:not(pre) > code {
  color: rgb(190, 24, 93);
}
html.dark :not(pre) > code {
  color: rgb(244, 114, 182);
}

/* ---------- Left sidebar ----------
   Smaller type, tighter rhythm, bold top-level sections. */
.myst-primary-sidebar-toc {
  font-size: 0.85rem;
}
.myst-primary-sidebar-toc .myst-toc-item {
  margin-top: 0.125rem;
  margin-bottom: 0.125rem;
}
.myst-primary-sidebar-toc a.myst-toc-item {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}
.myst-primary-sidebar-toc .myst-toc-item > div {
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
}
.myst-primary-sidebar-toc button svg {
  height: 1.1rem;
  width: 1.1rem;
}
/* Top-level sections in bold */
.myst-toc > div > .myst-toc-item {
  font-weight: 700;
}
/* book-theme marks the section containing the current page in blue; make it
   bold accent instead, and keep the page links themselves accented when active. */
.myst-primary-sidebar-toc .text-blue-800,
html.dark .myst-primary-sidebar-toc .dark\:text-blue-200 {
  color: var(--dp-accent) !important;
  font-weight: 700;
}
.myst-primary-sidebar-toc a.myst-toc-item-exact,
.myst-primary-sidebar-toc a.myst-toc-item.active {
  color: var(--dp-accent) !important;
  font-weight: 700;
}
/* The section that contains the current page: bold in the ordinary text
   colour, not the theme's blue (book-theme 1.4 marks it text-myst-accent-text). */
.myst-primary-sidebar-toc .text-myst-accent-text {
  color: rgb(28, 25, 23) !important;
  font-weight: 700;
}
html.dark .myst-primary-sidebar-toc .text-myst-accent-text {
  color: rgb(245, 245, 244) !important;
}
/* The site title is already in the top bar; drop the duplicate
   root entry at the top of the sidebar. */
.myst-toc > a.myst-toc-item[title="Detector Provenance"] {
  display: none;
}
/* ---------- Hide the article-style frontmatter strip ---------- */
.myst-fm-block-header,
.myst-fm-block-date-doi,
header.myst-fm-authors-affiliations {
  display: none !important;
}

/* ---------- Landing page ---------- */
.dp-tagline {
  text-align: left;
  font-size: 1.15rem;
  opacity: 0.85;
  max-width: 46rem;
  margin: 1rem auto 1.5rem auto;
}

/* ---------- Search ----------
   The theme's dialog-based search is replaced at runtime (see
   scripts/patch_theme.py) with a flat input in the top bar. No overlay,
   no scroll lock, so opening it never shifts the page. */
.dp-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 12rem;
  min-width: 0;          /* allow the input to shrink inside the flex nav */
}
.dp-search input {
  height: 2.5rem;
  width: 100%;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: rgb(28, 25, 23);   /* explicit: the top bar's text is black in both themes */
  background: rgb(249, 250, 251);
  border: 1px solid rgb(209, 213, 219);
  border-radius: 0.5rem;
  outline: none;
  appearance: none;
}
html.dark .dp-search input {
  color: rgb(231, 229, 228);
  background: rgb(55, 65, 81);
  border-color: rgb(75, 85, 99);
}
.dp-search input::placeholder {
  color: rgb(107, 114, 128);
}
html.dark .dp-search input::placeholder {
  color: rgb(156, 163, 175);
}
.dp-search input::-webkit-search-cancel-button {
  appearance: none;
}
.dp-search input:focus {
  border-color: var(--dp-accent);
  box-shadow: 0 0 0 1px var(--dp-accent);
}
@media (min-width: 640px) {
  .dp-search { width: 16rem; }   /* the stock search button's sm:w-64 */
}
.dp-search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 1000;
  width: min(26rem, 90vw);
  max-height: 70vh;
  overflow-y: auto;
  padding: 0.25rem;
  color: rgb(28, 25, 23);   /* the top bar's text color is black in both themes */
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 0.5rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}
html.dark .dp-search-results {
  color: rgb(231, 229, 228);
  background: rgb(28, 25, 23);
  border-color: rgba(255, 255, 255, 0.18);
}
a.dp-search-hit {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 0.35rem;
  color: inherit !important;
  text-decoration: none;
}
a.dp-search-hit:hover,
a.dp-search-hit.active {
  background: var(--dp-accent);
  color: #fff !important;
}
.dp-search-hit-title {
  font-size: 0.85rem;
  font-weight: 600;
}
.dp-search-hit-text {
  font-size: 0.78rem;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Article heading spacing ----------
   With hide_title_block, the first heading otherwise sits flush
   against the top bar. */
article {
  padding-top: 1.75rem;
}

/* ---------- Light/dark artwork pairs ----------
   Two copies of the same figure; the one that does not match the current
   theme is dropped. The class lands on the wrapper for MyST `image`
   directives and on the <img> for plain Markdown, so match both. */
html:not(.dark) .dp-dark-only,
html:not(.dark) img.dp-dark-only,
html.dark .dp-light-only,
html.dark img.dp-light-only {
  display: none !important;
}

/* ---------- Tables ---------- */
article table td,
article table th {
  vertical-align: top;
}
