/* User Provided Stylesheet */

/* Hide the "Made with MyST" attribution in the page footer.
   Targets the theme's stable component class. */
.myst-made-with-myst {
  display: none !important;
}

/* Hide the in-page "start a kernel" power button and its binder connection-status
   tray. In-page execution can't work against our JupyterHub (it speaks the
   BinderHub protocol, which JupyterHub doesn't implement). The native
   "Launch external computing interface" button (myst-fm-launch-*) is unaffected. */
.myst-jp-nb-toolbar-power,
.myst-jp-connect-status-tray {
  display: none !important;
}

/* "Launch on JupyterHub" call-to-action, styled as a button. */
a.launch-button {
  display: inline-block;
  margin: 0.5rem 0;
  padding: 0.55rem 1.1rem;
  background: #1f6feb;
  color: #fff !important;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
}
a.launch-button:hover {
  background: #1a5fd0;
}

/* ===================================================================
   Sidebar redesign — scoped to the left nav only.
   See docs/superpowers/specs/2026-06-14-sidebar-redesign-design.md
   =================================================================== */

/* Density + typography: tighter rows, slightly smaller text. */
.myst-primary-sidebar-nav a {
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  padding-top: 3px !important;
  padding-bottom: 3px !important;
}

/* Hover affordance. */
.myst-primary-sidebar-nav a:hover {
  background: #f4f5f7;
  border-radius: 6px;
}

/* Active page: tinted background + weight (no edge bar). */
.myst-primary-sidebar-nav a[aria-current="page"] {
  background: #eef2ff !important;
  color: #1e3a8a !important;
  border-radius: 6px;
}

/* Shared "section-header" wordmark look: uppercase, bold, letter-spaced. */
.myst-primary-sidebar-nav div[title],
.myst-primary-sidebar-nav a[href="/autoscaling"],
.myst-primary-sidebar-nav a[href="/"] {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700 !important;
}

/* Gray (light) / near-white (dark) for the sidebar title and the section
   headers. The sitewide header logo is intentionally left untouched. */
.myst-primary-sidebar-nav div[title],
.myst-primary-sidebar-nav a[href="/"] {
  color: #64748b !important;
}
.dark .myst-primary-sidebar-nav div[title],
.dark .myst-primary-sidebar-nav a[href="/"] {
  color: #f1f5f9 !important;
}

/* Top-level "Autoscaling" entry keeps the brighter indigo accent. */
.myst-primary-sidebar-nav a[href="/autoscaling"] {
  color: #6366f1 !important;
}

/* Generic section headers (any TOC group title) — plain uppercase labels. */
.myst-primary-sidebar-nav div[title] {
  margin: 8px 0 2px;
  padding: 0;
  font-size: 10px;
}

/* Top-level "Autoscaling" entry, dressed as a section header. */
.myst-primary-sidebar-nav a[href="/autoscaling"] {
  font-size: 10px !important;
}

/* Contribution badges. The forked theme (TableOfContentsItems.tsx) renders a
   real <span class="toc-badge toc-badge-{lit,exp,idea}">…</span> inside the nav
   link for /lit-, /exp-, /idea- pages and adds `toc-has-badge` to the link. The
   link becomes a flex row so a wrapped label aligns as its own column beside the
   badge. Colours stay here so all site styling lives in one place. */
.myst-primary-sidebar-nav a.toc-has-badge {
  display: flex;
  align-items: baseline;
}

.toc-badge {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-width: 36px;
  margin-right: 6px;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: #fff;
}

.toc-badge-lit  { background: #2563eb; }
.toc-badge-exp  { background: #dc2626; }
.toc-badge-idea { background: #15803d; }

/* Dark-mode variants (theme toggles .dark on <html>). */
.dark .myst-primary-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
}
.dark .myst-primary-sidebar-nav a[aria-current="page"] {
  background: rgba(59, 130, 246, 0.16) !important;
  color: #bfdbfe !important;
}
.dark .myst-primary-sidebar-nav a[href="/autoscaling"] {
  color: #a5b4fc !important;
}

/* ===================================================================
   Sticky-frame for the wide papers comparison table.
   Scoped via the `expandable` wrapper: the table is wrapped in
   `:::{div} :class: expandable` in comparison.md, which the forked theme
   renders as `.cmp-expandable` containing the `.overflow-auto` table
   wrapper, so this touches no other table.
   NOTE: MyST emits the header row as <th> inside <tbody> (there is no
   <thead>), so sticky rules target `tr:first-child th` for the header
   and `tr > :first-child` for the pinned paper-name column.
   See docs/superpowers/specs/2026-06-15-comparison-table-sticky-frame-design.md
   =================================================================== */

/* Height cap: the table scrolls inside a fixed box instead of making the
   whole page enormous, which also keeps the horizontal scrollbar in view. */
.cmp-expandable > .overflow-auto {
  max-height: min(72vh, 640px);
}
/* Drop the table's top margin so the sticky header sits flush against the top
   of the scroll box (otherwise that margin shows as a scrollable gap above it). */
.cmp-expandable > .overflow-auto > table {
  margin-top: 0;
}

/* Sticky header row. */
.cmp-expandable > .overflow-auto table tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef2ff;
  color: #1e3a8a;
}

/* Sticky first column (paper name); right-edge line reads as "pinned". */
.cmp-expandable > .overflow-auto table tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  box-shadow: 1px 0 0 #d0d7de;
}

/* Corner cell (header ∩ first column) stays above both axes. */
.cmp-expandable > .overflow-auto table tr:first-child > :first-child {
  z-index: 3;
  background: #eef2ff;
}

/* Dark-mode variants for the sticky cell backgrounds. */
.dark .cmp-expandable > .overflow-auto table tr:first-child th,
.dark .cmp-expandable > .overflow-auto table tr:first-child > :first-child {
  background: #1e293b;
  color: #bfdbfe;
}
.dark .cmp-expandable > .overflow-auto table tr > :first-child {
  background: #0f172a;
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.12);
}

/* Dark-theme scrollbars for the in-page scroll box (the default OS scrollbar
   stays light otherwise). Firefox uses scrollbar-color; WebKit/Chromium use the
   ::-webkit-scrollbar pseudo-elements. */
.dark .cmp-expandable > .overflow-auto {
  scrollbar-color: #475569 #1e293b;
}
.dark .cmp-expandable > .overflow-auto::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
.dark .cmp-expandable > .overflow-auto::-webkit-scrollbar-track {
  background: #1e293b;
}
.dark .cmp-expandable > .overflow-auto::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 6px;
  border: 2px solid #1e293b;
}
.dark .cmp-expandable > .overflow-auto::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
.dark .cmp-expandable > .overflow-auto::-webkit-scrollbar-corner {
  background: #1e293b;
}

/* -------------------------------------------------------------------
   "Expand" button + modal for the comparison table. The forked theme
   (ExpandableContainer in myst-to-react) renders the button and a native
   <dialog> for any `{div}` carrying the `expandable` class; these rules
   style that markup.
   ------------------------------------------------------------------- */

/* The expandable wrapper stacks the button above the table, right-aligned. */
.cmp-expandable {
  display: flex;
  flex-direction: column;
}
.cmp-expand-btn {
  align-self: flex-end;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
}
.cmp-expand-btn:hover { background: #e2e8f0; }

/* The modal is a native <dialog>: Esc and backdrop-click close it, focus and
   top-layer stacking are handled by the platform. display:none until open. */
.cmp-modal {
  width: min(98vw, 1400px);
  max-height: 94vh;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.cmp-modal[open] {
  display: flex;
  flex-direction: column;
}
.cmp-modal::backdrop {
  background: rgba(15, 23, 42, 0.55);
}
.cmp-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid #e5e7eb;
}
.cmp-modal-title { font-weight: 700; color: #334155; }
.cmp-modal-close {
  font-size: 16px;
  line-height: 1;
  padding: 4px 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  cursor: pointer;
}
.cmp-modal-close:hover { background: #f1f5f9; }
/* The cloned table lives outside the theme's article/prose context, so it does
   NOT inherit the theme text color — set it explicitly (and links inherit it). */
.cmp-modal-body { overflow: auto; color: #1f2937; }
/* The cloned wrapper is no longer height-capped here — full table, full width. */
.cmp-modal-body .overflow-auto { max-height: none; }
.cmp-modal-body table { width: 100%; border-collapse: collapse; }
/* The theme's table padding/borders are scoped to article content and don't
   reach the cloned table, so set our own for breathing room + row separation. */
.cmp-modal-body th,
.cmp-modal-body td {
  padding: 10px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #e5e7eb;
}
.cmp-modal-body table tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  color: #1f2937;
  border-bottom: 1px solid #cbd5e1;
}
/* The first column is all DOI links; keep them as readable row labels instead
   of a wall of blue. */
.cmp-modal-body a,
.cmp-modal-body a.hover-link {
  /* The theme's .hover-link sets a hard blue in a Tailwind layer; override it. */
  color: inherit !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #94a3b8 !important;
}
.cmp-modal-body a:hover { text-decoration-color: currentColor !important; }

/* Dark-mode variants. */
.dark .cmp-expand-btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.15);
}
.dark .cmp-modal { background: #0f172a; }
.dark .cmp-modal-body { color: #e2e8f0; }
.dark .cmp-modal-body { scrollbar-color: #475569 #0f172a; }
.dark .cmp-modal-body::-webkit-scrollbar { width: 12px; height: 12px; }
.dark .cmp-modal-body::-webkit-scrollbar-track { background: #0f172a; }
.dark .cmp-modal-body::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 6px;
  border: 2px solid #0f172a;
}
.dark .cmp-modal-body::-webkit-scrollbar-thumb:hover { background: #64748b; }
.dark .cmp-modal-body::-webkit-scrollbar-corner { background: #0f172a; }
.dark .cmp-modal-bar { border-bottom-color: rgba(255, 255, 255, 0.12); }
.dark .cmp-modal-title { color: #cbd5e1; }
.dark .cmp-modal-close { color: #cbd5e1; }
.dark .cmp-modal-close:hover { background: rgba(255, 255, 255, 0.08); }
.dark .cmp-modal-body th,
.dark .cmp-modal-body td { border-bottom-color: rgba(255, 255, 255, 0.08); }
.dark .cmp-modal-body table tr:first-child th {
  background: #1e293b;
  color: #e2e8f0;
  border-bottom-color: rgba(255, 255, 255, 0.16);
}
.dark .cmp-modal-body a { text-decoration-color: rgba(255, 255, 255, 0.35); }

/* ===================================================================
   Full-width toggle. The FullWidthButton component (forked theme, next to
   the theme switcher) flips html.full-width, which hides both sidebars and
   lets the article content span the full page. The button's base pill shape
   comes from the component's own classes (mirroring the theme button); only
   the active "on" state and the layout live here.

   Layout note: the book-theme places article content in the grid's `body`
   column (`.article-grid > * { grid-column: body }`). Full-width mode hides
   the left nav (.myst-primary-sidebar*) and the right TOC (col-margin-right),
   then retargets content to the `screen-inset` column so it fills the page.
   A clamp() gutter on the grid container keeps text off the viewport edge.
   =================================================================== */

/* Filled "on" state so the toggle reads as active (overrides the component's
   base/hover classes by specificity, in both light and dark mode). */
html.full-width .fw-toggle-btn {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

/* --- Full-width layout --- */

/* Collapse both sidebars: the left nav (fixed panel + its layout placeholder)
   and the right margin TOC. */
html.full-width .myst-primary-sidebar,
html.full-width .myst-primary-sidebar-pointer,
html.full-width .article.content [class*="col-margin-right"] {
  display: none !important;
}

/* Let the article content fill the page, with a symmetric responsive gutter on
   the grid container so prose isn't glued to the viewport edges. */
html.full-width .article.content {
  padding-inline: clamp(1rem, 4vw, 4rem);
}
html.full-width .article.content > * {
  grid-column: screen-inset !important;
}
